repo_name
stringlengths
7
84
path
stringlengths
5
184
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
978
477k
license
stringclasses
15 values
yonglehou/scikit-learn
examples/neighbors/plot_classification.py
287
1790
""" ================================ Nearest Neighbors Classification ================================ Sample usage of Nearest Neighbors 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 ListedColorm...
bsd-3-clause
Bismarrck/tensorflow
tensorflow/contrib/factorization/python/ops/kmeans_test.py
16
21836
# 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
samuel1208/scikit-learn
examples/covariance/plot_sparse_cov.py
300
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
kernc/scikit-learn
examples/covariance/plot_robust_vs_empirical_covariance.py
73
6451
r""" ======================================= Robust vs Empirical covariance estimate ======================================= The usual covariance maximum likelihood estimate is very sensitive to the presence of outliers in the data set. In such a case, it would be better to use a robust estimator of covariance to guar...
bsd-3-clause
tomlof/scikit-learn
sklearn/decomposition/tests/test_online_lda.py
24
14430
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
kchodorow/tensorflow
tensorflow/examples/learn/iris_run_config.py
86
2087
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
apache-2.0
DailyActie/Surrogate-Model
01-codes/scikit-learn-master/sklearn/ensemble/tests/test_iforest.py
1
6658
""" Testing for Isolation Forest algorithm (sklearn.ensemble.iforest). """ # Authors: Nicolas Goix <nicolas.goix@telecom-paristech.fr> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # License: BSD 3 clause import numpy as np from scipy.sparse import csc_matrix, csr_matrix from sklearn.cross_v...
mit
shenzebang/scikit-learn
examples/classification/plot_classifier_comparison.py
181
4699
#!/usr/bin/python # -*- coding: utf-8 -*- """ ===================== Classifier comparison ===================== A comparison of a several classifiers in scikit-learn on synthetic datasets. The point of this example is to illustrate the nature of decision boundaries of different classifiers. This should be taken with ...
bsd-3-clause
scipy/scipy
scipy/signal/wavelets.py
16
14046
import numpy as np from scipy.linalg import eig from scipy.special import comb from scipy.signal import convolve __all__ = ['daub', 'qmf', 'cascade', 'morlet', 'ricker', 'morlet2', 'cwt'] def daub(p): """ The coefficients for the FIR low-pass filter producing Daubechies wavelets. p>=1 gives the order of...
bsd-3-clause
clemkoa/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
mrkowalski/kaggle_santander
scikit/src/commons.py
1
7185
import pandas as pd import numpy as np from sklearn.externals import joblib from sklearn.preprocessing import LabelEncoder from functools import partial import re num_months = 4 chunk_size = 1000000 indicators = ['ind_ahor_fin_ult1', 'ind_aval_fin_ult1', 'ind_cco_fin_ult1', 'ind_cder_fin_ult1', 'ind_cno_fin_ult1', ...
mit
kevinyu98/spark
dev/sparktestsupport/modules.py
3
16591
# # 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
ldirer/scikit-learn
sklearn/utils/multiclass.py
15
15056
# Author: Arnaud Joly, Joel Nothman, Hamzeh Alsalhi # # License: BSD 3 clause """ Multi-class / multi-label utility function ========================================== """ from __future__ import division from collections import Sequence from itertools import chain from scipy.sparse import issparse from scipy.sparse.b...
bsd-3-clause
rvanderheyde/SoftwareSystems
hw04/wave3/generate_sine.py
23
2124
"""This file contains code used in "Think DSP", by Allen B. Downey, available from greenteapress.com Copyright 2013 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ import thinkdsp import thinkplot import matplotlib.pyplot as pyplot def print_reverse_tables(): print 'int reverse1[] =...
gpl-3.0
harterj/moose
modules/combined/examples/geochem-porous_flow/geotes_weber_tensleep/scaling.py
9
1503
#!/usr/bin/env python3 #* This file is part of the MOOSE framework #* https://www.mooseframework.org #* #* All rights reserved, see COPYRIGHT for full restrictions #* https://github.com/idaholab/moose/blob/master/COPYRIGHT #* #* Licensed under LGPL 2.1, please see LICENSE for details #* https://www.gnu.org/licenses/lgp...
lgpl-2.1
tgsmith61591/skutil
skutil/h2o/util.py
1
13251
from __future__ import print_function, division, absolute_import import numpy as np import h2o import pandas as pd import warnings from collections import Counter from pkg_resources import parse_version from ..utils import (validate_is_pd, human_bytes, corr_plot, load_breast_cancer_df, load_iris_d...
bsd-3-clause
fbuitron/FBMusic_ML_be
INTERACTIVE/MachineLearning/Classification.py
1
4629
import numpy as np import pandas as pd from sklearn import neighbors, tree from sklearn import cross_validation from . import Preprocessing # import Preprocessing as Preprocessing def excKNN(k, train_data, train_labels, test_data, test_labels): errorCount = 0.0 knnclf = neighbors.KNeighborsClassifier(k, weight...
apache-2.0
bwc126/MLND-Subvocal
prepare_EMG.py
1
2434
# TODO: Separate EMG data into 50ms windows, run FFT + preprocessing. from pandas import DataFrame from scipy.fftpack import rfft, rfftfreq import time import numpy as np class EMG_preparer(): """ An EMG_preparer prepares EMG data for training a subvocal recognition classification system. Scipy's cwt algorithm is...
mit
jusjusjus/Motiftoolbox
Tools/network3N.py
1
5648
#!/usr/bin/env python import sys sys.path.insert(0, '../Tools') import window as win import numpy as np import pylab as pl import matplotlib.patches as mpatches win_width, win_height, margin = 700, 600, 10 text2coupling = {} text2coupling[0] = 2 text2coupling[1] = 0 text2coupling[2] = 5 text2coupling[3] = 3 text2c...
gpl-2.0
phipleg/pymlp
plt_pixels.py
1
1131
import time import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator def draw_pixels(fig, ax, pixel_sequences, inner, outer): m = np.zeros((inner[1] * outer[1], inner[0] * outer[0])) for k, pixel_seq in enumerate(pixel_sequences): oy = k / outer[0] ox = ...
apache-2.0
pythonvietnam/scikit-learn
sklearn/decomposition/nmf.py
100
19059
""" Non-negative matrix factorization """ # Author: Vlad Niculae # Lars Buitinck <L.J.Buitinck@uva.nl> # Author: Chih-Jen Lin, National Taiwan University (original projected gradient # NMF implementation) # Author: Anthony Di Franco (original Python and NumPy port) # License: BSD 3 clause from __future__ ...
bsd-3-clause
datapythonista/pandas
pandas/tests/frame/methods/test_rank.py
1
15673
from datetime import ( datetime, timedelta, ) import numpy as np import pytest from pandas._libs.algos import ( Infinity, NegInfinity, ) import pandas.util._test_decorators as td from pandas import ( DataFrame, Series, ) import pandas._testing as tm class TestRank: s = Series([1, 3, 4, ...
bsd-3-clause
beepee14/scikit-learn
examples/decomposition/plot_pca_vs_fa_model_selection.py
142
4467
""" =============================================================== Model selection with Probabilistic PCA and Factor Analysis (FA) =============================================================== Probabilistic PCA and Factor Analysis are probabilistic models. The consequence is that the likelihood of new data can be u...
bsd-3-clause
josl/ThinkStats2
code/regression.py
62
9652
"""This file contains code used in "Think Stats", by Allen B. Downey, available from greenteapress.com Copyright 2010 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ from __future__ import print_function, division import math import pandas import random import numpy as np import statsmode...
gpl-3.0
Adai0808/scikit-learn
sklearn/ensemble/partial_dependence.py
251
15097
"""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
pradyu1993/scikit-learn
sklearn/utils/tests/test_shortest_path.py
11
2828
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
uhjish/seaborn
seaborn/tests/test_rcmod.py
11
7231
import numpy as np import matplotlib as mpl from distutils.version import LooseVersion import nose import matplotlib.pyplot as plt import nose.tools as nt import numpy.testing as npt from .. import rcmod class RCParamTester(object): def flatten_list(self, orig_list): iter_list = map(np.atleast_1d, orig...
bsd-3-clause
neelravi/vasp
bandplotting-orb-resolved-bug-removed.py
1
5098
#!/usr/bin/env python # -*- coding=utf-8 -*- # A Python code for plotting orbital-resolved bandstructure. # Written by : Internet # catalyst : Ravindra # under the eagle eyes of : Rinkle import sys import os import numpy as np from numpy import array as npa import matplotlib as...
gpl-3.0
apache/incubator-superset
superset/datasets/commands/importers/v1/utils.py
1
4283
# 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
Novasoft-India/OperERP-AM-Motors
openerp/addons/resource/faces/timescale.py
170
3902
############################################################################ # Copyright (C) 2005 by Reithinger GmbH # mreithinger@web.de # # This file is part of faces. # # faces is free software; you can redistribute it and/or modify # ...
agpl-3.0
sniemi/SamPy
sandbox/src2/src/SplineFitting.py
2
2887
''' Created on Nov 26, 2009 @author: Sami-Matias Niemi ''' import numpy as N import scipy.signal as SS import scipy.interpolate as I import scipy.optimize as O import pylab as P class SplineFitting: def __init__(self, xnodes, spline_order = 3): ''' ''' self.xnodes = xnodes se...
bsd-2-clause
chenjun0210/tensorflow
tensorflow/python/estimator/inputs/queues/feeding_queue_runner_test.py
116
5164
# 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
KristoferHellman/gimli
doc/examples/modelling/dev/multi/ert.py
1
10724
#!/usr/bin/env python """ Test multi """ import sys import time import matplotlib.pyplot as plt import numpy as np import pygimli as pg from pygimli.viewer import * from pygimli.solver import * from pygimli.meshtools import * import pybert as pb import pybert.dataview def createCacheName(base, mesh=None): nc...
gpl-3.0
yl565/statsmodels
statsmodels/stats/sandwich_covariance.py
3
28418
# -*- coding: utf-8 -*- """Sandwich covariance estimators Created on Sun Nov 27 14:10:57 2011 Author: Josef Perktold Author: Skipper Seabold for HCxxx in linear_model.RegressionResults License: BSD-3 Notes ----- for calculating it, we have two versions version 1: use pinv pinv(x) scale pinv(x) used currently in...
bsd-3-clause
rexshihaoren/scikit-learn
examples/ensemble/plot_ensemble_oob.py
259
3265
""" ============================= OOB Errors for Random Forests ============================= The ``RandomForestClassifier`` is trained using *bootstrap aggregation*, where each new tree is fit from a bootstrap sample of the training observations :math:`z_i = (x_i, y_i)`. The *out-of-bag* (OOB) error is the average er...
bsd-3-clause
yavalvas/yav_com
build/matplotlib/examples/pylab_examples/fill_betweenx_demo.py
12
1576
import matplotlib.mlab as mlab from matplotlib.pyplot import figure, show import numpy as np ## Copy of fill_between.py but using fill_betweenx() instead. x = np.arange(0.0, 2, 0.01) y1 = np.sin(2*np.pi*x) y2 = 1.2*np.sin(4*np.pi*x) fig = figure() ax1 = fig.add_subplot(311) ax2 = fig.add_subplot(312, sharex=ax1) ax3...
mit
michaelmanhart/pathman
Plot_RBM_output.py
1
13564
################################################################################ # Plotting Script for Landscape and Properties of the RBM # Copyright (c) 2015 Michael Manhart and Willow Kion-Crosby # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Gene...
gpl-3.0
shenzebang/scikit-learn
examples/applications/topics_extraction_with_nmf_lda.py
133
3517
""" ======================================================================================== Topics extraction with Non-Negative Matrix Factorization And Latent Dirichlet Allocation ======================================================================================== This is an example of applying Non Negative Matr...
bsd-3-clause
MatthewDaggitt/PathVision
modules/pathDisplayModule.py
1
3864
import tkinter from itertools import groupby from collections import defaultdict import matplotlib.pyplot as plt from matplotlib.colors import to_hex import networkx as nx import settings from modules.shared.graphFrame import GraphFrame from modules.shared.graphInteraction import DrawData ################ ## Control...
mit
JsNoNo/scikit-learn
examples/cluster/plot_kmeans_assumptions.py
270
2040
""" ==================================== Demonstration of k-means assumptions ==================================== This example is meant to illustrate situations where k-means will produce unintuitive and possibly unexpected clusters. In the first three plots, the input data does not conform to some implicit assumptio...
bsd-3-clause
srio/shadow3-scripts
test_binormal_sampling.py
1
1618
import numpy as np import matplotlib.pyplot as plt # inputs (mean is zero) mean = [0,0] sig1 = 1.0 sig2 = 2.0 rho = -0.75 Npoints = 5000 #covariance matrix cov = np.array( [[sig1*sig1,rho*sig1*sig2],[rho*sig1*sig2,sig2*sig2]] ) print("\n\n input covariance matrix: ",cov) # # method 1: using np routine # x,y = np....
mit
cwhanse/pvlib-python
docs/examples/plot_interval_transposition_error.py
2
6815
""" Modeling with interval averages =============================== Transposing interval-averaged irradiance data """ # %% # This example shows how failing to account for the difference between # instantaneous and interval-averaged time series data can introduce # error in the modeling process. An instantaneous time ...
bsd-3-clause
AlexRobson/scikit-learn
examples/ensemble/plot_adaboost_twoclass.py
347
3268
""" ================== Two-class AdaBoost ================== This example fits an AdaBoosted decision stump on a non-linearly separable classification dataset composed of two "Gaussian quantiles" clusters (see :func:`sklearn.datasets.make_gaussian_quantiles`) and plots the decision boundary and decision scores. The di...
bsd-3-clause
lucasosouza/graph-competition
pagerank2.py
1
3831
import os import sys import math import numpy import pandas import pickle # Generalized matrix operations: def __extractNodes(matrix): nodes = set() for colKey in matrix: nodes.add(colKey) for rowKey in matrix.T: nodes.add(rowKey) return nodes def __makeSquare(matrix, keys, default=0...
mit
eljost/pysisyphus
tests_staging/hcn_iso/hcn_iso.py
1
1938
#!/usr/bin/env python3 import matplotlib.pyplot as plt import numpy as np from calculators.ORCA import ORCA from calculators.IDPP import idpp_interpolate from cos.NEB import NEB from cos.SimpleZTS import SimpleZTS from Geometry import Geometry from optimizers.SteepestDescent import SteepestDescent from optimizers.FIR...
gpl-3.0
davidgbe/scikit-learn
sklearn/feature_selection/variance_threshold.py
238
2594
# Author: Lars Buitinck <L.J.Buitinck@uva.nl> # License: 3-clause BSD import numpy as np from ..base import BaseEstimator from .base import SelectorMixin from ..utils import check_array from ..utils.sparsefuncs import mean_variance_axis from ..utils.validation import check_is_fitted class VarianceThreshold(BaseEstim...
bsd-3-clause
mick-d/nipype
nipype/utils/config.py
1
11215
# -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: ''' Created on 20 Apr 2010 logging options : INFO, DEBUG hash_method : content, timestamp @author: Chris Filo Gorgolewski ''' from __future__ import print_function, division, unico...
bsd-3-clause
witcxc/scipy
scipy/signal/spectral.py
3
13830
"""Tools for spectral analysis. """ from __future__ import division, print_function, absolute_import import numpy as np from scipy import fftpack from . import signaltools from .windows import get_window from ._spectral import lombscargle import warnings from scipy._lib.six import string_types __all__ = ['periodogr...
bsd-3-clause
bhargav/scikit-learn
sklearn/datasets/tests/test_lfw.py
55
7877
"""This test for the LFW require medium-size data downloading 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
jeammimi/deepnano5bases
src/data/get_optimal_gamma.py
1
15855
if __name__ == "__main__": import argparse import json from git import Repo import os from multiprocessing import Pool import numpy as np from ..data.dataset import Dataset, NotAllign from ..features.helpers import scale_simple, scale_named, scale_named2, scale_named4, scale_named4s ...
mit
dyoung418/tensorflow
tensorflow/contrib/learn/python/learn/estimators/_sklearn.py
153
6723
# 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
thilbern/scikit-learn
sklearn/linear_model/stochastic_gradient.py
3
49778
# Authors: Peter Prettenhofer <peter.prettenhofer@gmail.com> (main author) # Mathieu Blondel (partial_fit support) # # License: BSD 3 clause """Classification and regression using Stochastic Gradient Descent (SGD).""" import numpy as np import scipy.sparse as sp from abc import ABCMeta, abstractmethod from ...
bsd-3-clause
datapythonista/pandas
pandas/tests/tseries/holiday/test_calendar.py
4
3531
from datetime import datetime import pytest from pandas import ( DatetimeIndex, offsets, to_datetime, ) import pandas._testing as tm from pandas.tseries.holiday import ( AbstractHolidayCalendar, Holiday, Timestamp, USFederalHolidayCalendar, USLaborDay, USThanksgivingDay, get_c...
bsd-3-clause
yunfeilu/scikit-learn
examples/covariance/plot_sparse_cov.py
300
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
snurk/meta-strains
final_algo/read_files.py
1
4683
import pandas as pd from collections import Counter from itertools import permutations import networkx as nx from graph_functions import * def read_graph(dataset_name="example"): G = nx.DiGraph() df_cov = pd.read_csv("data/{}/edge_profiles_0.txt".format(dataset_name), sep=' ', index_...
mit
eg-zhang/scikit-learn
sklearn/tree/tree.py
59
34839
""" 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
hsk81/rpc.js
server/py/plot.py
1
3297
#!/usr/bin/env python ############################################################################### import argparse, os, sys from datetime import datetime from matplotlib import pyplot from matplotlib import pylab ############################################################################### #####################...
gpl-3.0
sapfo/medeas
processing/freqs.py
1
2054
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 20 11:31:18 2017 @author: ivan """ import numpy as np import sys import matplotlib.pyplot as plt from typing import Tuple from collections import defaultdict import pickle from options import TESTING freqs = defaultdict(list) bars = defaultdict(l...
gpl-3.0
RapidApplicationDevelopment/tensorflow
tensorflow/contrib/learn/python/learn/dataframe/tensorflow_dataframe.py
75
29377
# 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
Vimos/scikit-learn
benchmarks/bench_covertype.py
57
7378
""" =========================== Covertype dataset benchmark =========================== Benchmark stochastic gradient descent (SGD), Liblinear, and Naive Bayes, CART (decision tree), RandomForest and Extra-Trees on the forest covertype dataset of Blackard, Jock, and Dean [1]. The dataset comprises 581,012 samples. It ...
bsd-3-clause
ldirer/scikit-learn
benchmarks/bench_plot_incremental_pca.py
374
6430
""" ======================== IncrementalPCA benchmark ======================== Benchmarks for IncrementalPCA """ import numpy as np import gc from time import time from collections import defaultdict import matplotlib.pyplot as plt from sklearn.datasets import fetch_lfw_people from sklearn.decomposition import Incre...
bsd-3-clause
hlin117/scikit-learn
sklearn/covariance/tests/test_robust_covariance.py
28
3792
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Gael Varoquaux <gael.varoquaux@normalesup.org> # Virgile Fritsch <virgile.fritsch@inria.fr> # # License: BSD 3 clause import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_alm...
bsd-3-clause
lancezlin/ml_template_py
lib/python2.7/site-packages/matplotlib/tests/test_rcparams.py
6
15775
from __future__ import (absolute_import, division, print_function, unicode_literals) from matplotlib.externals import six import io import os import sys import warnings from cycler import cycler, Cycler import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.tests import ass...
mit
UCSC-iGEM-2016/taris_controller
taris_controller/taris_calibrate.py
1
4385
import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import Button import time class ButtonSet: def __init__(self, px, mx, kx): self.buttonP = Button(px, '+') self.buttonM = Button(mx, '-') self.stVal = kx self.buttonP.on_clicked(self.button_handler...
gpl-3.0
vigilv/scikit-learn
sklearn/ensemble/tests/test_base.py
284
1328
""" Testing for the base module (sklearn.ensemble.base). """ # Authors: Gilles Louppe # License: BSD 3 clause from numpy.testing import assert_equal from nose.tools import assert_true from sklearn.utils.testing import assert_raise_message from sklearn.datasets import load_iris from sklearn.ensemble import BaggingCla...
bsd-3-clause
orbitfold/tardis
tardis/plasma/properties/level_population.py
1
4820
import logging import pandas as pd import numpy as np from tardis.plasma.properties.base import ProcessingPlasmaProperty logger = logging.getLogger(__name__) __all__ = ['LevelNumberDensity', 'LevelNumberDensityHeNLTE'] class LevelNumberDensity(ProcessingPlasmaProperty): """ Attributes: level_number_dens...
bsd-3-clause
bthirion/scikit-learn
sklearn/utils/multiclass.py
2
14743
# Author: Arnaud Joly, Joel Nothman, Hamzeh Alsalhi # # License: BSD 3 clause """ Multi-class / multi-label utility function ========================================== """ from __future__ import division from collections import Sequence from itertools import chain from scipy.sparse import issparse from scipy.sparse....
bsd-3-clause
belltailjp/scikit-learn
examples/svm/plot_svm_nonlinear.py
61
1089
""" ============== Non-linear SVM ============== Perform binary classification using non-linear SVC with RBF kernel. The target to predict is a XOR of the inputs. The color map illustrates the decision function learn by the SVC. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from sklearn impor...
bsd-3-clause
yunque/sms-tools
software/models_interface/sineModel_function.py
21
2749
# function to call the main analysis/synthesis functions in software/models/sineModel.py import numpy as np import matplotlib.pyplot as plt from scipy.signal import get_window import os, sys sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../models/')) import utilFunctions as UF import sineM...
agpl-3.0
trachelr/mne-python
examples/visualization/plot_topo_compare_conditions.py
7
2375
""" ================================================= Compare evoked responses for different conditions ================================================= In this example, an Epochs object for visual and auditory responses is created. Both conditions are then accessed by their respective names to create a sensor layout...
bsd-3-clause
jeffery-do/Vizdoombot
doom/lib/python3.5/site-packages/scipy/integrate/quadrature.py
33
28087
from __future__ import division, print_function, absolute_import import numpy as np import math import warnings # trapz is a public function for scipy.integrate, # even though it's actually a numpy function. from numpy import trapz from scipy.special.orthogonal import p_roots from scipy.special import gammaln from sc...
mit
paladin74/neural-network-animation
matplotlib/tests/test_png.py
10
1259
from __future__ import (absolute_import, division, print_function, unicode_literals) import six import glob import os import numpy as np from matplotlib.testing.decorators import image_comparison from matplotlib import pyplot as plt import matplotlib.cm as cm @image_comparison(baseline_ima...
mit
NNPDF/reportengine
example/flowers/actions.py
1
2872
""" actions.py Basic tools to study the IRIS dataset. """ import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.metrics import roc_curve, hamming_loss from sklearn.model_selection import train_test_split from reportengine import collect from reportengine.figure import figure from reporte...
gpl-2.0
Balandat/cont_no_regret
NIPS2_CNR_hollowbox.py
1
3958
''' Comparison of Continuous No-Regret Algorithms for the 2nd NIPS paper @author: Maximilian Balandat @date: May 22, 2015 ''' # Set up infrastructure and basic problem parameters import matplotlib as mpl mpl.use('Agg') # this is needed when running on a linux server over terminal import multiprocessing as mp import n...
mit
adamtiger/tensorflow
tensorflow/contrib/learn/python/learn/estimators/__init__.py
7
12756
# 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
ningchi/scikit-learn
sklearn/linear_model/__init__.py
270
3096
""" The :mod:`sklearn.linear_model` module implements generalized linear models. It includes Ridge regression, Bayesian Regression, Lasso and Elastic Net estimators computed with Least Angle Regression and coordinate descent. It also implements Stochastic Gradient Descent related algorithms. """ # See http://scikit-le...
bsd-3-clause
epfl-lts2/pygsp
pygsp/graphs/nngraphs/nngraph.py
1
7452
# -*- coding: utf-8 -*- import traceback import numpy as np from scipy import sparse, spatial from pygsp import utils from pygsp.graphs import Graph # prevent circular import in Python < 3.5 _logger = utils.build_logger(__name__) def _import_pfl(): try: import pyflann as pfl except Exception as e...
bsd-3-clause
HHammond/kcbo
setup.py
1
1281
import os import sys import setuptools from setuptools import setup, find_packages # Utility function to read the README file. # Used for the long_description. It's nice, because now 1) we have a top level # README file and 2) it's easier to type in the README file than to put a raw # string in below ... def read(f...
mit
digitalghost/pycv-gameRobot
cv.py
1
2233
import sys import cv2 import numpy as np from matplotlib import pyplot as plt def mse(imageA, imageB): # the 'Mean Squared Error' between the two images is the # sum of the squared difference between the two images; # NOTE: the two images must have the same dimension err = np.sum((imageA.astype("float") -...
gpl-3.0
DmitryOdinoky/sms-tools
lectures/08-Sound-transformations/plots-code/stftMorph-frame.py
21
2700
import numpy as np import time, os, sys import matplotlib.pyplot as plt from scipy.signal import hamming, resample sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/')) import dftModel as DFT import utilFunctions as UF import math (fs, x1) = UF.wavread('../../../sounds...
agpl-3.0
dfm/celerite
paper/figures/sho.py
3
2042
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division, print_function import numpy as np import matplotlib.pyplot as plt from celerite.plot_setup import setup, get_figsize np.random.seed(42) setup(auto=True) def sho_psd(Q, x): x2 = x*x return 1.0 / ((x2 - 1)**2 + x2 / Q**2) def sho_...
mit
rsmailach/MultiServerSRPT
ClassBased_Multi_RR_Scaled.py
1
45830
#----------------------------------------------------------------------# # ApproxSRPTE_Multi_RR.py # # This application simulates multiple server with Poisson arrivals # and processing times of a general distribution. There are errors in # time estimates within a range. Arrivals are assigned to SRPT classes # using the...
mit
nikitasingh981/scikit-learn
examples/decomposition/plot_incremental_pca.py
175
1974
""" =============== Incremental PCA =============== Incremental principal component analysis (IPCA) is typically used as a replacement for principal component analysis (PCA) when the dataset to be decomposed is too large to fit in memory. IPCA builds a low-rank approximation for the input data using an amount of memo...
bsd-3-clause
jgillis/topaf
pathfollowing/pathfollowing.py
2
27834
# TOPAF -- Time optimal path following for differentially flat systems # Copyright (C) 2013 Wannes Van Loock, KU Leuven. All rights reserved. # # TOPAF is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; ei...
lgpl-3.0
ian-r-rose/SHTOOLS
examples/python/LocalizedSpectralAnalysis/SHWindowsBiasOther.py
2
2535
#!/usr/bin/env python """ This script tests other routines related to localized spectral analyses """ # standard imports: import os import sys import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt # import shtools: sys.path.append(os.path.join(os.path.dirname(__file__), "../../..")) import pysht...
bsd-3-clause
ShapeNet/JointEmbedding
src/utilities_caffe.py
1
5047
#!/usr/bin/python # -*- coding: utf-8 -*- import os import sys import math import shutil import datetime import numpy as np from multiprocessing import Pool from google.protobuf import text_format #https://github.com/BVLC/caffe/issues/861#issuecomment-70124809 import matplotlib matplotlib.use('Agg') def _array4d_id...
bsd-3-clause
quiltdata/quilt
lambdas/es/indexer/test/constants.py
2
3726
""" constants for use in testing """ NORMAL_EXTRACT = """%matplotlib inline import keras from keras.layers import Dense from keras.models import Model from keras.models import Sequential from keras.utils.np_utils import to_categorical from collections import Counter import numpy ...
apache-2.0
jhamman/xarray
xarray/plot/dataset_plot.py
2
14664
import functools import numpy as np import pandas as pd from ..core.alignment import broadcast from .facetgrid import _easy_facetgrid from .utils import ( _add_colorbar, _is_numeric, _process_cmap_cbar_kwargs, get_axis, label_from_attrs, ) # copied from seaborn _MARKERSIZE_RANGE = np.array([18.0,...
apache-2.0
info-370/python-intro
ed-cost/analysis.py
1
2409
#If a question is asked of you, output the answer to the STDOUT (google-able # term) # There are multiple equally valid ways to accomplish many of these tasks # import pandas and plotly. You may want to comment out the plotly import until # you get to that part because the code runs much slower with it import pandas #...
mit
mgarg1/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
IshitaTakeshi/PCANet
ensemble.py
1
2702
from multiprocessing import cpu_count from itertools import repeat from sklearn.svm import SVC from multiprocessing import Pool from numpy.random import randint from pcanet import PCANet import numpy as np def most_frequent_label(v): values, counts = np.unique(v, return_counts=True) return values[np.argmax(c...
mit
pymir3/pymir3
scripts/dcase2016/resultados/bands_graph.py
2
3754
import numpy as np import matplotlib.pyplot as plt from matplotlib import colors import six def plot_bands(band_features, filename): filename = filename.split(".")[0] report = open(filename + "_REPORT.txt", "w") print filename report.write(filename + "\n") feature_colors = { 'Energy' : ...
mit
kazemakase/scikit-learn
sklearn/metrics/cluster/tests/test_unsupervised.py
230
2823
import numpy as np from scipy.sparse import csr_matrix from sklearn import datasets from sklearn.metrics.cluster.unsupervised import silhouette_score from sklearn.metrics import pairwise_distances from sklearn.utils.testing import assert_false, assert_almost_equal from sklearn.utils.testing import assert_raises_regexp...
bsd-3-clause
rousseab/pymatgen
pymatgen/io/abinitio/flows.py
1
92896
# coding: utf-8 """ A Flow is a container for Works, and works consist of tasks. Flows are the final objects that can be dumped directly to a pickle file on disk Flows are executed using abirun (abipy). """ from __future__ import unicode_literals, division, print_function import os import sys import time import collec...
mit
chenyyx/scikit-learn-doc-zh
examples/zh/gaussian_process/plot_gpc_iris.py
100
2269
""" ===================================================== Gaussian process classification (GPC) on iris dataset ===================================================== This example illustrates the predicted probability of GPC for an isotropic and anisotropic RBF kernel on a two-dimensional version for the iris-dataset. ...
gpl-3.0
saiwing-yeung/scikit-learn
benchmarks/bench_multilabel_metrics.py
276
7138
#!/usr/bin/env python """ A comparison of multilabel target formats and metrics over them """ from __future__ import division from __future__ import print_function from timeit import timeit from functools import partial import itertools import argparse import sys import matplotlib.pyplot as plt import scipy.sparse as...
bsd-3-clause
valexandersaulys/prudential_insurance_kaggle
venv/lib/python2.7/site-packages/pandas/tseries/tests/test_timeseries.py
9
183904
# pylint: disable-msg=E1101,W0612 import calendar from datetime import datetime, time, timedelta import sys import operator import warnings import nose import numpy as np randn = np.random.randn from pandas import (Index, Series, DataFrame, isnull, date_range, Timestamp, Period, DatetimeIndex, ...
gpl-2.0
landlab/landlab
tests/ca/cts_model.py
3
5412
#!/usr/env/python import time from matplotlib.pyplot import axis from numpy import random from landlab.ca.celllab_cts import CAPlotter, Transition from landlab.io.native_landlab import save_grid _DEBUG = False class CTSModel(object): """ Implement a generic CellLab-CTS model. This is the base class fr...
mit
brev/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/pylab.py
70
10245
""" This is a procedural interface to the matplotlib object-oriented plotting library. The following plotting commands are provided; the majority have Matlab(TM) analogs and similar argument. _Plotting commands acorr - plot the autocorrelation function annotate - annotate something in the figure arrow ...
agpl-3.0
duguyue100/telaugesa
scripts/cifar10_stacked_improve_deconvae_test.py
1
8454
"""Stacked fixed noise dCOnvAE test""" import sys; sys.path.append(".."); import numpy as np; import matplotlib.pyplot as plt; import cPickle as pickle; import theano; import theano.tensor as T; import telaugesa.datasets as ds; from telaugesa.fflayers import ReLULayer; from telaugesa.fflayers import SoftmaxLayer; f...
mit