repo_name
stringlengths
7
90
path
stringlengths
5
191
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
976
581k
license
stringclasses
15 values
rcrowder/nupic
examples/opf/tools/MirrorImageViz/mirrorImageViz.py
50
7221
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This progra...
agpl-3.0
ArnaudKOPP/BioREST
BioREST/QuickGo.py
1
12406
# coding=utf-8 """ REST class to QuicGo services """ __author__ = "Arnaud KOPP" __copyright__ = "© 2015-2016 KOPP Arnaud All Rights Reserved" __credits__ = ["KOPP Arnaud"] __license__ = "GNU GPL V3.0" __maintainer__ = "Arnaud KOPP" __email__ = "kopp.arnaud@gmail.com" __status__ = "Production" import logging from BioR...
gpl-3.0
mbayon/TFG-MachineLearning
vbig/lib/python2.7/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
manashmndl/scikit-learn
benchmarks/bench_plot_neighbors.py
287
6433
""" Plot the scaling of the nearest neighbors algorithms with k, D, and N """ from time import time import numpy as np import pylab as pl from matplotlib import ticker from sklearn import neighbors, datasets def get_data(N, D, dataset='dense'): if dataset == 'dense': np.random.seed(0) return np....
bsd-3-clause
heidtn/evolutionary_robotics
ANN/test.py
1
1281
import sys sys.path.append("../hill_climber") import hill_climber as hc import math import matplotlib.pyplot as plt import random import ANN num_neurons = 10 neuronPositions = hc.MatrixCreate(2,num_neurons) angle = 0.0 angleUpdate = 2 * math.pi / num_neurons for i in range(0, num_neurons): x = math.sin(angle)...
gpl-3.0
ilayn/scipy
scipy/stats/_continuous_distns.py
7
296915
# -*- coding: utf-8 -*- # # Author: Travis Oliphant 2002-2011 with contributions from # SciPy Developers 2004-2011 # import warnings from collections.abc import Iterable import ctypes import numpy as np from scipy._lib.doccer import (extend_notes_in_docstring, replace_notes_i...
bsd-3-clause
ssaeger/scikit-learn
sklearn/feature_extraction/hashing.py
41
6175
# Author: Lars Buitinck <L.J.Buitinck@uva.nl> # License: BSD 3 clause import numbers import numpy as np import scipy.sparse as sp from . import _hashing from ..base import BaseEstimator, TransformerMixin def _iteritems(d): """Like d.iteritems, but accepts any collections.Mapping.""" return d.iteritems() if...
bsd-3-clause
gfyoung/pandas
pandas/tests/arrays/boolean/test_comparison.py
9
3103
import numpy as np import pytest import pandas as pd import pandas._testing as tm from pandas.arrays import BooleanArray from pandas.tests.extension.base import BaseOpsUtil @pytest.fixture def data(): return pd.array( [True, False] * 4 + [np.nan] + [True, False] * 44 + [np.nan] + [True, False], d...
bsd-3-clause
geomf/omf-fork
omf/common/plot.py
1
1137
# # Open Modeling Framework (OMF) Software for simulating power systems behavior # Copyright (c) 2015, Intel Corporation. # # This program is free software; you can redistribute it and/or modify it # under the terms and conditions of the GNU General Public License, # version 2, as published by the Free Software Foundat...
gpl-2.0
Radymus/QMetric
QMetric.py
1
40492
#!/usr/bin/env python -W ignore::DeprecationWarning # -*- coding: utf-8 -*- """ Created on Thu Apr 3 21:24:06 2014 @author: Radim Spigel """ from __future__ import division import shutil import os import logging import re from pandas import DataFrame from gittle import Gittle, InvalidRemoteUrl from argparse import A...
gpl-3.0
Averroes/statsmodels
statsmodels/sandbox/rls.py
33
5179
"""Restricted least squares from pandas License: Simplified BSD """ from __future__ import print_function import numpy as np from statsmodels.regression.linear_model import WLS, GLS, RegressionResults class RLS(GLS): """ Restricted general least squares model that handles linear constraints Parameters ...
bsd-3-clause
matthewdippel/pandas-utils
plots/plotutils.py
1
2507
import matplotlib.pyplot as plt import seaborn as sns __author__ = 'mdippel' def prettify_axis(ax): ax.patch.set_facecolor('grey') ax.patch.set_alpha(0.5) ax.grid(linestyle='-', linewidth='0.5', color='white') def pretty_scatter(df, x, y): plt.clf() ax = df.plot(kind='scatter', x=x, y=y) ...
mit
chrisburr/scikit-learn
sklearn/feature_selection/tests/test_from_model.py
62
6762
import numpy as np import scipy.sparse as sp from nose.tools import assert_raises, assert_true from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.ut...
bsd-3-clause
Bismarrck/tensorflow
tensorflow/contrib/learn/python/learn/learn_io/data_feeder.py
39
32726
# 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
robin-lai/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
mcstrother/dicom-sr-qi
inquiries/cpt_box_plots.py
2
3170
from srqi.core import inquiry, Parse_Syngo, my_utils import matplotlib.pyplot as plt import heapq import math class Cpt_Box_Plots(inquiry.Inquiry): NUM_PROCEDURE_TYPES = inquiry.Inquiry_Parameter(5, "Number of Procedure Types", "The Maximum number of proce...
bsd-2-clause
jakobworldpeace/scikit-learn
examples/ensemble/plot_gradient_boosting_oob.py
82
4768
""" ====================================== Gradient Boosting Out-of-Bag estimates ====================================== Out-of-bag (OOB) estimates can be a useful heuristic to estimate the "optimal" number of boosting iterations. OOB estimates are almost identical to cross-validation estimates but they can be compute...
bsd-3-clause
jayflo/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
gregstarr/anomaly-detection
test.py
1
1597
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue May 30 16:42:25 2017 @author: greg """ import numpy as np from ranksvm_k import ranksvm_k import matplotlib.pyplot as plt from scipy.sparse import csr_matrix from gregAD import knn_score from scipy.io import loadmat dic = np.load('arrays.npz') l = len...
gpl-3.0
MartinSavc/scikit-learn
sklearn/metrics/cluster/bicluster.py
359
2797
from __future__ import division import numpy as np from sklearn.utils.linear_assignment_ import linear_assignment from sklearn.utils.validation import check_consistent_length, check_array __all__ = ["consensus_score"] def _check_rows_and_columns(a, b): """Unpacks the row and column arrays and checks their shap...
bsd-3-clause
mbayon/TFG-MachineLearning
venv/lib/python3.6/site-packages/pandas/tests/test_errors.py
6
1133
# -*- coding: utf-8 -*- import pytest from warnings import catch_warnings import pandas # noqa import pandas as pd @pytest.mark.parametrize( "exc", ['UnsupportedFunctionCall', 'UnsortedIndexError', 'OutOfBoundsDatetime', 'ParserError', 'PerformanceWarning', 'DtypeWarning', 'E...
mit
cauchycui/scikit-learn
examples/text/document_classification_20newsgroups.py
222
10500
""" ====================================================== Classification of text documents using sparse features ====================================================== This is an example showing how scikit-learn can be used to classify documents by topics using a bag-of-words approach. This example uses a scipy.spars...
bsd-3-clause
jeromecn/caravel_viz_full
caravel/models.py
1
88506
"""A collection of ORM sqlalchemy models for Caravel""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from collections import OrderedDict import functools import json import logging import pickle import re import tex...
apache-2.0
BeiLuoShiMen/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/backend_bases.py
69
69740
""" Abstract base classes define the primitives that renderers and graphics contexts must implement to serve as a matplotlib backend :class:`RendererBase` An abstract base class to handle drawing/rendering operations. :class:`FigureCanvasBase` The abstraction layer that separates the :class:`matplotlib.fi...
agpl-3.0
rexshihaoren/scikit-learn
examples/bicluster/plot_spectral_biclustering.py
403
2011
""" ============================================= A demo of the Spectral Biclustering algorithm ============================================= This example demonstrates how to generate a checkerboard dataset and bicluster it using the Spectral Biclustering algorithm. The data is generated with the ``make_checkerboard`...
bsd-3-clause
kernc/scikit-learn
examples/tree/plot_tree_regression_multioutput.py
73
1854
""" =================================================================== Multi-output Decision Tree Regression =================================================================== An example to illustrate multi-output regression with decision tree. The :ref:`decision trees <tree>` is used to predict simultaneously the ...
bsd-3-clause
sauliusl/seaborn
seaborn/palettes.py
3
33251
from __future__ import division import colorsys from itertools import cycle import numpy as np import matplotlib as mpl from .external import husl from .external.six import string_types from .external.six.moves import range from .utils import desaturate, set_hls_values, get_color_cycle from .colors import xkcd_rgb, ...
bsd-3-clause
gviejo/ThalamusPhysio
python/pyfigures/main_fig3.py
1
9231
import numpy as np import pandas as pd # from matplotlib.pyplot import plot,show,draw import scipy.io import sys sys.path.append("../") from functions import * from pylab import * from sklearn.decomposition import PCA import _pickle as cPickle import matplotlib.cm as cm import os ####################################...
gpl-3.0
rahuldhote/scikit-learn
sklearn/utils/multiclass.py
83
12343
# Author: Arnaud Joly, Joel Nothman, Hamzeh Alsalhi # # License: BSD 3 clause """ Multi-class / multi-label utility function ========================================== """ from __future__ import division from collections import Sequence from itertools import chain from scipy.sparse import issparse from scipy.sparse....
bsd-3-clause
INM-6/elephant
elephant/current_source_density_src/icsd.py
2
35175
# -*- coding: utf-8 -*- """ py-iCSD toolbox! Translation of the core functionality of the CSDplotter MATLAB package to python. The methods were originally developed by Klas H. Pettersen, as described in: Klas H. Pettersen, Anna Devor, Istvan Ulbert, Anders M. Dale, Gaute T. Einevoll, Current-source density estimation ...
bsd-3-clause
HyperloopTeam/FullOpenMDAO
lib/python2.7/site-packages/matplotlib/tests/test_basic.py
10
1264
from __future__ import (absolute_import, division, print_function, unicode_literals) import six from nose.tools import assert_equal from matplotlib.testing.decorators import knownfailureif from pylab import * def test_simple(): assert_equal(1 + 1, 2) @knownfailureif(True) def test_sim...
gpl-2.0
grahesh/Stock-Market-Event-Analysis
Tools/Visualizer/Visualizer.py
3
62630
''' (c) 2011, 2012 Georgia Tech Research Corporation This source code is released under the New BSD license. Please see http://wiki.quantsoftware.org/index.php?title=QSTK_License for license details. Created on April, 20, 2012 @author: Sourabh Bajaj @contact: sourabhbajaj90@gmail.com @summary: Visualizer Main Code ...
bsd-3-clause
Newman101/scipy
scipy/integrate/odepack.py
62
9420
# Author: Travis Oliphant from __future__ import division, print_function, absolute_import __all__ = ['odeint'] from . import _odepack from copy import copy import warnings class ODEintWarning(Warning): pass _msgs = {2: "Integration successful.", 1: "Nothing was done; the integration time was 0.", ...
bsd-3-clause
tobanw/py-econ-examples
timeseries.py
1
2106
#Time series example: generate series, visualize, regression import numpy as np from statsmodels.tsa.stattools import acf,pacf from statsmodels.tsa import ar_model import matplotlib.pyplot as plt import pandas as pd def ar1(phi,n): """ Generates an instance of an AR(1) process with Gaussian white noise phi...
mit
sillvan/hyperspy
doc/sphinxext/gen_rst.py
2
4933
# This is a modified version of matplotlib's file of the same name # The matplotlib license of choice applies to this file """ generate the rst files for the examples by iterating over the examples """ import os import glob import os import re import sys fileList = [] def out_of_date(original, derived): """ ...
gpl-3.0
AnoshZahir/bad_boids
boids/boids.py
1
3762
from matplotlib import pyplot as plt from matplotlib import animation import numpy as np class Boids(object): def __init__(self, no_of_boids = 50, position_limits = [-450, 300, 50, 600], velocity_limits = [0, -20, 10, 20], move_to_middle_strength = 0.01, alert_distance = 100, formation_flying_dist...
mit
sssllliang/edx-analytics-pipeline
edx/analytics/tasks/tests/test_course_subjects.py
1
10412
""" Test the course subjects task which processes from the course catalog. Testing strategy: Empty catalog (expect empty output) Catalog with one course listed which has no subjects listed (expect output with null values?) Catalog with one course listed which has one subject Catalog with one course lis...
agpl-3.0
roystgnr/queso
examples/gp/scalar/cobra-manual.py
5
1375
import sys import re from StringIO import StringIO import numpy as np import matplotlib matplotlib.use('pdf') import matplotlib.pyplot as plt chain = str(sys.argv[2]) with open(str(sys.argv[1])+'/ip_raw_chain_sub'+chain+'.m', 'r') as fin: header = fin.readline() # Sort out the dimension of the 2D array of s...
lgpl-2.1
kdebrab/pandas
pandas/tests/frame/test_sorting.py
4
22928
# -*- coding: utf-8 -*- from __future__ import print_function import pytest import random import numpy as np import pandas as pd from pandas.compat import lrange from pandas.api.types import CategoricalDtype from pandas import (DataFrame, Series, MultiIndex, Timestamp, date_range, NaT, IntervalIn...
bsd-3-clause
MihawkHu/Gene_Chip
dnn/dnn.py
1
2261
from load import * from sklearn import decomposition import sys import numpy as np from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation from keras.optimizers import RMSprop from keras.utils import np_utils # pca feature dimension ndim = 100 if len(sys.argv) != 1: ndim = int...
mit
jmcorgan/gnuradio
gr-analog/examples/fmtest.py
18
7986
#!/usr/bin/env python # # Copyright 2009,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio 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, or (at your ...
gpl-3.0
bthirion/scikit-learn
examples/neural_networks/plot_mlp_training_curves.py
58
3692
""" ======================================================== Compare Stochastic learning strategies for MLPClassifier ======================================================== This example visualizes some training loss curves for different stochastic learning strategies, including SGD and Adam. Because of time-constrai...
bsd-3-clause
jrkerns/pylinac
pylinac/core/geometry.py
1
13651
"""Module for classes that represent common geometric objects or patterns.""" from itertools import zip_longest import math from typing import Union, Optional, List, Iterable, Tuple import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Circle as mpl_Circle from matplotlib.patches import Rec...
mit
Titan-C/scikit-learn
sklearn/neighbors/regression.py
7
10971
"""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 # Multi-output support by Arnaud Joly <a.joly@ulg.ac...
bsd-3-clause
justacec/bokeh
bokeh/charts/builders/donut_builder.py
9
9623
"""This is the Bokeh charts interface. It gives you a high level API to build complex plot is a simple way. This is the Donut builder which lets you build your Donut plots just passing the arguments to the Chart class and calling the proper functions. """ #--------------------------------------------------------------...
bsd-3-clause
bsipocz/scikit-image
doc/examples/plot_rag.py
25
2139
""" ======================= Region Adjacency Graphs ======================= This example demonstrates the use of the `merge_nodes` function of a Region Adjacency Graph (RAG). The `RAG` class represents a undirected weighted graph which inherits from `networkx.graph` class. When a new node is formed by merging two node...
bsd-3-clause
timnon/pyschedule
examples/shift-bounds.py
1
1450
# test artefact for the case that pyschedule is # read from folder import sys sys.path += ['../src','src'] import getopt opts, _ = getopt.getopt(sys.argv[1:], 't:', ['test']) from pyschedule import Scenario, solvers, plotters, Task S = Scenario('shift_bounds',horizon=8) # define two employees empl0 = S.Resource('empl...
apache-2.0
ysasaki6023/NeuralNetworkStudy
bayes_opt/helpers.py
1
5447
from __future__ import print_function from __future__ import division import numpy as np from datetime import datetime from scipy.stats import norm class UtilityFunction(object): """ An object to compute the acquisition functions. """ def __init__(self, kind, kappa, xi): """ If UCB is...
mit
Phlya/adjustText
docs/source/conf.py
1
5095
import sys import os import matplotlib sys.path.insert(0, os.path.abspath('../..')) matplotlib.use('Agg') # -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sph...
mit
trankmichael/scikit-learn
examples/model_selection/plot_learning_curve.py
250
4171
""" ======================== Plotting Learning Curves ======================== On the left side the learning curve of a naive Bayes classifier is shown for the digits dataset. Note that the training score and the cross-validation score are both not very good at the end. However, the shape of the curve can be found in ...
bsd-3-clause
scw/geopandas
geopandas/geodataframe.py
7
15536
try: from collections import OrderedDict except ImportError: # Python 2.6 from ordereddict import OrderedDict import json import os import sys import numpy as np from pandas import DataFrame, Series from shapely.geometry import mapping, shape from shapely.geometry.base import BaseGeometry from six import s...
bsd-3-clause
plissonf/scikit-learn
examples/cross_decomposition/plot_compare_cross_decomposition.py
128
4761
""" =================================== Compare cross decomposition methods =================================== Simple usage of various cross decomposition algorithms: - PLSCanonical - PLSRegression, with multivariate response, a.k.a. PLS2 - PLSRegression, with univariate response, a.k.a. PLS1 - CCA Given 2 multivari...
bsd-3-clause
shusenl/scikit-learn
examples/ensemble/plot_forest_importances.py
241
1761
""" ========================================= Feature importances with forests of trees ========================================= This examples shows the use of forests of trees to evaluate the importance of features on an artificial classification task. The red bars are the feature importances of the forest, along wi...
bsd-3-clause
pypot/scikit-learn
sklearn/feature_extraction/dict_vectorizer.py
234
12267
# Authors: Lars Buitinck # Dan Blanchard <dblanchard@ets.org> # License: BSD 3 clause from array import array from collections import Mapping from operator import itemgetter import numpy as np import scipy.sparse as sp from ..base import BaseEstimator, TransformerMixin from ..externals import six from ..ext...
bsd-3-clause
maxlz/ML
tf_simple_LR.py
1
1144
# -*- coding: utf-8 -*- """ Created on Mon Aug 1 19:50:54 2016 @author: max """ import tensorflow as tf import numpy as np import matplotlib.pylab as m x_data = np.linspace(0.0,1.0,num = 500,dtype='float32') x_data = np.reshape(x_data,(500,)) y_data = np.linspace(0.0,1.0,num = 500,dtype='float32') y_data = y_data ...
apache-2.0
Shaswat27/scipy
scipy/spatial/_plotutils.py
11
4843
from __future__ import division, print_function, absolute_import import numpy as np from scipy._lib.decorator import decorator as _decorator __all__ = ['delaunay_plot_2d', 'convex_hull_plot_2d', 'voronoi_plot_2d'] @_decorator def _held_figure(func, obj, ax=None, **kw): import matplotlib.pyplot as plt if ax...
bsd-3-clause
AlexanderFabisch/scikit-learn
examples/decomposition/plot_ica_vs_pca.py
306
3329
""" ========================== FastICA on 2D point clouds ========================== This example illustrates visually in the feature space a comparison by results using two different component analysis techniques. :ref:`ICA` vs :ref:`PCA`. Representing ICA in the feature space gives the view of 'geometric ICA': ICA...
bsd-3-clause
dimroc/tensorflow-mnist-tutorial
lib/python3.6/site-packages/matplotlib/backends/backend_qt5agg.py
10
9036
""" Render to qt from agg """ from __future__ import (absolute_import, division, print_function, unicode_literals) import six import ctypes import sys import traceback from matplotlib.figure import Figure from .backend_agg import FigureCanvasAgg from .backend_qt5 import QtCore from .backend_...
apache-2.0
anntzer/scikit-learn
sklearn/linear_model/_perceptron.py
7
6205
# Author: Mathieu Blondel # License: BSD 3 clause from ..utils.validation import _deprecate_positional_args from ._stochastic_gradient import BaseSGDClassifier class Perceptron(BaseSGDClassifier): """Perceptron Read more in the :ref:`User Guide <perceptron>`. Parameters ---------- penalty : {'...
bsd-3-clause
karlnapf/kernel_exp_family
kernel_exp_family/examples/demo_xvalidation_grid_search_manual.py
1
2087
from kernel_exp_family.estimators.lite.gaussian import KernelExpLiteGaussian from kernel_exp_family.examples.tools import visualise_fit_2d import matplotlib.pyplot as plt import numpy as np if __name__ == '__main__': """ This simple demo demonstrates how to select the kernel parameter for the lite estimat...
bsd-3-clause
bhillmann/gingivere
tests/ensemble_gradient.py
2
2184
import random import pandas as pd from sklearn.cross_validation import StratifiedKFold import numpy as np from sklearn.metrics import classification_report from sklearn.metrics import roc_auc_score from sklearn.neighbors import KNeighborsClassifier from tests import shelve_api def yield_patient_names(name, d): ...
mit
futurulus/scipy
scipy/stats/tests/test_morestats.py
17
50896
# Author: Travis Oliphant, 2002 # # Further enhancements and tests added by numerous SciPy developers. # from __future__ import division, print_function, absolute_import import warnings import numpy as np from numpy.random import RandomState from numpy.testing import (TestCase, run_module_suite, assert_array_equal, ...
bsd-3-clause
CartoDB/crankshaft
release/python/0.5.2/crankshaft/setup.py
1
1300
""" CartoDB Spatial Analysis Python Library See: https://github.com/CartoDB/crankshaft """ from setuptools import setup, find_packages setup( name='crankshaft', version='0.5.2', description='CartoDB Spatial Analysis Python Library', url='https://github.com/CartoDB/crankshaft', author='Data Se...
bsd-3-clause
derdav3/tf-sparql
meta-learner.py
1
3028
import tensorflow as tf import matplotlib import matplotlib.pyplot as plt import numpy as np DIMS = 10 # Dimensions of the parabola LAYERS = 2 STATE_SIZE = 20 TRAINING_STEPS = 20 # This is 100 in the paper scale = tf.random_uniform([DIMS], 0.5, 1.5) # This represents the network/function we are trying to optimize,...
mit
IssamLaradji/scikit-learn
examples/feature_stacker.py
246
1906
""" ================================================= Concatenating multiple feature extraction methods ================================================= In many real-world examples, there are many ways to extract features from a dataset. Often it is beneficial to combine several methods to obtain good performance. Th...
bsd-3-clause
henridwyer/scikit-learn
examples/cluster/plot_digits_linkage.py
369
2959
""" ============================================================================= Various Agglomerative Clustering on a 2D embedding of digits ============================================================================= An illustration of various linkage option for agglomerative clustering on a 2D embedding of the di...
bsd-3-clause
wdbm/shijian
setup.py
1
1580
#!/usr/bin/python # -*- coding: utf-8 -*- import os import setuptools def main(): setuptools.setup( name = 'shijian', version = '2020.01.29.1857', description = 'change, time, file, list, statistics, language and other utilities', long_description = long_d...
gpl-3.0
masml/masmlblog
Naive Bayes/Naive_bayes_MASML.py
1
4678
# coding: utf-8 # In[1]: import pandas as pd import numpy as np import scipy as sp df1=pd.read_csv("C:\\Users\\hp\\Desktop\\MAS ML\\datasets\\t20.csv")#rem to use double backslash #booleans[] dfx=df1[df1.Innings1Team==df1.Winner] dfy= df1[df1.Innings1Team!=df1.Winner] dfx['Winner']=0 dfy['Winner']=1 df1=pd.concat(...
mit
blisseth/ThinkStats2
code/thinkplot.py
75
18140
"""This file contains code for use with "Think Stats", by Allen B. Downey, available from greenteapress.com Copyright 2014 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ from __future__ import print_function import math import matplotlib import matplotlib.pyplot as pyplot import numpy as...
gpl-3.0
ashhher3/scikit-learn
examples/manifold/plot_manifold_sphere.py
258
5101
#!/usr/bin/python # -*- coding: utf-8 -*- """ ============================================= Manifold Learning methods on a severed sphere ============================================= An application of the different :ref:`manifold` techniques on a spherical data-set. Here one can see the use of dimensionality reducti...
bsd-3-clause
XiaoLiuAI/RUPEE
src/python/model/statsmodel_wrapper.py
1
1509
import copy import numpy as np import statsmodels.api as sm import sklearn class MNLogit(sklearn.base.ClassifierMixin, sklearn.base.BaseEstimator): def __init__(self): self.algoModule = sm.MNLogit def choose_opt_params(self, X, y, params, cross_val_score, average_measure, metric_func): score...
gpl-2.0
hdmetor/scikit-learn
sklearn/datasets/tests/test_samples_generator.py
67
14842
from __future__ import division from collections import defaultdict from functools import partial import numpy as np from sklearn.externals.six.moves import zip from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_almost_equal fr...
bsd-3-clause
DomiDre/SASModels
tests/Simulate_distribution.py
1
4707
import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as tck import matplotlib.colors as mcolors from mpl_toolkits.axes_grid1 import make_axes_locatable from scipy import integrate from scipy import constants # Stochastic solver for a colloidal magnetic rod pi = np.pi sqrt = np.sqrt # Set up mea...
gpl-3.0
anne-urai/RT_RDK
old_code/HDDM_RunStopos.py
2
6676
#!/usr/bin/env python # encoding: utf-8 """ Anne Urai, 2016 takes input arguments from stopos Important: on Cartesius, call module load python2.7.9 before running (the only environment where HDDM is installed) """ # ============================================ # # HDDM cheat sheet # ==================================...
mit
nguyentu1602/statsmodels
statsmodels/datasets/spector/data.py
25
2000
"""Spector and Mazzeo (1980) - Program Effectiveness Data""" __docformat__ = 'restructuredtext' COPYRIGHT = """Used with express permission of the original author, who retains all rights. """ TITLE = __doc__ SOURCE = """ http://pages.stern.nyu.edu/~wgreene/Text/econometricanalysis.htm The raw data was d...
bsd-3-clause
kinshuk4/MoocX
k2e/dev/libs/python/numpy-and-pandas/average_gold_silver_and_bronze.py
1
1802
import numpy from pandas import DataFrame, Series def avg_medal_count(): ''' Using the dataframe's apply method, create a new Series called avg_medal_count that indicates the average number of gold, silver, and bronze medals earned amongst countries who earned at least one medal of any kind at the...
mit
walterreade/scikit-learn
sklearn/gaussian_process/gpr.py
43
18642
"""Gaussian processes regression. """ # Authors: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de> # # License: BSD 3 clause import warnings from operator import itemgetter import numpy as np from scipy.linalg import cholesky, cho_solve, solve_triangular from scipy.optimize import fmin_l_bfgs_b from sklearn.base im...
bsd-3-clause
yunfeilu/scikit-learn
sklearn/kernel_ridge.py
155
6545
"""Module :mod:`sklearn.kernel_ridge` implements kernel ridge regression.""" # Authors: Mathieu Blondel <mathieu@mblondel.org> # Jan Hendrik Metzen <jhm@informatik.uni-bremen.de> # License: BSD 3 clause import numpy as np from .base import BaseEstimator, RegressorMixin from .metrics.pairwise import pairwise...
bsd-3-clause
deepakantony/sms-tools
lectures/09-Sound-description/plots-code/soundAnalysis.py
25
5271
import numpy as np import matplotlib.pyplot as plt from matplotlib.lines import Line2D import os, sys import json from scipy.cluster.vq import vq, kmeans, whiten def fetchDataDetails(inputDir, descExt = '.json'): dataDetails = {} for path, dname, fnames in os.walk(inputDir): for fname in fnames: if des...
agpl-3.0
MohammedWasim/scikit-learn
sklearn/cluster/tests/test_bicluster.py
226
9457
"""Testing for Spectral Biclustering methods""" import numpy as np from scipy.sparse import csr_matrix, issparse from sklearn.grid_search import ParameterGrid from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from...
bsd-3-clause
tseaver/google-cloud-python
bigquery/samples/load_table_dataframe.py
1
3122
# Copyright 2019 Google LLC # # 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 applicable law or agreed to in writing, s...
apache-2.0
allenai/allennlp
tests/training/metrics/fbeta_multi_label_measure_test.py
1
18049
from typing import Dict, List, Tuple, Union, Any import pytest import torch from allennlp.common.checks import ConfigurationError from allennlp.common.testing import ( AllenNlpTestCase, global_distributed_metric, multi_device, run_distributed_test, ) from sklearn.metrics import precision_recall_fscore_...
apache-2.0
wwf5067/statsmodels
statsmodels/nonparametric/_kernel_base.py
29
18238
""" Module containing the base object for multivariate kernel density and regression, plus some utilities. """ from statsmodels.compat.python import range, string_types import copy import numpy as np from scipy import optimize from scipy.stats.mstats import mquantiles try: import joblib has_joblib = True exce...
bsd-3-clause
jpautom/scikit-learn
sklearn/ensemble/tests/test_weight_boosting.py
58
17158
"""Testing for the boost module (sklearn.ensemble.boost).""" import numpy as np from sklearn.utils.testing import assert_array_equal, assert_array_less from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal, assert_true from sklearn.utils.testing import assert_raises...
bsd-3-clause
mikecroucher/GPy
GPy/testing/plotting_tests.py
3
21811
#=============================================================================== # Copyright (c) 2015, Max Zwiessele # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source...
bsd-3-clause
vibhorag/scikit-learn
sklearn/linear_model/setup.py
146
1713
import os from os.path import join import numpy from sklearn._build_utils import get_blas_info def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('linear_model', parent_package, top_path) cblas_libs, blas_info = get_blas_info...
bsd-3-clause
simon-pepin/scikit-learn
sklearn/qda.py
140
7682
""" Quadratic Discriminant Analysis """ # Author: Matthieu Perrot <matthieu.perrot@gmail.com> # # License: BSD 3 clause import warnings import numpy as np from .base import BaseEstimator, ClassifierMixin from .externals.six.moves import xrange from .utils import check_array, check_X_y from .utils.validation import ...
bsd-3-clause
Jakub21/EU4-Province-Editor
src/meta.py
1
7228
from platform import system as psys from os import getcwd ################################ # SETTINGS AND CONSTANT VARIABLES def get_const(): global const const = { # General 'auto_sort' : True, 'auto_apply' : True, 'autoprint_atselect' : False, ...
mit
pandeyadarsh/sympy
sympy/external/importtools.py
85
7294
"""Tools to assist importing optional external modules.""" from __future__ import print_function, division import sys # Override these in the module to change the default warning behavior. # For example, you might set both to False before running the tests so that # warnings are not printed to the console, or set bo...
bsd-3-clause
enlighter/learnML
learn/sklearn/label_data_preprocessing_labelencoder.py
1
1248
# In this exercise we'll load the titanic data (from Project 0) # And then perform one-hot encoding on the feature names import numpy as np import pandas as pd # Load the dataset X = pd.read_csv('titanic_data.csv') # Limit to categorical data X = X.select_dtypes(include=[object]) from sklearn.preprocessing import La...
mit
amolkahat/pandas
pandas/tests/extension/base/missing.py
5
4326
import numpy as np import pytest import pandas as pd import pandas.util.testing as tm from .base import BaseExtensionTests class BaseMissingTests(BaseExtensionTests): def test_isna(self, data_missing): expected = np.array([True, False]) result = pd.isna(data_missing) tm.assert_numpy_arr...
bsd-3-clause
KeithYue/StockTrading
st_select.py
1
6527
# coding=utf-8 import pandas as pd import pandas.io.data as web import os import numpy as np import logging # config the logging system logging.basicConfig(level=logging.DEBUG) from scipy.signal import argrelextrema, argrelmin, argrelextrema from talib.abstract import * # load the utility function from utility impor...
apache-2.0
zuku1985/scikit-learn
sklearn/linear_model/coordinate_descent.py
4
81531
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Olivier Grisel <olivier.grisel@ensta.org> # Gael Varoquaux <gael.varoquaux@inria.fr> # # License: BSD 3 clause import sys import warnings from abc import ABCMeta, abstractmethod import n...
bsd-3-clause
mikebenfield/scikit-learn
examples/semi_supervised/plot_label_propagation_digits.py
55
2723
""" =================================================== Label Propagation digits: Demonstrating performance =================================================== This example demonstrates the power of semisupervised learning by training a Label Spreading model to classify handwritten digits with sets of very few labels....
bsd-3-clause
zhenv5/scikit-learn
sklearn/cluster/tests/test_k_means.py
63
26190
"""Testing for K-means""" import sys import numpy as np from scipy import sparse as sp from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import SkipTest from sklearn.utils.testing i...
bsd-3-clause
bradmontgomery/ml
book/ch03/noise_analysis.py
24
2412
# This code is supporting material for the book # Building Machine Learning Systems with Python # by Willi Richert and Luis Pedro Coelho # published by PACKT Publishing # # It is made available under the MIT License import sklearn.datasets groups = [ 'comp.graphics', 'comp.os.ms-windows.misc', 'comp.sys.ibm.pc.ha...
mit
funbaker/astropy
astropy/visualization/tests/test_histogram.py
2
1772
# Licensed under a 3-clause BSD style license - see LICENSE.rst from numpy.testing import assert_allclose try: import matplotlib.pyplot as plt HAS_PLT = True except ImportError: HAS_PLT = False try: import scipy # noqa HAS_SCIPY = True except ImportError: HAS_SCIPY = False import pytest im...
bsd-3-clause
kalyons11/kevin
kevin/playground/gpa.py
1
2017
# Quick script to calculate GPA given a class list file. # Class list file should be a csv with COURSE_ID,NUM_UNITS,GRADE # GRADE should be LETTER with potential modifiers after that # registrar.mit.edu/classes-grades-evaluations/grades/calculating-gpa import argparse import pandas as pd def get_parser(): # Get ...
mit
evidation-health/bokeh
examples/interactions/interactive_bubble/gapminder.py
8
4161
import pandas as pd from jinja2 import Template from bokeh.browserlib import view from bokeh.models import ( ColumnDataSource, Plot, Circle, Range1d, LinearAxis, HoverTool, Text, SingleIntervalTicker, CustomJS, Slider ) from bokeh.palettes import Spectral6 from bokeh.plotting import vplot from bokeh.resou...
bsd-3-clause
sinhrks/scikit-learn
sklearn/ensemble/tests/test_base.py
284
1328
""" Testing for the base module (sklearn.ensemble.base). """ # Authors: Gilles Louppe # License: BSD 3 clause from numpy.testing import assert_equal from nose.tools import assert_true from sklearn.utils.testing import assert_raise_message from sklearn.datasets import load_iris from sklearn.ensemble import BaggingCla...
bsd-3-clause