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
nesterione/scikit-learn
examples/linear_model/plot_lasso_lars.py
363
1080
#!/usr/bin/env python """ ===================== Lasso path using LARS ===================== Computes Lasso Path along the regularization parameter using the LARS algorithm on the diabetes dataset. Each color represents a different feature of the coefficient vector, and this is displayed as a function of the regulariza...
bsd-3-clause
clavicule/keras-exp
tmp/rnn.py
1
7006
import argparse import numpy as np import os.path # from progressbar import ProgressBar from keras.models import Sequential from keras.layers import LSTM, Dense from keras.callbacks import ModelCheckpoint from sklearn.preprocessing import StandardScaler from sklearn.metrics import mean_squared_error def baseline_mode...
mit
mattgiguere/scikit-learn
examples/model_selection/plot_train_error_vs_test_error.py
349
2577
""" ========================= Train error vs Test error ========================= Illustration of how the performance of an estimator on unseen data (test data) is not the same as the performance on training data. As the regularization increases the performance on train decreases while the performance on test is optim...
bsd-3-clause
mbayon/TFG-MachineLearning
vbig/lib/python2.7/site-packages/sklearn/ensemble/tests/test_voting_classifier.py
5
17078
"""Testing for the VotingClassifier""" import numpy as np from sklearn.utils.testing import assert_almost_equal, assert_array_equal from sklearn.utils.testing import assert_equal, assert_true, assert_false from sklearn.utils.testing import assert_raise_message from sklearn.utils.testing import assert_warns_message fro...
mit
BigDataforYou/movie_recommendation_workshop_1
big_data_4_you_demo_1/venv/lib/python2.7/site-packages/numpy/core/tests/test_multiarray.py
4
238592
from __future__ import division, absolute_import, print_function import collections import tempfile import sys import shutil import warnings import operator import io import itertools import ctypes import os if sys.version_info[0] >= 3: import builtins else: import __builtin__ as builtins from decimal import D...
mit
pavanramkumar/pyglmnet
pyglmnet/externals/sklearn/utils/validation.py
2
27669
"""Utilities for input validation""" # adapt from scikit-learn # Authors: Olivier Grisel # Gael Varoquaux # Andreas Mueller # Lars Buitinck # Alexandre Gramfort # Nicolas Tresegnie # Sylvain Marie # License: BSD 3 clause import warnings import numbers import nump...
mit
henrykironde/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
woutdenolf/spectrocrunch
spectrocrunch/utils/lut.py
1
5768
# -*- coding: utf-8 -*- import numpy as np from scipy import interpolate import matplotlib.pyplot as plt from copy import copy from . import instance from . import units from . import listtools from .copyable import Copyable class LUT(Copyable): """Lookup table with sorted/unique keys and keys/values with units...
mit
peterfpeterson/mantid
scripts/MultiPlotting/subplot/subplot.py
3
10459
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + from...
gpl-3.0
googleinterns/cabby
cabby/geo/util.py
1
19295
# coding=utf-8 # Copyright 2020 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to ...
apache-2.0
andaag/scikit-learn
benchmarks/bench_plot_parallel_pairwise.py
297
1247
# Author: Mathieu Blondel <mathieu@mblondel.org> # License: BSD 3 clause import time import pylab as pl from sklearn.utils import check_random_state from sklearn.metrics.pairwise import pairwise_distances from sklearn.metrics.pairwise import pairwise_kernels def plot(func): random_state = check_random_state(0) ...
bsd-3-clause
marcsans/cnn-physics-perception
phy/lib/python2.7/site-packages/matplotlib/animation.py
4
50572
# TODO: # * Loop Delay is broken on GTKAgg. This is because source_remove() is not # working as we want. PyGTK bug? # * Documentation -- this will need a new section of the User's Guide. # Both for Animations and just timers. # - Also need to update http://www.scipy.org/Cookbook/Matplotlib/Animations # * Blit ...
mit
mfjb/scikit-learn
sklearn/metrics/cluster/supervised.py
207
27395
"""Utilities to evaluate the clustering performance of models Functions named as *_score return a scalar value to maximize: the higher the better. """ # Authors: Olivier Grisel <olivier.grisel@ensta.org> # Wei LI <kuantkid@gmail.com> # Diego Molla <dmolla-aliod@gmail.com> # License: BSD 3 clause fr...
bsd-3-clause
linebp/pandas
bench/bench_take_indexing.py
2
1194
from __future__ import print_function import numpy as np from pandas import * import pandas._tseries as lib from pandas import DataFrame import timeit from pandas.compat import zip setup = """ from pandas import Series import pandas._tseries as lib import random import numpy as np import random n = %d k = %d arr = ...
bsd-3-clause
zephirefaith/AI_Fall15_Assignments
A2/lib/networkx/drawing/tests/test_pylab.py
45
1137
""" Unit tests for matplotlib drawing functions. """ import os from nose import SkipTest import networkx as nx class TestPylab(object): @classmethod def setupClass(cls): global plt try: import matplotlib as mpl mpl.use('PS',warn=False) import matplotli...
mit
nkcr/WebIndex
app/venv/lib/python3.5/site-packages/nltk/tbl/demo.py
7
14715
# -*- coding: utf-8 -*- # Natural Language Toolkit: Transformation-based learning # # Copyright (C) 2001-2016 NLTK Project # Author: Marcus Uneson <marcus.uneson@gmail.com> # based on previous (nltk2) version by # Christopher Maloof, Edward Loper, Steven Bird # URL: <http://nltk.org/> # For license information, see...
mit
ODM2/ODM2YODAParser
yodatools/converter/Outputs/dbOutput.py
2
8074
from sqlalchemy.exc import IntegrityError from yodatools.converter.Abstract import iOutputs from odm2api.ODMconnection import dbconnection from odm2api.services import * from odm2api.models import setSchema, _changeSchema, Sites, Results, SamplingFeatures, Specimens, MeasurementResults, TimeSeriesResults import logging...
bsd-3-clause
ankurankan/scikit-learn
examples/covariance/plot_sparse_cov.py
6
5078
""" ====================================== Sparse inverse covariance estimation ====================================== Using the GraphLasso estimator to learn a covariance and sparse precision from a small number of samples. To estimate a probabilistic model (e.g. a Gaussian model), estimating the precision matrix, t...
bsd-3-clause
phdowling/scikit-learn
sklearn/decomposition/tests/test_online_lda.py
48
12645
import numpy as np from scipy.linalg import block_diag from scipy.sparse import csr_matrix from scipy.special import psi from sklearn.decomposition import LatentDirichletAllocation from sklearn.decomposition._online_lda import (_dirichlet_expectation_1d, _dirichlet_expect...
bsd-3-clause
mlperf/training_results_v0.7
Google/benchmarks/gnmt/implementations/gnmt-research-TF-tpu-v3-1024/nmt.py
2
22970
# Copyright 2017 Google Inc. 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 applicable law or a...
apache-2.0
Barmaley-exe/scikit-learn
examples/neighbors/plot_nearest_centroid.py
264
1804
""" =============================== Nearest Centroid Classification =============================== Sample usage of Nearest Centroid classification. It will plot the decision boundaries for each class. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap f...
bsd-3-clause
mojoboss/scikit-learn
sklearn/cross_validation.py
96
58309
""" The :mod:`sklearn.cross_validation` module includes utilities for cross- validation and performance evaluation. """ # 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
Solid-Mechanics/matplotlib-4-abaqus
matplotlib/axes.py
3
334534
from __future__ import division, print_function import math import warnings from operator import itemgetter import itertools import numpy as np from numpy import ma import matplotlib rcParams = matplotlib.rcParams import matplotlib.artist as martist from matplotlib.artist import allow_rasterization import matplotlib...
mit
computationalEpidemiology/biobankAccelerometerAnalysis
setup.py
2
1064
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="accelerometer", version="3.1", author="Aiden Doherty", author_email="aiden.doherty@bdi.ox.ac.uk", description="A package to extract meaningful health information from large accelerometer d...
bsd-2-clause
dremio/arrow
js/test/data/tables/generate.py
13
2324
# 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
larsoner/mne-python
tutorials/sample-datasets/plot_sleep.py
7
12214
# -*- coding: utf-8 -*- """ .. _tut-sleep-stage-classif: Sleep stage classification from polysomnography (PSG) data ========================================================== .. note:: This code is taken from the analysis code used in [3]_. If you reuse this code please consider citing this work. This tuto...
bsd-3-clause
juditacs/morph-segmentation-experiments
morph_seg/sequence_tagger/train.py
2
11252
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2017 Judit Acs <judit@sch.bme.hu> # # Distributed under terms of the MIT license. from argparse import ArgumentParser from sys import stdin, stdout import os from six.moves import cPickle from datetime import datetime import copy import ya...
mit
chrisburr/scikit-learn
sklearn/feature_extraction/tests/test_feature_hasher.py
258
2861
from __future__ import unicode_literals import numpy as np from sklearn.feature_extraction import FeatureHasher from nose.tools import assert_raises, assert_true from numpy.testing import assert_array_equal, assert_equal def test_feature_hasher_dicts(): h = FeatureHasher(n_features=16) assert_equal("dict",...
bsd-3-clause
AnnieJumpCannon/RAVE
article/figures/plot_bensby.py
1
1775
""" Make label comparisons with Bensby et al. (2014). """ import numpy as np import matplotlib.pyplot as plt try: bensby except NameError: # Do you know who I am? from rave_io import get_cannon_dr1, get_literature_bensby rave_cannon_dr1 = get_cannon_dr1() #OK = (data["SNRK"] > 10) * (data["R_CHI...
mit
fbagirov/scikit-learn
examples/neighbors/plot_approximate_nearest_neighbors_scalability.py
225
5719
""" ============================================ Scalability of Approximate Nearest Neighbors ============================================ This example studies the scalability profile of approximate 10-neighbors queries using the LSHForest with ``n_estimators=20`` and ``n_candidates=200`` when varying the number of sa...
bsd-3-clause
RomainBrault/scikit-learn
sklearn/feature_extraction/dict_vectorizer.py
41
12562
# 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
rabernat/xray
xarray/core/dataarray.py
1
71555
from __future__ import absolute_import from __future__ import division from __future__ import print_function import functools import warnings import numpy as np import pandas as pd from ..plot.plot import _PlotMethods from . import duck_array_ops from . import indexing from . import groupby from . import resample fr...
apache-2.0
alexei-matveev/ase-local
ase/optimize/minimahopping.py
1
28613
import os import numpy as np from ase import io, units from ase.optimize import QuasiNewton from ase.parallel import paropen, rank, world from ase.md import VelocityVerlet from ase.md import MDLogger from ase.md.velocitydistribution import MaxwellBoltzmannDistribution class MinimaHopping: """Implements the minima...
gpl-2.0
glemaitre/protoclass
protoclass/validation/tests/.dummy_validation.py
1
3150
#title :test_validation.py #description :This will create a header for a python script. #author :Guillaume Lemaitre #date :2015/05/18 #version :0.1 #notes : #python_version :2.7.6 #============================================================================== # Im...
gpl-2.0
rajul/tardis
tardis/plasma/properties/radiative_properties.py
2
7371
import logging import numpy as np import pandas as pd from astropy import units as u, constants as const from tardis.plasma.properties.base import ProcessingPlasmaProperty from tardis import macro_atom logger = logging.getLogger(__name__) __all__ = ['StimulatedEmissionFactor', 'TauSobolev', 'BetaSobolev', 'Tran...
bsd-3-clause
jdavidrcamacho/Tests_GP
07 - MCMC results/kernel_ess_1day.py
1
16967
# -*- coding: utf-8 -*- import Gedi as gedi import numpy as np; #np.random.seed(13042017) import matplotlib.pylab as pl; pl.close("all") from matplotlib.ticker import MaxNLocator import astropy.table as Table from time import time import sys print print 'It has began.' print for ijk in range(1,41): #file to use ...
mit
Bismarrck/pymatgen
pymatgen/analysis/chemenv/coordination_environments/tests/test_voronoi.py
1
14923
#!/usr/bin/env python __author__ = 'waroquiers' import unittest from pymatgen.analysis.chemenv.coordination_environments.voronoi import DetailedVoronoiContainer from pymatgen.core.structure import Structure from pymatgen.core.lattice import Lattice import os import shutil import random import numpy as np <<<<<<< HEA...
mit
nelango/ViralityAnalysis
model/lib/pandas/tseries/tests/test_resample.py
9
65806
# pylint: disable=E1101 from datetime import datetime, timedelta from functools import partial from pandas.compat import range, lrange, zip, product import numpy as np from pandas import (Series, TimeSeries, DataFrame, Panel, Index, isnull, notnull, Timestamp) from pandas.core.groupby import Dat...
mit
y0sh1/iozone-results-comparator
src/plotter.py
8
8195
#!/usr/bin/python # Copyright (C) 2011, 2013 # Adam Okuliar aokuliar at redhat dot com # Jiri Hladky hladky dot jiri at gmail dot com # Petr Benas petrbenas at gmail dot com # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Gene...
gpl-3.0
zentol/flink
flink-python/pyflink/table/table.py
4
32961
################################################################################ # 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...
apache-2.0
kmather73/zipline
tests/history_cases.py
20
21166
""" Test case definitions for history tests. """ import pandas as pd import numpy as np from zipline.finance.trading import TradingEnvironment from zipline.history.history import HistorySpec from zipline.protocol import BarData from zipline.utils.test_utils import to_utc def mixed_frequency_expected_index(count, fr...
apache-2.0
gojira/tensorflow
tensorflow/contrib/learn/python/learn/estimators/linear_test.py
23
77821
# 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
imperial-genomics-facility/data-management-python
test/utils/projectutils_test.py
1
16333
import os, unittest import pandas as pd from sqlalchemy import create_engine from igf_data.igfdb.igfTables import Base,Project,User,ProjectUser,Sample,Experiment,Run,Collection,Collection_group,File from igf_data.igfdb.baseadaptor import BaseAdaptor from igf_data.igfdb.projectadaptor import ProjectAdaptor from igf_data...
apache-2.0
cbertinato/pandas
pandas/tests/extension/test_datetime.py
1
7308
import numpy as np import pytest from pandas.core.dtypes.dtypes import DatetimeTZDtype import pandas as pd from pandas.core.arrays import DatetimeArray from pandas.tests.extension import base @pytest.fixture(params=["US/Central"]) def dtype(request): return DatetimeTZDtype(unit="ns", tz=request.param) @pytest...
bsd-3-clause
Sapphirine/Real-time-Risk-Management-System
GetVar.py
1
5402
''' Copyright [2014] [Iljoon Hwang, ih138@columbia.edu Sung Joon Huh, sh3246@columbia.edu] 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 ...
apache-2.0
lokik/sfepy
examples/linear_elasticity/its2D_4.py
5
4331
r""" Diametrically point loaded 2-D disk with postprocessing and probes. See :ref:`sec-primer`. Use it as follows (assumes running from the sfepy directory; on Windows, you may need to prefix all the commands with "python " and remove "./"): 1. solve the problem:: ./simple.py examples/linear_elasticity/its2D_4.py...
bsd-3-clause
sanja7s/SR_Twitter
src_general/explain_bar_plot_edge_FORMATION_REL_SIMPLE7s.py
1
6311
#!/usr/bin/env python # a bar plot with errorbars import matplotlib import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Ellipse, Polygon from pylab import * width=0.28 # the width of the bars font = {'family' : 'sans-serif', 'variant' : 'normal', 'weight' : 'light', ...
mit
suiyuan2009/tensorflow
tensorflow/contrib/learn/python/learn/estimators/estimator_input_test.py
72
12865
# 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
zhenv5/scikit-learn
sklearn/decomposition/tests/test_dict_learning.py
69
8605
import numpy as np 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 sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_raises...
bsd-3-clause
osvaldshpengler/BuildingMachineLearningSystemsWithPython
ch08/chapter.py
21
6372
import numpy as np # NOT IN BOOK from matplotlib import pyplot as plt # NOT IN BOOK def load(): import numpy as np from scipy import sparse data = np.loadtxt('data/ml-100k/u.data') ij = data[:, :2] ij -= 1 # original data is in 1-based system values = data[:, 2] reviews = sparse.csc_matri...
mit
cdemulde/wwdata
wwdata/Class_HydroData.py
1
84432
# -*- coding: utf-8 -*- """ Class_HydroData provides functionalities for handling data obtained in the context of (waste)water treatment. Copyright (C) 2016 Chaim De Mulder 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 Fre...
agpl-3.0
wangmiao1981/spark
python/pyspark/sql/session.py
8
31156
# # 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
marcocaccin/scikit-learn
sklearn/utils/tests/test_linear_assignment.py
421
1349
# Author: Brian M. Clapper, G Varoquaux # License: BSD import numpy as np # XXX we should be testing the public API here from sklearn.utils.linear_assignment_ import _hungarian def test_hungarian(): matrices = [ # Square ([[400, 150, 400], [400, 450, 600], [300, 225, 300]], ...
bsd-3-clause
DailyActie/Surrogate-Model
01-codes/scikit-learn-master/examples/cluster/plot_digits_linkage.py
1
2967
""" ============================================================================= Various Agglomerative Clustering on a 2D embedding of digits ============================================================================= An illustration of various linkage option for agglomerative clustering on a 2D embedding of the di...
mit
followyourheart/airflow
airflow/hooks/hive_hooks.py
17
14064
from __future__ import print_function from builtins import zip from past.builtins import basestring import csv import logging import subprocess from tempfile import NamedTemporaryFile from thrift.transport import TSocket from thrift.transport import TTransport from thrift.protocol import TBinaryProtocol from hive_ser...
apache-2.0
pkruskal/scikit-learn
examples/svm/plot_separating_hyperplane.py
294
1273
""" ========================================= SVM: Maximum margin separating hyperplane ========================================= Plot the maximum margin separating hyperplane within a two-class separable dataset using a Support Vector Machine classifier with linear kernel. """ print(__doc__) import numpy as np impor...
bsd-3-clause
lthurlow/Network-Grapher
proj/external/matplotlib-1.2.1/lib/mpl_examples/api/scatter_piecharts.py
3
1214
""" This example makes custom 'pie charts' as the markers for a scatter plotqu Thanks to Manuel Metz for the example """ import math import numpy as np import matplotlib.pyplot as plt # first define the ratios r1 = 0.2 # 20% r2 = r1 + 0.4 # 40% # define some sizes of the scatter marker sizes = [60,80,120] # ca...
mit
Sentient07/scikit-learn
sklearn/cluster/tests/test_k_means.py
26
32656
"""Testing for K-means""" import sys import numpy as np from scipy import sparse as sp from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import SkipTest from sklearn.utils.testing i...
bsd-3-clause
bssrdf/sklearn-theano
examples/plot_comparison.py
8
1823
""" ================================================ Comparison of GoogLeNet and Overfeat Classifiers ================================================ In this example, an image is input to an OverfeatClassifier and a GoogLeNetClassifier, and the top N probability outputs are compared for both classifiers. """ print(_...
bsd-3-clause
robin-lai/scikit-learn
examples/cluster/plot_digits_linkage.py
369
2959
""" ============================================================================= Various Agglomerative Clustering on a 2D embedding of digits ============================================================================= An illustration of various linkage option for agglomerative clustering on a 2D embedding of the di...
bsd-3-clause
ishank08/scikit-learn
sklearn/neighbors/tests/test_neighbors.py
49
46769
from itertools import product 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.model_selection import train_test_split from sklearn.model_selection import cross_val_score from sklearn....
bsd-3-clause
hamish2014/optTune
optTune/terminationCriteria.py
1
5882
''' OptTunes standard termination crition is based on the gammaBudget, this module constrains additional termination critera ''' import numpy, pickle from tMOPSO_code import tMOPSO from paretoArchives import paretoArchive2D def noTransform(x): return x class hyperVolume_stagation: def __init__(self, ratioTh...
gpl-3.0
kagayakidan/scikit-learn
examples/mixture/plot_gmm.py
248
2817
""" ================================= Gaussian Mixture Model Ellipsoids ================================= Plot the confidence ellipsoids of a mixture of two Gaussians with EM and variational Dirichlet process. Both models have access to five components with which to fit the data. Note that the EM model will necessari...
bsd-3-clause
NextThought/pypy-numpy
numpy/lib/polynomial.py
35
37641
""" Functions to operate on polynomials. """ from __future__ import division, absolute_import, print_function __all__ = ['poly', 'roots', 'polyint', 'polyder', 'polyadd', 'polysub', 'polymul', 'polydiv', 'polyval', 'poly1d', 'polyfit', 'RankWarning'] import re import warnings import numpy.core....
bsd-3-clause
equialgo/scikit-learn
benchmarks/bench_sparsify.py
323
3372
""" Benchmark SGD prediction time with dense/sparse coefficients. Invoke with ----------- $ kernprof.py -l sparsity_benchmark.py $ python -m line_profiler sparsity_benchmark.py.lprof Typical output -------------- input data sparsity: 0.050000 true coef sparsity: 0.000100 test data sparsity: 0.027400 model sparsity:...
bsd-3-clause
mbayon/TFG-MachineLearning
vbig/lib/python2.7/site-packages/sklearn/cross_decomposition/tests/test_pls.py
24
14995
import numpy as np from numpy.testing import assert_approx_equal from sklearn.utils.testing import (assert_equal, assert_array_almost_equal, assert_array_equal, assert_true, assert_raise_message) from sklearn.datasets import load_linnerud from sklea...
mit
studywolf/control
studywolf_control/sim_and_plot.py
1
7267
''' Copyright (C) 2014 Terry Stewart and Travis DeWolf 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 distrib...
gpl-3.0
xhappy/selfMachineLearning
cs231n-assignment/assigment1/CifarDataUtil.py
1
2549
import pickle import numpy as np import matplotlib.pyplot as plt class CifarDataUtil(object): def __init__(self, path): self.path = path def loadBatchData(self, fileName): with open(self.path+'/'+fileName, 'rb') as batchFile: pickleObj = pickle.load(batchFil...
mit
brainiak/brainiak
brainiak/factoranalysis/htfa.py
6
28942
# Copyright 2016 Intel Corporation # # 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
JackKelly/neuralnilm_prototype
scripts/e435.py
2
7298
from __future__ import print_function, division import matplotlib import logging from sys import stdout matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! from neuralnilm import (Net, RealApplianceSource, BLSTMLayer, DimshuffleLayer, Bidirectio...
mit
mhue/scikit-learn
sklearn/neighbors/tests/test_neighbors.py
103
41083
from itertools import product import numpy as np from scipy.sparse import (bsr_matrix, coo_matrix, csc_matrix, csr_matrix, dok_matrix, lil_matrix) from sklearn.cross_validation import train_test_split from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing impo...
bsd-3-clause
NunoEdgarGub1/scikit-learn
examples/model_selection/plot_precision_recall.py
249
6150
""" ================ Precision-Recall ================ Example of Precision-Recall metric to evaluate classifier output quality. In information retrieval, precision is a measure of result relevancy, while recall is a measure of how many truly relevant results are returned. A high area under the curve represents both ...
bsd-3-clause
akrherz/iem
scripts/ingestors/isusm/ingest_isusm.py
1
13145
"""ISUSM ingest.""" import datetime import os import subprocess import traceback import inotify.adapters import pytz from metpy.units import units from metpy.calc import dewpoint_from_relative_humidity from pyiem.observation import Observation from pyiem.util import get_dbconn, logger, convert_value, c2f, mm2inch impo...
mit
mjgrav2001/scikit-learn
sklearn/qda.py
140
7682
""" Quadratic Discriminant Analysis """ # Author: Matthieu Perrot <matthieu.perrot@gmail.com> # # License: BSD 3 clause import warnings import numpy as np from .base import BaseEstimator, ClassifierMixin from .externals.six.moves import xrange from .utils import check_array, check_X_y from .utils.validation import ...
bsd-3-clause
Weihonghao/ECM
Vpy34/lib/python3.5/site-packages/pandas/tests/series/test_api.py
7
11504
# coding=utf-8 # pylint: disable-msg=E1101,W0612 import pytest import numpy as np import pandas as pd from pandas import Index, Series, DataFrame, date_range from pandas.core.indexes.datetimes import Timestamp from pandas.compat import range from pandas import compat import pandas.io.formats.printing as printing fr...
agpl-3.0
dhermyt/WONS
analysis/textclassification/SklearnClassifierWrapper.py
1
4179
import re from sklearn.feature_extraction.text import TfidfVectorizer from analysis import corpus from analysis.textclassification import bagofwords from helpers.file import File from tools.SentimentAnalysisToolbox import SentimentAnalysisToolbox class SklearnClassifierWrapper(object): __classifier = None _...
bsd-2-clause
dsm054/pandas
asv_bench/benchmarks/stat_ops.py
3
3231
import numpy as np import pandas as pd ops = ['mean', 'sum', 'median', 'std', 'skew', 'kurt', 'mad', 'prod', 'sem', 'var'] class FrameOps(object): params = [ops, ['float', 'int'], [0, 1], [True, False]] param_names = ['op', 'dtype', 'axis', 'use_bottleneck'] def setup(self, op, dtype, axis, use...
bsd-3-clause
h2educ/scikit-learn
sklearn/tests/test_pipeline.py
35
15221
""" Test the pipeline module. """ import numpy as np from scipy import sparse from sklearn.externals.six.moves import zip from sklearn.utils.testing import assert_raises, assert_raises_regex, assert_raise_message from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_false from sklearn...
bsd-3-clause
cl4rke/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
index-0/Geometric-Shapes
3D/Tri-Surface/ellipsoid.py
1
1059
#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl from mpl_toolkits.mplot3d import Axes3D import matplotlib.tri as mtri fig = plt.figure(figsize=plt.figaspect(1)) a = float(input("a: ")) b = float(input("b: ")) c = float(input("c: ")) u = np.linspace(0, 2 * np.pi, endp...
gpl-3.0
linyc74/CaMNIST
dnn.py
1
19966
""" Version 0.3 Give the option to compute cost or not for each epoch """ __version__ = '0.3' import numpy as np import tensorflow as tf import matplotlib.pyplot as plt import math, cv2, json, time class NeuralNet(object): """ There are two main groups of attributes for this neural network model. --- G...
mit
ASPP/svg_utils
docs/source/tutorial/anscombe.py
1
1899
#!/usr/bin/env python """ Edward Tufte uses this example from Anscombe to show 4 datasets of x and y that have the same mean, standard deviation, and regression line, but which are qualitatively different. matplotlib fun for a rainy day Downloaded from: http://matplotlib.sourceforge.net/examples/pylab_examples/ansco...
mit
mne-tools/mne-tools.github.io
stable/_downloads/4872a48890443799edd4c7e80b4327d9/60_visualize_stc.py
6
8504
""" .. _tut-viz-stcs: Visualize source time courses (stcs) ==================================== This tutorial focuses on visualization of :term:`source estimates<STC>`. Surface Source Estimates ------------------------ First, we get the paths for the evoked data and the time courses (stcs). """ import os import os....
bsd-3-clause
AIML/scikit-learn
examples/plot_digits_pipe.py
250
1809
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Pipelining: chaining a PCA and a logistic regression ========================================================= The PCA does an unsupervised dimensionality reduction, while the logistic regression does the predictio...
bsd-3-clause
kzky/python-online-machine-learning-library
cw/multiclass_soft_confidence_weighted_1_diag.py
1
13277
import numpy as np import logging as logger import time from base import ConfidenceWeightedModel from collections import defaultdict from sklearn.metrics import confusion_matrix from sklearn.datasets import load_svmlight_file from scipy.stats import norm from scipy.sparse import csr_matrix from scipy import sparse cl...
bsd-3-clause
simpeg/simpegem
simpegEM/Examples/CylInversion.py
2
3124
from SimPEG import * import simpegEM as EM from scipy.constants import mu_0 import matplotlib.pyplot as plt plotIt = False cs, ncx, ncz, npad = 5., 25, 15, 15 hx = [(cs,ncx), (cs,npad,1.3)] hz = [(cs,npad,-1.3), (cs,ncz), (cs,npad,1.3)] mesh = Mesh.CylMesh([hx,1,hz], '00C') active = mesh.vectorCCz<0. layer = (mesh.v...
mit
vshtanko/scikit-learn
examples/linear_model/plot_iris_logistic.py
283
1678
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Logistic Regression 3-class Classifier ========================================================= Show below is a logistic-regression classifiers decision boundaries on the `iris <http://en.wikipedia.org/wiki/Iris_f...
bsd-3-clause
rohanp/scikit-learn
sklearn/manifold/tests/test_mds.py
324
1862
import numpy as np from numpy.testing import assert_array_almost_equal from nose.tools import assert_raises from sklearn.manifold import mds def test_smacof(): # test metric smacof using the data of "Modern Multidimensional Scaling", # Borg & Groenen, p 154 sim = np.array([[0, 5, 3, 4], ...
bsd-3-clause
jereze/scikit-learn
examples/calibration/plot_calibration_multiclass.py
272
6972
""" ================================================== Probability Calibration for 3-class classification ================================================== This example illustrates how sigmoid calibration changes predicted probabilities for a 3-class classification problem. Illustrated is the standard 2-simplex, wher...
bsd-3-clause
arjun-krishna/Face_Recognition
src/facial_feature_extract_inceptionv3.py
1
1175
import os import re import cv2 import numpy as np import pandas as pd import tensorflow as tf from tensorflow.python.platform import gfile frozen_graph_filename = 'models/classify_image_graph_def.pb' # define with libraries def load_graph(frozen_graph_filename): with tf.gfile.GFile(frozen_graph_filename, "rb") a...
mit
hsiaoyi0504/scikit-learn
examples/model_selection/grid_search_text_feature_extraction.py
253
4158
""" ========================================================== Sample pipeline for text feature extraction and evaluation ========================================================== The dataset used in this example is the 20 newsgroups dataset which will be automatically downloaded and then cached and reused for the do...
bsd-3-clause
DGrady/pandas
pandas/tests/io/json/test_ujson.py
7
55996
# -*- coding: utf-8 -*- try: import json except ImportError: import simplejson as json import math import pytz import pytest import time import datetime import calendar import re import decimal import dateutil from functools import partial from pandas.compat import range, zip, StringIO, u import pandas._libs.j...
bsd-3-clause
shennjia/home
.script/myTPC.py
1
4549
#!/usr/bin/env python import sys from tempfile import mkstemp from shutil import move from os import remove, close import fileinput from subprocess import call import os import re import matplotlib.pyplot as plt import numpy as np def filteroutTpcSamples(file_path, rePattern): import re #Create temp file ...
unlicense
phievo/phievo
phievo/AnalysisTools/palette.py
1
4432
from phievo import __silent__,__verbose__ if __verbose__: print("Execute palette.py") from matplotlib import pylab,colors default_colormap = "gist_rainbow" def update_default_colormap(colormap): """ Update the color map used by the palette modules Arg: colormap (str): name of the matplotlib c...
lgpl-3.0
skandavivek/tracking-cars-highway
common.py
11
6701
#!/usr/bin/env python ''' This module contains some common routines used by other samples. ''' # Python 2/3 compatibility from __future__ import print_function import sys PY3 = sys.version_info[0] == 3 if PY3: from functools import reduce import numpy as np import cv2 # built-in modules import os import iterto...
apache-2.0
dhomeier/astropy
astropy/visualization/tests/test_units.py
7
3529
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst import io import pytest from astropy.utils.compat.optional_deps import HAS_PLT if HAS_PLT: import matplotlib.pyplot as plt from astropy import units as u from astropy.coordinates import Angle from astropy.visualization.units...
bsd-3-clause
myt00seven/svrg
cifar/alexnet_lasagne/lasagne-googlenet-master/googlenet_bn.py
1
57162
from __future__ import division, absolute_import from __future__ import unicode_literals import theano import theano.tensor as T import numpy as np import lasagne from lasagne.layers import dnn from lasagne.objectives import categorical_crossentropy, aggregate # custom layers and functions import googlenet #from uti...
mit
sameeptandon/sail-car-log
mapping/sandbox/graphslam/scripts/eval_maps.py
1
4146
import h5py import json import numpy as np from os.path import splitext, basename, join as pjoin from pipeline_utils import print_and_call from pipeline_config import MAPPING_PATH from graphslam_config import GRAPHSLAM_EVAL_DIR, GRAPHSLAM_MAPS_DIR, MATCH_JSON_DATA from sklearn.neighbors import NearestNeighbors import m...
bsd-2-clause
wanggang3333/scikit-learn
examples/classification/plot_lda.py
164
2224
""" ==================================================================== Normal and Shrinkage Linear Discriminant Analysis for classification ==================================================================== Shows how shrinkage improves classification. """ from __future__ import division import numpy as np import...
bsd-3-clause
vrok/gucdb
test/comparative.py
1
14232
#!/usr/bin/python from os import system import os from collections import defaultdict import subprocess import sys TEMP_PRE_INPUT = '/tmp/pre_input.txt' TEMP_INPUT = '/tmp/input.txt' GRANULARITY = 4 REPEATS = 1 MEMORY_LABEL = 'Memory (MB)' files = [ 'test_data/Wikipedia_titles', 'test_data/Length_from_150_to_...
gpl-3.0