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
r-mart/scikit-learn
examples/svm/plot_iris.py
225
3252
""" ================================================== Plot different SVM classifiers in the iris dataset ================================================== Comparison of different linear SVM classifiers on a 2D projection of the iris dataset. We only consider the first 2 features of this dataset: - Sepal length - Se...
bsd-3-clause
hitszxp/scikit-learn
benchmarks/bench_sparsify.py
28
3380
""" 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
meduz/scikit-learn
sklearn/neural_network/rbm.py
46
12291
"""Restricted Boltzmann Machine """ # Authors: Yann N. Dauphin <dauphiya@iro.umontreal.ca> # Vlad Niculae # Gabriel Synnaeve # Lars Buitinck # License: BSD 3 clause import time import numpy as np import scipy.sparse as sp from ..base import BaseEstimator from ..base import TransformerMixi...
bsd-3-clause
cbertinato/pandas
pandas/tests/io/sas/test_sas7bdat.py
1
8025
import io import os import numpy as np import pytest from pandas.errors import EmptyDataError import pandas.util._test_decorators as td import pandas as pd import pandas.util.testing as tm # https://github.com/cython/cython/issues/1720 @pytest.mark.filterwarnings("ignore:can't resolve package:ImportWarning") class...
bsd-3-clause
bharcode/Kaggle
JobSalaryPrediction/train.py
4
1520
import data_io from features import FeatureMapper, SimpleTransform import numpy as np import pickle from sklearn.ensemble import RandomForestRegressor from sklearn.feature_extraction.text import CountVectorizer from sklearn.pipeline import Pipeline def feature_extractor(): features = [('FullDescription-Bag of Word...
gpl-2.0
leesavide/pythonista-docs
Documentation/matplotlib/examples/user_interfaces/wxcursor_demo.py
9
2167
""" Example to draw a cursor and report the data coords in wx """ import matplotlib matplotlib.use('WXAgg') from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.backends.backend_wx import NavigationToolbar2Wx from matplotlib.figure import Figure from numpy import arange, sin...
apache-2.0
madjelan/scikit-learn
examples/ensemble/plot_bias_variance.py
357
7324
""" ============================================================ Single estimator versus bagging: bias-variance decomposition ============================================================ This example illustrates and compares the bias-variance decomposition of the expected mean squared error of a single estimator again...
bsd-3-clause
datacommonsorg/api-python
datacommons_pandas/examples/df_builder.py
1
4925
# Copyright 2020 Google 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 writing, so...
apache-2.0
bsipocz/glue
glue/clients/layer_artist.py
1
20184
""" LayerArtist classes handle the visualization of an individual subset or dataset """ import logging import numpy as np from matplotlib.cm import gray from ..core.exceptions import IncompatibleAttribute from ..core.util import color2rgb, PropertySetMixin, Pointer from ..core.subset import Subset from .util import vi...
bsd-3-clause
rtavenar/tslearn
tslearn/docs/examples/classification/plot_svm.py
1
1387
# -*- coding: utf-8 -*- """ SVM and GAK =========== This example illustrates the use of the global alignment kernel (GAK) for support vector classification. This metric is defined in the :ref:`tslearn.metrics <mod-metrics>` module and explained in details in [1]. In this example, a `TimeSeriesSVC` model that uses GA...
bsd-2-clause
tawsifkhan/scikit-learn
examples/linear_model/lasso_dense_vs_sparse_data.py
348
1862
""" ============================== Lasso on dense and sparse data ============================== We show that linear_model.Lasso provides the same results for dense and sparse data and that in the case of sparse data the speed is improved. """ print(__doc__) from time import time from scipy import sparse from scipy ...
bsd-3-clause
MadsJensen/RP_scripts
graph_transitivity_ada_post.py
1
2037
import numpy as np import bct from sklearn.externals import joblib from my_settings import (bands, source_folder) from sklearn.ensemble import AdaBoostClassifier from sklearn.cross_validation import (StratifiedKFold, cross_val_score) from sklearn.grid_search import GridSearchCV subjects = [ "0008", "0009", "0010"...
bsd-3-clause
Jozhogg/iris
lib/iris/pandas.py
1
6889
# (C) British Crown Copyright 2013 - 2014, Met Office # # This file is part of Iris. # # Iris 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, either version 3 of the License, or # (at your option) any l...
lgpl-3.0
jramapuram/LSTM_Anomaly_Detector
data_generator.py
1
2121
__author__ = 'jramapuram' import numpy as np from data_source import DataSource from random import randint from math import sin, pi from data_manipulator import window, split, normalize # from sklearn.cross_validation import train_test_split class DataGenerator(DataSource): def __init__(self, conf, plotter): ...
mit
macks22/scikit-learn
sklearn/grid_search.py
103
36232
""" The :mod:`sklearn.grid_search` includes utilities to fine-tune the parameters of an estimator. """ from __future__ import print_function # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>, # Gael Varoquaux <gael.varoquaux@normalesup.org> # Andreas Mueller <amueller@ais.uni-bonn.de> # ...
bsd-3-clause
evelynegroen/evelynegroen.github.io
Code/SSRC_LCA_evelynegroen.py
1
2933
# Procedure: Global sensitivity analysis for matrix-based LCA # Method: Squared standardized regression coefficients (SSRC) # MCS: Monte Carlo simulation (normal random) # Author: Evelyne Groen {evelyne [dot] groen [at] gmail [dot] com} # Last update: 25/10/2016 import numpy as np ...
mit
tacaswell/bokeh
bokeh/compat/mpl.py
32
2834
"Supporting objects and functions to convert Matplotlib objects into Bokeh." #----------------------------------------------------------------------------- # Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved. # # Powered by the Bokeh Development Team. # # The full license is in the file LICENSE.t...
bsd-3-clause
jls713/jfactors
flattened/flattened.py
1
19220
## Generates Figs 5, 6 & 7 of SEG 2016 ## ============================================================================ import matplotlib.pyplot as plt import numpy as np from scipy.integrate import quad from matplotlib.patches import Ellipse import flattened as fJ from scipy.optimize import curve_fit import seaborn as ...
mit
SpectreJan/gnuradio
gr-filter/examples/fft_filter_ccc.py
47
4363
#!/usr/bin/env python # # Copyright 2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # ...
gpl-3.0
eramirem/astroML
book_figures/chapter3/fig_chi2_distribution.py
4
2407
r""" Example of a chi-squared distribution --------------------------------------- Figure 3.14. This shows an example of a :math:`\chi^2` distribution with various parameters. We'll generate the distribution using:: dist = scipy.stats.chi2(...) Where ... should be filled in with the desired distribution paramete...
bsd-2-clause
chiffa/TcanAnalyzer
src/curve_fitting.py
1
3961
import numpy as np from matplotlib import pyplot as plt from scipy.optimize import minimize from functools import partial from adapters import hung_ji_adapter from common import Plate from configs import Locations from csv import writer def growth(timepoints, stepness, maxVal, midpoint, delay): # maxVal = 50 # w...
bsd-3-clause
ryandougherty/mwa-capstone
MWA_Tools/build/matplotlib/doc/mpl_toolkits/axes_grid/figures/axis_direction_demo_step04.py
6
1465
import matplotlib.pyplot as plt import mpl_toolkits.axisartist as axisartist def setup_axes(fig, rect): ax = axisartist.Subplot(fig, rect) fig.add_axes(ax) ax.set_ylim(-0.1, 1.5) ax.set_yticks([0, 1]) ax.axis[:].set_visible(False) ax.axis["x1"] = ax.new_floating_axis(1, 0.3) ax.axis["x1"...
gpl-2.0
MaxStrange/ArtieInfant
Artie/internals/vae/vae.py
1
18464
""" This module contains all the code necessary for the VAE. The general use is to instantiate a VAE with the appropriate hyper parameters, then to train it with a dataset. You can then load the resulting weights into a VAE later. Much of this code was taken from here: https://blog.keras.io/building-autoencoders-in-k...
mit
clingsz/GAE
immuAnalysis/distribution_test.py
1
5204
# -*- coding: utf-8 -*- """ Created on Wed Mar 22 21:43:24 2017 @author: cling """ from scipy.stats import norm,lognorm,laplace,loglaplace,gamma,loggamma import misc.data_gen as dg import numpy import misc.utils as utils from sklearn.model_selection import KFold from scipy import stats import matplotlib.pyplot as plt...
gpl-3.0
lancezlin/ml_on_lc
templates/plots_templates.py
1
5128
# -*- coding: utf-8 -*- ## classification plotting templates # Visualising the Training set results from matplotlib.colors import ListedColormap X_set, y_set = X_train, y_train X1, X2 = np.meshgrid(np.arange(start = X_set[:, 0].min() - 1, stop = X_set[:, 0].max() + 1, step = 0.01), np.arange(start...
mit
zentonllo/gcom
pr2/test_classify_plane_points.py
2
3522
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Checking the implementation of MLP Creates two concentric circles and checks whether points near the middle circle are correctly classified. @author: avaldes """ from __future__ import division, print_function import numpy as np import matplotlib.pyplot as plt import...
mit
liuwenf/moose
modules/tensor_mechanics/test/tests/drucker_prager/small_deform3.py
23
3585
#!/usr/bin/env python import os import sys import numpy as np import matplotlib.pyplot as plt def expected(scheme, sqrtj2): cohesion = 10 friction_degrees = 35 tip_smoother = 8 friction = friction_degrees * np.pi / 180.0 if (scheme == "native"): aaa = cohesion bbb = np.tan(fricti...
lgpl-2.1
ishay2b/tensorflow
tensorflow/contrib/learn/python/learn/learn_io/__init__.py
79
2464
# 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
vermouthmjl/scikit-learn
sklearn/tests/test_metaestimators.py
57
4958
"""Common tests for metaestimators""" import functools import numpy as np from sklearn.base import BaseEstimator from sklearn.externals.six import iterkeys from sklearn.datasets import make_classification from sklearn.utils.testing import assert_true, assert_false, assert_raises from sklearn.pipeline import Pipeline...
bsd-3-clause
hbhzwj/GAD
gad/Detector/BotDetector.py
1
11724
#!/usr/bin/env python """ Community Detection Related Functions """ from __future__ import print_function, division, absolute_import from subprocess import check_call import itertools import numpy as np import scipy as sp import sys from .Correlation import TrafficCorrelationAnalyzer from .. import util # def com_de...
gpl-3.0
jjhelmus/wradlib
examples/verify_example.py
1
3221
# -*- coding: UTF-8 -*- # ------------------------------------------------------------------------------- # Name: verify_example # Purpose: # # Author: Maik Heistermann # # Created: 28.10.2011 # Copyright: (c) Maik Heistermann 2011 # Licence: The MIT License # ---------------------------...
mit
LevinJ/ud730-Deep-Learning
A1_notmnistdataset/p2_checkimage.py
1
2762
import matplotlib.pyplot as plt import matplotlib.image as mpimg import pickle import math import numpy as np class CheckImage: def checkImageinPicle(self, randindexes): with open('notMNIST_large/J.pickle', 'rb') as handle: dataset = pickle.load(handle) self.dispImages(dataset[randindex...
gpl-2.0
seansu4you87/kupo
projects/MOOCs/udacity/ud120-ml/projects/tools/email_preprocess.py
5
2627
#!/usr/bin/python import pickle import cPickle import numpy from sklearn import cross_validation from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.feature_selection import SelectPercentile, f_classif def preprocess(words_file = "../tools/word_data.pkl", authors_file="../tools/email_authors.p...
mit
kuleshov/deep-learning-models
util/data.py
1
10479
import sys import os import pickle import tarfile import theano import numpy as np from scipy.ndimage import convolve try: from sklearn import datasets from sklearn.cross_validation import train_test_split except ImportError: print "Warning: Couldn't load scikit-learn" # ----------------------------------------...
mit
betatim/BlackBox
skopt/tests/test_callbacks.py
2
2072
import pytest import numpy as np import os from collections import namedtuple from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_less from skopt import dummy_minimize from skopt import gp_minimize from skopt.benchmarks import bench1 from skopt.benchmarks import bench3 from skopt....
bsd-3-clause
iABC2XYZ/abc
DM_RFGAP_6/Test_Opti_phis2.py
2
4583
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Mon Jul 31 14:29:03 2017 Author: Peiyong Jiang : jiangpeiyong@impcas.ac.cn Function: Test 完整可用,带优化 """ from InputBeam import * from InputLattice import * import matplotlib.pyplot as plt import tensorflow as tf import numpy as np from EmitNG imp...
gpl-3.0
TeamHG-Memex/eli5
tests/test_sklearn_utils.py
1
4892
# -*- coding: utf-8 -*- from __future__ import absolute_import import numpy as np import pytest from sklearn.datasets import make_classification, make_regression from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer from sklearn.linear_model import LogisticRegression, ElasticNet, SGDRegressor fr...
mit
dingocuster/scikit-learn
examples/model_selection/plot_roc_crossval.py
247
3253
""" ============================================================= Receiver Operating Characteristic (ROC) with cross validation ============================================================= Example of Receiver Operating Characteristic (ROC) metric to evaluate classifier output quality using cross-validation. ROC curv...
bsd-3-clause
vibhorag/scikit-learn
sklearn/tree/tests/test_tree.py
48
47506
""" Testing for the tree module (sklearn.tree). """ import pickle from functools import partial from itertools import product import platform import numpy as np from scipy.sparse import csc_matrix from scipy.sparse import csr_matrix from scipy.sparse import coo_matrix from sklearn.random_projection import sparse_rand...
bsd-3-clause
chaluemwut/fbserver
venv/lib/python2.7/site-packages/sklearn/linear_model/__init__.py
5
2876
""" 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...
apache-2.0
Reagankm/KnockKnock
venv/lib/python3.4/site-packages/matplotlib/testing/jpl_units/Epoch.py
11
7243
#=========================================================================== # # Epoch # #=========================================================================== """Epoch module.""" #=========================================================================== # Place all imports after here. # from __future__ impo...
gpl-2.0
simon-pepin/scikit-learn
examples/svm/plot_svm_kernels.py
329
1971
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= SVM-Kernels ========================================================= Three different types of SVM-Kernels are displayed below. The polynomial and RBF are especially useful when the data-points are not linearly sep...
bsd-3-clause
cbtolson/MakeUpMatch
WebApp/flask_mm/recommender.py
1
7609
import mysql.connector import pandas as pd import numpy as np import re #################################################### #Class for finding and returning products #################################################### class Products(): ################################################ #Function to initialze ...
apache-2.0
bibsian/database-development
test/test_qualitycontrol.py
1
3500
from pandas import DataFrame import pytest import re import difflib import ast import shlex import sys, os if sys.platform == "darwin": rootpath = ( "/Users/bibsian/Desktop/git/database-development/") end = "/" elif sys.platform == "win32": rootpath = ( "C:\\Users\MillerLab\\Desktop\\databas...
mit
shyamalschandra/scikit-learn
examples/cluster/plot_affinity_propagation.py
349
2304
""" ================================================= Demo of affinity propagation clustering algorithm ================================================= Reference: Brendan J. Frey and Delbert Dueck, "Clustering by Passing Messages Between Data Points", Science Feb. 2007 """ print(__doc__) from sklearn.cluster impor...
bsd-3-clause
gameduell/dask
dask/dataframe/tests/test_arithmetics_reduction.py
4
42449
from datetime import datetime import pytest import numpy as np import pandas as pd import dask.dataframe as dd from dask.dataframe.utils import assert_eq, assert_dask_graph, make_meta @pytest.mark.slow def test_arithmetics(): dsk = {('x', 0): pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]}, ...
bsd-3-clause
UviDTE-UviSpace/UviSpace
docs/conf.py
2
10251
# -*- coding: utf-8 -*- # # UviSpace documentation build configuration file, created by # sphinx-quickstart on Wed Oct 26 11:31:59 2016. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # ...
gpl-3.0
miloharper/neural-network-animation
matplotlib/tri/tritools.py
10
12738
""" Tools for triangular grids. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import six from matplotlib.tri import Triangulation import numpy as np class TriAnalyzer(object): """ Define basic tools for triangular mesh analysis and improveme...
mit
mixturemodel-flow/tensorflow
tensorflow/contrib/learn/python/learn/learn_io/pandas_io_test.py
111
7865
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
raoulbq/scipy
scipy/spatial/_plotutils.py
53
4034
from __future__ import division, print_function, absolute_import import numpy as np from scipy._lib.decorator import decorator as _decorator __all__ = ['delaunay_plot_2d', 'convex_hull_plot_2d', 'voronoi_plot_2d'] @_decorator def _held_figure(func, obj, ax=None, **kw): import matplotlib.pyplot as plt if ax...
bsd-3-clause
jjx02230808/project0223
sklearn/neighbors/nearest_centroid.py
38
7356
# -*- coding: utf-8 -*- """ Nearest Centroid Classification """ # Author: Robert Layton <robertlayton@gmail.com> # Olivier Grisel <olivier.grisel@ensta.org> # # License: BSD 3 clause import warnings import numpy as np from scipy import sparse as sp from ..base import BaseEstimator, ClassifierMixin from ..met...
bsd-3-clause
boada/HETDEXCluster
analysis/mkMLMasses_targetedOnly.py
2
8189
import numpy as np import h5py as hdf from sklearn.ensemble import RandomForestRegressor from numpy.lib import recfunctions as rfns from itertools import permutations import multiprocessing from halo_handler import find_indices def child_initializer(_rf): print('Starting', multiprocessing.current_process().name) ...
mit
efce/voltPy
manager/helpers/alternatingSlicewiseDiagonalization.py
1
5267
import numpy as np # import matplotlib.pyplot as plt def asd(R, X0, Y0, I, J, K, F, lambdaa, eps, maxiter): """ Implements Alternating Slice-wise Decomposition. Implementation based on: N. M. Faber, R. Bro, and P. K. Hopke, “Recent developments in CANDECOMP/PARAFAC algorithms:A critical review,” ...
gpl-3.0
gitten/python-emag
mom_capacitor.py
1
2072
import numpy as np import matplotlib.pyplot as plt import pylab from scipy import linalg from scipy import pi #segmentation size dl = .5 dx = dl dy = dl ##physical parameters and constants plate_len = 2 plate_width = plate_len gap = .5 voltage = 1 ofx = 0 ofy = 0 e0 = 8.854e-12 col = 1.602176565e-19 ##digitize p...
mit
ofgulban/scikit-image
doc/examples/transform/plot_ransac3D.py
19
1351
""" ============================================ Robust 3D line model estimation using RANSAC ============================================ In this example we see how to robustly fit a 3D line model to faulty data using the RANSAC algorithm. """ import numpy as np from matplotlib import pyplot as plt from mpl_toolkits...
bsd-3-clause
janhahne/nest-simulator
pynest/examples/pulsepacket.py
12
11358
# -*- coding: utf-8 -*- # # pulsepacket.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST 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 2 of the License, or...
gpl-2.0
mne-tools/mne-tools.github.io
0.18/_downloads/581d2726b5c2411659b07c43f23c972e/plot_brainstorm_phantom_ctf.py
3
4731
# -*- coding: utf-8 -*- """ .. _plot_brainstorm_phantom_ctf: ======================================= Brainstorm CTF phantom dataset tutorial ======================================= Here we compute the evoked from raw for the Brainstorm CTF phantom tutorial dataset. For comparison, see [1]_ and: https://neuroimag...
bsd-3-clause
zaxtax/scikit-learn
sklearn/ensemble/voting_classifier.py
4
8056
""" Soft Voting/Majority Rule classifier. This module contains a Soft Voting/Majority Rule classifier for classification estimators. """ # Authors: Sebastian Raschka <se.raschka@gmail.com>, # Gilles Louppe <g.louppe@gmail.com> # # Licence: BSD 3 clause import numpy as np from ..base import BaseEstimator f...
bsd-3-clause
berkeley-stat222/mousestyles
mousestyles/visualization/path_diversity_plotting.py
3
2827
from __future__ import (absolute_import, division, print_function, unicode_literals) import matplotlib.pyplot as plt def plot_box(list_of_arrays, title="Box Plot of Distribution", width=4, height=4): r""" Make a box plot of the desired metric (path length, speed, angle, e...
bsd-2-clause
TomAugspurger/pandas
pandas/tests/indexing/test_partial.py
1
22825
""" test setting *parts* of objects both positionally and label based TODO: these should be split among the indexer tests """ import numpy as np import pytest import pandas as pd from pandas import DataFrame, Index, Period, Series, Timestamp, date_range, period_range import pandas._testing as tm class TestPartialS...
bsd-3-clause
scls19fr/blaze
blaze/compute/tests/test_postgresql_compute.py
6
4809
from datetime import timedelta import itertools import re import pytest sa = pytest.importorskip('sqlalchemy') pytest.importorskip('psycopg2') import numpy as np import pandas as pd import pandas.util.testing as tm from odo import odo, resource, drop, discover from blaze import symbol, compute, concat names = ('...
bsd-3-clause
louisLouL/pair_trading
capstone_env/lib/python3.6/site-packages/matplotlib/tri/trirefine.py
2
14271
""" Mesh refinement for triangular grids. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import six import numpy as np from matplotlib.tri.triangulation import Triangulation import matplotlib.tri.triinterpolate class TriRefiner(object): """ A...
mit
shusenl/scikit-learn
examples/decomposition/plot_sparse_coding.py
247
3846
""" =========================================== Sparse coding with a precomputed dictionary =========================================== Transform a signal as a sparse combination of Ricker wavelets. This example visually compares different sparse coding methods using the :class:`sklearn.decomposition.SparseCoder` esti...
bsd-3-clause
hansbrenna/NetCDF_postprocessor
HB_module/outsourced.py
1
5152
# -*- coding: utf-8 -*- """ Created on Tue Feb 23 09:46:10 2016 @author: hanbre """ import os.path import sys import numpy as np import pandas as pd import xarray import re def parse_time_axis(t,res,verbose=True): #"""parse_time_axis(time_axis, resolution) parses an xray DataArray of netcdftime objects into a lis...
gpl-3.0
valexandersaulys/prudential_insurance_kaggle
venv/lib/python2.7/site-packages/sklearn/feature_extraction/tests/test_dict_vectorizer.py
276
3790
# Authors: Lars Buitinck <L.J.Buitinck@uva.nl> # 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, ...
gpl-2.0
lekston/ardupilot
Tools/mavproxy_modules/lib/magcal_graph_ui.py
108
8248
# Copyright (C) 2016 Intel Corporation. All rights reserved. # # This file 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 fi...
gpl-3.0
3drobotics/mavlink-solo
pymavlink/tools/mavgpslag.py
43
3446
#!/usr/bin/env python ''' calculate GPS lag from DF log ''' import sys, time, os from argparse import ArgumentParser parser = ArgumentParser(description=__doc__) parser.add_argument("--plot", action='store_true', default=False, help="plot errors") parser.add_argument("--minspeed", type=float, default=6, help="minimu...
lgpl-3.0
MartinDelzant/scikit-learn
sklearn/datasets/tests/test_rcv1.py
322
2414
"""Test the rcv1 loader. Skipped if rcv1 is not already downloaded to data_home. """ import errno import scipy.sparse as sp import numpy as np from sklearn.datasets import fetch_rcv1 from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing i...
bsd-3-clause
BigDataforYou/movie_recommendation_workshop_1
big_data_4_you_demo_1/venv/lib/python2.7/site-packages/pandas/core/panel4d.py
2
1831
""" Panel4D: a 4-d dict like collection of panels """ from pandas.core.panelnd import create_nd_panel_factory from pandas.core.panel import Panel Panel4D = create_nd_panel_factory(klass_name='Panel4D', orders=['labels', 'items', 'major_axis', ...
mit
soulmachine/scikit-learn
sklearn/manifold/tests/test_isomap.py
31
3991
from itertools import product import numpy as np from numpy.testing import assert_almost_equal, assert_array_almost_equal from sklearn import datasets from sklearn import manifold from sklearn import neighbors from sklearn import pipeline from sklearn import preprocessing from sklearn.utils.testing import assert_less ...
bsd-3-clause
openpathsampling/openpathsampling
openpathsampling/numerics/resampling_statistics.py
3
6058
""" Tools for resampling functions that output pandas.DataFrame objects. Typically, you use these tools in 3 steps: 1. Create resampling groups of data, using, e.g., BlockResampling 2. Create a function that maps a list of input data into the desired output DataFrame 3. Create a ResamplingStatistics object using t...
mit
saiwing-yeung/scikit-learn
sklearn/manifold/tests/test_spectral_embedding.py
37
11168
from nose.tools import assert_true from nose.tools import assert_equal from scipy.sparse import csr_matrix from scipy.sparse import csc_matrix from scipy.sparse import coo_matrix from scipy.linalg import eigh import numpy as np from numpy.testing import assert_array_almost_equal from numpy.testing import assert_array_...
bsd-3-clause
alexsavio/scikit-learn
sklearn/datasets/mldata.py
31
7856
"""Automatically download MLdata datasets.""" # Copyright (c) 2011 Pietro Berkes # License: BSD 3 clause import os from os.path import join, exists import re import numbers try: # Python 2 from urllib2 import HTTPError from urllib2 import quote from urllib2 import urlopen except ImportError: # Pyt...
bsd-3-clause
wrobstory/seaborn
seaborn/axisgrid.py
20
66716
from __future__ import division from itertools import product from distutils.version import LooseVersion import warnings from textwrap import dedent import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt from six import string_types from . import utils from .palettes import c...
bsd-3-clause
vishnumani2009/OpenSource-Open-Ended-Statistical-toolkit
FRONTEND/svmfront.py
2
8728
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'svmui.ui' # # Created: Sun Mar 22 21:45:22 2015 # by: PyQt4 UI code generator 4.10.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui from sklearn import svm import numpy as np try: _fromUtf8...
gpl-3.0
ProkopHapala/ProbeParticleModel
examples/_bak/afm.py
1
4476
#!/usr/bin/python import sys import os import ProbeParticle as PP import elements import basUtils import numpy as np import GridUtils as GU import PPPlot as PL import matplotlib.pyplot as plt import sys def query_yes_no(question, default="yes"): """Ask a yes/no question via raw_input() and return their answer. ...
mit
mjsauvinen/P4UL
pyNetCDF/quadrantHoleNetCdf.py
1
6023
#!/usr/bin/env python3 import sys import numpy as np import argparse import matplotlib.pyplot as plt from plotTools import addContourf from analysisTools import sensibleIds, groundOffset, quadrantAnalysis from netcdfTools import read3dDataFromNetCDF from utilities import filesFromList from txtTools import openIOFile ''...
mit
markfink/supercars
test/perftest/scripts/plot_jmeter.py
1
17079
#!/usr/bin/env python """ For performance testing you need a clear understanding of the transaction rates of your target system configuration. From this information you need to design a simplified load model for your performance test. This script helps you to analyse access logs in order to extract information about t...
mit
Scapogo/zipline
zipline/utils/calendars/trading_calendar.py
2
29586
# # 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
pgromano/Markov_Models
Markov_Models/models.py
1
8312
from .base import MarkovChainMixin, MarkovStateModelMixin from .estimation import count_matrix, count_vectorizer from .utils import DiscreteSequence import numpy as np from sklearn.preprocessing import LabelEncoder from copy import deepcopy __all__ = ['MarkovChain', 'MarkovStateModel'] class MarkovChain(MarkovChain...
gpl-3.0
wavelets/office-nfl-pool
extra_code/make_datasheet.py
2
4061
""" make_datasheet.py ~~~~~~~~~~~~~~~~~~ A one-sheet log for the 2015 season. Read in the CSV in '../data/nfl_season2015.csv' and write out to '../excel_files/season2015_datasheet.xlsx' The input file '../data/nfl_season2015.csv' looks like: Season,Category,Week,Team,Opponent,AtHome,Points,PointsAllowed,Date,Stadiu...
mit
dilawar/moose-full
moose-examples/snippets/insertSpines.py
2
2798
######################################################################### ## This program is part of 'MOOSE', the ## Messaging Object Oriented Simulation Environment. ## Copyright (C) 2015 Upinder S. Bhalla. and NCBS ## It is made available under the terms of the ## GNU Lesser General Public License version 2...
gpl-2.0
sanketloke/scikit-learn
sklearn/utils/tests/test_shortest_path.py
303
2841
from collections import defaultdict import numpy as np from numpy.testing import assert_array_almost_equal from sklearn.utils.graph import (graph_shortest_path, single_source_shortest_path_length) def floyd_warshall_slow(graph, directed=False): N = graph.shape[0] #set nonzer...
bsd-3-clause
masterkeywikz/seq2graph
src/theanets-0.6.1/examples/recurrent-sinusoid.py
1
3784
#!/usr/bin/env python '''This example compares recurrent layer performance on a sine-generation task. The task is to generate a complex sine wave that is constructed as a superposition of a small set of pure frequencies. All networks are constructed with one input (which receives all zero values), one recurrent hidde...
mit
rgommers/pywt
pywt/_doc_utils.py
3
5823
"""Utilities used to generate various figures in the documentation.""" from itertools import product import numpy as np from matplotlib import pyplot as plt from ._dwt import pad __all__ = ['wavedec_keys', 'wavedec2_keys', 'draw_2d_wp_basis', 'draw_2d_fswavedecn_basis', 'boundary_mode_subplot'] def wave...
mit
mlyundin/scikit-learn
sklearn/ensemble/tests/test_weight_boosting.py
83
17276
"""Testing for the boost module (sklearn.ensemble.boost).""" import numpy as np from sklearn.utils.testing import assert_array_equal, assert_array_less from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal, assert_true from sklearn.utils.testing import assert_raises...
bsd-3-clause
booya-at/paraBEM
examples/openglider/alpha_cL_cD.py
2
2600
# -*- coding: utf-8 -*- import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np from openglider.jsonify import load from openglider.utils.distribution import Distribution from openglider.glider.in_out.export_3d import parabem_Panels import parabem from parabem.pan3d import DirichletD...
gpl-3.0
caganze/splat
splat/model.py
1
230645
from __future__ import print_function, division """ .. note:: These are the spectral modeling functions for SPLAT """ # imports: internal import bz2 import copy import glob import gzip import os import requests import shutil import sys import time # imports: external #import corner import matplotlib; matplo...
mit
lancezlin/ml_template_py
lib/python2.7/site-packages/pandas/io/s3.py
7
3676
""" s3 support for remote file interactivity """ import os from pandas import compat from pandas.compat import BytesIO try: import boto from boto.s3 import key except: raise ImportError("boto is required to handle s3 files") if compat.PY3: from urllib.parse import urlparse as parse_url else: from...
mit
hrjn/scikit-learn
examples/neighbors/plot_digits_kde_sampling.py
108
2026
""" ========================= Kernel Density Estimation ========================= This example shows how kernel density estimation (KDE), a powerful non-parametric density estimation technique, can be used to learn a generative model for a dataset. With this generative model in place, new samples can be drawn. These...
bsd-3-clause
JasonKessler/scattertext
scattertext/categorytable/__init__.py
1
6681
import json from bisect import bisect_left import pandas as pd import numpy as np from scattertext.termranking import AbsoluteFrequencyRanker from scattertext.termscoring.RankDifference import RankDifference from scipy.stats import gmean from sklearn.feature_extraction.text import TfidfTransformer from sklearn.linear...
apache-2.0
alexlee-gk/visual_dynamics
visual_dynamics/algorithms/cem.py
1
7754
from __future__ import division, print_function import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt import numpy as np import scipy import scipy.stats from matplotlib.ticker import MultipleLocator, FormatStrFormatter from visual_dynamics.algorithms import Algorithm, ServoingOptimizationAlgorithm fr...
mit
potash/scikit-learn
examples/cluster/plot_feature_agglomeration_vs_univariate_selection.py
87
3903
""" ============================================== Feature agglomeration vs. univariate selection ============================================== This example compares 2 dimensionality reduction strategies: - univariate feature selection with Anova - feature agglomeration with Ward hierarchical clustering Both metho...
bsd-3-clause
potash/scikit-learn
examples/linear_model/plot_robust_fit.py
147
3050
""" Robust linear estimator fitting =============================== Here a sine function is fit with a polynomial of order 3, for values close to zero. Robust fitting is demoed in different situations: - No measurement errors, only modelling errors (fitting a sine with a polynomial) - Measurement errors in X - M...
bsd-3-clause
CallaJun/hackprince
indico/mpl_toolkits/axisartist/axislines.py
8
26139
""" Axislines includes modified implementation of the Axes class. The biggest difference is that the artists responsible to draw axis line, ticks, ticklabel and axis labels are separated out from the mpl's Axis class, which are much more than artists in the original mpl. Originally, this change was motivated to support...
lgpl-3.0
ryfeus/lambda-packs
Sklearn_scipy_numpy/source/sklearn/linear_model/tests/test_theil_sen.py
6
9943
""" Testing for Theil-Sen module (sklearn.linear_model.theil_sen) """ # Author: Florian Wilhelm <florian.wilhelm@gmail.com> # License: BSD 3 clause from __future__ import division, print_function, absolute_import import os import sys from contextlib import contextmanager import numpy as np from numpy.testing import ...
mit
pprett/statsmodels
statsmodels/sandbox/nonparametric/kdecovclass.py
5
5713
'''subclassing kde Author: josef pktd ''' import numpy as np import scipy from scipy import stats import matplotlib.pylab as plt class gaussian_kde_set_covariance(stats.gaussian_kde): ''' from Anne Archibald in mailinglist: http://www.nabble.com/Width-of-the-gaussian-in-stats.kde.gaussian_kde---td1955892...
bsd-3-clause
rmartinez-adc/ThinkStats2
code/density.py
67
2934
"""This file contains code used in "Think Stats", by Allen B. Downey, available from greenteapress.com Copyright 2014 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ from __future__ import print_function import math import random import brfss import first import thinkstats2 import thinkp...
gpl-3.0
nikitasingh981/scikit-learn
examples/model_selection/plot_learning_curve.py
76
4509
""" ======================== Plotting Learning Curves ======================== On the left side the learning curve of a naive Bayes classifier is shown for the digits dataset. Note that the training score and the cross-validation score are both not very good at the end. However, the shape of the curve can be found in ...
bsd-3-clause
binghongcha08/pyQMD
GWP/2D/1.0.8/plt.py
14
1041
##!/usr/bin/python import numpy as np import pylab as plt import seaborn as sns sns.set_context('poster') #with open("traj.dat") as f: # data = f.read() # # data = data.split('\n') # # x = [row.split(' ')[0] for row in data] # y = [row.split(' ')[1] for row in data] # # fig = plt.figure() # # ax1 ...
gpl-3.0