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
ricklupton/sankeyview
floweaver/color_scales.py
1
4260
"""Color scales for Sankey diagrams. author: Rick Lupton created: 2018-01-19 """ import numpy as np from palettable.colorbrewer import qualitative, sequential # From matplotlib.colours def rgb2hex(rgb): 'Given an rgb or rgba sequence of 0-1 floats, return the hex string' if isinstance(rgb, str): retu...
mit
BenoitDamota/mempamal
mempamal/scripts/mapper.py
1
2112
#!/usr/bin/env python # Author: Benoit Da Mota <damota.benoit@gmail.com> # # License: BSD 3 clause """ Generic mapper """ import json from sklearn.externals import joblib from sklearn.pipeline import Pipeline from mempamal.arguments import get_map_argparser from mempamal.crossval import get_fold, print_fold from memp...
bsd-3-clause
robert-giaquinto/air_pollution
build_dataset/Importing.py
1
6250
from __future__ import division import os from urllib2 import urlopen, URLError, HTTPError import zipfile import pandas as pd import numpy as np from data_utilities import * # A list of all files for download can be found here: # http://aqsdr1.epa.gov/aqsweb/aqstmp/airdata/file_list.csv def dlfile(url, data_dir): # ...
gpl-2.0
mhue/scikit-learn
sklearn/utils/tests/test_sparsefuncs.py
57
13752
import numpy as np import scipy.sparse as sp from scipy import linalg from numpy.testing import assert_array_almost_equal, assert_array_equal from sklearn.datasets import make_classification from sklearn.utils.sparsefuncs import (mean_variance_axis, inplace_column_scale, ...
bsd-3-clause
anntzer/scikit-learn
sklearn/decomposition/_pca.py
2
24060
""" Principal Component Analysis. """ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Denis A. Engemann <denis-alexander.engemann@inria.fr> # Michael Eickenberg <michael.eickenberg@inria.fr...
bsd-3-clause
LiaoPan/scikit-learn
sklearn/utils/testing.py
47
23587
"""Testing utilities.""" # Copyright (c) 2011, 2012 # Authors: Pietro Berkes, # Andreas Muller # Mathieu Blondel # Olivier Grisel # Arnaud Joly # Denis Engemann # License: BSD 3 clause import os import inspect import pkgutil import warnings import sys import re import platf...
bsd-3-clause
codevlabs/pandashells
pandashells/test/p_hist_tests.py
7
2350
#! /usr/bin/env python from mock import patch, MagicMock from unittest import TestCase import pandas as pd from pandashells.bin.p_hist import main, get_input_args, validate_args class GetInputArgsTests(TestCase): @patch('pandashells.bin.p_hist.sys.argv', 'p.hist -c x -n 30'.split()) def test_right_number_of_...
bsd-2-clause
codles/UpDownMethods
UpDownMethods/plot.py
1
1966
import matplotlib.pyplot as plt import UpDownMethods as ud def plot_results(results, midpoints=False, figure=None, estimate=False, reversals=False, runs=True): if figure is None: figure = plt.figure() figure.clf() figure.add_subplot(111) plt.hold(True) # Plot correct r...
mit
hugobowne/scikit-learn
examples/ensemble/plot_gradient_boosting_quantile.py
392
2114
""" ===================================================== Prediction Intervals for Gradient Boosting Regression ===================================================== This example shows how quantile regression can be used to create prediction intervals. """ import numpy as np import matplotlib.pyplot as plt from skle...
bsd-3-clause
altairpearl/scikit-learn
sklearn/datasets/svmlight_format.py
9
16760
"""This module implements a loader and dumper for the svmlight format This format is a text-based format, with one sample per line. It does not store zero valued features hence is suitable for sparse dataset. The first element of each line can be used to store a target variable to predict. This format is used as the...
bsd-3-clause
dstndstn/astromalign
astrom_common.py
1
57653
from __future__ import print_function import sys import os from glob import glob from math import sqrt, ceil, pi, cos import re import numpy as np from astrometry.util.fits import fits_table from astrometry.util.util import Tan from astrometry.libkd import spherematch from astrometry.util.starutil_numpy import arcsec...
bsd-3-clause
unnikrishnankgs/va
venv/lib/python3.5/site-packages/matplotlib/spines.py
10
19237
from __future__ import (absolute_import, division, print_function, unicode_literals) import six import matplotlib import matplotlib.artist as martist from matplotlib.artist import allow_rasterization from matplotlib import docstring import matplotlib.transforms as mtransforms import matplotli...
bsd-2-clause
aylward/ITKTubeTK
examples/archive/TubeGraphKernels/permtest.py
7
9961
############################################################################## # # Library: TubeTK # # Copyright 2010 Kitware Inc. 28 Corporate Drive, # Clifton Park, NY, 12065, USA. # # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in comp...
apache-2.0
deepesch/scikit-learn
sklearn/datasets/tests/test_lfw.py
230
7880
"""This test for the LFW require medium-size data dowloading and processing If the data has not been already downloaded by running the examples, the tests won't run (skipped). If the test are run, the first execution will be long (typically a bit more than a couple of minutes) but as the dataset loader is leveraging ...
bsd-3-clause
freemindhv/tq-python
docs/conf.py
1
8134
# -*- coding: utf-8 -*- # # 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. # # All configuration values have a default; values that are commented out # serve to show the default. import sys imp...
gpl-2.0
xuzhenqi/gardenia
scripts/shift_exp.py
1
3841
import numpy as np import random import cv2 import matplotlib.pyplot as plt from util import get_index, get_index_mean, softmax from inference import get_preds_multiple caffe_root = '../caffe/' import sys sys.path.insert(0, caffe_root + 'python') import caffe caffe.set_mode_gpu() mean_file = '../data/train_mean.blob'...
gpl-3.0
cmap/cmapPy
cmapPy/pandasGEXpress/tests/python2_tests/test_write_gctx.py
1
11644
import logging import cmapPy.pandasGEXpress.setup_GCToo_logger as setup_logger import unittest import h5py import os import numpy import cmapPy.pandasGEXpress.parse_gctx as parse_gctx import cmapPy.pandasGEXpress.write_gctx as write_gctx import cmapPy.pandasGEXpress.mini_gctoo_for_testing as mini_gctoo_for_testing __...
bsd-3-clause
AntoinePassemiers/Scythe
python/examples/rf_benchmark.py
1
2815
# -*- coding: utf-8 -*- # rf_benchmark.py - Comparison with sklearn # author : Antoine Passemiers import time from sklearn.datasets import make_classification from sklearn.ensemble import RandomForestClassifier import matplotlib.pyplot as plt from scythe.core import * from scythe.plot import plot_feature_importances ...
apache-2.0
nelango/ViralityAnalysis
model/lib/sklearn/semi_supervised/label_propagation.py
35
15442
# coding=utf8 """ Label propagation in the context of this module refers to a set of semisupervised classification algorithms. In the 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 per...
mit
mayblue9/scikit-learn
sklearn/metrics/scorer.py
211
13141
""" The :mod:`sklearn.metrics.scorer` submodule implements a flexible interface for model selection and evaluation using arbitrary score functions. A scorer object is a callable that can be passed to :class:`sklearn.grid_search.GridSearchCV` or :func:`sklearn.cross_validation.cross_val_score` as the ``scoring`` parame...
bsd-3-clause
TomTranter/OpenPNM
setup.py
1
2601
import os import sys from distutils.util import convert_path try: from setuptools import setup except ImportError: from distutils.core import setup sys.path.append(os.getcwd()) main_ = {} ver_path = convert_path('openpnm/__init__.py') with open(ver_path) as f: for line in f: if line.startswith('__...
mit
asoliveira/NumShip
scripts/plot/beta-ace-v-cg-plt.py
1
2033
#!/usr/bin/env python # -*- coding: utf-8 -*- #É adimensional? adi = False #É para salvar as figuras(True|False)? save = True #Caso seja para salvar, qual é o formato desejado? formato = 'jpg' #Caso seja para salvar, qual é o diretório que devo salvar? dircg = 'fig-sen' #Caso seja para salvar, qual é o nome do arquivo...
gpl-3.0
tomography/tomobank
docs/demo/phantom_00004.py
1
4114
# -*- coding: utf-8 -*- """ Created on Sat Dec 3 15:35:30 2016 @author: decarlo """ from __future__ import (absolute_import, division, print_function, unicode_literals) from xdesign import * import os import time import pytz import datetime import numpy as np import m...
bsd-3-clause
IndraVikas/scikit-learn
examples/mixture/plot_gmm_sin.py
248
2747
""" ================================= Gaussian Mixture Model Sine Curve ================================= This example highlights the advantages of the Dirichlet Process: complexity control and dealing with sparse data. The dataset is formed by 100 points loosely spaced following a noisy sine curve. The fit by the GMM...
bsd-3-clause
mattmcd/PyAnalysis
scripts/doing_data_science/ch2_nyt_analysis.py
1
2147
import os import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns sys.path.append(os.environ.get('MDA_CODE_DIR')) import mda def read(): df = pd.concat( pd.read_csv( mda.data_dir( 'doing_data_science', 'dds_datasets', 'nyt{}.csv'....
apache-2.0
ZhenxingWu/luigi
examples/pyspark_wc.py
56
3361
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
apache-2.0
zhenv5/scikit-learn
sklearn/utils/tests/test_shortest_path.py
303
2841
from collections import defaultdict import numpy as np from numpy.testing import assert_array_almost_equal from sklearn.utils.graph import (graph_shortest_path, single_source_shortest_path_length) def floyd_warshall_slow(graph, directed=False): N = graph.shape[0] #set nonzer...
bsd-3-clause
planaspa/Data-Mining
src/graphDb.py
1
3347
import sqlite3 import matplotlib.pyplot as plt import sys def text_format(text): text = text.replace("&amp;", "&") text = text.replace("&gt;", ">") text = text.replace("&lt;", "<") return text def creatingGroups(c, nGroups): """ This function returns a list which divides the tweets in differ...
mit
ocefpaf/python-oceans
oceans/ocfis.py
2
20695
import re import warnings import gsw import numpy as np import numpy.ma as ma def spdir2uv(spd, ang, deg=False): """ Computes u, v components from speed and direction. Parameters ---------- spd : array_like speed [m s :sup:`-1`] ang : array_like direction [deg] deg : ...
bsd-3-clause
henridwyer/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
adamgreenhall/scikit-learn
sklearn/preprocessing/tests/test_imputation.py
213
11911
import numpy as np from scipy import sparse from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_false from sklearn.utils.testing import assert_true from sklearn.preprocessing.imputa...
bsd-3-clause
alejandro-mc/trees
makeHistos.py
1
4901
import glob import os import sys import matplotlib.pyplot as plt from math import * __stats__ = []#[min,max,histo] #histogram settings __min__ = 0 __max__ = 0 __bincount__ = 0 class histogram: def __init__(self,bincount,maximum,minimum): self.bincount = bincount self.minimum = minimum se...
mit
gfyoung/pandas
pandas/io/excel/_xlsxwriter.py
2
8066
from typing import Dict, List, Tuple import pandas._libs.json as json from pandas._typing import StorageOptions from pandas.io.excel._base import ExcelWriter from pandas.io.excel._util import validate_freeze_panes class _XlsxStyler: # Map from openpyxl-oriented styles to flatter xlsxwriter representation # ...
bsd-3-clause
wllmtrng/udacity_data_analyst_nanodegree
P5 sklearn ML/tools/feature_format.py
1
4386
#!/usr/bin/python """ A general tool for converting data from the dictionary format to an (n x k) python list that's ready for training an sklearn algorithm n--no. of key-value pairs in dictonary k--no. of features being extracted dictionary keys are names of persons in dataset dictiona...
mit
rs2/pandas
pandas/tests/indexes/datetimes/test_pickle.py
4
1342
import pytest from pandas import NaT, date_range, to_datetime import pandas._testing as tm class TestPickle: def test_pickle(self): # GH#4606 idx = to_datetime(["2013-01-01", NaT, "2014-01-06"]) idx_p = tm.round_trip_pickle(idx) assert idx_p[0] == idx[0] assert idx_p[1] is...
bsd-3-clause
binghongcha08/pyQMD
GWP/2D/1.0.4/c.py
28
1767
##!/usr/bin/python import numpy as np import pylab as plt import seaborn as sns sns.set_context('poster') #with open("traj.dat") as f: # data = f.read() # # data = data.split('\n') # # x = [row.split(' ')[0] for row in data] # y = [row.split(' ')[1] for row in data] # # fig = plt.figure() # # ax1 ...
gpl-3.0
jcalogovic/lightning
stormstats/storm.py
1
2992
import os import numpy as np import pandas as pd import datetime as dt from datetime import timedelta import folium from shapely.geometry import Point import geopandas as gpd import pkg_resources as pkg class Storm(object): """Main analysis class. Optional kwargs, f can set file path and name of csv file down...
mit
s-gv/rnicu-webapp
ecg/ecg_visualizer_ble_PC/galry/test/test.py
7
3947
"""Galry unit tests. Every test shows a GalryWidget with a white square (non filled) and a black background. Every test uses a different technique to show the same picture on the screen. Then, the output image is automatically saved as a PNG file and it is then compared to the ground truth. """ import unittest import...
agpl-3.0
ch3ll0v3k/scikit-learn
benchmarks/bench_sample_without_replacement.py
397
8008
""" Benchmarks for sampling without replacement of integer. """ from __future__ import division from __future__ import print_function import gc import sys import optparse from datetime import datetime import operator import matplotlib.pyplot as plt import numpy as np import random from sklearn.externals.six.moves i...
bsd-3-clause
timothy1191xa/project-epsilon-1
code/utils/scripts/multi_beta_script.py
2
4214
""" Purpose: ----------------------------------------------------------------------------------- We generate beta values for each single voxels for each subject and save them to files for multi-comparison test. ----------------------------------------------------------------------------------- """ import sys, os, ...
bsd-3-clause
flag0010/pop_gen_cnn
data_prep_tricks/genet.data.matrix.prep.tricks.py
1
1258
from sklearn.neighbors import NearestNeighbors def sort_min_diff(amat): '''this function takes in a SNP matrix with indv on rows and returns the same matrix with indvs sorted by genetic similarity. this problem is NP, so here we use a nearest neighbors approx. it's not perfect, but it's fast and generally perf...
gpl-3.0
jchodera/MSMs
shanson/mek-10488/msmbuilder-finding4/msmbuilder-finding4-chi1/msmbuilder-finding4-mek.py
2
2180
import matplotlib matplotlib.use('Agg') from msmbuilder.dataset import dataset from msmbuilder import msm, featurizer, utils, decomposition import numpy as np import mdtraj as md import matplotlib.pyplot as plt from glob import glob import os # Source directory for MEK simulations source_directory = '/cbio/jclab/pr...
gpl-2.0
Yiangos01/ADE2017
hybrid_classifier.py
1
5365
from pandas import DataFrame import pandas as pd import re import numpy from sklearn import svm from sklearn.preprocessing import Normalizer from sklearn.feature_extraction.text import CountVectorizer from sklearn.calibration import CalibratedClassifierCV from sklearn.feature_extraction import DictVectorizer from sklea...
gpl-3.0
ankurankan/scikit-learn
examples/applications/plot_tomography_l1_reconstruction.py
45
5463
""" ====================================================================== Compressive sensing: tomography reconstruction with L1 prior (Lasso) ====================================================================== This example shows the reconstruction of an image from a set of parallel projections, acquired along dif...
bsd-3-clause
mfjb/scikit-learn
sklearn/tree/tree.py
113
34767
""" This module gathers tree-based methods, including decision, regression and randomized trees. Single and multi-output problems are both handled. """ # Authors: Gilles Louppe <g.louppe@gmail.com> # Peter Prettenhofer <peter.prettenhofer@gmail.com> # Brian Holt <bdholt1@gmail.com> # Noel Da...
bsd-3-clause
ankurankan/scikit-learn
examples/datasets/plot_random_multilabel_dataset.py
15
3460
""" ============================================== Plot randomly generated multilabel dataset ============================================== This illustrates the `datasets.make_multilabel_classification` dataset generator. Each sample consists of counts of two features (up to 50 in total), which are differently distri...
bsd-3-clause
ch3ll0v3k/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
dingocuster/scikit-learn
examples/svm/plot_svm_anova.py
250
2000
""" ================================================= SVM-Anova: SVM with univariate feature selection ================================================= This example shows how to perform univariate feature before running a SVC (support vector classifier) to improve the classification scores. """ print(__doc__) import...
bsd-3-clause
wrobstory/seaborn
seaborn/tests/test_distributions.py
18
8426
import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt import nose.tools as nt import numpy.testing as npt from numpy.testing.decorators import skipif from .. import distributions as dist try: import statsmodels.nonparametric.api assert statsmodels.nonparametric.api ...
bsd-3-clause
TomAugspurger/pandas
pandas/tests/indexes/multi/test_setops.py
1
11417
import numpy as np import pytest import pandas as pd from pandas import MultiIndex, Series import pandas._testing as tm @pytest.mark.parametrize("case", [0.5, "xxx"]) @pytest.mark.parametrize( "method", ["intersection", "union", "difference", "symmetric_difference"] ) def test_set_ops_error_cases(idx, case, sort...
bsd-3-clause
nsalomonis/AltAnalyze
visualization_scripts/umap_learn_single/spectral.py
2
9570
import numpy as np import scipy.sparse import scipy.sparse.csgraph from sklearn.manifold import SpectralEmbedding from sklearn.metrics import pairwise_distances from warnings import warn def component_layout( data, n_components, component_labels, dim, metric="euclidean", metric_kwds={} ): """Provide a layou...
apache-2.0
sensbio/sensbiotk
examples/scripts/expe_prima.py
1
4757
# -*- coding: utf-8 -*- """ Reconstruction angles example comparison """ import numpy as np from sensbiotk.algorithms import martin_ahrs from sensbiotk.algorithms.basic import find_static_periods from sensbiotk.io.iofox import load_foxcsvfile from sensbiotk.io.ahrs import save_ahrs_csvfile import sensbiotk...
gpl-3.0
zhmxu/nyu_ml_lectures
fetch_data.py
20
2545
import os try: from urllib.request import urlopen except ImportError: from urllib import urlopen import zipfile SENTIMENT140_URL = ("http://cs.stanford.edu/people/alecmgo/" "trainingandtestdata.zip") SENTIMENT140_ARCHIVE_NAME = "trainingandtestdata.zip" def get_datasets_folder(): he...
cc0-1.0
DonBeo/statsmodels
statsmodels/base/tests/test_shrink_pickle.py
6
7890
# -*- coding: utf-8 -*- """ Created on Fri Mar 09 16:00:27 2012 Author: Josef Perktold """ from __future__ import print_function from statsmodels.compat.python import iterkeys, cPickle, BytesIO import numpy as np import statsmodels.api as sm import pandas as pd from numpy.testing import assert_ from nose import Ski...
bsd-3-clause
nddsg/TreeDecomps
xplodnTree/tdec/td_ba_rnd_gm.py
1
16969
#!/usr/bin/env python __version__="0.1.0" # ToDo: # [] process mult dimacs.trees to hrg import sys import math import numpy as np import traceback import argparse import os from glob import glob import networkx as nx import pandas as pd from tdec.PHRG import graph_checks import subprocess import math import itertools...
mit
dyoung418/tensorflow
tensorflow/contrib/learn/python/learn/estimators/kmeans.py
10
10909
# 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
jereze/scikit-learn
examples/linear_model/plot_sgd_penalties.py
249
1563
""" ============== SGD: Penalties ============== Plot the contours of the three penalties. All of the above are supported by :class:`sklearn.linear_model.stochastic_gradient`. """ from __future__ import division print(__doc__) import numpy as np import matplotlib.pyplot as plt def l1(xs): return np.array([np....
bsd-3-clause
sofianehaddad/gosa
doc/sphinxext/numpy_ext/docscrape_sphinx.py
408
8061
import re import inspect import textwrap import pydoc from .docscrape import NumpyDocString from .docscrape import FunctionDoc from .docscrape import ClassDoc class SphinxDocString(NumpyDocString): def __init__(self, docstring, config=None): config = {} if config is None else config self.use_plots...
lgpl-3.0
alshedivat/tensorflow
tensorflow/contrib/timeseries/examples/lstm.py
24
13826
# Copyright 2017 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
lancezlin/ml_template_py
lib/python2.7/site-packages/mpl_toolkits/tests/__init__.py
8
2604
from __future__ import (absolute_import, division, print_function, unicode_literals) from matplotlib.externals import six import difflib import os from matplotlib import rcParams, rcdefaults, use _multiprocess_can_split_ = True # Check that the test directories exist if not os.path.exists...
mit
miloharper/neural-network-animation
matplotlib/artist.py
11
41588
from __future__ import (absolute_import, division, print_function, unicode_literals) import six import re import warnings import inspect import matplotlib import matplotlib.cbook as cbook from matplotlib import docstring, rcParams from .transforms import Bbox, IdentityTransform, TransformedBbo...
mit
anurag313/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
NixaSoftware/CVis
venv/lib/python2.7/site-packages/pandas/tests/reshape/test_union_categoricals.py
4
14309
import pytest import numpy as np import pandas as pd from pandas import Categorical, Series, CategoricalIndex from pandas.core.dtypes.concat import union_categoricals from pandas.util import testing as tm class TestUnionCategoricals(object): def test_union_categorical(self): # GH 13361 data = [ ...
apache-2.0
ilyes14/scikit-learn
examples/ensemble/plot_adaboost_hastie_10_2.py
355
3576
""" ============================= Discrete versus Real AdaBoost ============================= This example is based on Figure 10.2 from Hastie et al 2009 [1] and illustrates the difference in performance between the discrete SAMME [2] boosting algorithm and real SAMME.R boosting algorithm. Both algorithms are evaluate...
bsd-3-clause
PrashntS/scikit-learn
sklearn/datasets/base.py
196
18554
""" Base IO code for all datasets """ # Copyright (c) 2007 David Cournapeau <cournape@gmail.com> # 2010 Fabian Pedregosa <fabian.pedregosa@inria.fr> # 2010 Olivier Grisel <olivier.grisel@ensta.org> # License: BSD 3 clause import os import csv import shutil from os import environ from os.pa...
bsd-3-clause
93lorenzo/software-suite-movie-market-analysis
LinearRegression.py
1
5811
from __future__ import division import numpy as np import json import math import itertools import matplotlib.cm as cm import scipy import csv from scipy.optimize import fmin from scipy.optimize import minimize import scipy.sparse from sklearn.model_selection import train_test_split from sklearn import linear_model imp...
gpl-3.0
guoxiao/lwan
tools/benchmark.py
6
4379
#!/usr/bin/python import sys import json import commands import time try: import matplotlib.pyplot as plt except ImportError: plt = None def clearstderrline(): sys.stderr.write('\033[2K') def weighttp(url, n_threads, n_connections, n_requests, keep_alive): keep_alive = '-k' if keep_alive else '' command...
gpl-2.0
BV-DR/foamBazar
pythonScripts/upPost.py
1
1848
#!/usr/bin/env upython ######################################################################### # Filename: upPost.py # # Date: 2017-May-02 # # Version: 1. # # ...
gpl-3.0
jereze/scikit-learn
examples/linear_model/plot_ols_ridge_variance.py
387
2060
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Ordinary Least Squares and Ridge Regression Variance ========================================================= Due to the few points in each dimension and the straight line that linear regression uses to follow thes...
bsd-3-clause
andaag/scikit-learn
sklearn/decomposition/tests/test_sparse_pca.py
142
5990
# Author: Vlad Niculae # License: BSD 3 clause import sys import numpy as np from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import SkipTest from sklearn.utils.testing import ass...
bsd-3-clause
IndraVikas/scikit-learn
examples/classification/plot_digits_classification.py
289
2397
""" ================================ Recognizing hand-written digits ================================ An example showing how the scikit-learn can be used to recognize images of hand-written digits. This example is commented in the :ref:`tutorial section of the user manual <introduction>`. """ print(__doc__) # Autho...
bsd-3-clause
soft-matter/mr
mr/motion.py
1
16234
# Copyright 2012 Daniel B. Allan # dallan@pha.jhu.edu, daniel.b.allan@gmail.com # http://pha.jhu.edu/~dallan # http://www.danallan.com # # 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 ve...
gpl-3.0
maniteja123/sympy
sympy/physics/quantum/tensorproduct.py
64
13572
"""Abstract tensor product.""" from __future__ import print_function, division from sympy import Expr, Add, Mul, Matrix, Pow, sympify from sympy.core.compatibility import u, range from sympy.core.trace import Tr from sympy.printing.pretty.stringpict import prettyForm from sympy.physics.quantum.qexpr import QuantumEr...
bsd-3-clause
harisbal/pandas
pandas/tests/dtypes/test_cast.py
6
17619
# -*- coding: utf-8 -*- """ These test the private routines in types/cast.py """ import pytest from datetime import datetime, timedelta, date import numpy as np import pandas as pd from pandas import (Timedelta, Timestamp, DatetimeIndex, DataFrame, NaT, Period, Series) from pandas.core.dtypes.c...
bsd-3-clause
AIML/scikit-learn
sklearn/neighbors/tests/test_neighbors.py
22
45265
from itertools import product import pickle import numpy as np from scipy.sparse import (bsr_matrix, coo_matrix, csc_matrix, csr_matrix, dok_matrix, lil_matrix) from sklearn import metrics from sklearn.cross_validation import train_test_split, cross_val_score from sklearn.utils.testing impor...
bsd-3-clause
cl4rke/scikit-learn
examples/cluster/plot_birch_vs_minibatchkmeans.py
333
3694
""" ================================= Compare BIRCH and MiniBatchKMeans ================================= This example compares the timing of Birch (with and without the global clustering step) and MiniBatchKMeans on a synthetic dataset having 100,000 samples and 2 features generated using make_blobs. If ``n_clusters...
bsd-3-clause
ltiao/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
rexshihaoren/scikit-learn
examples/cluster/plot_kmeans_stability_low_dim_dense.py
338
4324
""" ============================================================ Empirical evaluation of the impact of k-means initialization ============================================================ Evaluate the ability of k-means initializations strategies to make the algorithm convergence robust as measured by the relative stan...
bsd-3-clause
allenai/allennlp
allennlp/commands/find_learning_rate.py
1
12036
""" The `find-lr` subcommand can be used to find a good learning rate for a model. It requires a configuration file and a directory in which to write the results. """ import argparse import logging import math import os import re from typing import List, Tuple import itertools from overrides import overrides from al...
apache-2.0
bureau14/qdb-benchmark
thirdparty/boost/libs/numeric/odeint/performance/plot_result.py
43
2225
""" Copyright 2011-2014 Mario Mulansky Copyright 2011-2014 Karsten Ahnert Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) """ import numpy as np from matplotlib import pyplot as plt plt.rc("font", size=16) def g...
bsd-2-clause
DLunin/bayescraft
graphmodels/flow_analysis.py
1
7775
import networkx as nx import numpy as np from numpy import log, exp import scipy as sp import pymc from scipy import stats import emcee import random import matplotlib as mpl import matplotlib.pyplot as plt from itertools import product from sklearn.metrics import mutual_info_score from scipy.stats import gaussian_kde ...
mit
B3AU/waveTree
sklearn/metrics/cluster/bicluster/tests/test_bicluster_metrics.py
13
1145
"""Testing for bicluster metrics module""" import numpy as np from sklearn.utils.testing import assert_equal from ..bicluster_metrics import _jaccard from ..bicluster_metrics import consensus_score def test_jaccard(): a1 = np.array([True, True, False, False]) a2 = np.array([True, True, True, True]) a3 ...
bsd-3-clause
Vvucinic/Wander
venv_2_7/lib/python2.7/site-packages/pandas/tseries/tests/test_daterange.py
9
26349
from datetime import datetime from pandas.compat import range import nose import numpy as np from pandas.core.index import Index from pandas.tseries.index import DatetimeIndex from pandas import Timestamp from pandas.tseries.offsets import generate_range from pandas.tseries.index import cdate_range, bdate_range, date...
artistic-2.0
maartenbreddels/ipyvolume
ipyvolume/transferfunction.py
1
6308
"""The transferfunction module of ipvyolume.""" from __future__ import absolute_import __all__ = ['TransferFunction', 'TransferFunctionJsBumps', 'TransferFunctionWidgetJs3', 'TransferFunctionWidget3'] import numpy as np import ipywidgets as widgets # we should not have widgets under two names import traitlets from ...
mit
0todd0000/spm1d
spm1d/examples/stats1d_roi/ex_ttest2.py
1
1033
import numpy as np from matplotlib import pyplot import spm1d #(0) Load data: dataset = spm1d.data.uv1d.t2.SimulatedTwoLocalMax() YA,YB = dataset.get_data() #(0a) Create region of interest(ROI): roi = np.array([False]*YA.shape[1]) roi[15:35] = True roi[65:85] = True #(1) Conduct t test: alp...
gpl-3.0
tomsilver/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/_cm.py
70
375423
""" Color data and pre-defined cmap objects. This is a helper for cm.py, originally part of that file. Separating the data (this file) from cm.py makes both easier to deal with. Objects visible in cm.py are the individual cmap objects ('autumn', etc.) and a dictionary, 'datad', including all of these objects. """ im...
gpl-3.0
Clyde-fare/scikit-learn
sklearn/decomposition/pca.py
192
23117
""" Principal Component Analysis """ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Denis A. Engemann <d.engemann@fz-juelich.de> # Michael Eickenberg <michael.eickenberg@inria.fr> # # Lice...
bsd-3-clause
LumPenPacK/NetworkExtractionFromImages
osx_build/nefi2_osx_amd64_xcode_2015/site-packages/numpy_1.11/numpy/fft/fftpack.py
22
45592
""" Discrete Fourier Transforms Routines in this module: fft(a, n=None, axis=-1) ifft(a, n=None, axis=-1) rfft(a, n=None, axis=-1) irfft(a, n=None, axis=-1) hfft(a, n=None, axis=-1) ihfft(a, n=None, axis=-1) fftn(a, s=None, axes=None) ifftn(a, s=None, axes=None) rfftn(a, s=None, axes=None) irfftn(a, s=None, axes=None...
bsd-2-clause
RWArunde/Mallet
vis/vis.py
10
3086
# -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # ------------------------------------------------------------------------ # Filename : heatmap.py # Date : 2013-04-19 # Updated : 2014-01-04 # Author : @LotzJoe >> Joe Lotz # Description: My attempt at reproducing the FlowingData graphic in Python # So...
epl-1.0
ssh0/growing-string
triangular_lattice/diecutting.py
1
10266
#!/usr/bin/env python # -*- coding:utf-8 -*- # # written by Shotaro Fujimoto # 2016-08-24 from growing_string import Main from surface import get_surface_points, set_labels, get_labeled_position from optimize import Optimize_linear import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d.axes3d imp...
mit
ashhher3/scikit-learn
benchmarks/bench_glmnet.py
297
3848
""" To run this, you'll need to have installed. * glmnet-python * scikit-learn (of course) Does two benchmarks First, we fix a training set and increase the number of samples. Then we plot the computation time as function of the number of samples. In the second benchmark, we increase the number of dimensions of...
bsd-3-clause
ProkopHapala/SimpleSimulationEngine
python/pyApprox/radialIntegral2D.py
1
1067
import numpy as np def genPoints( n, sc, dphi0=0.0 ): ps = np.empty((n+1,2)) phiMax = 2*np.pi dPhi = phiMax/n #phis = np.arange(0,phiMax,phiMax/n) + dPhi phis = np.linspace(0,phiMax,n+1) + dphi0*dPhi ps[:,0] = np.cos(phis)*sc ps[:,1] = np.sin(phis)*sc return ps if __name__ == "...
mit
Clyde-fare/scikit-learn
sklearn/tree/export.py
78
15814
""" This module defines export functions for decision trees. """ # Authors: Gilles Louppe <g.louppe@gmail.com> # Peter Prettenhofer <peter.prettenhofer@gmail.com> # Brian Holt <bdholt1@gmail.com> # Noel Dawe <noel@dawe.me> # Satrajit Gosh <satrajit.ghosh@gmail.com> # Trevor...
bsd-3-clause
siutanwong/scikit-learn
examples/linear_model/plot_sgd_separating_hyperplane.py
260
1219
""" ========================================= SGD: Maximum margin separating hyperplane ========================================= Plot the maximum margin separating hyperplane within a two-class separable dataset using a linear Support Vector Machines classifier trained using SGD. """ print(__doc__) import numpy as n...
bsd-3-clause
liberatorqjw/scikit-learn
examples/datasets/plot_random_dataset.py
348
2254
""" ============================================== Plot randomly generated classification dataset ============================================== Plot several randomly generated 2D classification datasets. This example illustrates the :func:`datasets.make_classification` :func:`datasets.make_blobs` and :func:`datasets....
bsd-3-clause
krez13/scikit-learn
sklearn/metrics/pairwise.py
14
45532
# -*- coding: utf-8 -*- # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Mathieu Blondel <mathieu@mblondel.org> # Robert Layton <robertlayton@gmail.com> # Andreas Mueller <amueller@ais.uni-bonn.de> # Philippe Gervais <philippe.gervais@inria.fr> # Lars Buitinck ...
bsd-3-clause
mqyqlx/deeppy
examples/siamese_mnist.py
9
2485
#!/usr/bin/env python """ Siamese networks ================ """ import random import numpy as np import matplotlib.pyplot as plt from matplotlib import offsetbox import deeppy as dp # Fetch MNIST data dataset = dp.dataset.MNIST() x_train, y_train, x_test, y_test = dataset.data(flat=True, dp_dtypes=True) # Normaliz...
mit
nmabhi/Webface
classifier_webcam.py
1
7103
#!/usr/bin/env python2 # # Example to run classifier on webcam stream. # Brandon Amos & Vijayenthiran # 2016/06/21 # # Copyright 2015-2016 Carnegie Mellon University # # 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 ...
apache-2.0
casimp/edi12
pyxe/plotting.py
2
16130
# -*- coding: utf-8 -*- """ Created on Tue Oct 20 17:40:07 2015 @author: casimp """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import h5py import numpy as np import matplotlib.pyplot as plt from scipy.interpol...
mit
nilmtk/nilmtk
nilmtk/feature_detectors/cluster.py
1
5665
import numpy as np import pandas as pd def cluster(X, max_num_clusters=3, exact_num_clusters=None): '''Applies clustering on reduced data, i.e. data where power is greater than threshold. Parameters ---------- X : pd.Series or single-column pd.DataFrame max_num_clusters : int Returns ...
apache-2.0