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
CforED/Machine-Learning
sklearn/utils/tests/test_extmath.py
19
21979
# Authors: Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Denis Engemann <d.engemann@fz-juelich.de> # # License: BSD 3 clause import numpy as np from scipy import sparse from scipy import linalg from scipy import stats from sklearn.utils.testing import assert_eq...
bsd-3-clause
willettk/rgz-analysis
python/test_consensus.py
2
15556
from __future__ import division # Local RGZ modules import collinearity from load_contours import get_contours,make_pathdict # Default packages import datetime import operator from collections import Counter import cStringIO import urllib import json import os.path import time import shutil # Other packages impor...
mit
appapantula/scikit-learn
examples/applications/plot_stock_market.py
227
8284
""" ======================================= Visualizing the stock market structure ======================================= This example employs several unsupervised learning techniques to extract the stock market structure from variations in historical quotes. The quantity that we use is the daily variation in quote ...
bsd-3-clause
wzbozon/statsmodels
statsmodels/genmod/tests/test_glm.py
19
37824
""" Test functions for models.GLM """ from statsmodels.compat import range import os import numpy as np from numpy.testing import (assert_almost_equal, assert_equal, assert_raises, assert_allclose, assert_, assert_array_less, dec) from scipy import stats import statsmodels.api as sm from st...
bsd-3-clause
TNick/pylearn2
pylearn2/cross_validation/dataset_iterators.py
29
19389
""" Cross-validation dataset iterators. """ __author__ = "Steven Kearnes" __copyright__ = "Copyright 2014, Stanford University" __license__ = "3-clause BSD" import numpy as np import warnings try: from sklearn.cross_validation import (KFold, StratifiedKFold, ShuffleSplit, ...
bsd-3-clause
acapet/GHER-POSTPROC
Examples/Second.py
1
1944
import numpy as np import numpy.ma as ma from netCDF4 import Dataset #from mpl_toolkits.basemap import Basemap #from multiprocessing import Pool #import gsw ...
gpl-3.0
cauchycui/scikit-learn
sklearn/cross_decomposition/cca_.py
209
3150
from .pls_ import _PLS __all__ = ['CCA'] class CCA(_PLS): """CCA Canonical Correlation Analysis. CCA inherits from PLS with mode="B" and deflation_mode="canonical". Read more in the :ref:`User Guide <cross_decomposition>`. Parameters ---------- n_components : int, (default 2). numb...
bsd-3-clause
Obus/scikit-learn
examples/calibration/plot_calibration.py
225
4795
""" ====================================== Probability calibration of classifiers ====================================== When performing classification you often want to predict not only the class label, but also the associated probability. This probability gives you some kind of confidence on the prediction. However,...
bsd-3-clause
rousseab/pymatgen
pymatgen/analysis/diffraction/xrd.py
2
14724
# coding: utf-8 from __future__ import division, unicode_literals """ This module implements an XRD pattern calculator. """ from six.moves import filter from six.moves import map from six.moves import zip __author__ = "Shyue Ping Ong" __copyright__ = "Copyright 2012, The Materials Project" __version__ = "0.1" __mai...
mit
kiyoto/statsmodels
statsmodels/examples/l1_demo/short_demo.py
33
3737
""" You can fit your LikelihoodModel using l1 regularization by changing the method argument and adding an argument alpha. See code for details. The Story --------- The maximum likelihood (ML) solution works well when the number of data points is large and the noise is small. When the ML solution starts "bre...
bsd-3-clause
tttor/csipb-jamu-prj
predictor/connectivity/similarity/protein-kernel/gene-ontology/combine_go_sim.py
1
2248
import csv import sys import math import time import numpy as np from sklearn.preprocessing import MinMaxScaler def main(): if len(sys.argv)!=5: print "Usage: python combine_go_sim.py [BP] [MF] [CC] [Output]" CCDataDir = sys.argv[3] outDir = sys.argv[4] BPDataDir = sys.argv[1] MFDataDir = ...
mit
aliparsai/LittleDarwin
utils/HigherOrderExperiment/FormulaCalculator.py
1
3395
import math from mpl_toolkits.mplot3d import axes3d from itertools import izip import matplotlib.pyplot as plt import numpy as np def calculate_formula(m, n, t): poweroftwo = (1 - m + ((n + 1) // 2)) try: # print m,n,t top = math.factorial(t) top *= math.factorial(m) top *= m...
gpl-3.0
kjung/scikit-learn
examples/plot_kernel_approximation.py
19
8004
""" ================================================== Explicit feature map approximation for RBF kernels ================================================== An example illustrating the approximation of the feature map of an RBF kernel. .. currentmodule:: sklearn.kernel_approximation It shows how to use :class:`RBFSa...
bsd-3-clause
Obus/scikit-learn
sklearn/utils/random.py
234
10510
# Author: Hamzeh Alsalhi <ha258@cornell.edu> # # License: BSD 3 clause from __future__ import division import numpy as np import scipy.sparse as sp import operator import array from sklearn.utils import check_random_state from sklearn.utils.fixes import astype from ._random import sample_without_replacement __all__ =...
bsd-3-clause
centrofermi/e3sim
plot/plot_energy_cpu.py
1
1300
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on 21/04/2015 @author: Fabrizio Coccetti (fabrizio.coccetti@centrofermi.it) [www.fc8.net] """ import matplotlib.pyplot as plt import numpy as np import os import pkg_resources from e3sim.config.specific_machine import machine try: # For Python 3.0 and later...
gpl-3.0
MechCoder/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
suchyta1/BalrogReconstruction
functions2.py
1
15679
#!/usr/bin/env python import desdb import numpy as np import esutil import pyfits import sys import healpy as hp import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator, FormatStrFormatter #import seaborn as sns def CatMatch(c1, c2, band1, band2): radius = 1/3600.0...
mit
Tong-Chen/scikit-learn
sklearn/tests/test_common.py
1
44279
""" General tests for all estimators in sklearn. """ # Authors: Andreas Mueller <amueller@ais.uni-bonn.de> # Gael Varoquaux gael.varoquaux@normalesup.org # License: BSD 3 clause from __future__ import print_function import os import warnings import sys import traceback import inspect import pickle import pkg...
bsd-3-clause
pprett/scikit-learn
sklearn/feature_selection/tests/test_from_model.py
26
6935
import numpy as np from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_equal 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...
bsd-3-clause
jaredweiss/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/pyplot.py
69
77521
import sys import matplotlib from matplotlib import _pylab_helpers, interactive from matplotlib.cbook import dedent, silent_list, is_string_like, is_numlike from matplotlib.figure import Figure, figaspect from matplotlib.backend_bases import FigureCanvasBase from matplotlib.image import imread as _imread from matplotl...
gpl-3.0
pkruskal/scikit-learn
sklearn/datasets/tests/test_rcv1.py
322
2414
"""Test the rcv1 loader. Skipped if rcv1 is not already downloaded to data_home. """ import errno import scipy.sparse as sp import numpy as np from sklearn.datasets import fetch_rcv1 from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing i...
bsd-3-clause
fredhusser/scikit-learn
examples/covariance/plot_robust_vs_empirical_covariance.py
248
6359
r""" ======================================= Robust vs Empirical covariance estimate ======================================= The usual covariance maximum likelihood estimate is very sensitive to the presence of outliers in the data set. In such a case, it would be better to use a robust estimator of covariance to guar...
bsd-3-clause
allenlavoie/tensorflow
tensorflow/examples/learn/boston.py
75
2549
# 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
xwolf12/scikit-learn
examples/linear_model/plot_ols_3d.py
350
2040
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Sparsity Example: Fitting only features 1 and 2 ========================================================= Features 1 and 2 of the diabetes-dataset are fitted and plotted below. It illustrates that although feature...
bsd-3-clause
mclaughlin6464/pylearn2
pylearn2/training_algorithms/sgd.py
1
48347
""" Stochastic Gradient Descent and related functionality such as learning rate adaptation, momentum, and Polyak averaging. """ from __future__ import division __authors__ = "Ian Goodfellow" __copyright__ = "Copyright 2010-2012, Universite de Montreal" __credits__ = ["Ian Goodfellow, David Warde-Farley"] __license__ =...
bsd-3-clause
jmmease/pandas
pandas/tests/frame/test_block_internals.py
3
20693
# -*- coding: utf-8 -*- from __future__ import print_function import pytest from datetime import datetime, timedelta import itertools from numpy import nan import numpy as np from pandas import (DataFrame, Series, Timestamp, date_range, compat, option_context) from pandas.compat import StringIO...
bsd-3-clause
vibhorag/scikit-learn
sklearn/metrics/regression.py
175
16953
"""Metrics to assess performance on regression task Functions named as ``*_score`` return a scalar value to maximize: the higher the better Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize: the lower the better """ # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Ma...
bsd-3-clause
DGrady/pandas
pandas/tests/dtypes/test_dtypes.py
10
18488
# -*- coding: utf-8 -*- import pytest from itertools import product import numpy as np import pandas as pd from pandas import Series, Categorical, IntervalIndex, date_range from pandas.core.dtypes.dtypes import ( DatetimeTZDtype, PeriodDtype, IntervalDtype, CategoricalDtype) from pandas.core.dtypes.common im...
bsd-3-clause
stczhc/neupy
examples/gd/rectangles_mlp.py
1
1025
from sklearn import cross_validation, metrics from skdata.larochelle_etal_2007 import dataset from neupy import algorithms, layers, environment environment.reproducible() rectangle_dataset = dataset.Rectangles() rectangle_dataset.fetch(download_if_missing=True) data, target = rectangle_dataset.classification_task()...
mit
rs2/pandas
pandas/tests/generic/test_frame.py
2
7703
from copy import deepcopy from operator import methodcaller import numpy as np import pytest import pandas as pd from pandas import DataFrame, MultiIndex, Series, date_range import pandas._testing as tm from .test_generic import Generic class TestDataFrame(Generic): _typ = DataFrame _comparator = lambda se...
bsd-3-clause
reminisce/mxnet
example/speech_recognition/stt_utils.py
8
5838
# 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 u...
apache-2.0
yanikou19/pymatgen
pymatgen/analysis/pourbaix/plotter.py
4
24049
# coding: utf-8 from __future__ import division, unicode_literals """ This module provides classes for plotting Pourbaix objects. """ import six from six.moves import map from six.moves import zip __author__ = "Sai Jayaraman" __copyright__ = "Copyright 2011, The Materials Project" __version__ = "1.1" __maintainer__...
mit
valexandersaulys/prudential_insurance_kaggle
venv/lib/python2.7/site-packages/pandas/tests/test_series.py
9
288883
# coding=utf-8 # pylint: disable-msg=E1101,W0612 import re import sys from datetime import datetime, timedelta import operator import string from inspect import getargspec from itertools import product, starmap from distutils.version import LooseVersion import warnings import random import nose from numpy import nan...
gpl-2.0
alphaBenj/zipline
zipline/utils/security_list.py
6
5399
import warnings from datetime import datetime from os import listdir import os.path import pandas as pd import pytz import zipline from zipline.errors import SymbolNotFound from zipline.finance.asset_restrictions import SecurityListRestrictions from zipline.zipline_warnings import ZiplineDeprecationWarning DATE_FOR...
apache-2.0
psathyrella/partis
test/cf-tree-metrics.py
1
70896
#!/usr/bin/env python import argparse import operator import os import sys import yaml import json import colored_traceback.always import collections import numpy import math import subprocess import multiprocessing # ---------------------------------------------------------------------------------------- linestyles =...
gpl-3.0
flightgong/scikit-learn
sklearn/linear_model/tests/test_base.py
8
10058
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # # License: BSD 3 clause import numpy as np from scipy import sparse from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.linear_model....
bsd-3-clause
glos/glos-qartod
glos_qartod/run.py
1
4052
import os import sys import glob import pandas as pd from redis import Redis from rq import Queue from netCDF4 import Dataset from glos_qartod import cli from glos_qartod import get_logger def main(): q = Queue(connection=Redis()) conf_file, proc_dir = sys.argv[1:3] sheets = pd.read_excel(conf_file, None)...
apache-2.0
walterst/qiime
scripts/print_qiime_config.py
15
35150
#!/usr/bin/env python from __future__ import division __author__ = "Jens Reeder" __copyright__ = "Copyright 2011, The QIIME Project" __credits__ = ["Jens Reeder", "Dan Knights", "Antonio Gonzalez Pena", "Justin Kuczynski", "Jai Ram Rideout", "Greg Caporaso", "Emily TerAvest"] __license__ ...
gpl-2.0
anirudhjayaraman/scikit-learn
sklearn/ensemble/voting_classifier.py
178
8006
""" Soft Voting/Majority Rule classifier. This module contains a Soft Voting/Majority Rule classifier for classification estimators. """ # Authors: Sebastian Raschka <se.raschka@gmail.com>, # Gilles Louppe <g.louppe@gmail.com> # # Licence: BSD 3 clause import numpy as np from ..base import BaseEstimator f...
bsd-3-clause
mblondel/scikit-learn
examples/cluster/plot_affinity_propagation.py
349
2304
""" ================================================= Demo of affinity propagation clustering algorithm ================================================= Reference: Brendan J. Frey and Delbert Dueck, "Clustering by Passing Messages Between Data Points", Science Feb. 2007 """ print(__doc__) from sklearn.cluster impor...
bsd-3-clause
leogulus/pisco_pipeline
run_rgb_pisco.py
1
6622
import os import subprocess import shlex import sys import pandas as pd import numpy as np import matplotlib.pyplot as plt from astropy.io import fits from astropy.cosmology import Planck15 as cosmo from astropy.visualization import make_lupton_rgb import aplpy def list_file_name(dir, name, end=0): """ lis...
mit
manahl/arctic
tests/unit/serialization/test_incremental.py
1
6189
import itertools import pytest from arctic.exceptions import ArcticSerializationException from arctic.serialization.incremental import IncrementalPandasToRecArraySerializer from arctic.serialization.numpy_records import DataFrameSerializer from tests.unit.serialization.serialization_test_data import _mixed_test_data,...
lgpl-2.1
masa-ito/ProtoToMET
src/test/benchmarkPlot.py
1
1992
import numpy as np import matplotlib.pyplot as plt # Create a figure of size 8x6 inches, 80 dots per inch plt.figure(figsize=(8, 6), dpi=80) # Create a new subplot from a grid of 1x1 plt.subplot(1, 1, 1) threadNums = [ 1, 2, 4, 8, 12, 16, 20, 24]; # elasped time (milisecond) for conj...
lgpl-3.0
Averroes/statsmodels
statsmodels/tools/print_version.py
23
7951
#!/usr/bin/env python from __future__ import print_function from statsmodels.compat.python import reduce import sys from os.path import dirname def safe_version(module, attr='__version__'): if not isinstance(attr, list): attr = [attr] try: return reduce(getattr, [module] + attr) except Att...
bsd-3-clause
woozzu/tf_tutorials
01_linear_regression_starter.py
1
1652
""" Simple linear regression example in TensorFlow This program tries to predict the number of thefts from the number of fire in the city of Chicago """ import numpy as np import matplotlib.pyplot as plt import tensorflow as tf import csv DATA_FILE = 'data/fire_theft.csv' # Step 1: read data with open(DATA_FILE, 'r...
mit
michigraber/scikit-learn
sklearn/neighbors/tests/test_nearest_centroid.py
305
4121
""" Testing for the nearest centroid module. """ import numpy as np from scipy import sparse as sp from numpy.testing import assert_array_equal from numpy.testing import assert_equal from sklearn.neighbors import NearestCentroid from sklearn import datasets from sklearn.metrics.pairwise import pairwise_distances # t...
bsd-3-clause
kiyoto/statsmodels
tools/code_maintenance.py
37
2307
""" Code maintenance script modified from PyMC """ #!/usr/bin/env python import sys import os # This is a function, not a test case, because it has to be run from inside # the source tree to work well. mod_strs = ['IPython', 'pylab', 'matplotlib', 'scipy','Pdb'] dep_files = {} for mod_str in mod_strs: dep_files...
bsd-3-clause
etkirsch/scikit-learn
examples/applications/plot_prediction_latency.py
234
11277
""" ================== Prediction Latency ================== This is an example showing the prediction latency of various scikit-learn estimators. The goal is to measure the latency one can expect when doing predictions either in bulk or atomic (i.e. one by one) mode. The plots represent the distribution of the pred...
bsd-3-clause
xubenben/scikit-learn
examples/classification/plot_classification_probability.py
242
2624
""" =============================== Plot classification probability =============================== Plot the classification probability for different classifiers. We use a 3 class dataset, and we classify it with a Support Vector classifier, L1 and L2 penalized logistic regression with either a One-Vs-Rest or multinom...
bsd-3-clause
wangwei7175878/tutorials
matplotlibTUT/plt19_animation.py
3
1573
# View more python tutorials on my Youtube and Youku channel!!! # Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg # Youku video tutorial: http://i.youku.com/pythontutorial # 19 - animation """ Please note, this script is for python3+. If you are using python2+, please modify it accord...
mit
mbayon/TFG-MachineLearning
vbig/lib/python2.7/site-packages/sklearn/semi_supervised/label_propagation.py
12
18811
# coding=utf8 """ Label propagation in the context of this module refers to a set of semi-supervised classification algorithms. At a high level, these algorithms work by forming a fully-connected graph between all points given and solving for the steady-state distribution of labels at each point. These algorithms perf...
mit
vermouthmjl/scikit-learn
examples/plot_isotonic_regression.py
303
1767
""" =================== Isotonic Regression =================== An illustration of the isotonic regression on generated data. The isotonic regression finds a non-decreasing approximation of a function while minimizing the mean squared error on the training data. The benefit of such a model is that it does not assume a...
bsd-3-clause
jseabold/scikit-learn
sklearn/tests/test_kernel_ridge.py
342
3027
import numpy as np import scipy.sparse as sp from sklearn.datasets import make_regression from sklearn.linear_model import Ridge from sklearn.kernel_ridge import KernelRidge from sklearn.metrics.pairwise import pairwise_kernels from sklearn.utils.testing import ignore_warnings from sklearn.utils.testing import assert...
bsd-3-clause
bhargav/scikit-learn
examples/linear_model/plot_huber_vs_ridge.py
127
2206
""" ======================================================= HuberRegressor vs Ridge on dataset with strong outliers ======================================================= Fit Ridge and HuberRegressor on a dataset with outliers. The example shows that the predictions in ridge are strongly influenced by the outliers p...
bsd-3-clause
jblackburne/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
ChanderG/scikit-learn
sklearn/utils/graph.py
289
6239
""" Graph utilities and algorithms Graphs are represented with their adjacency matrices, preferably using sparse matrices. """ # Authors: Aric Hagberg <hagberg@lanl.gov> # Gael Varoquaux <gael.varoquaux@normalesup.org> # Jake Vanderplas <vanderplas@astro.washington.edu> # License: BSD 3 clause impo...
bsd-3-clause
franzpl/sweep
log_sweep_kaiser_window_script2/log_sweep_kaiser_window_script2.py
2
2113
#!/usr/bin/env python3 """The influence of windowing of log. sweep signals when using a Kaiser Window by fixing beta (=7) and fade_in (=0). fstart = 1 Hz fstop = 22050 Hz """ import sys sys.path.append('..') import measurement_chain import plotting import calculation import generation import matplotlib.py...
mit
cmdunkers/DeeperMind
PythonEnv/lib/python2.7/site-packages/scipy/stats/_distn_infrastructure.py
3
112844
# # Author: Travis Oliphant 2002-2011 with contributions from # SciPy Developers 2004-2011 # from __future__ import division, print_function, absolute_import from scipy._lib.six import string_types, exec_ from scipy._lib._util import getargspec_no_self as _getargspec import sys import keyword import re imp...
bsd-3-clause
wkfwkf/statsmodels
statsmodels/regression/tests/test_regression.py
6
37622
""" Test functions for models.regression """ # TODO: Test for LM from statsmodels.compat.python import long, lrange import warnings import pandas import numpy as np from numpy.testing import (assert_almost_equal, assert_approx_equal, assert_raises, assert_equal, assert_allclose) from scipy.l...
bsd-3-clause
leighpauls/k2cro4
native_client/build/buildbot_chrome_nacl_stage.py
1
11521
#!/usr/bin/python # Copyright (c) 2012 The Native Client Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Do all the steps required to build and test against nacl.""" import optparse import os.path import re import shutil import su...
bsd-3-clause
mrjacobagilbert/gnuradio
gr-filter/examples/reconstruction.py
5
4279
#!/usr/bin/env python # # Copyright 2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # # SPDX-License-Identifier: GPL-3.0-or-later # # from gnuradio import gr, digital from gnuradio import filter from gnuradio import blocks from gnuradio.fft import window import sys import numpy try: ...
gpl-3.0
mkness/TheCannon
code/makeplot_test.py
1
3991
#!/usr/bin/python import scipy import numpy from numpy import * from scipy import ndimage from scipy import interpolate from numpy import loadtxt import os import numpy as np from numpy import * from matplotlib import pyplot import matplotlib.pyplot as plt from matplotlib.pyplot import axes from matplotlib.pyplo...
mit
dkasak/pacal
pacal/depvars/copulas.py
1
35176
"""Set of copulas different types""" from pacal.integration import * from pacal.interpolation import * from matplotlib.collections import PolyCollection import pacal.distr #from pacal import * from pacal.segments import PiecewiseDistribution, MInfSegment, PInfSegment, Segment, _segint from pacal.segments imp...
gpl-3.0
dsm054/pandas
pandas/core/strings.py
1
100158
# -*- coding: utf-8 -*- import numpy as np from pandas.compat import zip from pandas.core.dtypes.generic import ABCSeries, ABCIndex from pandas.core.dtypes.missing import isna from pandas.core.dtypes.common import ( ensure_object, is_bool_dtype, is_categorical_dtype, is_object_dtype, is_string_like...
bsd-3-clause
wy36101299/NCKU_Machine-Learning-and-Bioinformatics
hw4_predictData/creatPredictdata.py
1
2986
import glob import os import pandas as pd class CTD(object): """docstring for CTD""" def __init__(self): self.format_l = [] self.td_l = [] self.iternum = 0 self.formatname = "" def feature(self,index): format_l = self.format_l feature = ((float(format_l[inde...
mit
mumuwoyou/vnpy-master
vnpy/trader/gateway/tkproGateway/DataApi/data_api.py
4
18709
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from builtins import * import time import numpy as np from . import jrpc_py # import jrpc from . import utils # def set_log_dir(log_dir): # if log_dir: # jr...
mit
AlexGrig/GPy
GPy/core/parameterization/transformations.py
10
20673
# Copyright (c) 2012, GPy authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) import numpy as np from .domains import _POSITIVE,_NEGATIVE, _BOUNDED import weakref import sys _exp_lim_val = np.finfo(np.float64).max _lim_val = 36.0 epsilon = np.finfo(np.float64).resolution #=======...
bsd-3-clause
tawsifkhan/scikit-learn
sklearn/cluster/setup.py
263
1449
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD 3 clause 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 cblas_libs, blas_info = ...
bsd-3-clause
voxlol/scikit-learn
sklearn/neighbors/tests/test_dist_metrics.py
230
5234
import itertools import pickle import numpy as np from numpy.testing import assert_array_almost_equal import scipy from scipy.spatial.distance import cdist from sklearn.neighbors.dist_metrics import DistanceMetric from nose import SkipTest def dist_func(x1, x2, p): return np.sum((x1 - x2) ** p) ** (1. / p) de...
bsd-3-clause
anirudhjayaraman/Dato-Core
src/unity/python/graphlab/test/test_sarray.py
13
60654
# -*- coding: utf-8 -*- ''' Copyright (C) 2015 Dato, Inc. All rights reserved. This software may be modified and distributed under the terms of the BSD license. See the DATO-PYTHON-LICENSE file for details. ''' from graphlab.data_structures.sarray import SArray from graphlab_util.timezone import GMT import pandas as p...
agpl-3.0
mhue/scikit-learn
examples/cluster/plot_agglomerative_clustering.py
343
2931
""" Agglomerative clustering with and without structure =================================================== This example shows the effect of imposing a connectivity graph to capture local structure in the data. The graph is simply the graph of 20 nearest neighbors. Two consequences of imposing a connectivity can be s...
bsd-3-clause
JetBrains/intellij-community
python/helpers/pydev/pydev_ipython/inputhook.py
21
19415
# coding: utf-8 """ Inputhook management for GUI event loop integration. """ #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distribu...
apache-2.0
rafael-radkowski/ME325
ME325Common/InputHelpers.py
1
2465
import platform import matplotlib if platform.system() == 'Darwin': matplotlib.use("TkAgg") from matplotlib import pyplot as plt from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg from matplotlib.patches import Circle, Arc # tkinter for the display from tkinter import * from tkinter import Canvas fro...
mit
MdAsifKhan/DNGR-Keras
example.py
1
1675
import pandas as pd from sklearn.metrics.pairwise import cosine_similarity import networkx as nx from sklearn.cluster import KMeans import matplotlib.colors as colors from itertools import cycle import time import matplotlib.pyplot as plt import subprocess from utils import tsne import pdb import numpy as np from sklea...
mit
zbanga/trading-with-python
lib/interactiveBrokers/histData.py
76
6472
''' Created on May 8, 2013 Copyright: Jev Kuznetsov License: BSD Module for downloading historic data from IB ''' import ib import pandas as pd from ib.ext.Contract import Contract from ib.opt import ibConnection, message import logger as logger from pandas import DataFrame, Index import os imp...
bsd-3-clause
niamoto/niamoto-core
niamoto/data_providers/plantnote_provider/plantnote_plot_occurrence_provider.py
2
1454
# coding: utf-8 from sqlalchemy import * import pandas as pd from niamoto.data_providers.base_plot_occurrence_provider import \ BasePlotOccurrenceProvider class PlantnotePlotOccurrenceProvider(BasePlotOccurrenceProvider): """ Pl@ntnote Plot-Occurrence provider. """ def __init__(self, data_provi...
gpl-3.0
jreback/pandas
pandas/tests/series/methods/test_argsort.py
3
2248
import numpy as np import pytest from pandas import Series, Timestamp, isna import pandas._testing as tm class TestSeriesArgsort: def _check_accum_op(self, name, ser, check_dtype=True): func = getattr(np, name) tm.assert_numpy_array_equal( func(ser).values, func(np.array(ser)), check_...
bsd-3-clause
agiovann/Constrained_NMF
use_cases/CaImAnpaper/train_net_cifar_SNIPER.py
2
10134
#!/usr/bin/env python """ Created on Thu Aug 24 12:30:19 2017 @author: agiovann """ '''From keras example of convnet on the MNIST dataset. TRAIN ON DATA EXTRACTED FROM RESIDUALS WITH generate_GT script ''' #%% import cv2 import glob try: cv2.setNumThreads(1) except: print('Open CV is naturally single threa...
gpl-2.0
isrohutamahopetechnik/MissionPlanner
Lib/site-packages/scipy/signal/filter_design.py
53
63381
"""Filter design. """ import types import warnings import numpy from numpy import atleast_1d, poly, polyval, roots, real, asarray, allclose, \ resize, pi, absolute, logspace, r_, sqrt, tan, log10, arctan, arcsinh, \ cos, exp, cosh, arccosh, ceil, conjugate, zeros, sinh from numpy import mintypecode from scipy...
gpl-3.0
glenioborges/ibis
ibis/util.py
6
3963
# Copyright 2014 Cloudera Inc. # # 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, so...
apache-2.0
rohanp/scikit-learn
sklearn/metrics/regression.py
5
17399
"""Metrics to assess performance on regression task Functions named as ``*_score`` return a scalar value to maximize: the higher the better Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize: the lower the better """ # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Ma...
bsd-3-clause
duthchao/kaggle-galaxies
try_convnet_cc_multirotflip_3x69r45_maxout2048_extradense_dup3.py
7
17439
import numpy as np # import pandas as pd import theano import theano.tensor as T import layers import cc_layers import custom import load_data import realtime_augmentation as ra import time import csv import os import cPickle as pickle from datetime import datetime, timedelta # import matplotlib.pyplot as plt # plt.i...
bsd-3-clause
nitishkd/Customer-Prediction
graph.py
1
1975
import numpy as np; import matplotlib.pyplot as plt from sklearn import svm dset_file = open("extradata.txt"); ##print(dset_file.readline()) row = 0; col = 0; dset = [] for info in dset_file.readlines(): col = 0; s = info.strip() sa = s.split("(") sb = sa[1].split(")") k = sb[0].split(",") lst...
mit
pdamodaran/yellowbrick
tests/test_meta.py
1
5443
# tests.test_meta # Meta testing for testing helper functions! # # Author: Benjamin Bengfort <benjamin@bengfort.com> # Created: Sat Apr 07 13:16:53 2018 -0400 # # ID: test_meta.py [] benjamin@bengfort.com $ """ Meta testing for testing helper functions! """ ###########################################################...
apache-2.0
benschneider/sideprojects1
Shotnoise-Calibration/SNfit1.py
1
19844
# -*- coding: utf-8 -*- ''' @author: Ben Schneider A script is used to readout mtx measurement data which also contains a shotnoise responses. Then fits them for G and Tn ''' import numpy as np from parsers import savemtx, loadmtx, make_header, read_header # from scipy.optimize import curve_fit # , leastsq from scipy....
gpl-2.0
Erotemic/ibeis
ibeis/expt/test_result.py
1
108427
# -*- coding: utf-8 -*- # TODO: find unused functions and kill them from __future__ import absolute_import, division, print_function, unicode_literals import six import copy import operator import utool as ut import vtool_ibeis as vt import numpy as np import itertools as it from functools import partial from six impor...
apache-2.0
michigraber/scikit-learn
benchmarks/bench_plot_approximate_neighbors.py
85
6377
""" Benchmark for approximate nearest neighbor search using locality sensitive hashing forest. There are two types of benchmarks. First, accuracy of LSHForest queries are measured for various hyper-parameters and index sizes. Second, speed up of LSHForest queries compared to brute force method in exact nearest neigh...
bsd-3-clause
meduz/scikit-learn
sklearn/svm/tests/test_sparse.py
63
13366
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_classification, load_digits, make_blobs from sklearn.svm.tests import te...
bsd-3-clause
eclee25/flu-SDI-exploratory-age
scripts/create_fluseverity_figs_v4/functions_v4.py
1
67932
#!/usr/bin/python ############################################## ###Python template ###Author: Elizabeth Lee ###Date: 10/19/14 ## Purpose: script of functions for data cleaning and processing to draw flu severity figures; supports figures in create_fluseverity_figs ## v2: swap child:adult OR to adult:child OR ## v3: ...
mit
slowvak/MachineLearningForMedicalImages
code/Module3.py
1
11790
# coding: utf-8 # # Supervised Classification: SVM # # ## Import Libraries # In[13]: get_ipython().magic('matplotlib inline') import warnings warnings.filterwarnings('ignore') import os import numpy as np import matplotlib.pyplot as plt from sklearn import svm import pandas as pd from matplotlib.colors import Li...
mit
rhattersley/iris
docs/iris/example_code/General/projections_and_annotations.py
6
5396
""" Plotting in different projections ================================= This example shows how to overlay data and graphics in different projections, demonstrating various features of Iris, Cartopy and matplotlib. We wish to overlay two datasets, defined on different rotated-pole grids. To display both together, we m...
lgpl-3.0
ryfeus/lambda-packs
Sklearn_scipy_numpy/source/sklearn/feature_selection/variance_threshold.py
238
2594
# Author: Lars Buitinck <L.J.Buitinck@uva.nl> # License: 3-clause BSD import numpy as np from ..base import BaseEstimator from .base import SelectorMixin from ..utils import check_array from ..utils.sparsefuncs import mean_variance_axis from ..utils.validation import check_is_fitted class VarianceThreshold(BaseEstim...
mit
gengliangwang/spark
python/pyspark/pandas/data_type_ops/categorical_ops.py
1
1062
# # 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
stylianos-kampakis/scikit-learn
benchmarks/bench_mnist.py
76
6136
""" ======================= MNIST dataset benchmark ======================= Benchmark on the MNIST dataset. The dataset comprises 70,000 samples and 784 features. Here, we consider the task of predicting 10 classes - digits from 0 to 9 from their raw images. By contrast to the covertype dataset, the feature space is...
bsd-3-clause
stitchfix/pyxley
tests/app/components/plotly.py
1
1349
from pyxley.charts.plotly import PlotlyAPI from pyxley.filters import SelectButton from pyxley import UILayout import pandas as pd from flask import jsonify, request def make_plotly_ui(): filename = "../examples/metricsgraphics/project/fitbit_data.csv" df = pd.read_csv(filename) # Make a UI ui = UIL...
mit
ephes/scikit-learn
sklearn/metrics/setup.py
299
1024
import os import os.path import numpy from numpy.distutils.misc_util import Configuration from sklearn._build_utils import get_blas_info def configuration(parent_package="", top_path=None): config = Configuration("metrics", parent_package, top_path) cblas_libs, blas_info = get_blas_info() if os.name ==...
bsd-3-clause
dieterich-lab/riboseq-utils
riboutils/extract_metagene_profiles.py
1
10027
#! /usr/bin/env python3 import argparse import collections import numpy as np import pandas as pd import sys import bio_utils.bam_utils as bam_utils import bio_utils.bed_utils as bed_utils import misc.utils as utils import misc.pandas_utils as pandas_utils import logging import misc.logging_utils as logging_utils lo...
mit
vmAggies/omniture-master
tests/testReports.py
1
7658
#!/usr/bin/python import unittest import omniture import os from datetime import date import pandas import datetime import requests_mock creds = {} creds['username'] = os.environ['OMNITURE_USERNAME'] creds['secret'] = os.environ['OMNITURE_SECRET'] test_report_suite = 'omniture.api-gateway' class ReportTest(unittes...
mit
CrazyGuo/vincent
examples/bar_chart_examples.py
11
2026
# -*- coding: utf-8 -*- """ Vincent Bar Chart Example """ #Build a Bar Chart from scratch from vincent import * import pandas as pd farm_1 = {'apples': 10, 'berries': 32, 'squash': 21, 'melons': 13, 'corn': 18} farm_2 = {'apples': 15, 'berries': 43, 'squash': 17, 'melons': 10, 'corn': 22} farm_3 = {'apples': 6, 'b...
mit
djfan/why_yellow_taxi
Sjoin/Sjoin_Pyspark_1.py
1
3068
import pyproj import csv import shapely.geometry as geom import fiona import fiona.crs import shapely import rtree import geopandas as gpd import numpy as np import operator import pandas as pd def countLine(partID, records): import pyproj import csv import shapely.geometry as geom import fiona imp...
mit