repo_name
stringlengths
6
67
path
stringlengths
5
185
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
1.02k
962k
license
stringclasses
15 values
youprofit/shogun
examples/undocumented/python_modular/graphical/so_multiclass_BMRM.py
16
2853
#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt from modshogun import RealFeatures from modshogun import MulticlassModel, MulticlassSOLabels, RealNumber, DualLibQPBMSOSVM from modshogun import BMRM, PPBMRM, P3BMRM from modshogun import StructuredAccuracy def fill_data(cnt, minv, maxv): x1 =...
gpl-3.0
arokem/scipy
doc/source/tutorial/stats/plots/kde_plot3.py
132
1229
import numpy as np import matplotlib.pyplot as plt from scipy import stats np.random.seed(12456) x1 = np.random.normal(size=200) # random data, normal distribution xs = np.linspace(x1.min()-1, x1.max()+1, 200) kde1 = stats.gaussian_kde(x1) kde2 = stats.gaussian_kde(x1, bw_method='silverman') fig = plt.figure(figsi...
bsd-3-clause
ywcui1990/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/cm.py
70
5385
""" This module contains the instantiations of color mapping classes """ import numpy as np from numpy import ma import matplotlib as mpl import matplotlib.colors as colors import matplotlib.cbook as cbook from matplotlib._cm import * def get_cmap(name=None, lut=None): """ Get a colormap instance, defaultin...
agpl-3.0
lfairchild/PmagPy
pmagpy/ipmag.py
1
476806
# /usr/bin/env/pythonw from past.utils import old_div import codecs import copy import numpy as np import pandas as pd from scipy import stats import random import matplotlib.pyplot as plt from matplotlib.patches import Polygon from matplotlib.pylab import polyfit import matplotlib.ticker as mtick import os import sys...
bsd-3-clause
henry0312/LightGBM
examples/python-guide/dask/prediction.py
2
1325
import dask.array as da from distributed import Client, LocalCluster from sklearn.datasets import make_regression from sklearn.metrics import mean_squared_error import lightgbm as lgb if __name__ == "__main__": print("loading data") X, y = make_regression(n_samples=1000, n_features=50) print("initializi...
mit
jonyroda97/redbot-amigosprovaveis
lib/matplotlib/tests/test_rcparams.py
2
18156
from __future__ import (absolute_import, division, print_function, unicode_literals) import six import io import os import warnings from collections import OrderedDict from cycler import cycler, Cycler import pytest try: from unittest import mock except ImportError: import mock impor...
gpl-3.0
jseabold/scikit-learn
sklearn/tree/tree.py
23
40423
""" This module gathers tree-based methods, including decision, regression and randomized trees. Single and multi-output problems are both handled. """ # Authors: Gilles Louppe <g.louppe@gmail.com> # Peter Prettenhofer <peter.prettenhofer@gmail.com> # Brian Holt <bdholt1@gmail.com> # Noel Da...
bsd-3-clause
dkriegner/xrayutilities
examples/xrayutilities_experiment_Powder_example_Iron.py
1
2057
# This file is part of xrayutilities. # # xrayutilities is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed...
gpl-2.0
kjung/scikit-learn
sklearn/svm/tests/test_sparse.py
35
13182
from nose.tools import assert_raises, assert_true, assert_false import numpy as np from scipy import sparse from numpy.testing import (assert_array_almost_equal, assert_array_equal, assert_equal) from sklearn import datasets, svm, linear_model, base from sklearn.datasets import make_classif...
bsd-3-clause
Lab603/PicEncyclopedias
jni-build/jni/include/tensorflow/contrib/learn/python/learn/learn_io/data_feeder.py
8
21806
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
mit
BigDataforYou/movie_recommendation_workshop_1
big_data_4_you_demo_1/venv/lib/python2.7/site-packages/pandas/tests/test_util.py
1
11190
# -*- coding: utf-8 -*- import nose from collections import OrderedDict from pandas.util._move import move_into_mutable_buffer, BadMove from pandas.util.decorators import deprecate_kwarg from pandas.util.validators import (validate_args, validate_kwargs, validate_args_and_kwargs) i...
mit
cswiercz/sympy
sympy/interactive/printing.py
31
15830
"""Tools for setting up printing in interactive sessions. """ from __future__ import print_function, division import sys from distutils.version import LooseVersion as V from io import BytesIO from sympy import latex as default_latex from sympy import preview from sympy.core.compatibility import integer_types from sy...
bsd-3-clause
lvniqi/tianchi_power
code/preprocess.py
1
32964
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Sat May 13 17:36:18 2017 @author: boweiy """ from sklearn.model_selection import train_test_split import pandas as pd import numpy as np import os import xgboost as xgb from multiprocessing import Pool as m_Pool from sklearn import preprocessing from sklea...
mit
yunfeilu/scikit-learn
doc/tutorial/text_analytics/skeletons/exercise_01_language_train_model.py
254
2005
"""Build a language detector model The goal of this exercise is to train a linear classifier on text features that represent sequences of up to 3 consecutive characters so as to be recognize natural languages by using the frequencies of short character sequences as 'fingerprints'. """ # Author: Olivier Grisel <olivie...
bsd-3-clause
synergetics/spectrum
src/conventional/cumest.py
1
2697
#!/usr/bin/env python from __future__ import division import numpy as np from scipy.linalg import hankel import scipy.io as sio import matplotlib.pyplot as plt from ..tools import * from cum2est import * from cum3est import * from cum4est import * def cumest(y, norder=2, maxlag=0 ,nsamp=None, overlap=0, flag='biase...
mit
rvraghav93/scikit-learn
sklearn/linear_model/omp.py
3
31718
"""Orthogonal matching pursuit algorithms """ # Author: Vlad Niculae # # License: BSD 3 clause import warnings import numpy as np from scipy import linalg from scipy.linalg.lapack import get_lapack_funcs from .base import LinearModel, _pre_fit from ..base import RegressorMixin from ..utils import as_float_array, ch...
bsd-3-clause
synthicity/urbansim
urbansim/urbanchoice/tests/test_interaction.py
3
1744
import numpy as np import numpy.testing as npt import pandas as pd import pytest from .. import interaction as inter @pytest.fixture def choosers(): return pd.DataFrame( {'var1': range(5, 10), 'thing_id': ['a', 'c', 'e', 'g', 'i']}) @pytest.fixture def alternatives(): return pd.DataFrame( ...
bsd-3-clause
Keleir/glances
glances/core/glances_main.py
11
15502
# -*- coding: utf-8 -*- # # This file is part of Glances. # # Copyright (C) 2015 Nicolargo <nicolas@nicolargo.com> # # Glances is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the Lic...
lgpl-3.0
IBT-FMI/SAMRI
samri/pipelines/extra_functions.py
1
36883
# -*- coding: utf-8 -*- import csv import inspect import os import re import json import shutil from copy import deepcopy import pandas as pd # PyBIDS 0.6.5 and 0.10.2 compatibility try: from bids.grabbids import BIDSLayout except ModuleNotFoundError: from bids.layout import BIDSLayout BEST_GUESS_MODALITY_MATCH = ...
gpl-3.0
jreback/pandas
pandas/tests/util/test_doc.py
8
1492
from textwrap import dedent from pandas.util._decorators import doc @doc(method="cumsum", operation="sum") def cumsum(whatever): """ This is the {method} method. It computes the cumulative {operation}. """ @doc( cumsum, dedent( """ Examples -------- >>> cum...
bsd-3-clause
trungnt13/scikit-learn
sklearn/feature_extraction/tests/test_feature_hasher.py
258
2861
from __future__ import unicode_literals import numpy as np from sklearn.feature_extraction import FeatureHasher from nose.tools import assert_raises, assert_true from numpy.testing import assert_array_equal, assert_equal def test_feature_hasher_dicts(): h = FeatureHasher(n_features=16) assert_equal("dict",...
bsd-3-clause
drivendataorg/metrics
metrics.py
1
10482
import editdistance import numpy as np from sklearn.metrics import roc_auc_score, r2_score # Defined for your convenience; these are the # class_column_indices for the Box-Plots for Education competition # www.drivendata.org/competitions/4/ BOX_PLOTS_COLUMN_INDICES = [range(37), range(37, 4...
mit
gclenaghan/scikit-learn
sklearn/base.py
22
18131
"""Base classes for all estimators.""" # Author: Gael Varoquaux <gael.varoquaux@normalesup.org> # License: BSD 3 clause import copy import warnings import numpy as np from scipy import sparse from .externals import six from .utils.fixes import signature from .utils.deprecation import deprecated from .exceptions impor...
bsd-3-clause
neurospin/pylearn-epac
epac/sklearn_plugins/estimators.py
1
11147
""" Estimator wrap ML procedure into EPAC Node. To be EPAC compatible, one should inherit from BaseNode and implement the "transform" method. InternalEstimator and LeafEstimator aim to provide automatic wrapper to objects that implement fit and predict methods. @author: edouard.duchesnay@cea.fr @author: jinpeng.li@ce...
bsd-3-clause
datapythonista/pandas
pandas/tests/scalar/timedelta/test_arithmetic.py
2
33869
""" Tests for scalar Timedelta arithmetic ops """ from datetime import ( datetime, timedelta, ) import operator import numpy as np import pytest from pandas.compat import is_numpy_dev from pandas.errors import OutOfBoundsTimedelta import pandas as pd from pandas import ( NaT, Timedelta, Timestamp...
bsd-3-clause
SpatialMetabolomics/SM_distributed
sm/engine/fdr.py
2
4132
import logging import numpy as np import pandas as pd logger = logging.getLogger('engine') DECOY_ADDUCTS = ['+He', '+Li', '+Be', '+B', '+C', '+N', '+O', '+F', '+Ne', '+Mg', '+Al', '+Si', '+P', '+S', '+Cl', '+Ar', '+Ca', '+Sc', '+Ti', '+V', '+Cr', '+Mn', '+Fe', '+Co', '+Ni', '+Cu', '+Zn', '+Ga', '+Ge', '+As', '+Se', ...
apache-2.0
rfablet/PB_ANDA
AnDA_Multiscale_Assimilation.py
1
11561
import numpy as np from pyflann import * from sklearn.decomposition import PCA from AnDA_analog_forecasting import AnDA_analog_forecasting as AnDA_AF from AnDA_data_assimilation import AnDA_data_assimilation from AnDA_variables import General_AF, AnDA_result from AnDA_stat_functions import AnDA_RMSE, AnDA_correla...
gpl-3.0
MAKOMO/artisan
src/setup-win.py
2
7374
""" This is a set up script for py2exe USAGE: python setup-win py2exe """ from distutils.core import setup import matplotlib as mpl import py2exe import numpy import os import sys # add any numpy directory containing a dll file to sys.path def numpy_dll_paths_fix(): paths = set() np_path ...
gpl-3.0
VisTrails/vistrails-contrib-legacy
NumSciPy/ArrayPlot.py
6
24193
import core.modules import core.modules.module_registry from core.modules.vistrails_module import Module, ModuleError from core.modules.basic_modules import PythonSource from Array import * from Matrix import * import pylab import matplotlib import urllib import random class ArrayPlot(object): namespace = 'numpy|...
bsd-3-clause
jmargeta/scikit-learn
sklearn/svm/classes.py
2
26517
from .base import BaseLibLinear, BaseSVC, BaseLibSVM from ..base import RegressorMixin from ..linear_model.base import LinearClassifierMixin, SparseCoefMixin from ..feature_selection.selector_mixin import SelectorMixin class LinearSVC(BaseLibLinear, LinearClassifierMixin, SelectorMixin, SparseCoefMixi...
bsd-3-clause
bthirion/scikit-learn
examples/ensemble/plot_ensemble_oob.py
58
3265
""" ============================= OOB Errors for Random Forests ============================= The ``RandomForestClassifier`` is trained using *bootstrap aggregation*, where each new tree is fit from a bootstrap sample of the training observations :math:`z_i = (x_i, y_i)`. The *out-of-bag* (OOB) error is the average er...
bsd-3-clause
HyperloopTeam/FullOpenMDAO
lib/python2.7/site-packages/matplotlib/backends/backend_template.py
20
9358
""" This is a fully functional do nothing backend to provide a template to backend writers. It is fully functional in that you can select it as a backend with import matplotlib matplotlib.use('Template') and your matplotlib scripts will (should!) run without error, though no output is produced. This provides a ...
gpl-2.0
ndingwall/scikit-learn
examples/ensemble/plot_adaboost_twoclass.py
72
3333
""" ================== Two-class AdaBoost ================== This example fits an AdaBoosted decision stump on a non-linearly separable classification dataset composed of two "Gaussian quantiles" clusters (see :func:`sklearn.datasets.make_gaussian_quantiles`) and plots the decision boundary and decision scores. The di...
bsd-3-clause
sarahgrogan/scikit-learn
sklearn/linear_model/passive_aggressive.py
97
10879
# Authors: Rob Zinkov, Mathieu Blondel # License: BSD 3 clause from .stochastic_gradient import BaseSGDClassifier from .stochastic_gradient import BaseSGDRegressor from .stochastic_gradient import DEFAULT_EPSILON class PassiveAggressiveClassifier(BaseSGDClassifier): """Passive Aggressive Classifier Read mor...
bsd-3-clause
MattNolanLab/ei-attractor
grid_cell_model/plotting/connections.py
1
2559
'''Functions/methods to plot connectivity matrices. .. currentmodule:: grid_cell_model.plotting.connections Classes / Functions ------------------- .. autosummary:: plotConnHistogram plot2DWeightMatrix ''' import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as ti from global_defs im...
gpl-3.0
marcelovilaca/DIRAC
Core/Utilities/Graphs/PlotBase.py
10
9309
######################################################################## # $HeadURL$ ######################################################################## """ PlotBase is a base class for various Graphs plots The DIRAC Graphs package is derived from the GraphTool plotting package of the CMS/Phedex Proj...
gpl-3.0
jarrison/trEFM-learn
trEFMlearn/process_image.py
1
2175
import numpy as np import util from sklearn import preprocessing from pandas import read_csv def analyze_image(path, reg_object): """ This function analyzes data from a trEFM image that has been pre-processed and placed in a folder. The path must be given, as well as a previously fit SVR model to be us...
mit
kashif/scikit-learn
examples/exercises/plot_iris_exercise.py
323
1602
""" ================================ SVM Exercise ================================ A tutorial exercise for using different SVM kernels. This exercise is used in the :ref:`using_kernels_tut` part of the :ref:`supervised_learning_tut` section of the :ref:`stat_learn_tut_index`. """ print(__doc__) import numpy as np i...
bsd-3-clause
dsavoiu/kafe2
examples/007_cost_functions/01_poisson_cost_function.py
1
5063
#!/usr/bin/env python """ kafe2 example: Poisson cost function ==================================== In data analysis the uncertainty on measurement data is most often assumed to resemble a normal distribution. For many use cases this assumption works reasonably well but there is a problem: to get meaningful fit result...
gpl-3.0
ua-snap/downscale
snap_scripts/baseline_climatologies/calc_ra_monthly_L48.py
1
4827
# # # # # # # # # # # # # # # # # # # # # # # # # PORT S.McAffee's Ra SCRIPT TO Python # # # # # # # # # # # # # # # # # # # # # # # # def coordinates( fn=None, meta=None, numpy_array=None, input_crs=None, to_latlong=False ): ''' take a raster file as input and return the centroid coords for each of the grid cells...
mit
lgbouma/astrobase
astrobase/checkplot/pkl_utils.py
1
76493
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # pkl_utils.py - Waqas Bhatti (wbhatti@astro.princeton.edu) - Feb 2019 # License: MIT. ''' This contains utility functions that support checkplot.pkl public functions. ''' ############# ## LOGGING ## ############# import logging from astrobase import log_sub, log_fmt, l...
mit
tomazberisa/custom_db
validate_bootstrap.py
1
3561
#!/usr/bin/env python3 import commanderline.commander_line as cl import pandas as pd import gzip ancestry_translation = { "ARABIAN" : "NEAREAST", "ASHKENAZI" : "ASHKENAZI-EMED", "BALOCHI-MAKRANI-BRAHUI" : "CASIA", "BANTUKENYA" : "EAFRICA", ...
mit
daler/Pharmacogenomics_Prediction_Pipeline_P3
tools/pipeline_helpers.py
4
7419
import os import yaml import numpy as np import pandas as pd import string def sanitize(s): """ Replace special characters with underscore """ valid = "-_.()" + string.ascii_letters + string.digits return ''.join(i if i in valid else "_" for i in s) def index_converter(df, label): """ San...
cc0-1.0
elingg/tensorflow
tensorflow/contrib/factorization/python/ops/gmm.py
11
12252
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
ningchi/scikit-learn
examples/feature_selection/plot_feature_selection.py
249
2827
""" =============================== Univariate Feature Selection =============================== An example showing univariate feature selection. Noisy (non informative) features are added to the iris data and univariate feature selection is applied. For each feature, we plot the p-values for the univariate feature s...
bsd-3-clause
altaetran/bayesianoracle
tests/quadraticBayesianAveraging/paper_examples/StatisticalQuadraticModels1D.py
1
9162
import numpy as np import bayesianoracle as bo import bayesianoracle.plot as boplotter import matplotlib.pyplot as plt from matplotlib.collections import LineCollection from matplotlib import colors as cl from matplotlib import gridspec, ticker # Import function information from function_data import * execfile("func...
apache-2.0
JosmanPS/scikit-learn
sklearn/datasets/mldata.py
309
7838
"""Automatically download MLdata datasets.""" # Copyright (c) 2011 Pietro Berkes # License: BSD 3 clause import os from os.path import join, exists import re import numbers try: # Python 2 from urllib2 import HTTPError from urllib2 import quote from urllib2 import urlopen except ImportError: # Pyt...
bsd-3-clause
kagayakidan/scikit-learn
sklearn/decomposition/tests/test_nmf.py
130
6059
import numpy as np from scipy import linalg from sklearn.decomposition import nmf from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_false from sklearn.utils.testing import raises from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_gr...
bsd-3-clause
liyu1990/sklearn
sklearn/manifold/tests/test_mds.py
324
1862
import numpy as np from numpy.testing import assert_array_almost_equal from nose.tools import assert_raises from sklearn.manifold import mds def test_smacof(): # test metric smacof using the data of "Modern Multidimensional Scaling", # Borg & Groenen, p 154 sim = np.array([[0, 5, 3, 4], ...
bsd-3-clause
boscotsang/BayesDigitClassify
classify_gf2.py
1
4586
import numpy from sklearn.metrics import confusion_matrix def load_data(): train_labels = [] with open('digitdata/traininglabels', 'rb') as f: for i, line in enumerate(f): train_labels.append(int(line)) train_labels = numpy.array(train_labels, dtype=int) train_x = numpy.zeros((trai...
mit
pllim/ginga
ginga/examples/matplotlib/example2_mpl.py
3
10002
#! /usr/bin/env python # # example2_mpl.py -- Simple, configurable FITS viewer using a matplotlib # QtAgg backend for Ginga and embedded in a Qt program. # # This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. # """ Usage: example2_mpl.py [fi...
bsd-3-clause
iamaris/anaMini
hist.py
7
1039
""" Demo of the histogram (hist) function with a few features. In addition to the basic histogram, this demo shows a few optional features: * Setting the number of data bins * The ``normed`` flag, which normalizes bin heights so that the integral of the histogram is 1. The resulting histogram is a proba...
mit
madjelan/scikit-learn
examples/preprocessing/plot_function_transformer.py
161
1949
""" ========================================================= Using FunctionTransformer to select columns ========================================================= Shows how to use a function transformer in a pipeline. If you know your dataset's first principle component is irrelevant for a classification task, you ca...
bsd-3-clause
MTG/essentia
test/src/QA/clipping/test_clipping.py
1
10356
#!/usr/bin/env python # Copyright (C) 2006-2021 Music Technology Group - Universitat Pompeu Fabra # # This file is part of Essentia # # Essentia is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation (FSF), e...
agpl-3.0
ueshin/apache-spark
python/pyspark/pandas/categorical.py
15
5290
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
apache-2.0
kaleoyster/ProjectNBI
nbi-utilities/data_gen/decisionFlowChart/validation.py
1
14013
""" description: Validation of the decision tree outputs """ import csv import os from sklearn.metrics import confusion_matrix, classification_report from collections import namedtuple from collections import defaultdict from collections import Counter __author__ = 'Akshay Kale' __copyright__ = 'GPL' # Year: 2019 ( ...
gpl-2.0
oaelhara/numbbo
code-postprocessing/bbob_pproc/ppfigparam.py
1
9900
#! /usr/bin/env python # -*- coding: utf-8 -*- """Generate ERT vs param. figures. The figures will show the performance in terms of ERT on a log scale w.r.t. parameter. On the y-axis, data is represented as a number of function evaluations. Crosses (+) give the median number of function evaluations for the smallest r...
bsd-3-clause
cauchycui/scikit-learn
examples/mixture/plot_gmm_classifier.py
250
3918
""" ================== GMM classification ================== Demonstration of Gaussian mixture models for classification. See :ref:`gmm` for more information on the estimator. Plots predicted labels on both training and held out test data using a variety of GMM classifiers on the iris dataset. Compares GMMs with sp...
bsd-3-clause
madjelan/scikit-learn
sklearn/neighbors/regression.py
106
10572
"""Nearest Neighbor Regression""" # Authors: Jake Vanderplas <vanderplas@astro.washington.edu> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Sparseness support by Lars Buitinck <L.J.Buitinck@uva.nl> # Multi-output support by Arna...
bsd-3-clause
ericpre/hyperspy
hyperspy/tests/drawing/test_plot_signal1d.py
1
11462
# Copyright 2007-2021 The HyperSpy developers # # This file is part of HyperSpy. # # HyperSpy is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later ...
gpl-3.0
nuclear-wizard/moose
modules/tensor_mechanics/test/tests/tensile/small_deform_hard3.py
12
1286
#!/usr/bin/env python3 #* This file is part of the MOOSE framework #* https://www.mooseframework.org #* #* All rights reserved, see COPYRIGHT for full restrictions #* https://github.com/idaholab/moose/blob/master/COPYRIGHT #* #* Licensed under LGPL 2.1, please see LICENSE for details #* https://www.gnu.org/licenses/lgp...
lgpl-2.1
UBC-Astrophysics/ObsPlan
ObsPlan.py
1
9933
#!/usr/bin/env python # # ObsPlan.py # # Elisa Antolini # Jeremy Heyl # UBC Southern Observatory # # This script takes the LIGO-Virgo Skymap (P(d|m)) and optionally a # galaxy-density map (P(m)) and finds the most likely fields to # observe (P(m|d)). The fields are assumed to be healpix regions from a # tesselation wi...
gpl-3.0
Barmaley-exe/scikit-learn
sklearn/metrics/tests/test_score_objects.py
2
13929
import pickle import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_raises_regexp from sklearn.utils.testing import assert_true from sklearn.utils.testing im...
bsd-3-clause
laszlocsomor/tensorflow
tensorflow/examples/tutorials/input_fn/boston.py
76
2920
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
apache-2.0
empirical-org/WikipediaSentences
notebooks/BERT-4 Experiments Multilabel.py
1
19268
#!/usr/bin/env python # coding: utf-8 # # Multilabel BERT Experiments # # In this notebook we do some first experiments with BERT: we finetune a BERT model+classifier on each of our datasets separately and compute the accuracy of the resulting classifier on the test data. # For these experiments we use the `pytorch_...
agpl-3.0
antlr/codebuff
python/src/tsql_noisy_one_file_capture.py
1
3111
# # AUTO-GENERATED FILE. DO NOT EDIT # CodeBuff 1.4.19 'Sat Jun 18 16:50:22 PDT 2016' # import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = plt.subplot(111) labels = ["backupset_queries.sql", "buffer_pool_usage_by_db.sql", "compare_db_powershell.sql", "compare_tables.sql", "create_columnlist.sql...
bsd-2-clause
Jozhogg/iris
docs/iris/example_code/General/SOI_filtering.py
6
3050
""" Applying a filter to a time-series ================================== This example demonstrates low pass filtering a time-series by applying a weighted running mean over the time dimension. The time-series used is the Darwin-only Southern Oscillation index (SOI), which is filtered using two different Lanczos filt...
lgpl-3.0
victorfsf/eva
setup.py
1
1454
# -*- coding: utf-8 -*- from setuptools import setup from setuptools import find_packages version = '0.0.1' setup( name='eva', packages=find_packages(exclude=['tests']), package_data={ 'eva': [], }, install_requires=[ 'nltk==3.2.4', 'numpy==1.12.1', 'pandas==0.20....
gpl-3.0
lenovor/scikit-learn
sklearn/ensemble/tests/test_voting_classifier.py
40
6991
"""Testing for the boost module (sklearn.ensemble.boost).""" import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_equal from sklearn.linear_model import LogisticRegression from sklearn.naive_bayes import GaussianNB from sklearn.ensemble import RandomForestCl...
bsd-3-clause
jjx02230808/project0223
examples/ensemble/plot_random_forest_embedding.py
286
3531
""" ========================================================= Hashing feature transformation using Totally Random Trees ========================================================= RandomTreesEmbedding provides a way to map data to a very high-dimensional, sparse representation, which might be beneficial for classificati...
bsd-3-clause
costypetrisor/scikit-learn
sklearn/tree/tests/test_tree.py
72
47440
""" Testing for the tree module (sklearn.tree). """ import pickle from functools import partial from itertools import product import platform import numpy as np from scipy.sparse import csc_matrix from scipy.sparse import csr_matrix from scipy.sparse import coo_matrix from sklearn.random_projection import sparse_rand...
bsd-3-clause
dimroc/tensorflow-mnist-tutorial
lib/python3.6/site-packages/matplotlib/textpath.py
10
16668
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) from collections import OrderedDict import six from six.moves import zip import warnings import numpy as np from matplotlib.path import Path from matplotlib import rcParams import m...
apache-2.0
droundy/deft
papers/fuzzy-fmt/nm_hist2_work_in_progress.py
1
1064
#!/usr/bin/python2 #NOTE: Run this script from deft/papers/fuzzy-fmt with the #command ./nm_hist.py #MODIFYING this program to take command line arguments... import numpy as np import matplotlib.mlab as mlab import matplotlib.pyplot as plt import os seeds=50 mcprefactor=40000 for gw in [.05]: #for gw in [0.01, 0....
gpl-2.0
sahana/Turkey
controllers/msg.py
5
80604
# -*- coding: utf-8 -*- """ Messaging Module - Controllers """ module = request.controller resourcename = request.function if not settings.has_module(module): raise HTTP(404, body="Module disabled: %s" % module) # ----------------------------------------------------------------------------- def index(): ...
mit
akionakamura/scikit-learn
examples/svm/plot_svm_scale_c.py
223
5375
""" ============================================== Scaling the regularization parameter for SVCs ============================================== The following example illustrates the effect of scaling the regularization parameter when using :ref:`svm` for :ref:`classification <svm_classification>`. For SVC classificati...
bsd-3-clause
weidel-p/nest-simulator
extras/ConnPlotter/examples/connplotter_tutorial.py
12
27772
# -*- coding: utf-8 -*- # # connplotter_tutorial.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the Li...
gpl-2.0
jkleve/Optimization-Algorithms
tests/ga_analysis.py
1
6534
import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm import numpy as np import sys sys.path.append("../utils") sys.path.append("../functions") sys.path.append("../genetic_algorithm") import genetic_algorithm import ackley_function import easom_function import rosenbrock_fun...
mit
has2k1/plydata
plydata/one_table_verbs.py
1
33733
""" One table verb initializations """ import itertools from .operators import DataOperator from .expressions import Expression __all__ = ['define', 'create', 'sample_n', 'sample_frac', 'select', 'rename', 'distinct', 'unique', 'arrange', 'group_by', 'ungroup', 'group_indices', 'summarize', ...
bsd-3-clause
bond-/udacity-ml
src/numpy-pandas-tutorials/quiz-create-dataframe.py
1
1819
from pandas import DataFrame, Series ################# # Syntax Reminder: # # The following code would create a two-column pandas DataFrame # named df with columns labeled 'name' and 'age': # # people = ['Sarah', 'Mike', 'Chrisna'] # ages = [28, 32, 25] # df = DataFrame({'name' : Series(people), # 'a...
apache-2.0
harisbal/pandas
pandas/tests/io/test_common.py
2
10380
""" Tests for the pandas.io.common functionalities """ import mmap import os import pytest import pandas as pd import pandas.io.common as icom import pandas.util._test_decorators as td import pandas.util.testing as tm from pandas.compat import ( is_platform_windows, StringIO, FileNotFoundError, ) class ...
bsd-3-clause
draperjames/bokeh
bokeh/core/compat/mpl_helpers.py
14
5432
"Helpers function for mpl module." #----------------------------------------------------------------------------- # Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved. # # Powered by the Bokeh Development Team. # # The full license is in the file LICENSE.txt, distributed with this software. #-----...
bsd-3-clause
xzh86/scikit-learn
benchmarks/bench_plot_nmf.py
206
5890
""" Benchmarks of Non-Negative Matrix Factorization """ from __future__ import print_function from collections import defaultdict import gc from time import time import numpy as np from scipy.linalg import norm from sklearn.decomposition.nmf import NMF, _initialize_nmf from sklearn.datasets.samples_generator import...
bsd-3-clause
boada/HETDEXCluster
legacy/stats/rejectOutliers.py
4
5284
import glob import pandas as pd import pylab as pyl from astLib import astCoords as aco from astLib import astStats as ast from astLib import astCalc as aca def parseResults(files): ''' Reads all of the results files and puts them into a list with the results. Returns field, dither, fiber, and redshift. '...
mit
ephes/scikit-learn
examples/covariance/plot_mahalanobis_distances.py
348
6232
r""" ================================================================ Robust covariance estimation and Mahalanobis distances relevance ================================================================ An example to show covariance estimation with the Mahalanobis distances on Gaussian distributed data. For Gaussian dis...
bsd-3-clause
george-montanez/LICORScabinet
TruncatedKDE.py
1
1467
from __future__ import division import numpy as np from sklearn.neighbors import NearestNeighbors from DensityEstimator import DensityEstimator from VectorGaussianKernel import VectorGaussianKernel from multi_flatten import multi_flatten class TruncatedKDE(DensityEstimator): def __init__(self, d_points, num_subsam...
gpl-2.0
rerpy/rerpy
doc/sphinxext/ipython_directive.py
1
27232
# -*- coding: utf-8 -*- """Sphinx directive to support embedded IPython code. This directive allows pasting of entire interactive IPython sessions, prompts and all, and their code will actually get re-executed at doc build time, with all prompts renumbered sequentially. It also allows you to input code as a pure pytho...
gpl-2.0
louisLouL/pair_trading
capstone_env/lib/python3.6/site-packages/pandas/tests/series/test_analytics.py
4
63970
# coding=utf-8 # pylint: disable-msg=E1101,W0612 from itertools import product from distutils.version import LooseVersion import pytest from numpy import nan import numpy as np import pandas as pd from pandas import (Series, Categorical, DataFrame, isnull, notnull, bdate_range, date_range, _np_v...
mit
DeercoderResearch/deepnet
deepnet/ais.py
10
7589
"""Computes partition function for RBM-like models using Annealed Importance Sampling.""" import numpy as np from deepnet import dbm from deepnet import util from deepnet import trainer as tr from choose_matrix_library import * import sys import numpy as np import pdb import time import itertools import matplotlib.pypl...
bsd-3-clause
kevinyu98/spark
python/pyspark/testing/sqlutils.py
9
7813
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
apache-2.0
drewokane/seaborn
seaborn/timeseries.py
4
15212
"""Timeseries plotting functions.""" from __future__ import division import numpy as np import pandas as pd from scipy import stats, interpolate import matplotlib as mpl import matplotlib.pyplot as plt from .external.six import string_types from . import utils from . import algorithms as algo from .palettes import c...
bsd-3-clause
PrieureDeSion/intelligent-agents
sin(x) Neural Network/Neural Network.py
1
2675
''' Function Approximator This neural network uses Universal Approximator technique to predict the value of function in a closed domain. This works on the theorem that any function in a closed domain which is continuous or discontinuous at finitely many points can be approximated using piece-wise constant functions. ...
gpl-3.0
saiwing-yeung/scikit-learn
examples/manifold/plot_mds.py
88
2731
""" ========================= Multi-dimensional scaling ========================= An illustration of the metric and non-metric MDS on generated noisy data. The reconstructed points using the metric MDS and non metric MDS are slightly shifted to avoid overlapping. """ # Author: Nelle Varoquaux <nelle.varoquaux@gmail....
bsd-3-clause
QBI-Microscopy/omero-user-scripts
Image_Processing/ExtractROIs.py
1
31955
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Title: Extract ROIs from images Description: Extracts multiple polygon or rectangle ROIs from an image or set of images and creates individual images from them with associated links to parent image. __author__ Liz Cooper-Williams, QBI This script is based on compon...
gpl-2.0
JoostHuizinga/ea-plotting-scripts
createPlots.py
1
77159
#!/usr/bin/env python3 import matplotlib import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from matplotlib.patches import Polygon import os import sys import io import copy import argparse as ap from createPlotUtils import * __author__ = "Joost Huizinga" __version__ = "1.7 (Dec. 19 2019)" initO...
mit
exowanderer/SpitzerDeepLearningNetwork
Python Scripts/spitzer_cal_NALU_train.py
1
15910
from multiprocessing import set_start_method, cpu_count #set_start_method('forkserver') import os os.environ["OMP_NUM_THREADS"] = str(cpu_count()) # or to whatever you want from argparse import ArgumentParser from datetime import datetime from sklearn.model_selection import train_test_split from sklearn.metrics impo...
mit
Unidata/MetPy
v1.0/_downloads/6405360ec40d7796ed64eb783f2ffe55/NEXRAD_Level_2_File.py
7
2016
# Copyright (c) 2015,2018,2019 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """ NEXRAD Level 2 File =================== Use MetPy to read information from a NEXRAD Level 2 (volume) file and plot """ import matplotlib.pyplot as plt import numpy as ...
bsd-3-clause
evidation-health/bokeh
bokeh/tests/test_protocol.py
42
3959
from __future__ import absolute_import import unittest from unittest import skipIf import numpy as np try: import pandas as pd is_pandas = True except ImportError as e: is_pandas = False class TestBokehJSONEncoder(unittest.TestCase): def setUp(self): from bokeh.protocol import BokehJSONEnc...
bsd-3-clause
chilang/zeppelin
python/src/main/resources/python/bootstrap_sql.py
60
1189
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
apache-2.0
tangyouze/tushare
tushare/stock/shibor.py
38
5010
# -*- coding:utf-8 -*- """ 上海银行间同业拆放利率(Shibor)数据接口 Created on 2014/07/31 @author: Jimmy Liu @group : waditu @contact: jimmysoa@sina.cn """ import pandas as pd import numpy as np from tushare.stock import cons as ct from tushare.util import dateu as du def shibor_data(year=None): """ 获取上海银行间同业拆放利率(Shibor) P...
bsd-3-clause
vibhorag/scikit-learn
sklearn/utils/tests/test_multiclass.py
128
12853
from __future__ import division import numpy as np import scipy.sparse as sp from itertools import product from sklearn.externals.six.moves import xrange from sklearn.externals.six import iteritems from scipy.sparse import issparse from scipy.sparse import csc_matrix from scipy.sparse import csr_matrix from scipy.sp...
bsd-3-clause