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
AlexanderFabisch/scikit-learn
examples/neural_networks/plot_mnist_filters.py
57
2195
""" ===================================== Visualization of MLP weights on MNIST ===================================== Sometimes looking at the learned coefficients of a neural network can provide insight into the learning behavior. For example if weights look unstructured, maybe some were not used at all, or if very l...
bsd-3-clause
lilleswing/deepchem
examples/low_data/tox_rf_one_fold.py
9
2037
""" Train low-data Tox21 models with random forests. Test last fold only. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import tempfile import numpy as np import deepchem as dc from datasets import load_tox21_ecfp from sklearn.ensemble import RandomFo...
mit
dtaht/ns-3-codel-dev
src/core/examples/sample-rng-plot.py
188
1246
# -*- Mode:Python; -*- # /* # * This program is free software; you can redistribute it and/or modify # * it under the terms of the GNU General Public License version 2 as # * published by the Free Software Foundation # * # * This program is distributed in the hope that it will be useful, # * but WITHOUT ANY WARRA...
gpl-2.0
rafiqsaleh/VERCE
verce-hpc-pe/src/pyflex/tests/test_pyflex.py
2
12276
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Pyflex test suite. Run with pytest. :copyright: Lion Krischer (krischer@geophysik.uni-muenchen.de), 2014 :license: GNU General Public License, Version 3 (http://www.gnu.org/copyleft/gpl.html) """ import inspect import matplotlib as mpl import matplotlib.py...
mit
wronk/mne-python
examples/inverse/plot_covariance_whitening_dspm.py
9
7201
# doc:slow-example """ =================================================== Demonstrate impact of whitening on source estimates =================================================== This example demonstrates the relationship between the noise covariance estimate and the MNE / dSPM source amplitudes. It computes source es...
bsd-3-clause
massmutual/scikit-learn
sklearn/tests/test_discriminant_analysis.py
35
11709
try: # Python 2 compat reload except NameError: # Regular Python 3+ import from importlib import reload import numpy as np from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.t...
bsd-3-clause
adamrvfisher/TechnicalAnalysisLibrary
PriceRelativeSMA.py
1
6467
# -*- coding: utf-8 -*- """ Created on Fri Jan 19 15:03:41 2018 @author: AmatVictoriaCuramIII """ #lets check out the drag in TBT, eh? import numpy as np import random as rand import pandas as pd import time as t from DatabaseGrabber import DatabaseGrabber from YahooGrabber import YahooGrabber iterati...
apache-2.0
elsid/kaggle-titanic
predict.py
1
11252
#!/usr/bin/env python3 # coding: utf-8 import re import yaml from argparse import ArgumentParser, FileType from collections import Counter, Iterable from functools import reduce from numpy import unique from pandas import read_csv, concat from sklearn.ensemble import AdaBoostClassifier from sys import stdin, stdout ...
mit
isb-cgc/ISB-CGC-data-proc
tcga_etl_pipeline/mirna_isoform_matrix/melt_matrix.py
1
3675
import pandas as pd import sys import os import sqlite3 import json from cStringIO import StringIO from bigquery_etl.extract.gcloud_wrapper import GcsConnector from bigquery_etl.extract.utils import convert_file_to_dataframe from bigquery_etl.transform.tools import cleanup_dataframe from bigquery_etl.utils.logging_ma...
apache-2.0
ClimbsRocks/scikit-learn
sklearn/metrics/tests/test_regression.py
272
6066
from __future__ import division, print_function import numpy as np from itertools import product from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils....
bsd-3-clause
jdreaver/vispy
vispy/visuals/isocurve.py
18
7809
# -*- coding: utf-8 -*- # Copyright (c) 2015, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. from __future__ import division import numpy as np from .line import LineVisual from ..color import ColorArray from ..color.colormap import _normalize, get_colormap from ..g...
bsd-3-clause
EducationalTestingService/rsmtool
tests/test_configuration_parser.py
1
48707
import json import logging import os import tempfile import warnings from io import StringIO from os import getcwd from os.path import abspath, dirname, join from pathlib import Path from shutil import rmtree import pandas as pd from nose.tools import assert_equal, assert_not_equal, eq_, ok_, raises from numpy.testing...
apache-2.0
tks0123456789/ParamTune_experiments
utility.py
1
4756
from datetime import datetime import numpy as np import pandas as pd from sklearn.cross_validation import StratifiedKFold, StratifiedShuffleSplit from sklearn.metrics import roc_auc_score, log_loss from sklearn.datasets import make_classification from xgboost.sklearn import XGBClassifier from hyperopt import fmin, tpe,...
mit
jkeung/yellowbrick
tests/test_text/test_base.py
2
1473
# tests.test_text.test_base # Tests for the text visualization base classes # # Author: Benjamin Bengfort <bbengfort@districtdatalabs.com> # Created: Mon Feb 20 06:34:50 2017 -0500 # # Copyright (C) 2016 District Data Labs # For license information, see LICENSE.txt # # ID: test_base.py [] benjamin@bengfort.com $ ""...
apache-2.0
Agent007/deepchem
scripts/split_csv.py
5
1651
""" Splits large CSVs into multiple shards. """ from __future__ import print_function from __future__ import division from __future__ import absolute_import import argparse import gzip import pandas as pd def parse_args(input_args=None): parser = argparse.ArgumentParser() parser.add_argument( "--csv-file", re...
mit
wlamond/scikit-learn
sklearn/metrics/cluster/tests/test_unsupervised.py
66
5806
import numpy as np import scipy.sparse as sp from scipy.sparse import csr_matrix from sklearn import datasets from sklearn.utils.testing import assert_false from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_equal from skl...
bsd-3-clause
tobias47n9e/innstereo
innstereo/polar_axes.py
3
8727
#!/usr/bin/python3 """ This module contains the custom projection for a north-up polar plot. The NorthPolarAxes-class is a polar projection that has its origin (0 degrees) at the top and counts clockwise in the positive direction. This makes it easier and fater to plot azimuth measurements. The class is called from t...
gpl-2.0
alphaBenj/zipline
tests/risk/test_risk_cumulative.py
2
4263
# # Copyright 2016 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
phrb/opentuner
stats_app/stats_app/views/charts.py
6
1669
import datetime import django from django.shortcuts import render from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.dates import DateFormatter from matplotlib.figure import Figure import random from opentuner.utils import stats_matplotlib as stats def display_graph(request):...
mit
liyu1990/sklearn
sklearn/manifold/tests/test_locally_linear.py
232
4761
from itertools import product from nose.tools import assert_true import numpy as np from numpy.testing import assert_almost_equal, assert_array_almost_equal from scipy import linalg from sklearn import neighbors, manifold from sklearn.manifold.locally_linear import barycenter_kneighbors_graph from sklearn.utils.testi...
bsd-3-clause
davidthaler/arboretum
arboretum/tests/test_mse_splitter.py
1
4011
import unittest import numpy as np from sklearn.tree import DecisionTreeRegressor from ..datasets import load_mtcars, load_als from .. mse_splitter import split from .. import tree_constants as tc NO_SPLIT = (tc.NO_FEATURE, tc.NO_THR) X, Y = load_mtcars() W = np.ones_like(Y) XTR, YTR, XTE, YTE = load_als() WTR = np.o...
mit
elijah513/scikit-learn
examples/ensemble/plot_voting_decision_regions.py
230
2386
""" ================================================== Plot the decision boundaries of a VotingClassifier ================================================== Plot the decision boundaries of a `VotingClassifier` for two features of the Iris dataset. Plot the class probabilities of the first sample in a toy dataset pred...
bsd-3-clause
jreback/pandas
pandas/tests/tools/test_to_time.py
8
2019
from datetime import time import numpy as np import pytest import pandas.util._test_decorators as td from pandas import Series import pandas._testing as tm from pandas.core.tools.datetimes import to_time as to_time_alias from pandas.core.tools.times import to_time class TestToTime: @td.skip_if_has_locale d...
bsd-3-clause
wdurhamh/statsmodels
statsmodels/tsa/base/tsa_model.py
9
10574
from statsmodels.compat.python import lrange import statsmodels.base.model as base from statsmodels.base import data import statsmodels.base.wrapper as wrap from statsmodels.tsa.base import datetools from numpy import arange, asarray from pandas import Index from pandas import datetools as pandas_datetools import datet...
bsd-3-clause
yuhangc/HRI_planner
scripts/hri/planner_component_tester.py
1
15083
#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import rospy from hri_planner.srv import * from plotting_utils import add_arrow def belief_update_client(xh, uh, xr, ur, xh0, xr0, weights, acomm, tcomm, log_path): rospy.wait_for_service("update_bel...
apache-2.0
kaichogami/scikit-learn
sklearn/utils/metaestimators.py
283
2353
"""Utilities for meta-estimators""" # Author: Joel Nothman # Andreas Mueller # Licence: BSD from operator import attrgetter from functools import update_wrapper __all__ = ['if_delegate_has_method'] class _IffHasAttrDescriptor(object): """Implements a conditional property using the descriptor protocol. ...
bsd-3-clause
msmbuilder/msmbuilder
msmbuilder/example_datasets/muller.py
9
4306
from __future__ import print_function, division, absolute_import from multiprocessing import cpu_count from multiprocessing.pool import ThreadPool import numpy as np from .base import _NWell from ._muller import propagate, muller_potential __all__ = ['load_muller', 'MullerPotential'] #############################...
lgpl-2.1
appapantula/scikit-learn
sklearn/manifold/t_sne.py
106
20057
# Author: Alexander Fabisch -- <afabisch@informatik.uni-bremen.de> # License: BSD 3 clause (C) 2014 # This is the standard t-SNE implementation. There are faster modifications of # the algorithm: # * Barnes-Hut-SNE: reduces the complexity of the gradient computation from # N^2 to N log N (http://arxiv.org/abs/1301....
bsd-3-clause
JimingAndYuqi/secret
src/ReadExternalData.py
1
2986
import json import numpy as np import pandas as pd import nltk from sklearn.feature_extraction.text import TfidfVectorizer from enhancement.ManipulateAndValidation import * from enhancement.LoadAndSubmit import * STOPWORDS = nltk.corpus.stopwords.words('english') train = pd.read_csv("train_stemmed.csv").fillna('')...
apache-2.0
ee-in/python-api
plotly/tools.py
1
107644
# -*- coding: utf-8 -*- """ tools ===== Functions that USERS will possibly want access to. """ from __future__ import absolute_import import os.path import warnings import six import math from plotly import utils from plotly import exceptions from plotly import session from plotly.graph_objs import graph_objs ...
mit
classner/barrista
examples/MNIST/visualize.py
2
3101
#!/usr/bin/env python """Create visualizations.""" # pylint: disable=no-member, invalid-name, wrong-import-position from __future__ import print_function import os import json import logging import click import numpy as np _LOGGER = logging.getLogger(__name__) try: import matplotlib.pyplot as plt MPL_AVAILABL...
mit
formath/mxnet
example/ssd/detect/detector.py
30
7112
# 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
datapythonista/pandas
pandas/tests/indexes/period/test_join.py
3
1790
import numpy as np import pytest from pandas._libs.tslibs import IncompatibleFrequency from pandas import ( Index, PeriodIndex, period_range, ) import pandas._testing as tm class TestJoin: def test_join_outer_indexer(self): pi = period_range("1/1/2000", "1/20/2000", freq="D") result...
bsd-3-clause
smjhnits/Praktikum_TU_D_16-17
Anfängerpraktikum/Protokolle/V703_Geiger_Müller/auswertung/test.py
1
5089
import numpy as np from scipy.stats import sem from uncertainties import ufloat import uncertainties.unumpy as unp import matplotlib.pyplot as plt from scipy.optimize import curve_fit import scipy.constants as const from uncertainties.unumpy import (nominal_values as noms, std_devs as stds) Spannung = np.linspace(320,...
mit
waterponey/scikit-learn
sklearn/model_selection/_validation.py
2
37620
""" 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
hugobowne/scikit-learn
sklearn/ensemble/tests/test_partial_dependence.py
365
6996
""" Testing for the partial dependence module. """ import numpy as np from numpy.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import if_matplotlib from sklearn.ensemble.partial_dependence import partial_dependence from sklearn.ensemble.partial_dependence...
bsd-3-clause
harisbal/pandas
pandas/tests/scalar/timestamp/test_arithmetic.py
2
2852
# -*- coding: utf-8 -*- from datetime import datetime, timedelta import pytest import numpy as np import pandas.util.testing as tm from pandas.compat import long from pandas.tseries import offsets from pandas import Timestamp, Timedelta class TestTimestampArithmetic(object): def test_overflow_offset(self): ...
bsd-3-clause
rishikksh20/scikit-learn
examples/model_selection/plot_precision_recall.py
23
6873
""" ================ 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
jvbalen/cover_id
SHS_data.py
1
4156
#!/usr/bin/env python """I/O methods for the SHS dataset.""" from __future__ import division, print_function import numpy as np import os from pandas import read_csv # global vars data_dir = '/Users/Jan/Documents/Work/Data/SHS_julien/' chroma_dir = os.path.join(data_dir, 'chroma/') def read_cliques(clique_file='...
mit
chanderbgoel/pybrain
examples/rl/valuebased/nfq.py
25
1973
from __future__ import print_function #!/usr/bin/env python __author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de' from pybrain.rl.environments.cartpole import CartPoleEnvironment, DiscreteBalanceTask, CartPoleRenderer from pybrain.rl.agents import LearningAgent from pybrain.rl.experiments import EpisodicExperiment fr...
bsd-3-clause
UNR-AERIAL/scikit-learn
sklearn/manifold/isomap.py
229
7169
"""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 import check_array from ..utils.graph import...
bsd-3-clause
tiagofrepereira2012/bob.measure
bob/measure/plot.py
1
12669
#!/usr/bin/env python # vim: set fileencoding=utf-8 : # Chakka Murali Mohan, Trainee, IDIAP Research Institute, Switzerland. # Mon 23 May 2011 14:36:14 CEST """Methods to plot error analysis figures such as ROC, precision-recall curve, EPC and DET""" def roc(negatives, positives, npoints=100, CAR=False, **kwargs): ...
bsd-3-clause
rashidsabbir/extractor
annotation_engine.py
1
14705
#!/usr/bin/python '''general approach: construct a high-dimension space of meaning for the various attributes under consideration develop algorithms to map an input string to a point in this space Approaches may include: Naive text analysis, adding a vector corresponding to each word + nearest neigh...
mit
dsquareindia/scikit-learn
sklearn/ensemble/partial_dependence.py
33
15265
"""Partial dependence plots for tree ensembles. """ # Authors: Peter Prettenhofer # License: BSD 3 clause from itertools import count import numbers import numpy as np from scipy.stats.mstats import mquantiles from ..utils.extmath import cartesian from ..externals.joblib import Parallel, delayed from ..externals im...
bsd-3-clause
trungnt13/scikit-learn
examples/tree/plot_iris.py
271
2186
""" ================================================================ Plot the decision surface of a decision tree on the iris dataset ================================================================ Plot the decision surface of a decision tree trained on pairs of features of the iris dataset. See :ref:`decision tree ...
bsd-3-clause
MatthieuBizien/scikit-learn
sklearn/feature_extraction/tests/test_dict_vectorizer.py
110
3768
# Authors: Lars Buitinck # Dan Blanchard <dblanchard@ets.org> # License: BSD 3 clause from random import Random import numpy as np import scipy.sparse as sp from numpy.testing import assert_array_equal from sklearn.utils.testing import (assert_equal, assert_in, assert_false...
bsd-3-clause
rubikloud/scikit-learn
examples/mixture/plot_gmm_selection.py
248
3223
""" ================================= Gaussian Mixture Model Selection ================================= This example shows that model selection can be performed with Gaussian Mixture Models using information-theoretic criteria (BIC). Model selection concerns both the covariance type and the number of components in th...
bsd-3-clause
gagneurlab/concise
concise/utils/pwm.py
2
10205
import numpy as np import copy from concise.preprocessing.sequence import DNA, _get_vocab_dict from io import StringIO import gzip from concise.utils.plot import seqlogo, seqlogo_fig import matplotlib.pyplot as plt DEFAULT_LETTER_TO_INDEX = _get_vocab_dict(DNA) DEFAULT_INDEX_TO_LETTER = dict((DEFAULT_LETTER_TO_INDEX[...
mit
rubind/forward_3d
scripts/model.py
1
13841
from numpy import * import commands import pyfits from scipy.interpolate import RectBivariateSpline, interp1d import time import multiprocessing as mp from matplotlib import use use("PDF") import matplotlib.pyplot as plt import sys from scipy.optimize import minimize def save_img(dat, imname, waves = None): comma...
mit
Sammers21/math_stat_python
problem1.py
2
1341
import numpy as np from scipy.stats import rv_continuous class customDist(rv_continuous): """" Distribution F(x)=1-exp(-exp(0.1x) """ #TODO поменять тут на своё распределение def _cdf(self, x, *args): return 1 - np.exp(-np.exp(x / 10.)) d = customDist() #Генерируем выборку из 100 случа...
apache-2.0
huzq/scikit-learn
benchmarks/bench_plot_ward.py
14
1277
""" Benchmark scikit-learn's Ward implement compared to SciPy's """ import time import numpy as np from scipy.cluster import hierarchy import matplotlib.pyplot as plt from sklearn.cluster import AgglomerativeClustering ward = AgglomerativeClustering(n_clusters=3, linkage='ward') n_samples = np.logspace(.5, 3, 9) n...
bsd-3-clause
krisaju95/NewsArticleClustering
IncrementalClustering/module6_Classifier.py
1
2735
import pickle import numpy as np import pandas as pd import math import os newsPaperName = "NewsPaper A" path = "C:/Users/hp/Desktop/FINAL YEAR PROJECT/S8/" words = set() dataFrame2 = pickle.load( open(os.path.join(path , 'Crawled Articles' , newsPaperName , 'Feature Set','dataFrame2.p'), "rb" )) dataFrame...
gpl-3.0
saketkc/statsmodels
statsmodels/genmod/tests/test_glm.py
19
37824
""" Test functions for models.GLM """ from statsmodels.compat import range import os import numpy as np from numpy.testing import (assert_almost_equal, assert_equal, assert_raises, assert_allclose, assert_, assert_array_less, dec) from scipy import stats import statsmodels.api as sm from st...
bsd-3-clause
UnitedThruAction/Data
Tools/FuzzyMatch.py
1
5653
"""A utility for fuzzy-matching people between the NY State Voter File and other data sources, e.g. Campaign Finance records or call records. Uses [fuzzywuzzy](https://github.com/seatgeek/fuzzywuzzy) to fuzzy-match name strings, with a bit of added interpersonal intelligence. @author n.o.franklin@gmail.com """ import...
apache-2.0
sinhrks/pyopendata
pyopendata/tests/test_eurostat.py
1
4053
# pylint: disable-msg=E1101,W0613,W0603 from pyopendata import EurostatStore, EurostatResource import numpy as np import pandas as pd from pandas.compat import range import pandas.util.testing as tm class TestEurostatTestSite(tm.TestCase): def setUp(self): self.store = EurostatStore() def test_isv...
bsd-2-clause
asnorkin/sentiment_analysis
site/lib/python2.7/site-packages/sklearn/neighbors/tests/test_kde.py
80
5560
import numpy as np from sklearn.utils.testing import (assert_allclose, assert_raises, assert_equal) from sklearn.neighbors import KernelDensity, KDTree, NearestNeighbors from sklearn.neighbors.ball_tree import kernel_norm from sklearn.pipeline import make_pipeline from sklearn.dataset...
mit
nikitasingh981/scikit-learn
sklearn/neighbors/tests/test_lof.py
34
4142
# Authors: Nicolas Goix <nicolas.goix@telecom-paristech.fr> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # License: BSD 3 clause from math import sqrt import numpy as np from sklearn import neighbors from numpy.testing import assert_array_equal from sklearn import metrics from sklearn.metr...
bsd-3-clause
pcmagic/stokes_flow
src/StokesFlowMethod_bck.py
1
70276
# coding=utf-8 import numpy as np from mpi4py import MPI from petsc4py import PETSc from numpy import pi from src import stokes_flow as sf from src import geo from tqdm import tqdm # from multiprocessing import cpu_count, Pool # from numba import jit # import numexpr as ne # from numpy import linalg as LA def delta...
mit
metalpen1984/SciTool_Py
gridtransU.py
1
15622
#!/usr/bin/python #Purpose: 1. To convert the grid data of following format to each other: # .sa .xyz .asc .pfb # (simple ascii, xyz, ascii grid, parflow binary) # 2. To simply plot the figure from the single output file. #ChangeLog: 20150429: Changing the reading method of read pfb. Make ...
lgpl-3.0
githubgir/LittleVeniceML
StrategyModule.py
1
47213
# -*- coding: utf-8 -*- """ Created on Mon Aug 6 10:47:43 2018 @author: Andreas """ import pandas as pd import dateutil import datetime import numpy as np import xarray as xr import re import pickle import seaborn as sns from StrategyUtils import * import matplotlib.pyplot as plt from IPython.core...
gpl-3.0
mizzao/ggplot
ggplot/tests/test_element_text.py
12
1362
from nose.tools import assert_equal, assert_true from ggplot.tests import image_comparison, cleanup from ggplot import * from numpy import linspace from pandas import DataFrame df = DataFrame({"blahblahblah": linspace(999, 1111, 9), "yadayadayada": linspace(999, 1111, 9)}) simple_gg = ggplot(aes(x="b...
bsd-2-clause
NehaMadalmatti/ml_lab_ecsc_306
labwork/lab2/sci-learn/non_linear_regression.py
120
1520
""" =================================================================== Support Vector Regression (SVR) using linear and non-linear kernels =================================================================== Toy example of 1D regression using linear, polynomial and RBF kernels. """ print(__doc__) import numpy as np ...
apache-2.0
zak-k/cis
cis/plotting/scatter_plot.py
1
5546
from cis.plotting.generic_plot import Generic_Plot class Scatter_Plot(Generic_Plot): def plot(self): """ Plots one or many scatter plots Stores the plot in a list to be used for when adding the legend """ from cis.plotting.plot import colors from cis.exceptions impo...
gpl-3.0
luiscruz/udacity_data_analyst
P05/src/tester.py
1
4508
#!/usr/bin/pickle """ a basic script for importing student's POI identifier, and checking the results that they get from it requires that the algorithm, dataset, and features list be written to my_classifier.pkl, my_dataset.pkl, and my_feature_list.pkl, respectively that process should happen a...
mit
waterponey/scikit-learn
examples/plot_compare_reduction.py
19
2489
#!/usr/bin/python # -*- coding: utf-8 -*- """ ================================================================= Selecting dimensionality reduction with Pipeline and GridSearchCV ================================================================= This example constructs a pipeline that does dimensionality reduction follo...
bsd-3-clause
moonbury/pythonanywhere
github/MasteringMLWithScikit-learn/8365OS_05_Codes/ch5.py
3
20416
################# Figures 05_01 ################# """ """ import pandas as pd from sklearn.tree import DecisionTreeClassifier, export_graphviz from sklearn.feature_extraction import DictVectorizer from sklearn.metrics import classification_report instances = [ {'plays fetch': True, 'species': 'Dog'}, {'plays ...
gpl-3.0
3manuek/scikit-learn
benchmarks/bench_sgd_regression.py
283
5569
""" Benchmark for SGD regression Compares SGD regression against coordinate descent and Ridge on synthetic data. """ print(__doc__) # Author: Peter Prettenhofer <peter.prettenhofer@gmail.com> # License: BSD 3 clause import numpy as np import pylab as pl import gc from time import time from sklearn.linear_model i...
bsd-3-clause
archangdcc/avalon-extras
farm-manager/status-report/tmplot.py
3
14721
#!/usr/bin/env python2 from __future__ import print_function import os import re import datetime import sys import numpy as np import matplotlib matplotlib.use('Agg', warn=False) import matplotlib.pyplot as plt import matplotlib.cm as cm from matplotlib import gridspec from statlogging import readlog def tmplot(ti...
unlicense
manpen/hypergen
libs/NetworKit/scripts/DynamicBetweennessExperiments_fixed_batch.py
3
4514
from networkit import * from networkit.dynamic import * from networkit.centrality import * import pandas as pd import random def isConnected(G): cc = properties.ConnectedComponents(G) cc.run() return (cc.numberOfComponents() == 1) def removeAndAddEdges(G, nEdges, tabu=None): if nEdges > G.numberOfEdges() - tabu....
gpl-3.0
ajdawson/eofs
examples/iris/hgt_example.py
1
1873
""" Compute and plot the leading EOF of geopotential height on the 500 hPa pressure surface over the European/Atlantic sector during winter time. This example uses the metadata-retaining iris interface. Additional requirements for this example: * iris (http://scitools.org.uk/iris/) * matplotlib (http://matpl...
gpl-3.0
depet/scikit-learn
examples/svm/plot_iris.py
5
1952
""" ================================================== Plot different SVM classifiers in the iris dataset ================================================== Comparison of different linear SVM classifiers on the iris dataset. It will plot the decision surface for four different SVM classifiers. """ print(__doc__) imp...
bsd-3-clause
andyraib/data-storage
python_scripts/env/lib/python3.6/site-packages/pandas/compat/numpy/__init__.py
7
2205
""" support numpy compatiblitiy across versions """ import re import numpy as np from distutils.version import LooseVersion from pandas.compat import string_types, string_and_binary_types # numpy versioning _np_version = np.version.short_version _nlv = LooseVersion(_np_version) _np_version_under1p8 = _nlv < '1.8' _n...
apache-2.0
rajat1994/scikit-learn
sklearn/utils/tests/test_estimator_checks.py
202
3757
import scipy.sparse as sp import numpy as np import sys from sklearn.externals.six.moves import cStringIO as StringIO from sklearn.base import BaseEstimator, ClassifierMixin from sklearn.utils.testing import assert_raises_regex, assert_true from sklearn.utils.estimator_checks import check_estimator from sklearn.utils....
bsd-3-clause
stkubr/zipline
zipline/utils/data_source_tables_gen.py
40
7380
# # 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
iamshang1/Projects
Basic_ML/Recommendation_System/nearest_neighbors.py
1
4332
import numpy as np import pandas as pd from sklearn import cross_validation from scipy import sparse from scipy.spatial import distance #load data print "loading data" ratings = pd.read_csv('u.data', sep = "\t", names = ['uid','mid','rating','timestamp'], engine='python') ratings.iloc[0,0] = 1 ratings['uid'] = pd.to_n...
mit
madphysicist/numpy
numpy/fft/_pocketfft.py
2
52860
""" Discrete Fourier Transforms Routines in this module: fft(a, n=None, axis=-1, norm="backward") ifft(a, n=None, axis=-1, norm="backward") rfft(a, n=None, axis=-1, norm="backward") irfft(a, n=None, axis=-1, norm="backward") hfft(a, n=None, axis=-1, norm="backward") ihfft(a, n=None, axis=-1, norm="backward") fftn(a, ...
bsd-3-clause
appapantula/pattern_classification
machine_learning/webapp/movieclassifier/app.py
17
3048
from flask import Flask, render_template, request from wtforms import Form, TextAreaField, validators import pickle import sqlite3 import re import os import numpy as np app = Flask(__name__) ######## Preparing the Classifier import re from sklearn.feature_extraction.text import HashingVectorizer cur_dir = os.path....
gpl-3.0
kyleabeauchamp/HMCNotes
code/optimize/test_optimize_hyper_ghmc_respa.py
1
2379
from hyperopt import fmin, tpe, hp import lb_loader import pandas as pd import simtk.openmm.app as app import numpy as np import simtk.openmm as mm from simtk import unit as u from openmmtools import hmc_integrators, testsystems pd.set_option('display.width', 1000) n_steps = 1000 platform_name = "CUDA" precision = "mi...
gpl-2.0
shenzebang/scikit-learn
sklearn/tree/tests/test_export.py
130
9950
""" Testing for export functions of decision trees (sklearn.tree.export). """ from re import finditer from numpy.testing import assert_equal from nose.tools import assert_raises from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor from sklearn.ensemble import GradientBoostingClassifier from sklearn...
bsd-3-clause
hrjn/scikit-learn
examples/linear_model/plot_ransac.py
103
1797
""" =========================================== Robust linear model estimation using RANSAC =========================================== In this example we see how to robustly fit a linear model to faulty data using the RANSAC algorithm. """ import numpy as np from matplotlib import pyplot as plt from sklearn import ...
bsd-3-clause
prashanthpai/swift
swift/common/middleware/xprofile.py
8
9623
# Copyright (c) 2010-2012 OpenStack, 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
zehpunktbarron/iOSMAnalyzer
scripts/c3_car_routing_high_net.py
1
7565
# -*- coding: utf-8 -*- #!/usr/bin/python2.7 #description :This file creates a plot: Calculates the development of the OSM road network length [km] by street-category #author :Christopher Barron @ http://giscience.uni-hd.de/ #date :19.01.2013 #version :0.1 #usage :python pyscr...
gpl-3.0
bartosh/zipline
tests/pipeline/test_slice.py
6
20007
""" Tests for slicing pipeline terms. """ from numpy import where from pandas import Int64Index, Timestamp from pandas.util.testing import assert_frame_equal from zipline.assets import Asset from zipline.errors import ( NonExistentAssetInTimeFrame, NonSliceableTerm, NonWindowSafeInput, UnsupportedPipel...
apache-2.0
florian-f/sklearn
sklearn/tests/test_cross_validation.py
1
21366
"""Test the cross_validation module""" import warnings import numpy as np from scipy.sparse import coo_matrix from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_raises from sklearn...
bsd-3-clause
alexis-jacq/Story_CoWriting
tools/log_analysis/pred.py
1
1487
import pandas as pd import seaborn as sns import numpy as np import os from scipy.stats import ttest_ind,ttest_rel p = "LOG_P_CSV" s = "LOG_S_CSV" r = "LOG_R_CSV" file_subject = "interface-12-stdout.log" file_robot = "main_activity-13-stdout.log" counters_p = [] counters_s = [] counters_r = [] def counts(condition...
isc
JeanKossaifi/scikit-learn
examples/cluster/plot_digits_agglomeration.py
377
1694
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Feature agglomeration ========================================================= These images how similar features are merged together using feature agglomeration. """ print(__doc__) # Code source: Gaël Varoquaux #...
bsd-3-clause
aflaxman/scikit-learn
examples/linear_model/plot_polynomial_interpolation.py
168
2088
#!/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
zorroblue/scikit-learn
benchmarks/bench_plot_lasso_path.py
84
4005
"""Benchmarks of Lasso regularization path computation using Lars and CD The input data is mostly low rank but is a fat infinite tail. """ from __future__ import print_function from collections import defaultdict import gc import sys from time import time import numpy as np from sklearn.linear_model import lars_pat...
bsd-3-clause
vighneshbirodkar/scikit-image
doc/examples/features_detection/plot_shape_index.py
5
4382
""" =========== Shape Index =========== The shape index is a single valued measure of local curvature, derived from the eigen values of the Hessian, defined by Koenderink & van Doorn [1]_. It can be used to find structures based on their apparent local shape. The shape index maps to values from -1 to 1, representing...
bsd-3-clause
dingocuster/scikit-learn
sklearn/ensemble/tests/test_voting_classifier.py
140
6926
"""Testing for the boost module (sklearn.ensemble.boost).""" import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_equal from sklearn.linear_model import LogisticRegression from sklearn.naive_bayes import GaussianNB from sklearn.ensemble import RandomForestCl...
bsd-3-clause
nkmk/python-snippets
notebook/sklearn_train_test_split_iris.py
1
1326
from sklearn.model_selection import train_test_split from sklearn.datasets import load_iris data = load_iris() X = data['data'] y = data['target'] print(X.shape) # (150, 4) print(X[:5]) # [[5.1 3.5 1.4 0.2] # [4.9 3. 1.4 0.2] # [4.7 3.2 1.3 0.2] # [4.6 3.1 1.5 0.2] # [5. 3.6 1.4 0.2]] print(y.shape) # (150,)...
mit
mojoboss/scikit-learn
examples/applications/plot_prediction_latency.py
234
11277
""" ================== Prediction Latency ================== This is an example showing the prediction latency of various scikit-learn estimators. The goal is to measure the latency one can expect when doing predictions either in bulk or atomic (i.e. one by one) mode. The plots represent the distribution of the pred...
bsd-3-clause
zihua/scikit-learn
benchmarks/bench_plot_approximate_neighbors.py
244
6011
""" Benchmark for approximate nearest neighbor search using locality sensitive hashing forest. There are two types of benchmarks. First, accuracy of LSHForest queries are measured for various hyper-parameters and index sizes. Second, speed up of LSHForest queries compared to brute force method in exact nearest neigh...
bsd-3-clause
kshedstrom/pyroms
pyroms_toolbox/pyroms_toolbox/twoDview.py
2
7579
import numpy as np import matplotlib.pyplot as plt from matplotlib import cm, colors from mpl_toolkits.basemap import Basemap import pyroms import pyroms_toolbox def twoDview(var, tindex, grid, filename=None, \ cmin=None, cmax=None, clev=None, fill=False, \ contour=False, d=4, range=None, fts=Non...
bsd-3-clause
viswimmer1/PythonGenerator
data/python_files/30585325/dot.py
1
1176
import os, sys up_path = os.path.abspath('..') sys.path.append(up_path) from numpy import * import matplotlib import matplotlib.pyplot as plt import matplotlib.patches as mpatches from matplotlib import rc from objects import SimObject from utils import scalar from covar import draw_ellipsoid, vec2cov, cov2vec,\ pr...
gpl-2.0
ywcui1990/nupic.research
htmresearch/support/sp_paper_utils.py
6
11432
#!/usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2016, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions ...
agpl-3.0
mreineck/healpy
doc/create_images.py
7
1087
import healpy as hp import numpy as np import matplotlib.pyplot as plt SIZE = 400 DPI = 60 m = np.arange(hp.nside2npix(32)) hp.mollview(m, nest = True, xsize=SIZE, title='Mollview image NESTED') plt.savefig('static/moll_nside32_nest.png', dpi=DPI) hp.mollview(m, nest = False, xsize=SIZE, title='Mollview image RING')...
gpl-2.0
Lynn-015/NJU_DMRG
homework/Homework_01.py
1
1112
#!/usr/bin/env python """ Tight-binding chain e0:on-site energy t:hopping t N:chain length N. """ import numpy as np import matplotlib.pyplot as plt def band_energy(k,t=1.0,e0=0.2,a=1.0): """The function of energy with respect to k.""" return e0-t*np.exp(1j*k*a)-t*np.exp(-1j*k*a) def band_plot(N=400,a=1.0): ...
mit
ZENGXH/scikit-learn
examples/applications/plot_tomography_l1_reconstruction.py
204
5442
""" ====================================================================== 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
pratapvardhan/pandas
pandas/tests/indexes/multi/test_equivalence.py
2
7275
# -*- coding: utf-8 -*- import numpy as np import pandas as pd import pandas.util.testing as tm from pandas import Index, MultiIndex, RangeIndex, Series, compat from pandas.compat import lrange, lzip, range def test_equals(idx): # TODO: Remove or Refactor. MultiIndex not tested. for name, idx in compat.iter...
bsd-3-clause