repo_name
stringlengths
7
92
path
stringlengths
5
149
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
911
693k
license
stringclasses
15 values
justincassidy/ThinkStats2
code/hinc_soln.py
67
4296
"""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 numpy as np import pandas import hinc import thinkplot import thinkstats2 ""...
gpl-3.0
yhilpisch/dx
dx/plot.py
1
5805
# # DX Analytics # Helper Function for Plotting # dx_plot.py # # DX Analytics is a financial analytics library, mainly for # derviatives modeling and pricing by Monte Carlo simulation # # (c) Dr. Yves J. Hilpisch # The Python Quants GmbH # # This program is free software: you can redistribute it and/or modify # it unde...
agpl-3.0
samuel1208/scikit-learn
sklearn/manifold/tests/test_isomap.py
226
3941
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
dwavesystems/dimod
dimod/sampleset.py
1
63014
# Copyright 2018 D-Wave Systems 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...
apache-2.0
cellular-nanoscience/pyotic
pyoti/modification/modification.py
1
26859
# -*- coding: utf-8 -*- """ Created on Fri Feb 12 14:22:31 2016 @author: Tobias Jachowski """ import collections import matplotlib.pyplot as plt import numpy as np from abc import ABCMeta, abstractmethod from .. import gui from .. import helpers as hp from .. import traces as tc from ..evaluate import signal as sn fr...
apache-2.0
omnirom/android_kernel_htc_flounder
scripts/tracing/dma-api/trace.py
96
12420
"""Main program and stuff""" #from pprint import pprint from sys import stdin import os.path import re from argparse import ArgumentParser import cPickle as pickle from collections import namedtuple from plotting import plotseries, disp_pic import smmu class TracelineParser(object): """Parse the needed informatio...
gpl-2.0
RayMick/scikit-learn
sklearn/metrics/classification.py
95
67713
"""Metrics to assess performance on classification task given classe prediction Functions named as ``*_score`` return a scalar value to maximize: the higher the better Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize: the lower the better """ # Authors: Alexandre Gramfort <alexandre.gram...
bsd-3-clause
phgupta/Building-Analytics
building-analytics/TS_Util_Clean_Data.py
1
15125
# -*- coding: utf-8 -*- """ @author : Armando Casillas <armcasillas@ucdavis.edu> @author : Marco Pritoni <marco.pritoni@gmail.com> Created on Wed Jul 26 2017 Update Aug 08 2017 """ from __future__ import division import pandas as pd import os import sys import requests as req import json import numpy as np import dat...
mit
MartinSavc/scikit-learn
sklearn/kernel_approximation.py
258
17973
""" The :mod:`sklearn.kernel_approximation` module implements several approximate kernel feature maps base on Fourier transforms. """ # Author: Andreas Mueller <amueller@ais.uni-bonn.de> # # License: BSD 3 clause import warnings import numpy as np import scipy.sparse as sp from scipy.linalg import svd from .base im...
bsd-3-clause
badjr/pysal
pysal/contrib/spint/tests/test_gravity_stats.py
8
12472
""" Tests for statistics for gravity-style spatial interaction models """ __author__ = 'toshan' import unittest import numpy as np import pandas as pd import gravity as grav import mle_stats as stats class SingleParameter(unittest.TestCase): """Unit tests statistics when there is a single parameters estimated""...
bsd-3-clause
allanino/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
fxia22/pointGAN
show_ae.py
1
1680
from __future__ import print_function from show3d_balls import * import argparse import os import random import numpy as np import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.optim as optim import torch.utils.data import torchvision.datasets as dset import torc...
mit
petosegan/scikit-learn
sklearn/calibration.py
137
18876
"""Calibration of predicted probabilities.""" # Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Balazs Kegl <balazs.kegl@gmail.com> # Jan Hendrik Metzen <jhm@informatik.uni-bremen.de> # Mathieu Blondel <mathieu@mblondel.org> # # License: BSD 3 clause from __future__ impo...
bsd-3-clause
BU-PyCon/Meeting-2
Programs/PyPlot.py
1
18763
import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib.patches import * import pdb print(""" MatPlotLib Advanced Tutorial ---------------------------- This is a tutorial covering the features and usage of the matplotlib package in more detail. In truth, no...
mit
ivano666/tensorflow
tensorflow/examples/skflow/text_classification_character_rnn.py
9
2530
# Copyright 2015-present The Scikit Flow 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 require...
apache-2.0
edhuckle/statsmodels
statsmodels/sandbox/regression/tests/test_gmm_poisson.py
31
13338
''' TestGMMMultTwostepDefault() has lower precision ''' from statsmodels.compat.python import lmap import numpy as np from numpy.testing.decorators import skipif import pandas import scipy from scipy import stats from statsmodels.regression.linear_model import OLS from statsmodels.sandbox.regression import gmm fro...
bsd-3-clause
cbertinato/pandas
pandas/tests/plotting/test_backend.py
1
1151
import pytest import pandas def test_matplotlib_backend_error(): msg = ('matplotlib is required for plotting when the default backend ' '"matplotlib" is selected.') try: import matplotlib # noqa except ImportError: with pytest.raises(ImportError, match=msg): pandas...
bsd-3-clause
leggitta/mne-python
examples/realtime/ftclient_rt_compute_psd.py
17
2460
""" ============================================================== Compute real-time power spectrum density with FieldTrip client ============================================================== Please refer to `ftclient_rt_average.py` for instructions on how to get the FieldTrip connector working in MNE-Python. This e...
bsd-3-clause
ChanderG/scikit-learn
sklearn/manifold/tests/test_isomap.py
226
3941
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
ovpn-to/oVPN.to-Client-Software
else/python/hooks.py
1
17289
# -*- coding: utf-8 -*- # # Hooks module for py2exe. # Inspired by cx_freeze's hooks.py, which is: # # Copyright © 2007-2013, Anthony Tuininga. # Copyright © 2001-2006, Computronix (Canada) Ltd., Edmonton, Alberta, Canada. # All rights reserved. # import os, sys # Exclude modules that the standard library imp...
gpl-2.0
idlead/scikit-learn
examples/neural_networks/plot_mlp_training_curves.py
56
3596
""" ======================================================== Compare Stochastic learning strategies for MLPClassifier ======================================================== This example visualizes some training loss curves for different stochastic learning strategies, including SGD and Adam. Because of time-constrai...
bsd-3-clause
musteryu/Data-Mining
assignment-黄煜-3120100937/question_4.py
1
1258
from mylib import * import os,sys import numpy as np import matplotlib.pyplot as plt import math import random from time import time if __name__ == '__main__': DIR_PATH = sys.path[0] + '\\' # normal distribution vector file nvctr_file1 = DIR_PATH + 'normal_500_1.txt' nvctr_file2 = DIR_PATH + 'normal_500_2.txt' #...
gpl-2.0
riddlezyc/geolab
src/structure/Z.py
1
1474
# -*- coding: utf-8 -*- # from framesplit import trajectory # too slow using this module import matplotlib.pyplot as plt dirName = r"F:\simulations\asphaltenes\na-mont\TMBO-oil\water\373-continue/" xyzName = 'all.xyz' hetero = 'O' # 'oh' 'N' 'sp' 'O' 'Np' 'sp' with open(dirName + xyzName, 'r') as f...
gpl-3.0
rraadd88/dms2dfe
dms2dfe/lib/io_mut_class.py
2
9503
# Copyright 2017, Rohan Dandage <rraadd_8@hotmail.com,rohan@igib.in> # This program is distributed under General Public License v. 3. """ ================================ ``io_mut_files`` ================================ """ from __future__ import division import sys from os.path import splitext,exists,basename,absp...
gpl-3.0
leejw51/BumblebeeNet
Test/AddLayer.py
1
1320
import numpy as np import matplotlib.pylab as plt from MulLayer import MulLayer class AddLayer: def __init__ (self): pass def forward(self, x, y): out = x + y return out def backward(self, dout): dx = dout * 1 ...
mit
stephenliu1989/HK_DataMiner
hkdataminer/cluster/faiss_dbscan_.py
1
14197
# -*- coding: utf-8 -*- """ DBSCAN Acclerated by Facebook AI Faiss DBSCAN: Density-Based Spatial Clustering of Applications with Noise """ # Author: Robert Layton <robertlayton@gmail.com> # Joel Nothman <joel.nothman@gmail.com> # Lars Buitinck # # License: BSD 3 clause import numpy as np import time f...
apache-2.0
joergsimon/gesture-analysis
analysis/feature_selection.py
1
6744
from analysis.preparation import labelMatrixToArray from analysis.preparation import normalizeZeroClassArray from visualise.trace_features import trace_feature_origin from visualise.confusion_matrix import plot_confusion_matrix import numpy as np import sklearn import sklearn.linear_model import sklearn.preprocessing ...
apache-2.0
brodoll/sms-tools
lectures/09-Sound-description/plots-code/centroid.py
23
1086
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') centroid = ess.Centroid(range=fs/2.0) x = ess.MonoLoader(filename = '../../../sounds/speech-male.wav', sampleRate = fs)() c...
agpl-3.0
Rignak/Scripts-Python
DeepLearning/TagPrediction/TagPrediction.py
1
10291
import numpy as np import matplotlib.pyplot as plt import os from os.path import join import cv2 from skimage.transform import resize from tqdm import tqdm from datetime import datetime import functools os.environ['TF_CPP_MIN_VLOG_LEVEL'] = '3' os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' from keras import optimizers fro...
gpl-3.0
asnorkin/sentiment_analysis
site/lib/python2.7/site-packages/sklearn/feature_selection/variance_threshold.py
123
2572
# Author: Lars Buitinck # 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(BaseEstimator, SelectorMixin): ...
mit
cogeorg/BlackRhino
networkx/drawing/nx_pylab.py
1
32861
# Copyright (C) 2004-2016 by # Aric Hagberg <hagberg@lanl.gov> # Dan Schult <dschult@colgate.edu> # Pieter Swart <swart@lanl.gov> # All rights reserved. # BSD license. # # Author: Aric Hagberg (hagberg@lanl.gov) """ ********** Matplotlib ********** Draw networks with matplotlib. See Also -------- m...
gpl-3.0
yavalvas/yav_com
build/matplotlib/lib/matplotlib/dviread.py
11
33923
""" An experimental module for reading dvi files output by TeX. Several limitations make this not (currently) useful as a general-purpose dvi preprocessor, but it is currently used by the pdf backend for processing usetex text. Interface:: dvi = Dvi(filename, 72) # iterate over pages (but only one page is support...
mit
l11x0m7/Paper
Modulation/code/signal_analysis.py
1
7322
# -*- encoding:utf-8 -*- import os import sys import logging from copy import deepcopy from matplotlib import pyplot as plt import numpy as np from sklearn.model_selection import train_test_split reload(sys) def drawModulation(dirpath, rownum=200): """信号文件绘图 :param filepath: 需要显示绘图的信号文件路径 :return: None ...
apache-2.0
marcusrehm/serenata-de-amor
research/src/fetch_cnpj_info.py
2
12631
from concurrent import futures import json import argparse import time import random import itertools import numpy as np import os.path import sys import pandas as pd import shutil import requests import requests.exceptions import re import logging import json from datetime import datetime, timedelta LOGGER_NAME = 'fe...
mit
decebel/librosa
librosa/filters.py
2
24021
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Filters ======= Filter bank construction ------------------------ .. autosummary:: :toctree: generated/ dct mel chroma constant_q Miscellaneous ------------- .. autosummary:: :toctree: generated/ constant_q_lengths cq_to_chroma wi...
isc
hyqneuron/pylearn2-maxsom
pylearn2/scripts/datasets/browse_norb.py
44
15741
#!/usr/bin/env python """ A browser for the NORB and small NORB datasets. Navigate the images by choosing the values for the label vector. Note that for the 'big' NORB dataset, you can only set the first 5 label dimensions. You can then cycle through the 3-12 images that fit those labels. """ import sys import os imp...
bsd-3-clause
jaidevd/scikit-learn
examples/cluster/plot_kmeans_silhouette_analysis.py
83
5888
""" =============================================================================== Selecting the number of clusters with silhouette analysis on KMeans clustering =============================================================================== Silhouette analysis can be used to study the separation distance between the...
bsd-3-clause
billy-inn/scikit-learn
examples/linear_model/plot_ransac.py
250
1673
""" =========================================== Robust linear model estimation using RANSAC =========================================== In this example we see how to robustly fit a linear model to faulty data using the RANSAC algorithm. """ import numpy as np from matplotlib import pyplot as plt from sklearn import ...
bsd-3-clause
alexsavio/scikit-learn
examples/gaussian_process/plot_gpc_iris.py
81
2231
""" ===================================================== 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. ...
bsd-3-clause
bouhlelma/smt
smt/sampling_methods/tests/test_sampling_method_examples.py
3
1403
import unittest import matplotlib matplotlib.use("Agg") class Test(unittest.TestCase): def test_random(self): import numpy as np import matplotlib.pyplot as plt from smt.sampling_methods import Random xlimits = np.array([[0.0, 4.0], [0.0, 3.0]]) sampling = Random(xlimit...
bsd-3-clause
vortex-ape/scikit-learn
examples/datasets/plot_random_multilabel_dataset.py
278
3402
""" ============================================== Plot randomly generated multilabel dataset ============================================== This illustrates the `datasets.make_multilabel_classification` dataset generator. Each sample consists of counts of two features (up to 50 in total), which are differently distri...
bsd-3-clause
jefffohl/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/backends/__init__.py
72
2225
import matplotlib import inspect import warnings # ipython relies on interactive_bk being defined here from matplotlib.rcsetup import interactive_bk __all__ = ['backend','show','draw_if_interactive', 'new_figure_manager', 'backend_version'] backend = matplotlib.get_backend() # validates, to match all_bac...
gpl-3.0
sohyongsheng/kaggle-carvana
plot_learning_curves.py
1
2337
import numpy import matplotlib.pyplot import pylab import sys def plot_learning_curves(experiment, epochs, train_losses, cross_validation_losses, dice_scores, x_limits = None, y_limits = None): axes = matplotlib.pyplot.figure().gca() x_axis = axes.get_xaxis() x_axis.set_major_locator(pylab.MaxNLocator(...
gpl-3.0
JesseLivezey/plankton
pylearn2/packaged_dependencies/theano_linear/unshared_conv/localdot.py
5
4839
""" WRITEME """ import logging from ..linear import LinearTransform from .unshared_conv import FilterActs, ImgActs from theano.compat.six.moves import xrange from theano.sandbox import cuda if cuda.cuda_available: import gpu_unshared_conv # register optimizations import numpy as np try: import matplotlib.pyp...
bsd-3-clause
vivekmishra1991/scikit-learn
sklearn/decomposition/dict_learning.py
104
44632
""" Dictionary learning """ from __future__ import print_function # Author: Vlad Niculae, Gael Varoquaux, Alexandre Gramfort # License: BSD 3 clause import time import sys import itertools from math import sqrt, ceil import numpy as np from scipy import linalg from numpy.lib.stride_tricks import as_strided from ..b...
bsd-3-clause
snario/geopandas
geopandas/plotting.py
2
9645
from __future__ import print_function import numpy as np from six import next from six.moves import xrange def plot_polygon(ax, poly, facecolor='red', edgecolor='black', alpha=0.5): """ Plot a single Polygon geometry """ from descartes.patch import PolygonPatch a = np.asarray(poly.exterior) # without...
bsd-3-clause
shirtsgroup/pygo
analysis/MBAR_foldingcurve_umbrella.py
1
6397
#!/usr/bin/python2.4 import sys import numpy import pymbar # for MBAR analysis import timeseries # for timeseries analysis import os import os.path import pdb # for debugging from optparse import OptionParser import MBAR_pmfQz import wham import MBAR_pmfQ import cPickle def parse_args(): parser=OptionParser() ...
gpl-2.0
rahul-c1/scikit-learn
benchmarks/bench_multilabel_metrics.py
11
7258
#!/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
plotly/python-api
packages/python/plotly/plotly/graph_objs/scatter/marker/_colorbar.py
1
69628
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class ColorBar(_BaseTraceHierarchyType): # class properties # -------------------- _parent_path_str = "scatter.marker" _path_str = "scatter.marker.colorbar" _valid_props = { "bgcolor", ...
mit
dominicmeroux/Reading-In-and-Analyzing-Calendar-Data-by-Interfacing-Between-MySQL-and-Python
Utilization-Report-MySQL.py
1
18653
from __future__ import print_function from icalendar import * from datetime import date, datetime, timedelta import mysql.connector from mysql.connector import errorcode import pickle import csv import pandas from pandas.io import sql import matplotlib.pyplot as plt import xlsxwriter import numpy as np import os import...
mit
gviejo/ThalamusPhysio
python/main_pop_pca.py
1
15802
import numpy as np import pandas as pd # from matplotlib.pyplot import plot,show,draw import scipy.io from functions import * import _pickle as cPickle import time import os, sys import ipyparallel import neuroseries as nts data_directory = '/mnt/DataGuillaume/MergedData/' datasets = np.loadtxt(data_directory+'datas...
gpl-3.0
RPGOne/Skynet
scikit-learn-c604ac39ad0e5b066d964df3e8f31ba7ebda1e0e/sklearn/utils/__init__.py
2
12026
""" The :mod:`sklearn.utils` module includes various utilities. """ from collections import Sequence import numpy as np from scipy.sparse import issparse import warnings from .murmurhash import murmurhash3_32 from .validation import (as_float_array, assert_all_finite, warn_if_not_float, ...
bsd-3-clause
AstroFloyd/LearningPython
Fitting/scipy.optimize.least_squares.py
1
2724
#!/bin/env python3 # https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.least_squares.html """Solve a curve fitting problem using robust loss function to take care of outliers in the data. Define the model function as y = a + b * exp(c * t), where t is a predictor variable, y is an observation and a,...
gpl-3.0
sugartom/tensorflow-alien
tensorflow/contrib/learn/python/learn/tests/dataframe/in_memory_source_test.py
62
3960
# 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
scienceopen/spectral_analysis
scripts/FilterDesign.py
1
3846
#!/usr/bin/env python """ Design FIR filter coefficients using Parks-McClellan or windowing algorithm and plot filter transfer function. Michael Hirsch, Ph.D. example for PiRadar CW prototype, writing filter coefficients for use by filters.f90: ./FilterDesign.py 9950 10050 100e3 -L 4096 -m firwin -o cwfir.asc Refs: h...
mit
biocore/qiita
qiita_db/meta_util.py
2
20723
r""" Util functions (:mod: `qiita_db.meta_util`) =========================================== ..currentmodule:: qiita_db.meta_util This module provides utility functions that use the ORM objects. ORM objects CANNOT import from this file. Methods ------- ..autosummary:: :toctree: generated/ get_lat_longs """...
bsd-3-clause
pratapvardhan/scikit-learn
examples/decomposition/plot_faces_decomposition.py
103
4394
""" ============================ Faces dataset decompositions ============================ This example applies to :ref:`olivetti_faces` different unsupervised matrix decomposition (dimension reduction) methods from the module :py:mod:`sklearn.decomposition` (see the documentation chapter :ref:`decompositions`) . """...
bsd-3-clause
gunan/tensorflow
tensorflow/python/keras/engine/data_adapter_test.py
1
43158
# Copyright 2019 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
sandeepgupta2k4/tensorflow
tensorflow/examples/learn/iris_val_based_early_stopping.py
62
2827
# 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
NunoEdgarGub1/scikit-learn
examples/cross_decomposition/plot_compare_cross_decomposition.py
142
4761
""" =================================== Compare cross decomposition methods =================================== Simple usage of various cross decomposition algorithms: - PLSCanonical - PLSRegression, with multivariate response, a.k.a. PLS2 - PLSRegression, with univariate response, a.k.a. PLS1 - CCA Given 2 multivari...
bsd-3-clause
duthchao/kaggle-galaxies
predict_augmented_npy_maxout2048_pysex.py
7
9584
""" Load an analysis file and redo the predictions on the validation set / test set, this time with augmented data and averaging. Store them as numpy files. """ import numpy as np # import pandas as pd import theano import theano.tensor as T import layers import cc_layers import custom import load_data import realtime...
bsd-3-clause
anhaidgroup/py_stringsimjoin
py_stringsimjoin/join/overlap_coefficient_join_py.py
1
17453
# overlap coefficient join from joblib import delayed, Parallel from six import iteritems import pandas as pd import pyprind from py_stringsimjoin.filter.overlap_filter import OverlapFilter from py_stringsimjoin.index.inverted_index import InvertedIndex from py_stringsimjoin.utils.generic_helper import convert_datafra...
bsd-3-clause
numairmansur/RoBO
examples/example_bagged_nets.py
1
1284
import sys import logging import numpy as np import matplotlib.pyplot as plt import robo.models.neural_network as robo_net import robo.models.bagged_networks as bn from robo.initial_design.init_random_uniform import init_random_uniform logging.basicConfig(stream=sys.stdout, level=logging.INFO) def f(x): return...
bsd-3-clause
Adai0808/scikit-learn
sklearn/cluster/tests/test_affinity_propagation.py
341
2620
""" Testing for Clustering methods """ import numpy as np from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.cluster.affinity_propagation_ import AffinityPropagation from sklearn.cluster.affinity_propagatio...
bsd-3-clause
f3r/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
apaloczy/ap_tools
utils.py
1
54151
# Description: General-purpose functions for personal use. # Author: André Palóczy # E-mail: paloczy@gmail.com __all__ = ['seasonal_avg', 'seasonal_std', 'deseason', 'blkavg', 'blkavgdir', 'blkavgt', 'blkapply', 'stripmsk', ...
mit
miaecle/deepchem
examples/tox21/tox21_KernelSVM.py
6
1174
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Sun Jul 23 16:02:07 2017 @author: zqwu """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import numpy as np import deepchem as dc import tempfile from sklearn.svm import SVC # Only for debug...
mit
idlead/scikit-learn
sklearn/naive_bayes.py
29
28917
# -*- coding: utf-8 -*- """ The :mod:`sklearn.naive_bayes` module implements Naive Bayes algorithms. These are supervised learning methods based on applying Bayes' theorem with strong (naive) feature independence assumptions. """ # Author: Vincent Michel <vincent.michel@inria.fr> # Minor fixes by Fabian Pedre...
bsd-3-clause
MichaelAquilina/numpy
numpy/lib/npyio.py
42
71218
from __future__ import division, absolute_import, print_function import sys import os import re import itertools import warnings import weakref from operator import itemgetter import numpy as np from . import format from ._datasource import DataSource from numpy.core.multiarray import packbits, unpackbits from ._ioto...
bsd-3-clause
0x0all/kaggle-galaxies
predict_augmented_npy_maxout2048.py
8
9452
""" Load an analysis file and redo the predictions on the validation set / test set, this time with augmented data and averaging. Store them as numpy files. """ import numpy as np # import pandas as pd import theano import theano.tensor as T import layers import cc_layers import custom import load_data import realtime...
bsd-3-clause
fivejjs/AD3
python/example.py
3
2817
import matplotlib.pyplot as plt import numpy as np from ad3 import simple_grid, general_graph def example_binary(): # generate trivial data x = np.ones((10, 10)) x[:, 5:] = -1 x_noisy = x + np.random.normal(0, 0.8, size=x.shape) x_thresh = x_noisy > .0 # create unaries unaries = x_noisy ...
lgpl-3.0
zseder/hunmisc
hunmisc/utils/plotting/matplotlib_simple_xy.py
1
1535
""" Copyright 2011-13 Attila Zseder Email: zseder@gmail.com This file is part of hunmisc project url: https://github.com/zseder/hunmisc hunmisc 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 versi...
gpl-3.0
cs591B1-Project/Social-Media-Impact-on-Stock-Market-and-Price
data/07 exxon/dataAnalysis.py
26
6163
import numpy from numpy import * from operator import truediv from ast import literal_eval import matplotlib.pyplot as plt import statsmodels.tsa.stattools as st import scipy.stats as scit def calCorrelation(s,v): # STEP 1: Read all data files p = [line.rstrip('\n') for line in open("positive.txt")] n = [line.rs...
mit
ZENGXH/scikit-learn
sklearn/neighbors/tests/test_kde.py
208
5556
import numpy as np from sklearn.utils.testing import (assert_allclose, assert_raises, assert_equal) from sklearn.neighbors import KernelDensity, KDTree, NearestNeighbors from sklearn.neighbors.ball_tree import kernel_norm from sklearn.pipeline import make_pipeline from sklearn.dataset...
bsd-3-clause
nolanliou/tensorflow
tensorflow/examples/get_started/regression/imports85.py
24
6638
# 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
pratapvardhan/pandas
pandas/tests/indexes/multi/test_integrity.py
3
9142
# -*- coding: utf-8 -*- import re import numpy as np import pandas as pd import pandas.util.testing as tm import pytest from pandas import IntervalIndex, MultiIndex, RangeIndex from pandas.compat import lrange, range from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike def test_labels_dtypes(...
bsd-3-clause
rohit21122012/DCASE2013
runs/2016/dnn2016med_gd_50/task3_sound_event_detection_in_real_life_audio.py
15
46699
#!/usr/bin/env python # -*- coding: utf-8 -*- # # DCASE 2016::Sound Event Detection in Real-life Audio / Baseline System import argparse import csv import math import numpy import textwrap import warnings from sklearn import mixture from src.dataset import * from src.evaluation import * from src.features import * fr...
mit
victor-prado/broker-manager
environment/lib/python3.5/site-packages/pandas/sparse/tests/test_indexing.py
7
38977
# pylint: disable-msg=E1101,W0612 import nose # noqa import numpy as np import pandas as pd import pandas.util.testing as tm class TestSparseSeriesIndexing(tm.TestCase): _multiprocess_can_split_ = True def setUp(self): self.orig = pd.Series([1, np.nan, np.nan, 3, np.nan]) self.sparse = sel...
mit
yarikoptic/NiPy-OLD
nipy/neurospin/viz/activation_maps.py
1
25526
#!/usr/bin/env python """ Functions to do automatic visualization of activation-like maps. For 2D-only visualization, only matplotlib is required. For 3D visualization, Mayavi, version 3.0 or greater, is required. """ # Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org> # License: BSD # Standard libr...
bsd-3-clause
ElDeveloper/qiita
qiita_pet/handlers/rest/study_samples.py
3
4239
# ----------------------------------------------------------------------------- # Copyright (c) 2014--, The Qiita Development Team. # # Distributed under the terms of the BSD 3-clause License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
bsd-3-clause
chongyangtao/gmmreg
Python/_plotting.py
14
2435
#!/usr/bin/env python #coding=utf-8 ##==================================================== ## $Author$ ## $Date$ ## $Revision$ ##==================================================== from pylab import * from configobj import ConfigObj import matplotlib.pyplot as plt def display2Dpointset(A): fig = plt.figure() ...
gpl-3.0
liang42hao/bokeh
bokeh/compat/mplexporter/renderers/base.py
44
14355
import warnings import itertools from contextlib import contextmanager import numpy as np from matplotlib import transforms from .. import utils from .. import _py3k_compat as py3k class Renderer(object): @staticmethod def ax_zoomable(ax): return bool(ax and ax.get_navigate()) @staticmethod ...
bsd-3-clause
dongjoon-hyun/tensorflow
tensorflow/contrib/learn/python/learn/estimators/linear_test.py
23
77821
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
bovulpes/AliceO2
Detectors/FIT/benchmark/process.py
6
12238
# load modules import re import sys import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import AutoMinorLocator # use classic plot style plt.style.use('classic') # read and save user input filenames mem_filename = sys.argv[1] cpu_filename = sys.argv[2] # save the process id ...
gpl-3.0
mjgrav2001/scikit-learn
sklearn/linear_model/tests/test_bayes.py
299
1770
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # # License: BSD 3 clause import numpy as np from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import SkipTest from sklearn.linear_model.bayes import BayesianRidge, ARDRegres...
bsd-3-clause
drabastomek/practicalDataAnalysisCookbook
Codes/Chapter07/ts_detrendAndRemoveSeasonality.py
1
2625
import pandas as pd import numpy as np import matplotlib import matplotlib.pyplot as plt # change the font size matplotlib.rc('xtick', labelsize=9) matplotlib.rc('ytick', labelsize=9) matplotlib.rc('font', size=14) # time series tools import statsmodels.api as sm def period_mean(data, freq): ''' Method t...
gpl-2.0
jlegendary/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/widgets.py
69
40833
""" GUI Neutral widgets All of these widgets require you to predefine an Axes instance and pass that as the first arg. matplotlib doesn't try to be too smart in layout -- you have to figure out how wide and tall you want your Axes to be to accommodate your widget. """ import numpy as np from mlab import dist from p...
gpl-3.0
murrayrm/python-control
examples/pvtol-nested.py
2
4551
# pvtol-nested.py - inner/outer design for vectored thrust aircraft # RMM, 5 Sep 09 # # This file works through a fairly complicated control design and # analysis, corresponding to the planar vertical takeoff and landing # (PVTOL) aircraft in Astrom and Murray, Chapter 11. It is intended # to demonstrate the basic fun...
bsd-3-clause
rc/sfepy
script/plot_mesh.py
4
4164
#!/usr/bin/env python """ Plot mesh connectivities, facet orientations, global and local DOF ids etc. To switch off plotting some mesh entities, set the corresponding color to `None`. """ from __future__ import absolute_import import sys sys.path.append('.') from argparse import ArgumentParser import matplotlib.pyplo...
bsd-3-clause
adamginsburg/APEX_CMZ_H2CO
plot_codes/tmap_figure.py
2
12670
import pylab as pl import numpy as np import aplpy import os import copy from astropy import log from paths import h2copath, figurepath import paths import matplotlib from scipy import stats as ss from astropy.io import fits matplotlib.rc_file(paths.pcpath('pubfiguresrc')) pl.ioff() # Close these figures so we can rem...
bsd-3-clause
drammock/mne-python
mne/viz/backends/_abstract.py
4
24939
"""ABCs.""" # Authors: Guillaume Favelier <guillaume.favelier@gmail.com # Eric Larson <larson.eric.d@gmail.com> # # License: Simplified BSD from abc import ABC, abstractmethod, abstractclassmethod from contextlib import nullcontext import warnings from ..utils import tight_layout class _AbstractRenderer(A...
bsd-3-clause
RPGroup-PBoC/gist_pboc_2017
code/inclass/phase_portrait_in_class.py
1
1286
# Duhhhh import numpy as np import matplotlib.pyplot as plt import seaborn plt.close('all') # Define the parameters r = 20 # the production rate gamma = 1 / 30 # the degradation rate k = 200 # in units of concentration max_R = 1000 # maximum number of R1 and R2 R1 = np.linspace(0, max_R, 500) R2 = np.linspace(0, m...
mit
mhue/scikit-learn
sklearn/cross_decomposition/tests/test_pls.py
215
11427
import numpy as np from sklearn.utils.testing import (assert_array_almost_equal, assert_array_equal, assert_true, assert_raise_message) from sklearn.datasets import load_linnerud from sklearn.cross_decomposition import pls_ from nose.tools import assert_equal def test_pls(): d =...
bsd-3-clause
OshynSong/scikit-learn
examples/model_selection/grid_search_digits.py
227
2665
""" ============================================================ Parameter estimation using grid search with cross-validation ============================================================ This examples shows how a classifier is optimized by cross-validation, which is done using the :class:`sklearn.grid_search.GridSearc...
bsd-3-clause
glouppe/scikit-learn
benchmarks/bench_isotonic.py
268
3046
""" Benchmarks of isotonic regression performance. We generate a synthetic dataset of size 10^n, for n in [min, max], and examine the time taken to run isotonic regression over the dataset. The timings are then output to stdout, or visualized on a log-log scale with matplotlib. This alows the scaling of the algorith...
bsd-3-clause
nmartensen/pandas
scripts/file_sizes.py
7
4949
from __future__ import print_function import os import sys import numpy as np import matplotlib.pyplot as plt from pandas import DataFrame from pandas.util.testing import set_trace from pandas import compat dirs = [] names = [] lengths = [] if len(sys.argv) > 1: loc = sys.argv[1] else: loc = '.' walked = os...
bsd-3-clause
jakobkolb/MayaSim
mayasim/model/ModelCore.py
1
66303
from __future__ import print_function import datetime import operator import os import sys import traceback import warnings from itertools import compress import networkx as nx import numpy as np import pandas import pkg_resources import scipy.ndimage as ndimage import scipy.sparse as sparse try: import cPickle ...
gpl-3.0
tapomayukh/projects_in_python
rapid_categorization/haptic_map/outlier/hmm_crossvalidation_force.py
1
19066
# Hidden Markov Model Implementation import pylab as pyl import numpy as np import matplotlib.pyplot as pp #from enthought.mayavi import mlab import scipy as scp import scipy.ndimage as ni import roslib; roslib.load_manifest('sandbox_tapo_darpa_m3') import rospy #import hrl_lib.mayavi2_util as mu import hrl_lib.viz ...
mit
dav-stott/phd-thesis
spectra_thesis_ais.py
1
70177
# -*- coding: utf-8 -*- """ Created on Fri Jul 25 08:48:28 2014 @author: david """ #*************** IMPORT DEPENDANCIES******************************************* import numpy as np #import spec_gdal4 as spg from osgeo import gdal import os import csv #import h5py import datetime import numpy.ma as ma #from StringIO ...
mit
omanor/MUSiCC
tests/test_musicc.py
1
5038
#!/usr/bin/env python """ This is the testing unit for MUSiCC """ # to comply with both Py2 and Py3 from __future__ import absolute_import, division, print_function import unittest import os import pandas as pd import musicc from musicc.core import correct_and_normalize class MUSiCCTestCase(unittest.TestCase): ...
bsd-3-clause