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
ishank08/scikit-learn
sklearn/linear_model/bayes.py
14
19671
""" Various bayesian regression """ from __future__ import print_function # Authors: V. Michel, F. Pedregosa, A. Gramfort # License: BSD 3 clause from math import log import numpy as np from scipy import linalg from .base import LinearModel from ..base import RegressorMixin from ..utils.extmath import fast_logdet, p...
bsd-3-clause
glouppe/scikit-learn
sklearn/neighbors/base.py
30
30586
"""Base and mixin classes for nearest neighbors""" # Authors: Jake Vanderplas <vanderplas@astro.washington.edu> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Sparseness support by Lars Buitinck <L.J.Buitinck@uva.nl> # Multi-output...
bsd-3-clause
saurav111/keras
examples/kaggle_otto_nn.py
70
3775
from __future__ import absolute_import from __future__ import print_function import numpy as np import pandas as pd np.random.seed(1337) # for reproducibility from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation from keras.layers.normalization import BatchNormalization from ke...
mit
r0k3/trading-with-python
cookbook/getDataFromYahooFinance.py
77
1391
# -*- coding: utf-8 -*- """ Created on Sun Oct 16 18:37:23 2011 @author: jev """ from urllib import urlretrieve from urllib2 import urlopen from pandas import Index, DataFrame from datetime import datetime import matplotlib.pyplot as plt sDate = (2005,1,1) eDate = (2011,10,1) symbol = 'SPY' fNa...
bsd-3-clause
bundgus/python-playground
matplotlib-playground/examples/animation/strip_chart_demo.py
1
1512
""" Emulate an oscilloscope. Requires the animation API introduced in matplotlib 1.0 SVN. """ import numpy as np from matplotlib.lines import Line2D import matplotlib.pyplot as plt import matplotlib.animation as animation class Scope(object): def __init__(self, ax, maxt=2, dt=0.02): self.ax = ax ...
mit
stevenjoelbrey/PMFutures
Python/plotParameterSpace.py
1
5647
#!/usr/bin/env python2 # plotEmissionSummary.py ############################################################################### # ------------------------- Description --------------------------------------- ############################################################################### # This script will be used to...
mit
okadate/romspy
romspy/tplot/tplot_param.py
1
4044
# coding: utf-8 # (c) 2016-01-27 Teruhisa Okada import netCDF4 import matplotlib.pyplot as plt from matplotlib.dates import DateFormatter from matplotlib.offsetbox import AnchoredText import numpy as np import pandas as pd import glob import romspy def tplot_param(inifiles, vname, ax=plt.gca()): for inifile in i...
mit
frank-tancf/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
hsiaoyi0504/scikit-learn
examples/model_selection/plot_precision_recall.py
249
6150
""" ================ Precision-Recall ================ Example of Precision-Recall metric to evaluate classifier output quality. In information retrieval, precision is a measure of result relevancy, while recall is a measure of how many truly relevant results are returned. A high area under the curve represents both ...
bsd-3-clause
KarlTDebiec/Moldynplot
moldynplot/dataset/TimeSeriesDataset.py
2
18697
#!/usr/bin/python # -*- coding: utf-8 -*- # moldynplot.dataset.TimeSeriesDataset.py # # Copyright (C) 2015-2017 Karl T Debiec # All rights reserved. # # This software may be modified and distributed under the terms of the # BSD license. See the LICENSE file for details. """ Represents timeseries data .. todo...
bsd-3-clause
MMKrell/pyspace
pySPACE/missions/nodes/feature_generation/correlation_features.py
3
25671
""" Extract statistical properties like moments or correlation coefficients **Known issues** No unit tests! """ import numpy import scipy.stats import copy from matplotlib import mlab import warnings from pySPACE.missions.nodes.base_node import BaseNode from pySPACE.resources.data_types.feature_vector import Feat...
gpl-3.0
kgsn1763/deep-learning-from-scratch
ch06/batch_norm_test.py
1
2841
#!/usr/bin/env python # coding: utf-8 import sys, os sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定 import numpy as np import matplotlib.pyplot as plt from dataset.mnist import load_mnist from common.multi_layer_net_extend import MultiLayerNetExtend from common.optimizer import SGD (x_train, t_train), (x_tes...
mit
Roboticmechart22/sms-tools
lectures/09-Sound-description/plots-code/spectralFlux-onsetFunction.py
25
1330
import numpy as np import matplotlib.pyplot as plt import essentia.standard as ess M = 1024 N = 1024 H = 512 fs = 44100 spectrum = ess.Spectrum(size=N) window = ess.Windowing(size=M, type='hann') flux = ess.Flux() onsetDetection = ess.OnsetDetection(method='hfc') x = ess.MonoLoader(filename = '../../../sounds/speech-m...
agpl-3.0
statsmodels/statsmodels.github.io
v0.10.0/plots/graphics_gofplots_qqplot.py
6
1926
# -*- coding: utf-8 -*- """ Created on Sun May 06 05:32:15 2012 Author: Josef Perktold editted by: Paul Hobson (2012-08-19) """ from scipy import stats from matplotlib import pyplot as plt import statsmodels.api as sm #example from docstring data = sm.datasets.longley.load(as_pandas=False) data.exog = sm.add_constant...
bsd-3-clause
tosolveit/scikit-learn
examples/model_selection/plot_underfitting_overfitting.py
230
2649
""" ============================ Underfitting vs. Overfitting ============================ This example demonstrates the problems of underfitting and overfitting and how we can use linear regression with polynomial features to approximate nonlinear functions. The plot shows the function that we want to approximate, wh...
bsd-3-clause
pkruskal/scikit-learn
examples/ensemble/plot_voting_probas.py
316
2824
""" =========================================================== Plot class probabilities calculated by the VotingClassifier =========================================================== Plot the class probabilities of the first sample in a toy dataset predicted by three different classifiers and averaged by the `VotingC...
bsd-3-clause
bthirion/nistats
examples/03_second_level_models/plot_oasis.py
1
5248
"""Voxel-Based Morphometry on Oasis dataset ======================================== This example uses Voxel-Based Morphometry (VBM) to study the relationship between aging, sex and gray matter density. The data come from the `OASIS <http://www.oasis-brains.org/>`_ project. If you use it, you need to agree with the d...
bsd-3-clause
jmetzen/scikit-learn
sklearn/decomposition/pca.py
20
23579
""" Principal Component Analysis """ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Denis A. Engemann <d.engemann@fz-juelich.de> # Michael Eickenberg <michael.eickenberg@inria.fr> # # Lice...
bsd-3-clause
jamesliu/mxnet
example/kaggle-ndsb1/training_curves.py
52
1879
# 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
SteveDiamond/cvxpy
examples/machine_learning/lasso_regression.py
2
2270
import cvxpy as cp import numpy as np import matplotlib.pyplot as plt def loss_fn(X, Y, beta): return cp.norm2(cp.matmul(X, beta) - Y)**2 def regularizer(beta): return cp.norm1(beta) def objective_fn(X, Y, beta, lambd): return loss_fn(X, Y, beta) + lambd * regularizer(beta) def mse(X, Y, beta): ...
gpl-3.0
sumspr/scikit-learn
examples/decomposition/plot_incremental_pca.py
244
1878
""" =============== 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
xiaohan2012/cotrain
view_extraction/views.py
1
4283
import cPickle as pkl import numpy as np from collections import (Counter, defaultdict) from scipy.sparse import (hstack, issparse, csr_matrix, csc_matrix) from sklearn.feature_extraction import DictVectorizer from mynlp.dependency.tree import NodeNotFoundError from mynlp.string_util.multistring_matching import Multi...
mit
cdegroc/scikit-learn
sklearn/check_build/__init__.py
2
1625
""" Module to give helpful messages to the user that did not compile the scikit properly. """ import os INPLACE_MSG = """ It appears that you are importing a local tree of the scikit-learn. For this, you need to have an inplace install. Maybe you are in the source directory and you need to try from another location.""...
bsd-3-clause
boomsbloom/dtm-fmri
DTM/for_gensim/lib/python2.7/site-packages/sklearn/datasets/__init__.py
72
3807
""" The :mod:`sklearn.datasets` module includes utilities to load datasets, including methods to load and fetch popular reference datasets. It also features some artificial data generators. """ from .base import load_diabetes from .base import load_digits from .base import load_files from .base import load_iris from ....
mit
DavidQiuChao/CS231nHomeWorks
assignment2/FullyConnectedNets.py
1
27403
# coding: utf-8 # # Fully-Connected Neural Nets # In the previous homework you implemented a fully-connected two-layer neural network on CIFAR-10. The implementation was simple but not very modular since the loss and gradient were computed in a single monolithic function. This is manageable for a simple two-layer net...
mit
pprett/scikit-learn
sklearn/feature_selection/tests/test_rfe.py
56
11274
""" Testing Recursive feature elimination """ import numpy as np from numpy.testing import assert_array_almost_equal, assert_array_equal from scipy import sparse from sklearn.feature_selection.rfe import RFE, RFECV from sklearn.datasets import load_iris, make_friedman1 from sklearn.metrics import zero_one_loss from sk...
bsd-3-clause
nguyentu1602/statsmodels
statsmodels/stats/sandwich_covariance.py
19
27944
# -*- 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
rsivapr/scikit-learn
examples/covariance/plot_robust_vs_empirical_covariance.py
8
6264
""" ======================================= 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 guara...
bsd-3-clause
jseabold/scikit-learn
examples/model_selection/plot_roc.py
49
5041
""" ======================================= Receiver Operating Characteristic (ROC) ======================================= Example of Receiver Operating Characteristic (ROC) metric to evaluate classifier output quality. ROC curves typically feature true positive rate on the Y axis, and false positive rate on the X a...
bsd-3-clause
Titan-C/selfspy
doc/conf.py
1
5433
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # SelfSpy documentation build configuration file, created by # sphinx-quickstart on Sun Apr 30 16:14:35 2017. # # 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 # au...
gpl-3.0
ArnaudBelcour/liasis
setup.py
1
1297
import os from io import open from setuptools import setup with open(os.path.join(os.path.dirname(__file__), 'README.rst'), encoding='utf-8') as readme_file: readme = readme_file.read() setup(name='pbsea', description='Singular Enrichment Analysis', long_description=readme, version...
gpl-3.0
eduardoftoliveira/oniomMacGyver
omg/asciiplot.py
2
27736
""" From https://github.com/mfouesneau/asciiplot Package that allows you to plot simple graphs in ASCII, a la matplotlib. This package is a inspired from Imri Goldberg's ASCII-Plotter 1.0 (https://pypi.python.org/pypi/ASCII-Plotter/1.0) At a time I was enoyed by security not giving me direct access to my computer, a...
gpl-3.0
Opendigitalradio/ODR-StaticPrecorrection
calc_lag.py
1
1161
from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import re import sys from tqdm import tqdm from glob import glob from natsort import natsorted import numpy as np import pandas as pd import matplotlib.pyplot as plt import src.dab_util as du ...
mit
madjelan/scikit-learn
sklearn/tests/test_metaestimators.py
226
4954
"""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
McDermott-Group/LabRAD
LabRAD/TestScripts/fpgaTest/pyle/pyle/dataking/diagnostics.py
2
2195
import numpy as np import matplotlib.pyplot as plt from pyle.plotting import dstools as ds import time def uwaveTraces(sample, channels = [1,2,3], name = '', muxServ = None, scopeServ = None, scopeMuxChan = 1, plotData = True, spacing = 100, holdFig=False): # spacing in units of [mv], just for the pl...
gpl-2.0
voxlol/scikit-learn
examples/ensemble/plot_random_forest_embedding.py
286
3531
""" ========================================================= Hashing feature transformation using Totally Random Trees ========================================================= RandomTreesEmbedding provides a way to map data to a very high-dimensional, sparse representation, which might be beneficial for classificati...
bsd-3-clause
PedroTrujilloV/nest-simulator
extras/ConnPlotter/tcd_nest.py
13
6838
# -*- coding: utf-8 -*- # # tcd_nest.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
bbreslauer/PySciPlot
src/WavePair.py
1
11319
# Copyright (C) 2010-2011 Ben Breslauer # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distribu...
gpl-3.0
vermouthmjl/scikit-learn
sklearn/__check_build/__init__.py
345
1671
""" Module to give helpful messages to the user that did not compile the scikit properly. """ import os INPLACE_MSG = """ It appears that you are importing a local scikit-learn source tree. For this, you need to have an inplace install. Maybe you are in the source directory and you need to try from another location.""...
bsd-3-clause
kenshay/ImageScripter
ProgramData/SystemFiles/Python/Lib/site-packages/dask/dataframe/groupby.py
2
44826
from __future__ import absolute_import, division, print_function import collections import itertools as it import operator import warnings import numpy as np import pandas as pd from .core import (DataFrame, Series, aca, map_partitions, merge, new_dd_object, no_default, split_out_on_index) from .m...
gpl-3.0
shakamunyi/tensorflow
tensorflow/contrib/factorization/python/ops/kmeans.py
19
17291
# 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
jskDr/jamespy_py3
krealdl.py
1
7145
# Sungjin Kim, 2016-5-7 # Python 3 from importlib import reload import tensorflow as tf import pandas as pd # Import MINST data import input_data def multilayer_perceptron(_X, _weights, _biases): #Hidden layer with RELU activation layer_1 = tf.nn.relu(tf.add(tf.matmul(_X, _weights['h1']), _biases['b1'])) #Hidden...
mit
phobson/statsmodels
statsmodels/imputation/tests/test_mice.py
4
10458
import numpy as np import pandas as pd from statsmodels.imputation import mice import statsmodels.api as sm from numpy.testing import assert_equal, assert_allclose, dec try: import matplotlib.pyplot as plt #makes plt available for test functions have_matplotlib = True except: have_matplotlib = False pdf_...
bsd-3-clause
ryfeus/lambda-packs
Tensorflow_Pandas_Numpy/source3.6/pandas/core/api.py
1
3109
# pylint: disable=W0614,W0401,W0611 # flake8: noqa import numpy as np from pandas.core.algorithms import factorize, unique, value_counts from pandas.core.dtypes.missing import isna, isnull, notna, notnull from pandas.core.arrays import Categorical from pandas.core.groupby.groupby import Grouper from pandas.io.format...
mit
f3r/scikit-learn
examples/cluster/plot_dbscan.py
346
2479
# -*- coding: utf-8 -*- """ =================================== Demo of DBSCAN clustering algorithm =================================== Finds core samples of high density and expands clusters from them. """ print(__doc__) import numpy as np from sklearn.cluster import DBSCAN from sklearn import metrics from sklearn...
bsd-3-clause
tosolveit/scikit-learn
benchmarks/bench_glm.py
297
1493
""" A comparison of different methods in GLM Data comes from a random square matrix. """ from datetime import datetime import numpy as np from sklearn import linear_model from sklearn.utils.bench import total_seconds if __name__ == '__main__': import pylab as pl n_iter = 40 time_ridge = np.empty(n_it...
bsd-3-clause
collbb/ThinkStats2
code/chap12soln.py
68
4459
"""This file contains code for use with "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 pandas import numpy as np import statsmodels.formula.api as smf import t...
gpl-3.0
louisLouL/pair_trading
hist_data/backtest/backtest.py
1
3041
import pandas as pd import numpy as np from collections import defaultdict from config import backup_database, pair import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D class BackTest: def __init__(self, pair_list): self.pair_list = pair_list @staticmethod def signal(x): ...
mit
ivano666/tensorflow
tensorflow/contrib/learn/python/learn/estimators/estimator_test.py
1
5210
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
apache-2.0
vibhorag/scikit-learn
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, ...
bsd-3-clause
moorepants/DynamicistToolKit
dtk/bicycle.py
1
30216
#!/usr/bin/env python # -*- coding: utf-8 -*- # standard library from math import sin, cos, tan, atan, pi # external libraries import numpy as np from scipy.optimize import newton from matplotlib.pyplot import figure, rcParams # local libraries from .inertia import y_rot def benchmark_state_space_vs_speed(M, C1, K...
unlicense
darionyaphet/spark
dev/sparktestsupport/modules.py
4
16318
# # 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
heli522/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
BillMills/AutoQC
util/benchmarks.py
3
4332
import util.combineTests as combinatorics import matplotlib.pyplot as plt import numpy as np def compare_to_truth(combos, trueResult): '''Given the results from all the possible combinations of tests (combos) and a set of truth results (trueResult), the false positive rate and the true positive rate ...
mit
flennerhag/mlens
benchmarks/ensemble_comp.py
1
2359
"""ML-ENSEMBLE Comparison of ensemble performance across scale. """ import numpy as np from mlens.ensemble import BlendEnsemble, SuperLearner, Subsemble from sklearn.metrics import accuracy_score from sklearn.linear_model import LogisticRegression from sklearn.ensemble import RandomForestClassifier, GradientBoosti...
mit
FCP-INDI/C-PAC
CPAC/qc/utils.py
1
68748
import os import re import math import base64 import subprocess import pkg_resources as p import numpy as np import nibabel as nb import numpy.ma as ma import numpy import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt import matplotlib.cm as cm from matplotlib import gridspec as mgs from matp...
bsd-3-clause
antoinecarme/pyaf
tests/neuralnet/test_ozone_rnn_only_LSTM.py
1
1418
import pandas as pd import numpy as np import pyaf.ForecastEngine as autof import pyaf.Bench.TS_datasets as tsds import logging import logging.config #logging.config.fileConfig('logging.conf') logging.basicConfig(level=logging.INFO) #get_ipython().magic('matplotlib inline') b1 = tsds.load_ozone() df = b1.mPastDa...
bsd-3-clause
kecnry/autofig
autofig/cyclers.py
2
6059
from matplotlib import colors, markers, cm import matplotlib.pyplot as plt from . import common _mplcolors = ['black', 'blue', 'red', 'green'] _mplcolors += [common.coloralias.map(c) for c in list(colors.ColorConverter.colors.keys()) + list(colors.cnames.keys()) if common.coloralias.map(c) not in _mplcolors and 'xkcd'...
gpl-3.0
AICreators/test_code
RL_01/reinforcement.py
1
3434
import gym import numpy as np import random from keras.models import Sequential from keras.layers import Dense, Dropout from keras.optimizers import Adam from collections import deque import matplotlib.pyplot as plt class DQN: def __init__(self, env): self.env = env self.memory = deque(maxlen=200...
gpl-3.0
ClimbsRocks/scikit-learn
examples/exercises/plot_iris_exercise.py
323
1602
""" ================================ SVM Exercise ================================ A tutorial exercise for using different SVM kernels. This exercise is used in the :ref:`using_kernels_tut` part of the :ref:`supervised_learning_tut` section of the :ref:`stat_learn_tut_index`. """ print(__doc__) import numpy as np i...
bsd-3-clause
mojoboss/scikit-learn
examples/calibration/plot_calibration.py
225
4795
""" ====================================== Probability calibration of classifiers ====================================== When performing classification you often want to predict not only the class label, but also the associated probability. This probability gives you some kind of confidence on the prediction. However,...
bsd-3-clause
pprett/scikit-learn
sklearn/linear_model/tests/test_randomized_l1.py
7
5998
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD 3 clause from tempfile import mkdtemp import shutil import numpy as np from scipy import sparse from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises...
bsd-3-clause
anntzer/scikit-learn
benchmarks/bench_plot_fastkmeans.py
12
4570
from collections import defaultdict from time import time import numpy as np from numpy import random as nr from sklearn.cluster import KMeans, MiniBatchKMeans def compute_bench(samples_range, features_range): it = 0 results = defaultdict(lambda: []) chunk = 100 max_it = len(samples_range) * len(f...
bsd-3-clause
TheHonestGene/imputor
setup.py
1
1812
from setuptools import setup, find_packages # Always prefer setuptools over distutils from codecs import open # To use a consistent encoding from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the relevant file with open(path.join(here, 'README.rst'), encoding='utf-8') as...
mit
suzlab/Autoware
ros/src/computing/perception/localization/packages/orb_localizer/src/analysis/orbndt.py
1
36681
from __future__ import division import numpy as np import datetime import rosbag import rospy from copy import copy, deepcopy from exceptions import KeyError, ValueError from segway_rmp.msg import SegwayStatusStamped from geometry_msgs.msg import PoseStamped import matplotlib.pyplot as plt import matplotlib.animation a...
bsd-3-clause
Adai0808/scikit-learn
sklearn/decomposition/tests/test_dict_learning.py
85
8565
import numpy as np from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_raises...
bsd-3-clause
talbrecht/pism_pik07
site-packages/siple/opt/linesearchHZ.py
2
11502
############################################################################ # # This file is a part of siple. # # Copyright 2010, 2014 David Maxwell # # siple 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 Foundati...
gpl-3.0
abhitopia/tensorflow
tensorflow/examples/learn/iris_custom_model.py
50
2613
# 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
almarklein/bokeh
examples/charts/stacked_bar.py
1
1124
from collections import OrderedDict import pandas as pd # we throw the data into a pandas df from bokeh.sampledata.olympics2014 import data from bokeh.charts import Bar from bokeh.plotting import output_file, show df = pd.io.json.json_normalize(data['data']) # we filter by countries with at least one medal and sort ...
bsd-3-clause
theoryno3/scikit-learn
sklearn/datasets/mlcomp.py
41
3803
# Copyright (c) 2010 Olivier Grisel <olivier.grisel@ensta.org> # License: BSD 3 clause """Glue code to load http://mlcomp.org data as a scikit.learn dataset""" import os import numbers from sklearn.datasets.base import load_files def _load_document_classification(dataset_path, metadata, set_=None, **kwargs): if ...
bsd-3-clause
hammerlab/cohorts
test/test_df_loading.py
1
1315
# Copyright (c) 2016. Mount Sinai School of Medicine # # 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 o...
apache-2.0
mbayon/TFG-MachineLearning
venv/lib/python3.6/site-packages/sklearn/utils/deprecation.py
20
4075
import sys import warnings import functools __all__ = ["deprecated", "DeprecationDict"] class deprecated(object): """Decorator to mark a function or class as deprecated. Issue a warning when the function is called/the class is instantiated and adds a warning to the docstring. The optional extra arg...
mit
TNick/pylearn2
pylearn2/scripts/train.py
34
8573
#!/usr/bin/env python """ Script implementing the logic for training pylearn2 models. This is a "driver" that we recommend using for all but the most unusual training experiments. Basic usage: .. code-block:: none train.py yaml_file.yaml The YAML file should contain a pylearn2 YAML description of a `pylearn2.t...
bsd-3-clause
nilmtk/nilmtk
nilmtk/disaggregate/mean.py
1
2165
from warnings import warn import pandas as pd import numpy as np import json from nilmtk.disaggregate import Disaggregator import os class Mean(Disaggregator): def __init__(self, params): self.model = {} self.MODEL_NAME = 'Mean' # Add the name for the algorithm self.save_model_path = param...
apache-2.0
Crespo911/pyspace
pySPACE/missions/nodes/visualization/feature_vector_vis.py
1
5372
""" Visualize :class:`~pySPACE.resources.data_types.feature_vector.FeatureVector` elements""" import itertools import pylab import numpy try: import mdp.nodes except: pass from pySPACE.missions.nodes.base_node import BaseNode class LLEVisNode(BaseNode): """ Show a 2d scatter plot of all :class:`~pySPACE.r...
gpl-3.0
CaymanUnterborn/burnman
setup.py
5
1333
from __future__ import absolute_import import re versionstuff = dict( re.findall("(.+) = '(.+)'\n", open('burnman/version.py').read())) metadata = dict(name='burnman', version=versionstuff['version'], description='a thermoelastic and thermodynamic toolkit for Earth and planetary sc...
gpl-2.0
bmcfee/crema
training/chords/02-train.py
1
11960
#!/usr/bin/env python '''CREMA structured chord model''' import argparse import os import sys from glob import glob import pickle import pandas as pd import keras as K from sklearn.model_selection import ShuffleSplit import pescador import pumpp import librosa import crema.utils import crema.layers from jams.util i...
bsd-2-clause
richardwolny/sms-tools
lectures/07-Sinusoidal-plus-residual-model/plots-code/hprModelFrame.py
22
2847
import numpy as np import matplotlib.pyplot as plt from scipy.signal import hamming, triang, blackmanharris import math from scipy.fftpack import fft, ifft, fftshift import sys, os, functools, time sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/')) import dftModel a...
agpl-3.0
alexsavio/scikit-learn
sklearn/tests/test_naive_bayes.py
72
19944
import pickle from io import BytesIO import numpy as np import scipy.sparse from sklearn.datasets import load_digits, load_iris from sklearn.model_selection import train_test_split from sklearn.model_selection import cross_val_score from sklearn.externals.six.moves import zip from sklearn.utils.testing import assert...
bsd-3-clause
mblue9/tools-iuc
tools/vsnp/vsnp_build_tables.py
2
17888
#!/usr/bin/env python import argparse import multiprocessing import os import queue import re import pandas import pandas.io.formats.excel from Bio import SeqIO INPUT_JSON_AVG_MQ_DIR = 'input_json_avg_mq_dir' INPUT_JSON_DIR = 'input_json_dir' INPUT_NEWICK_DIR = 'input_newick_dir' # Maximum columns allowed in a Libre...
mit
r-mart/scikit-learn
examples/linear_model/plot_robust_fit.py
238
2414
""" 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
mattilyra/scikit-learn
examples/svm/plot_svm_nonlinear.py
268
1091
""" ============== 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 learned by the SVC. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from sklearn imp...
bsd-3-clause
cojacoo/testcases_echoRD
gen_test2211.py
1
4396
import numpy as np import pandas as pd import scipy as sp import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import os, sys try: import cPickle as pickle except: import pickle #connect echoRD Tools pathdir='../echoRD' #path to echoRD lib_path = os.path.abspath(pathdir) #sys.path.append(lib_pa...
gpl-3.0
manashmndl/scikit-learn
examples/plot_isotonic_regression.py
303
1767
""" =================== Isotonic Regression =================== An illustration of the isotonic regression on generated data. The isotonic regression finds a non-decreasing approximation of a function while minimizing the mean squared error on the training data. The benefit of such a model is that it does not assume a...
bsd-3-clause
nelango/ViralityAnalysis
model/lib/sklearn/ensemble/tests/test_gradient_boosting_loss_functions.py
221
5517
""" Testing for the gradient boosting loss functions and initial estimators. """ import numpy as np from numpy.testing import assert_array_equal from numpy.testing import assert_almost_equal from numpy.testing import assert_equal from nose.tools import assert_raises from sklearn.utils import check_random_state from ...
mit
Vastra-Gotalandsregionen/verifierad.nu
dependencies/readability/readability/__init__.py
1
8765
"""Simple readability measures. Usage: %(cmd)s [--lang=<x>] [FILE] or: %(cmd)s [--lang=<x>] --csv FILES... By default, input is read from standard input. Text should be encoded with UTF-8, one sentence per line, tokens space-separated. Options: -L, --lang=<x> Set language (available: %(lang)s). --csv ...
mit
zyoohv/zyoohv.github.io
code_repository/tencent_ad_contest/tencent_contest/arrange_dataset/vw2csv.py
1
1582
#! /usr/bin/python3 from tqdm import tqdm import numpy as np import pandas as pd import os root_path = '/home/zyoohv/Documents/tencent_dataset/preliminary_contest_data/' input_path = root_path + 'userFeature.data' output_path = root_path + 'userFeature.csv' os.system('rm {}'.format(output_path)) output_file = [] d...
mit
boomsbloom/dtm-fmri
DTM/for_gensim/lib/python2.7/site-packages/scipy/spatial/_plotutils.py
23
5505
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...
mit
magne-max/zipline-ja
mk_bundle.py
1
7175
# -*- coding: utf-8 -*- """ zipline の data bundle として import するための前処理 * unit32 以上の volume は upper bound clip Author: Kohei """ from logging import getLogger, Formatter, StreamHandler, DEBUG import os import re from pathlib import Path from sklearn.externals.joblib import Parallel, delayed import tqdm import pandas a...
apache-2.0
matty-jones/MorphCT
tests/assets/update_pickle/MCT2.0_pickle/obtainChromophores.py
1
16164
import numpy as np import sys import helperFunctions import copy import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt try: import mpl_toolkits.mplot3d.axes3d as p3 except ImportError: print() pass class chromophore: def __init__(self, chromoID, chromophoreCGSites, CGMorphologyDict, ...
gpl-3.0
BiaDarkia/scikit-learn
examples/ensemble/plot_adaboost_regression.py
67
1530
""" ====================================== Decision Tree Regression with AdaBoost ====================================== A decision tree is boosted using the AdaBoost.R2 [1]_ algorithm on a 1D sinusoidal dataset with a small amount of Gaussian noise. 299 boosts (300 decision trees) is compared with a single decision t...
bsd-3-clause
Patrick-Cole/pygmi
pygmi/mt/dataprep.py
1
56454
# ----------------------------------------------------------------------------- # Name: dataprep.py (part of PyGMI) # # Author: Patrick Cole # E-Mail: pcole@geoscience.org.za # # Copyright: (c) 2019 Council for Geoscience # Licence: GPL-3.0 # # This file is part of PyGMI # # PyGMI is free softwar...
gpl-3.0
BorisJeremic/Real-ESSI-Examples
education_examples/_Chapter_Material_Behaviour_Examples/Interface_Models/Axial_Models/Bonded_Contact/plot.py
1
1408
#!/usr/bin/python import h5py import matplotlib.pylab as plt import matplotlib as mpl import sys import numpy as np; plt.rcParams.update({'font.size': 24}) # set tick width mpl.rcParams['xtick.major.size'] = 10 mpl.rcParams['xtick.major.width'] = 5 mpl.rcParams['xtick.minor.size'] = 10 mpl.rcParams['xtick.minor.width...
cc0-1.0
ankur-gupta/numerical-software-examples
examples/casadi/ode_example.py
1
1049
import numpy as np import casadi as ca import matplotlib.pyplot as plt # Simple Reaction System # A -> B; k1 # B -> C; k2 # Symbolic rate constants k = ca.MX.sym('k', 2, 1) # States x = ca.MX.sym('x', 3, 1) # RHS of the ODE # Works for version casadi v3.1.1. Check ca.__version__. # For casadi v2.4.3, put all args w...
gpl-3.0
willhaines/scikit-rf
setup.py
3
1100
#!/usr/bin/env python #import ez_setup #ez_setup.use_setuptools() from setuptools import setup, find_packages from distutils.core import Extension with open('skrf/__init__.py') as fid: for line in fid: if line.startswith('__version__'): VERSION = line.strip().split()[-1][1:-1] bre...
bsd-3-clause
joequant/zipline
zipline/utils/security_list.py
18
4472
from datetime import datetime from os import listdir import os.path import pandas as pd import pytz import zipline from zipline.finance.trading import with_environment DATE_FORMAT = "%Y%m%d" zipline_dir = os.path.dirname(zipline.__file__) SECURITY_LISTS_DIR = os.path.join(zipline_dir, 'resources', 'security_lists') ...
apache-2.0
apark263/tensorflow
tensorflow/contrib/metrics/python/ops/metric_ops.py
6
177807
# 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
erh3cq/hyperspy
hyperspy/defaults_parser.py
2
10674
# -*- coding: utf-8 -*- # Copyright 2007-2020 The HyperSpy developers # # This file is part of HyperSpy. # # HyperSpy 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...
gpl-3.0
jshoyer/plantcv
plantcv/analyze_color.py
2
11048
# Analyze Color of Object import os import cv2 import numpy as np from . import print_image from . import plot_image from . import fatal_error from . import plot_colorbar def _pseudocolored_image(device, histogram, bins, img, mask, background, channel, filename, resolution, analysis_images, ...
mit
asnorkin/sentiment_analysis
site/lib/python2.7/site-packages/sklearn/semi_supervised/tests/test_label_propagation.py
5
1998
""" test the label propagation module """ import numpy as np from sklearn.utils.testing import assert_equal from sklearn.semi_supervised import label_propagation from numpy.testing import assert_array_almost_equal from numpy.testing import assert_array_equal ESTIMATORS = [ (label_propagation.LabelPropagation, {...
mit