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
lpeska/BRDTI
cmf.py
1
4613
''' We base the CMF implementation on the one from PyDTI project, https://github.com/stephenliu0423/PyDTI, changes were made to the evaluation procedure [1] X. Zheng, H. Ding, H. Mamitsuka, and S. Zhu, "Collaborative matrix factorization with multiple similarities for predicting drug-target interaction", KDD, 2013. ...
gpl-2.0
jniediek/mne-python
mne/tests/test_label.py
3
33801
import os import os.path as op import shutil import glob import warnings import numpy as np from scipy import sparse from numpy.testing import assert_array_equal, assert_array_almost_equal from nose.tools import assert_equal, assert_true, assert_false, assert_raises from mne.datasets import testing from mne import (...
bsd-3-clause
thilbern/scikit-learn
sklearn/metrics/tests/test_common.py
2
42318
from __future__ import division, print_function from functools import partial from itertools import product import numpy as np import scipy.sparse as sp from sklearn.datasets import make_multilabel_classification from sklearn.preprocessing import LabelBinarizer, MultiLabelBinarizer from sklearn.utils.multiclass impo...
bsd-3-clause
shangwuhencc/scikit-learn
sklearn/gaussian_process/tests/test_gaussian_process.py
267
6813
""" Testing for Gaussian Process module (sklearn.gaussian_process) """ # Author: Vincent Dubourg <vincent.dubourg@gmail.com> # Licence: BSD 3 clause from nose.tools import raises from nose.tools import assert_true import numpy as np from sklearn.gaussian_process import GaussianProcess from sklearn.gaussian_process ...
bsd-3-clause
metpy/MetPy
examples/meteogram_metpy.py
6
8767
# Copyright (c) 2017 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """ Meteogram ========= Plots time series data as a meteogram. """ import datetime as dt import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np from metpy.ca...
bsd-3-clause
WillieMaddox/numpy
numpy/core/function_base.py
7
6565
from __future__ import division, absolute_import, print_function __all__ = ['logspace', 'linspace'] from . import numeric as _nx from .numeric import result_type, NaN, shares_memory, MAY_SHARE_BOUNDS, TooHardError def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None): """ Return evenly...
bsd-3-clause
totalgood/nlpia
src/nlpia/mavis_greetings.py
1
1246
#!/usr/bin/env python # -*- coding: utf-8 -*- """Constants and discovered values, like path to current installation of pug-nlp.""" # -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals, division, absolute_import from builtins import (bytes, dict, int, list, object, range, str, # noqa asci...
mit
DSLituiev/scikit-learn
sklearn/neighbors/graph.py
14
6609
"""Nearest Neighbors graph functions""" # Author: Jake Vanderplas <vanderplas@astro.washington.edu> # # License: BSD 3 clause (C) INRIA, University of Amsterdam import warnings from .base import KNeighborsMixin, RadiusNeighborsMixin from .unsupervised import NearestNeighbors def _check_params(X, metric, p, metric_...
bsd-3-clause
wwf5067/statsmodels
statsmodels/examples/tsa/ex_arma_all.py
34
1982
from __future__ import print_function import numpy as np from numpy.testing import assert_almost_equal import matplotlib.pyplot as plt import statsmodels.sandbox.tsa.fftarma as fa from statsmodels.tsa.descriptivestats import TsaDescriptive from statsmodels.tsa.arma_mle import Arma x = fa.ArmaFft([1, -0.5], [1., 0.4]...
bsd-3-clause
abhijeetmote/python_stuff
to_csv.py
1
1381
import xml.etree.ElementTree as ET import os import sys import fnmatch import csv import pdb import glob import tempfile import shutil import gzip import datetime import tarfile import time import pandas as pd import pdb file_name = "/home/abhijeet/test/file.xml" output = "/home/abhijeet/test/file.csv" #Handeling unpar...
gpl-3.0
hitszxp/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
gergopokol/renate-od
visualization/profiles.py
1
9125
import matplotlib.pyplot import utility from matplotlib.backends.backend_pdf import PdfPages import datetime from crm_solver.atomic_db import RenateDB class BeamletProfiles: def __init__(self, param_path='output/beamlet/beamlet_test.xml', key=['profiles']): self.param_path = param_path self.param ...
lgpl-3.0
anve8004/trading-with-python
lib/cboe.py
76
4433
# -*- coding: utf-8 -*- """ toolset working with cboe data @author: Jev Kuznetsov Licence: BSD """ from datetime import datetime, date import urllib2 from pandas import DataFrame, Index from pandas.core import datetools import numpy as np import pandas as pd def monthCode(month): """ perfo...
bsd-3-clause
fberanizo/sin5006
tests/optimization/utils.py
1
2030
# -*- coding: utf-8 -*- import numpy, matplotlib.pyplot, pandas, seaborn def plot(execution_info, title='', description=''): for generation_info in execution_info: x = numpy.arange(1, len(generation_info)+1) max = numpy.asarray(map(lambda individual: individual["max"], generation_info)) a...
bsd-2-clause
MrNuggelz/sklearn-glvq
sklearn_lvq/tests/test_glvq.py
1
10494
import numpy as np from .. import GlvqModel from .. import GrlvqModel from .. import GmlvqModel from .. import GrmlvqModel from .. import LgmlvqModel from sklearn.utils.testing import assert_greater, assert_raise_message, \ assert_allclose from sklearn import datasets from sklearn.utils import check_random_state ...
bsd-3-clause
manashmndl/scikit-learn
sklearn/neighbors/graph.py
208
7031
"""Nearest Neighbors graph functions""" # Author: Jake Vanderplas <vanderplas@astro.washington.edu> # # License: BSD 3 clause (C) INRIA, University of Amsterdam import warnings from .base import KNeighborsMixin, RadiusNeighborsMixin from .unsupervised import NearestNeighbors def _check_params(X, metric, p, metric_...
bsd-3-clause
zymsys/sms-tools
lectures/07-Sinusoidal-plus-residual-model/plots-code/hprModelFrame.py
22
2847
import numpy as np import matplotlib.pyplot as plt from scipy.signal import hamming, triang, blackmanharris import math from scipy.fftpack import fft, ifft, fftshift import sys, os, functools, time sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/')) import dftModel a...
agpl-3.0
robin-lai/scikit-learn
examples/decomposition/plot_pca_vs_fa_model_selection.py
142
4467
""" =============================================================== Model selection with Probabilistic PCA and Factor Analysis (FA) =============================================================== Probabilistic PCA and Factor Analysis are probabilistic models. The consequence is that the likelihood of new data can be u...
bsd-3-clause
voxlol/scikit-learn
benchmarks/bench_tree.py
297
3617
""" To run this, you'll need to have installed. * scikit-learn Does two benchmarks First, we fix a training set, increase the number of samples to classify and plot number of classified samples as a function of time. In the second benchmark, we increase the number of dimensions of the training set, classify a sam...
bsd-3-clause
Winand/pandas
pandas/tests/scalar/test_period_asfreq.py
15
35624
import pandas as pd from pandas import Period, offsets from pandas.util import testing as tm from pandas.tseries.frequencies import _period_code_map class TestFreqConversion(object): """Test frequency conversion of date objects""" def test_asfreq_corner(self): val = Period(freq='A', year=2007) ...
bsd-3-clause
larsmans/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
jerome-nexedi/pulp-or
doc/source/_static/plotter.py
4
1267
#!/usr/bin/env python # -*- encoding: utf-8 -*- from matplotlib import rc rc('text', usetex=True) rc('font', family='serif') def plot_interval(a,c,x_left, x_right,i, fbound): lh = c*(1-a[0]) rh = c*(1+a[1]) x=arange(x_left, x_right+1) y=0*x arrow_r = Arrow(c,0, c*a[1],0,0.2) arrow_l = Arrow(...
mit
rgommers/statsmodels
statsmodels/miscmodels/try_mlecov.py
33
7414
'''Multivariate Normal Model with full covariance matrix toeplitz structure is not exploited, need cholesky or inv for toeplitz Author: josef-pktd ''' from __future__ import print_function import numpy as np #from scipy import special #, stats from scipy import linalg from scipy.linalg import norm, toeplitz import ...
bsd-3-clause
pmelchior/shear-stacking-tests
run_quadrant_check.py
2
6519
#!/bin/env python import json, errno import healpy as hp import healpix_util as hu import numpy as np from sys import argv from shear_stacking import * def makeDensityMap(outfile, config, shapes, nside=512): ipix = hp.ang2pix(nside, (90-shapes[config['shape_dec_key']])/180*np.pi, shapes[config['shape_ra_key']]/18...
mit
infoelliex/addons-yelizariev
import_custom/import_custom.py
16
10226
# -*- coding: utf-8 -*- import logging import os _logger = logging.getLogger(__name__) try: import MySQLdb import MySQLdb.cursors except ImportError: pass from openerp.addons.import_framework.import_base import import_base try: from pandas import merge, DataFrame except ImportError: pass from ope...
lgpl-3.0
plissonf/scikit-learn
sklearn/decomposition/dict_learning.py
104
44632
""" Dictionary learning """ from __future__ import print_function # Author: Vlad Niculae, Gael Varoquaux, Alexandre Gramfort # License: BSD 3 clause import time import sys import itertools from math import sqrt, ceil import numpy as np from scipy import linalg from numpy.lib.stride_tricks import as_strided from ..b...
bsd-3-clause
jaeilepp/mne-python
mne/viz/tests/test_utils.py
3
4893
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: Simplified BSD import os.path as op import warnings import numpy as np from nose.tools import assert_true, assert_raises from numpy.testing import assert_allclose from mne.viz.utils import (compare_fiff, _fake_click, _compute_scaling...
bsd-3-clause
cybernet14/scikit-learn
sklearn/utils/multiclass.py
45
12390
# 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
cython-testbed/pandas
pandas/io/formats/console.py
3
4533
""" Internal module for console introspection """ import sys import locale from pandas.io.formats.terminal import get_terminal_size # ----------------------------------------------------------------------------- # Global formatting options _initial_defencoding = None def detect_console_encoding(): """ Try t...
bsd-3-clause
robin-lai/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
adammenges/statsmodels
statsmodels/sandbox/examples/thirdparty/ex_ratereturn.py
33
4394
# -*- coding: utf-8 -*- """Playing with correlation of DJ-30 stock returns this uses pickled data that needs to be created with findow.py to see graphs, uncomment plt.show() Created on Sat Jan 30 16:30:18 2010 Author: josef-pktd """ import numpy as np import matplotlib.finance as fin import matplotlib.pyplot as plt...
bsd-3-clause
lazywei/scikit-learn
sklearn/linear_model/tests/test_ridge.py
130
22974
import numpy as np import scipy.sparse as sp from scipy import linalg from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_a...
bsd-3-clause
fyffyt/scikit-learn
sklearn/gaussian_process/gaussian_process.py
78
34552
# -*- coding: utf-8 -*- # Author: Vincent Dubourg <vincent.dubourg@gmail.com> # (mostly translation, see implementation details) # Licence: BSD 3 clause from __future__ import print_function import numpy as np from scipy import linalg, optimize from ..base import BaseEstimator, RegressorMixin from ..metrics...
bsd-3-clause
nmartensen/pandas
doc/sphinxext/numpydoc/plot_directive.py
89
20530
""" A special directive for generating a matplotlib plot. .. warning:: This is a hacked version of plot_directive.py from Matplotlib. It's very much subject to change! Usage ----- Can be used like this:: .. plot:: examples/example.py .. plot:: import matplotlib.pyplot as plt plt.plot...
bsd-3-clause
tbenthompson/codim1
test/test_elastic_kernel.py
1
13129
from codim1.fast_lib import DisplacementKernel,\ TractionKernel,\ AdjointTractionKernel,\ HypersingularKernel,\ RegularizedHypersingularKernel,\ SemiRegularizedHypersingularKernel,...
mit
jorge2703/scikit-learn
examples/covariance/plot_outlier_detection.py
235
3891
""" ========================================== Outlier detection with several methods. ========================================== When the amount of contamination is known, this example illustrates two different ways of performing :ref:`outlier_detection`: - based on a robust estimator of covariance, which is assumin...
bsd-3-clause
konder/tushare
tushare/datayes/fundamental.py
16
18026
# -*- coding:utf-8 -*- """ 通联数据 Created on 2015/08/24 @author: Jimmy Liu @group : waditu @contact: jimmysoa@sina.cn """ from pandas.compat import StringIO import pandas as pd from tushare.util import vars as vs from tushare.util.common import Client from tushare.util import upass as up class Fundamental(): ...
bsd-3-clause
bzcheeseman/phys211
Alex/Relativistic Electron Dispersion/plotter.py
1
3556
from scipy import optimize import numpy as np import matplotlib.pyplot as plt a = 1.42372210086 aerr = 0.00295712984228 b = 0.0770992785753 berr = 0.00969212354148 cedges = np.array([338,234,749,279,614,186,634,773]) cedgerr = np.array([3,3,3,3,3,4,3,4]) cpeaks = np.array([469,353,900,405,758,296,782,922]) cperr = np...
lgpl-3.0
pjryan126/solid-start-careers
store/api/zillow/venv/lib/python2.7/site-packages/pandas/sparse/scipy_sparse.py
18
5516
""" Interaction with scipy.sparse matrices. Currently only includes SparseSeries.to_coo helpers. """ from pandas.core.index import MultiIndex, Index from pandas.core.series import Series from pandas.compat import OrderedDict, lmap def _check_is_partition(parts, whole): whole = set(whole) parts = [set(x) for ...
gpl-2.0
exxeleron/qPython
doc/source/conf.py
1
8654
# -*- coding: utf-8 -*- # # qPython documentation build configuration file, created by # sphinx-quickstart on Tue Sep 09 07:11:15 2014. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # A...
apache-2.0
roxyboy/scikit-learn
sklearn/feature_selection/tests/test_from_model.py
244
1593
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.datasets import load_iris from sklearn.linear_model import LogisticRegression from sklearn.linear_model import SGD...
bsd-3-clause
h2educ/scikit-learn
sklearn/linear_model/tests/test_ridge.py
68
23597
import numpy as np import scipy.sparse as sp from scipy import linalg from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_a...
bsd-3-clause
fredhusser/scikit-learn
examples/model_selection/grid_search_digits.py
227
2665
""" ============================================================ Parameter estimation using grid search with cross-validation ============================================================ This examples shows how a classifier is optimized by cross-validation, which is done using the :class:`sklearn.grid_search.GridSearc...
bsd-3-clause
MMaus/mutils
libshai/phaser.py
1
17012
from numpy import * from util import * from scipy import signal import warnings from exceptions import Warning """ The phaser module provides an implementation of the phase estimation algorithm of "Estimating the phase of synchronized oscillators"; S. Revzen & J. M. Guckenheimer; Phys. Rev. E; 2008, v. 78, pp. 051...
gpl-2.0
marcsans/cnn-physics-perception
phy/lib/python2.7/site-packages/matplotlib/fontconfig_pattern.py
8
6538
""" A module for parsing and generating fontconfig patterns. See the `fontconfig pattern specification <http://www.fontconfig.org/fontconfig-user.html>`_ for more information. """ # This class is defined here because it must be available in: # - The old-style config framework (:file:`rcsetup.py`) # - The traits-b...
mit
majetideepak/arrow
python/pyarrow/parquet.py
1
51904
# 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
sebp/scikit-survival
sksurv/svm/naive_survival_svm.py
1
7047
# This program 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 version. # # This program is distributed in the hope that it will be useful, # bu...
gpl-3.0
holdenk/spark
python/pyspark/sql/tests/test_pandas_udf_typehints.py
22
9603
# # 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
pli1988/portfolioFactory
portfolioFactory/metrics/retMetrics.py
1
2342
""" retMetrics is a module that contains a collection of functions to compute return metrics on Pandas timeseries. Author: Peter Li """ import pandas as pd import numpy as np from ..utils import utils as utils from ..utils import customExceptions as customExceptions def main(): pass def averageHorizonReturn(da...
mit
vdods/heisenberg
attic/shooting_method_2.py
1
15304
import abc import itertools import library.monte_carlo import numpy as np import scipy.integrate import scipy.linalg import sympy as sp import time import vorpy.symbolic """ Notes Define "return map" R : T^* Q -> T^* Q (really R^3xR^3 -> R^3xR^3, because it's coordinate dependent): R(q,p) is defined as the closest po...
mit
btabibian/scikit-learn
sklearn/cluster/birch.py
11
23640
# Authors: Manoj Kumar <manojkumarsivaraj334@gmail.com> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Joel Nothman <joel.nothman@gmail.com> # License: BSD 3 clause from __future__ import division import warnings import numpy as np from scipy import sparse from math import sqrt fro...
bsd-3-clause
meduz/scikit-learn
sklearn/decomposition/tests/test_dict_learning.py
46
9267
import numpy as np from sklearn.exceptions import ConvergenceWarning from sklearn.utils import check_array from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_true from...
bsd-3-clause
wagavulin/arrow
python/pyarrow/__init__.py
1
8314
# 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
ClementLancien/convertToEntrezGeneID
script/conversion/info.py
1
4970
# -*- coding: utf-8 -*- """ Created on Tue Aug 22 16:42:44 2017 @author: clancien """ try: import ConfigParser except ImportError: import configparser as ConfigParser import os import pandas import logging from logging.handlers import RotatingFileHandler import sys class Info(): def __init__(self): ...
mit
pllim/astropy
astropy/utils/compat/optional_deps.py
2
1548
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Checks for optional dependencies using lazy import from `PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_. """ import importlib import warnings # First, the top-level packages: # TODO: This list is a duplicate of the dependencies in setup.cfg "all...
bsd-3-clause
dpaiton/OpenPV
pv-core/analysis/python/plot_time_stability_all_k.py
1
18262
""" Plots the time stability """ import os import sys import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as mlab import matplotlib.cm as cm import PVReadWeights as rw import PVConversions as conv import scipy.cluster.vq as sp import math if len(sys.argv) < 5: print "usage: time_stability file...
epl-1.0
walterreade/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
DGrady/pandas
pandas/tests/frame/test_subclass.py
15
9524
# -*- coding: utf-8 -*- from __future__ import print_function from warnings import catch_warnings import numpy as np from pandas import DataFrame, Series, MultiIndex, Panel import pandas as pd import pandas.util.testing as tm from pandas.tests.frame.common import TestData class TestDataFrameSubclassing(TestData):...
bsd-3-clause
GunoH/intellij-community
python/helpers/pydev/pydevd.py
9
90108
''' Entry point module (keep at root): This module starts the debugger. ''' import os import sys from contextlib import contextmanager import weakref # allow the debugger to work in isolated mode Python here = os.path.dirname(os.path.abspath(__file__)) if here not in sys.path: sys.path.insert(0, here) from _pyde...
apache-2.0
kazemakase/scikit-learn
examples/ensemble/plot_adaboost_regression.py
311
1529
""" ====================================== Decision Tree Regression with AdaBoost ====================================== A decision tree is boosted using the AdaBoost.R2 [1] algorithm on a 1D sinusoidal dataset with a small amount of Gaussian noise. 299 boosts (300 decision trees) is compared with a single decision tr...
bsd-3-clause
tkuipers/mycli
mycli/packages/tabulate.py
28
38075
# -*- coding: utf-8 -*- """Pretty-print tabular data.""" from __future__ import print_function from __future__ import unicode_literals from collections import namedtuple from decimal import Decimal from platform import python_version_tuple from wcwidth import wcswidth import re if python_version_tuple()[0] < "3": ...
bsd-3-clause
7even7/DAT210x
Module6/assignment6.py
8
2431
import pandas as pd import time # Grab the DLA HAR dataset from: # http://groupware.les.inf.puc-rio.br/har # http://groupware.les.inf.puc-rio.br/static/har/dataset-har-PUC-Rio-ugulino.zip # # TODO: Load up the dataset into dataframe 'X' # # .. your code here .. # # TODO: Encode the gender column, 0 as male, 1 as ...
mit
MattNolanLab/ei-attractor
grid_cell_model/simulations/007_noise/figures/paper/i_place_cells/config.py
1
2423
'''Network test configuration file.''' from __future__ import absolute_import, print_function import os.path from configobj import ConfigObj import matplotlib.ticker as ti scale_factor = 1. tick_width = 1. * scale_factor tick_len = 6. * scale_factor DATA_ROOT = ['simulation_data', 'i_place_cells'] def get_conf...
gpl-3.0
BiaDarkia/scikit-learn
sklearn/mixture/tests/test_dpgmm.py
84
7866
# Important note for the deprecation cleaning of 0.20 : # All the function and classes of this file have been deprecated in 0.18. # When you remove this file please also remove the related files # - 'sklearn/mixture/dpgmm.py' # - 'sklearn/mixture/gmm.py' # - 'sklearn/mixture/test_gmm.py' import unittest import sys imp...
bsd-3-clause
luca-s/alphalens
alphalens/tears.py
1
26976
# # Copyright 2017 Quantopian, 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 wr...
apache-2.0
google-research/FirstOrderLp.jl
scripts/analyze_csv_data.py
1
29257
# Copyright 2021 The FirstOrderLp Authors # # 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...
apache-2.0
astroJeff/dart_board
paper/scripts/J0513_evidence.py
1
2610
import sys import numpy as np import time import matplotlib matplotlib.use('Agg') sys.path.append("../pyBSE/") import pybse import dart_board from dart_board import sf_history LMC_metallicity = 0.008 # Load the star formation history sf_history.lmc.load_sf_history() def lmc_sfh_J0513(ra, dec, ln_t_b): """ S...
mit
kcavagnolo/astroML
book_figures/chapter6/fig_density_estimation.py
3
4407
""" Comparison of 1D Density Estimators ----------------------------------- Figure 6.5 A comparison of different density estimation methods for two simulated one-dimensional data sets (cf. figure 5.21). The generating distribution is same in both cases and shown as the dotted line; the samples include 500 (top panel) ...
bsd-2-clause
nmayorov/scikit-learn
examples/classification/plot_classification_probability.py
138
2871
""" =============================== 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
rjl09c/ysp2017
katiecodeorderverification.py
1
9000
import yt import matplotlib.pyplot as plt import numpy as np from matplotlib import pylab from yt.analysis_modules.halo_finding.api import HaloFinder from pylab import* from numpy import ma from numpy import linalg as LA #deriveswith respect to x def derivx(vel,xcoords): distance = xcoords[1][0] + xcoords[0][1] - 2*...
gpl-3.0
chapman-phys227-2016s/cw-3-classwork-team
sequence_limits.py
1
3024
#! /usr/bin/env python """ File: sequence_limits.py Copyright (c) 2016 Austin Ayers License: MIT Course: PHYS227 Assignment: A. 1 Date: Feb 11, 2016 Email: ayers111@mail.chapman.edu Name: Austin Ayers Description: Determines the limit of a sequence """ import numpy as np import matplotlib.pyplot as plt def seq_a(n):...
mit
flaviovdf/aflux
aflux/dataio.py
1
3090
#-*- coding: utf8 from __future__ import division, print_function from collections import defaultdict from collections import OrderedDict import numpy as np import pandas as pd def save_model(out_fpath, model): store = pd.HDFStore(out_fpath, 'w') for model_key in model: model_val = model[model_key] ...
bsd-3-clause
ronalcc/zipline
zipline/sources/simulated.py
18
5422
# # Copyright 2014 Quantopian, 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 wr...
apache-2.0
plotly/python-api
packages/python/plotly/_plotly_utils/tests/validators/test_pandas_series_input.py
1
4531
import pytest import numpy as np import pandas as pd from datetime import datetime from _plotly_utils.basevalidators import ( NumberValidator, IntegerValidator, DataArrayValidator, ColorValidator, ) @pytest.fixture def data_array_validator(request): return DataArrayValidator("prop", "parent") @p...
mit
huongttlan/statsmodels
statsmodels/graphics/dotplots.py
31
18190
import numpy as np from statsmodels.compat import range from . import utils def dot_plot(points, intervals=None, lines=None, sections=None, styles=None, marker_props=None, line_props=None, split_names=None, section_order=None, line_order=None, stacked=False, styles_order=None, s...
bsd-3-clause
JingJunYin/tensorflow
tensorflow/contrib/training/python/training/feeding_queue_runner_test.py
76
5052
# Copyright 2015 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
lizardsystem/lizard-damage
lizard_damage/results.py
1
10390
"""Process results for a DamageEvent. The idea is that during a calculation a ResultCollector object is kept around, and generated results (like land use images for a given tile) can be "thrown to" it.""" import glob import os import shutil import subprocess import tempfile import zipfile from PIL import Image from ...
gpl-3.0
Reagankm/KnockKnock
venv/lib/python3.4/site-packages/matplotlib/container.py
11
3370
from __future__ import (absolute_import, division, print_function, unicode_literals) import six import matplotlib.cbook as cbook class Container(tuple): """ Base class for containers. """ def __repr__(self): return "<Container object of %d artists>" % (len(self)) ...
gpl-2.0
ajamesl/VectorTarget
plot.py
1
2392
import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib.patches import FancyArrowPatch import numpy as np from mpl_toolkits.mplot3d import proj3d x = [] y = [] z = [] #Reading two sets of x, y, z coordinates from a txt file with open('data.txt', 'r') as csvfile: coords = csv.reader...
mit
russel1237/scikit-learn
sklearn/linear_model/bayes.py
220
15248
""" Various bayesian regression """ from __future__ import print_function # Authors: V. Michel, F. Pedregosa, A. Gramfort # License: BSD 3 clause from math import log import numpy as np from scipy import linalg from .base import LinearModel from ..base import RegressorMixin from ..utils.extmath import fast_logdet, p...
bsd-3-clause
syl20bnr/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/projections/geo.py
69
19738
import math import numpy as np import numpy.ma as ma import matplotlib rcParams = matplotlib.rcParams from matplotlib.artist import kwdocd from matplotlib.axes import Axes from matplotlib import cbook from matplotlib.patches import Circle from matplotlib.path import Path from matplotlib.ticker import Formatter, Locat...
gpl-3.0
arcyfelix/Courses
18-11-22-Deep-Learning-with-PyTorch/02-Introduction to PyTorch/helper.py
1
2719
import matplotlib.pyplot as plt import numpy as np from torch import nn, optim from torch.autograd import Variable def test_network(net, trainloader): criterion = nn.MSELoss() optimizer = optim.Adam(net.parameters(), lr=0.001) dataiter = iter(trainloader) images, labels = dataiter.next() # Crea...
apache-2.0
xuewei4d/scikit-learn
sklearn/manifold/_isomap.py
11
9747
"""Isomap for manifold learning""" # Author: Jake Vanderplas -- <vanderplas@astro.washington.edu> # License: BSD 3 clause (C) 2011 import numpy as np from ..base import BaseEstimator, TransformerMixin from ..neighbors import NearestNeighbors, kneighbors_graph from ..utils.validation import check_is_fitted from ..uti...
bsd-3-clause
bgossele/geminicassandra
geminicassandra/scripts/gemini_install.py
1
15544
#!/usr/bin/env python """Installer for geminicassandra: a lightweight db framework for disease and population genetics. https://github.com/bgossele/geminicassandra Handles installation of: - Required third party software - Required Python libraries - Gemini application - Associated data files Requires: Python 2.7 (...
mit
pv/scikit-learn
sklearn/linear_model/bayes.py
220
15248
""" Various bayesian regression """ from __future__ import print_function # Authors: V. Michel, F. Pedregosa, A. Gramfort # License: BSD 3 clause from math import log import numpy as np from scipy import linalg from .base import LinearModel from ..base import RegressorMixin from ..utils.extmath import fast_logdet, p...
bsd-3-clause
JeanKossaifi/scikit-learn
examples/feature_selection/plot_permutation_test_for_classification.py
250
2233
""" ================================================================= Test with permutations the significance of a classification score ================================================================= In order to test if a classification score is significative a technique in repeating the classification procedure aft...
bsd-3-clause
cancan101/tensorflow
tensorflow/examples/learn/wide_n_deep_tutorial.py
24
8941
# 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
wzbozon/statsmodels
statsmodels/graphics/tsaplots.py
16
10392
"""Correlation plot functions.""" import numpy as np from statsmodels.graphics import utils from statsmodels.tsa.stattools import acf, pacf def plot_acf(x, ax=None, lags=None, alpha=.05, use_vlines=True, unbiased=False, fft=False, **kwargs): """Plot the autocorrelation function Plots lags on th...
bsd-3-clause
loli/semisupervisedforests
sklearn/cluster/tests/test_spectral.py
11
7958
"""Testing for Spectral Clustering methods""" from sklearn.externals.six.moves import cPickle dumps, loads = cPickle.dumps, cPickle.loads import numpy as np from scipy import sparse from sklearn.utils import check_random_state from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_a...
bsd-3-clause
nsat/gnuradio
gr-filter/examples/channelize.py
58
7003
#!/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
procoder317/scikit-learn
benchmarks/bench_plot_fastkmeans.py
294
4676
from __future__ import print_function from collections import defaultdict from time import time import numpy as np from numpy import random as nr from sklearn.cluster.k_means_ import KMeans, MiniBatchKMeans def compute_bench(samples_range, features_range): it = 0 results = defaultdict(lambda: []) chun...
bsd-3-clause
jorik041/scikit-learn
sklearn/svm/tests/test_svm.py
116
31653
""" Testing for Support Vector Machine module (sklearn.svm) TODO: remove hard coded numerical results when possible """ import numpy as np import itertools from numpy.testing import assert_array_equal, assert_array_almost_equal from numpy.testing import assert_almost_equal from scipy import sparse from nose.tools im...
bsd-3-clause
blondegeek/pymatgen
pymatgen/analysis/phase_diagram.py
2
83137
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. import re import collections import itertools import math import logging from monty.json import MSONable, MontyDecoder from functools import lru_cache import numpy as np from scipy.spatial import ConvexHull ...
mit
tomlof/scikit-learn
sklearn/model_selection/_validation.py
6
38471
""" The :mod:`sklearn.model_selection._validation` module includes classes and functions to validate the model. """ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>, # Gael Varoquaux <gael.varoquaux@normalesup.org>, # Olivier Grisel <olivier.grisel@ensta.org> # License: BSD 3 clause from __...
bsd-3-clause
parekhmitchell/Machine-Learning
Machine Learning A-Z Template Folder/Part 2 - Regression/Section 6 - Polynomial Regression/polynomial_regression.py
4
2115
# Polynomial Regression # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('Position_Salaries.csv') X = dataset.iloc[:, 1:2].values y = dataset.iloc[:, 2].values # Splitting the dataset into the Training set and Test set """f...
mit
kaiserroll14/301finalproject
main/pandas/tests/test_multilevel.py
9
90175
# -*- coding: utf-8 -*- # pylint: disable-msg=W0612,E1101,W0141 import datetime import itertools import nose from numpy.random import randn import numpy as np from pandas.core.index import Index, MultiIndex from pandas import Panel, DataFrame, Series, notnull, isnull, Timestamp from pandas.util.testing import (asser...
gpl-3.0
tmhm/scikit-learn
examples/linear_model/plot_polynomial_interpolation.py
251
1895
#!/usr/bin/env python """ ======================== Polynomial interpolation ======================== This example demonstrates how to approximate a function with a polynomial of degree n_degree by using ridge regression. Concretely, from n_samples 1d points, it suffices to build the Vandermonde matrix, which is n_samp...
bsd-3-clause
amolkahat/pandas
pandas/tests/indexes/multi/test_set_ops.py
2
6118
# -*- coding: utf-8 -*- import numpy as np import pandas as pd import pandas.util.testing as tm from pandas import MultiIndex, Series def test_setops_errorcases(idx): # # non-iterable input cases = [0.5, 'xxx'] methods = [idx.intersection, idx.union, idx.difference, idx.symmetric_differenc...
bsd-3-clause
KnHuq/Dynamic-Tensorflow-Tutorial
BiDirectional LSTM/bi_directional_lstm.py
2
12777
import tensorflow as tf from sklearn import datasets from sklearn.cross_validation import train_test_split import pylab as pl from IPython import display import sys # # Bi-LSTM class and functions class Bi_LSTM_cell(object): """ Bi directional LSTM cell object which takes 3 arguments for initialization. ...
mit
btabibian/scikit-learn
benchmarks/bench_random_projections.py
397
8900
""" =========================== Random projection benchmark =========================== Benchmarks for random projections. """ from __future__ import division from __future__ import print_function import gc import sys import optparse from datetime import datetime import collections import numpy as np import scipy.s...
bsd-3-clause