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
xiwei-zhang/vigra
vigranumpy/lib/__init__.py
4
80099
####################################################################### # # Copyright 2009-2010 by Ullrich Koethe # # This file is part of the VIGRA computer vision library. # The VIGRA Website is # http://hci.iwr.uni-heidelberg.de/vigra/ # Please direct questions, bug reports, and contributions...
mit
jorik041/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
mmilutinovic1313/zipline-with-algorithms
tests/finance/test_slippage.py
32
18400
# # Copyright 2013 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
hmendozap/auto-sklearn
test/test_pipeline/implementations/test_ProjLogit.py
1
1277
import unittest import os import numpy as np #import scipy.io from autosklearn.pipeline.implementations.ProjLogit import ProjLogit class TestProjLogit(unittest.TestCase): def test_sparse_filtering(self): """Test logistic regression implementation based on least squares""" # simple test that shou...
bsd-3-clause
drammock/mne-python
mne/io/base.py
2
99893
# -*- coding: utf-8 -*- # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Matti Hämäläinen <msh@nmr.mgh.harvard.edu> # Martin Luessi <mluessi@nmr.mgh.harvard.edu> # Denis Engemann <denis.engemann@gmail.com> # Teon Brooks <teon.brooks@gmail.com> # Marijn van Vliet...
bsd-3-clause
rajul/tvb-library
tvb/simulator/plot/tools.py
2
37849
# -*- coding: utf-8 -*- # # # TheVirtualBrain-Scientific Package. This package holds all simulators, and # analysers necessary to run brain-simulations. You can use it stand alone or # in conjunction with TheVirtualBrain-Framework Package. See content of the # documentation-folder for more details. See also http://ww...
gpl-2.0
djgagne/scikit-learn
examples/cluster/plot_lena_ward_segmentation.py
271
1998
""" =============================================================== A demo of structured Ward hierarchical clustering on Lena image =============================================================== Compute the segmentation of a 2D image with Ward hierarchical clustering. The clustering is spatially constrained in order ...
bsd-3-clause
krez13/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
elijah513/scikit-learn
examples/manifold/plot_lle_digits.py
181
8510
""" ============================================================================= Manifold learning on handwritten digits: Locally Linear Embedding, Isomap... ============================================================================= An illustration of various embeddings on the digits dataset. The RandomTreesEmbed...
bsd-3-clause
bikong2/scikit-learn
sklearn/semi_supervised/tests/test_label_propagation.py
307
1974
""" test the label propagation module """ import nose import numpy as np 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, {'kernel': 'rbf'}), (label_propa...
bsd-3-clause
SeanCameronConklin/aima-python
submissions/Blue/myNN.py
10
3071
from sklearn import datasets from sklearn.neural_network import MLPClassifier import traceback from submissions.Blue import music class DataFrame: data = [] feature_names = [] target = [] target_names = [] musicATRB = DataFrame() musicATRB.data = [] targetData = [] ''' Extract data from the CORGIS Mu...
mit
az0/entity-metadata
code/combine_people_names.py
1
6324
#!/usr/bin/python3 # # Copyright (C) 2019 by Compassion International. All rights reserved. # License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. # This is free software: you are free to change and redistribute it. # There is NO WARRANTY, to the extent permitted by law. """ This program g...
gpl-3.0
interactiveaudiolab/nussl
tests/ml/test_overfit.py
1
3184
from nussl import ml, datasets import tempfile from torch import optim import numpy as np import logging import os import torch from matplotlib import pyplot as plt logging.basicConfig( format='%(asctime)s,%(msecs)d %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s', datefmt='%Y-%m-%d:%H:%M:%S', level=...
mit
Nyker510/scikit-learn
examples/manifold/plot_manifold_sphere.py
258
5101
#!/usr/bin/python # -*- coding: utf-8 -*- """ ============================================= Manifold Learning methods on a severed sphere ============================================= An application of the different :ref:`manifold` techniques on a spherical data-set. Here one can see the use of dimensionality reducti...
bsd-3-clause
dh4gan/oberon
plot/plot_EBMlog_multiplefiles.py
1
2302
# Written 17/1/14 by dh4gan # Code reads in log files from multiple EBMs in the same N Body simulation and plots them import matplotlib.pyplot as plt import numpy as np import io_oberon.io_EBM import filefinder.localfiles as ff # Find log files in directory inputfiles = ff.find_sorted_local_input_fileset('*.log') ...
gpl-3.0
spallavolu/scikit-learn
examples/cluster/plot_mini_batch_kmeans.py
265
4081
""" ==================================================================== Comparison of the K-Means and MiniBatchKMeans clustering algorithms ==================================================================== We want to compare the performance of the MiniBatchKMeans and KMeans: the MiniBatchKMeans is faster, but give...
bsd-3-clause
breznak/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/rcsetup.py
69
23344
""" The rcsetup module contains the default values and the validation code for customization using matplotlib's rc settings. Each rc setting is assigned a default value and a function used to validate any attempted changes to that setting. The default values and validation functions are defined in the rcsetup module, ...
agpl-3.0
malin1993ml/h-store
graphs/throughput-timeline.py
4
7700
#!/usr/bin/env python # Example execution # export b=tpcc ; export dataDir=/home/pavlo/Documents/H-Store/Papers/anticache/data/evictions # ant compile hstore-benchmark -Dproject=$b -Dclient.interval=500 \ # -Dsite.anticache_enable=true -Dsite.anticache_profiling=true \ # -Dclient.output_memory=$dataDir/$b-memor...
gpl-3.0
benoitsteiner/tensorflow-opencl
tensorflow/contrib/distributions/python/ops/mixture.py
13
18780
# 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
carrillo/scikit-learn
sklearn/feature_selection/tests/test_rfe.py
209
11733
""" Testing Recursive feature elimination """ import warnings import numpy as np from numpy.testing import assert_array_almost_equal, assert_array_equal from nose.tools import assert_equal, assert_true from scipy import sparse from sklearn.feature_selection.rfe import RFE, RFECV from sklearn.datasets import load_iris,...
bsd-3-clause
kprestel/PyInvestment
pytech/fin/analysis/technical.py
2
15398
""" Contains functions to perform technical analysis on pandas OHLCV data frames """ import logging from typing import Union import pandas as pd import pytech.utils.pandas_utils as pd_utils logger = logging.getLogger(__name__) def sma(df: pd.DataFrame, period: int = 50, col: str = pd_utils.CLOSE_CO...
mit
aetilley/scikit-learn
examples/mixture/plot_gmm_selection.py
248
3223
""" ================================= Gaussian Mixture Model Selection ================================= This example shows that model selection can be performed with Gaussian Mixture Models using information-theoretic criteria (BIC). Model selection concerns both the covariance type and the number of components in th...
bsd-3-clause
MichelJuillard/dlstats
dlstats/tests/fetchers/test_esri.py
1
43458
# -*- coding: utf-8 -*- """ Created on Thu Nov 26 10:20:04 2015 @author: salimeh """ """ Created on Thu Nov 26 10:20:04 2015 @author: salimeh """ import io import tempfile import datetime import os import pandas from pprint import pprint from urllib.parse import urlparse, urljoin from urllib.request import url2pathn...
agpl-3.0
YinongLong/scikit-learn
examples/semi_supervised/plot_label_propagation_digits_active_learning.py
28
3417
""" ======================================== Label Propagation digits active learning ======================================== Demonstrates an active learning technique to learn handwritten digits using label propagation. We start by training a label propagation model with only 10 labeled points, then we select the t...
bsd-3-clause
xubenben/scikit-learn
sklearn/gaussian_process/gaussian_process.py
83
34544
# -*- coding: utf-8 -*- # Author: Vincent Dubourg <vincent.dubourg@gmail.com> # (mostly translation, see implementation details) # Licence: BSD 3 clause from __future__ import print_function import numpy as np from scipy import linalg, optimize from ..base import BaseEstimator, RegressorMixin from ..metrics...
bsd-3-clause
qrsforever/workspace
python/test/fangzu/collect.py
1
2931
#!/usr/bin/python3 # -*- coding: utf-8 -*- import re from room import RoomInfo from urllib.request import Request, urlopen from urllib.error import URLError import matplotlib.pyplot as plt WEB_SITE = "http://bj.58.com" AREA = "gaobeidianbj" TYPE = "zufang" SUFFIX = "pn" MAX_PAGES = 20 RE_ROOM = r'<p class="room">(\d...
mit
godrayz/trading-with-python
lib/functions.py
76
11627
# -*- coding: utf-8 -*- """ twp support functions @author: Jev Kuznetsov Licence: GPL v2 """ from scipy import polyfit, polyval import datetime as dt #from datetime import datetime, date from pandas import DataFrame, Index, Series import csv import matplotlib.pyplot as plt import numpy as np import p...
bsd-3-clause
moble/sympy
sympy/physics/quantum/state.py
58
29186
"""Dirac notation for states.""" from __future__ import print_function, division from sympy import (cacheit, conjugate, Expr, Function, integrate, oo, sqrt, Tuple) from sympy.core.compatibility import u, range from sympy.printing.pretty.stringpict import stringPict from sympy.physics.quantum.qexpr ...
bsd-3-clause
massmutual/scikit-learn
examples/neighbors/plot_nearest_centroid.py
264
1804
""" =============================== Nearest Centroid Classification =============================== Sample usage of Nearest Centroid classification. It will plot the decision boundaries for each class. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap f...
bsd-3-clause
liangz0707/scikit-learn
examples/linear_model/plot_ols.py
220
1940
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Linear Regression Example ========================================================= This example uses the only the first feature of the `diabetes` dataset, in order to illustrate a two-dimensional plot of this regre...
bsd-3-clause
jblackburne/scikit-learn
sklearn/feature_extraction/tests/test_image.py
25
11187
# Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org> # Gael Varoquaux <gael.varoquaux@normalesup.org> # License: BSD 3 clause import numpy as np import scipy as sp from scipy import ndimage from nose.tools import assert_equal, assert_true from numpy.testing import assert_raises from sklearn...
bsd-3-clause
corburn/scikit-bio
skbio/io/format/genbank.py
4
28763
""" GenBank format (:mod:`skbio.io.format.genbank`) =============================================== .. currentmodule:: skbio.io.format.genbank GenBank format (GenBank Flat File Format) stores sequence and its annotation together. The start of the annotation section is marked by a line beginning with the word "LOCUS"....
bsd-3-clause
Jimmy-Morzaria/scikit-learn
examples/decomposition/plot_faces_decomposition.py
204
4452
""" ============================ 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
lisa-lab/pylearn2
pylearn2/utils/image.py
39
18841
""" Utility functions for working with images. """ import logging import numpy as np plt = None axes = None from theano.compat.six.moves import xrange from theano.compat.six import string_types import warnings try: import matplotlib.pyplot as plt import matplotlib.axes except (RuntimeError, ImportError, TypeErr...
bsd-3-clause
lnls-fac/collective_effects
pycolleff/pycolleff/simulate_landau.py
1
11039
import numpy as np from functools import partial as _partial import scipy.integrate as scy_int import mathphys as _mp import resource import matplotlib.pyplot as plt c = _mp.constants.light_speed def memory_limit(): soft, hard = resource.getrlimit(resource.RLIMIT_AS) resource.setrlimit(resource.RLIMIT_AS, (g...
mit
henrykironde/scikit-learn
examples/ensemble/plot_gradient_boosting_regularization.py
355
2843
""" ================================ Gradient Boosting regularization ================================ Illustration of the effect of different regularization strategies for Gradient Boosting. The example is taken from Hastie et al 2009. The loss function used is binomial deviance. Regularization via shrinkage (``lear...
bsd-3-clause
Vimos/scikit-learn
examples/neighbors/plot_nearest_centroid.py
58
1803
""" =============================== Nearest Centroid Classification =============================== Sample usage of Nearest Centroid classification. It will plot the decision boundaries for each class. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap f...
bsd-3-clause
alephu5/Soundbyte
environment/lib/python3.3/site-packages/pandas/io/tests/test_ga.py
1
7200
import os from datetime import datetime import nose import pandas as pd from pandas import DataFrame from pandas.util.testing import network, assert_frame_equal, with_connectivity_check from numpy.testing.decorators import slow import pandas.util.testing as tm try: import httplib2 import pandas.io.ga as ga ...
gpl-3.0
jomolinare/kobocat
onadata/apps/viewer/tests/test_export_list.py
5
8203
import os from django.core.urlresolvers import reverse from onadata.apps.main.tests.test_base import TestBase from onadata.apps.viewer.models.export import Export from onadata.apps.main.models.meta_data import MetaData from onadata.apps.viewer.views import export_list class TestExportList(TestBase): def setUp(...
bsd-2-clause
radiasoft/radtrack
radtrack/ui/matplotlibwidget.py
1
1226
#!/usr/bin/python from PyQt4 import QtGui from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as Navigationtoolbar from matplotlib.figure import Figure #Embeddable matplotlib figure/canvas class MplCanvas(FigureCanvas):...
apache-2.0
valexandersaulys/airbnb_kaggle_contest
venv/lib/python3.4/site-packages/sklearn/cluster/spectral.py
233
18153
# -*- coding: utf-8 -*- """Algorithms for spectral clustering""" # Author: Gael Varoquaux gael.varoquaux@normalesup.org # Brian Cheung # Wei LI <kuantkid@gmail.com> # License: BSD 3 clause import warnings import numpy as np from ..base import BaseEstimator, ClusterMixin from ..utils import check_rand...
gpl-2.0
Matla/ForceTorqueSensor
code/bias_handler.py
1
12326
__author__ = "Mats Larsen" __copyright__ = "SINTEF, NTNU 2013" __credits__ = ["Morten Lind"] __license__ = "GPL" __maintainer__ = "Mats Larsen" __email__ = "matsla@{ntnu.no}" __status__ = "Development" #-------------------------------------------------------------------- #File: bias_handler.py #Module Description """ T...
gpl-3.0
fergalbyrne/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_emf.py
69
22336
""" Enhanced Metafile backend. See http://pyemf.sourceforge.net for the EMF driver library. """ from __future__ import division try: import pyemf except ImportError: raise ImportError('You must first install pyemf from http://pyemf.sf.net') import os,sys,math,re from matplotlib import verbose, __version__,...
agpl-3.0
swordsmaster/waf
testsuites/tmtests/tmcontext01/plot.py
14
1341
# # Copyright (c) 2014 embedded brains GmbH. All rights reserved. # # The license and distribution terms for this file may be # found in the file LICENSE in this distribution or at # http://www.rtems.org/license/LICENSE. # import libxml2 from libxml2 import xmlNode import matplotlib.pyplot as plt doc = libxml2.parseF...
gpl-2.0
almarklein/scikit-image
doc/examples/plot_line_hough_transform.py
2
4361
r""" ============================= Straight line Hough transform ============================= The Hough transform in its simplest form is a `method to detect straight lines <http://en.wikipedia.org/wiki/Hough_transform>`__. In the following example, we construct an image with a line intersection. We then use the Ho...
bsd-3-clause
alddiaz/anasynth
lib/libsignalplot.py
1
4480
# Plot DWT magnitude spectrum # Developed by Aldo Diaz # University of Campinas, 2020 import numpy as np # numeric library import matplotlib.pyplot as plt # graphics library from lib.dftSpectrum import * # DFT magnitue spectrum def plotSignal(x, y, fs=1): # Input: # x: Input signal # y: Reconst...
gpl-2.0
zfrenchee/pandas
pandas/tests/indexes/common.py
1
41457
# -*- coding: utf-8 -*- import pytest from pandas import compat from pandas.compat import PY3 import numpy as np from pandas import (Series, Index, Float64Index, Int64Index, UInt64Index, RangeIndex, MultiIndex, CategoricalIndex, DatetimeIndex, TimedeltaIndex, PeriodIndex, Int...
bsd-3-clause
idoerg/BOA
src/classify/mnbayes.py
1
9467
""" NOTE: OUT OF DATE Multinomial Naive Bayes classifier """ import nltk from nltk.classify.scikitlearn import SklearnClassifier from sklearn.naive_bayes import MultinomialNB import pylab as pl from sklearn.utils import shuffle from sklearn.metrics import roc_curve, auc import os,sys import itertools import argparse ...
gpl-3.0
DeepRNN/image_captioning
utils/vocabulary.py
1
2841
import os import numpy as np import pandas as pd from tqdm import tqdm import string from nltk.tokenize import word_tokenize class Vocabulary(object): def __init__(self, size, save_file=None): self.words = [] self.word2idx = {} self.word_frequencies = [] self.size = size if ...
mit
kc-lab/dms2dfe
dms2dfe/ana0_getfeats.py
2
2594
#!usr/bin/python # Copyright 2016, Rohan Dandage <rraadd_8@hotmail.com,rohan@igib.in> # This program is distributed under General Public License v. 3. import sys from os.path import exists,splitext import logging import numpy as np import pandas as pd from Bio.PDB import PDBParser from Bio.PDB.Polypeptide import PP...
gpl-3.0
pligor/predicting-future-product-prices
03_good_deal/relevant_deals.py
1
3248
# -*- coding: UTF-8 -*- from __future__ import division import numpy as np import pandas as pd import sys import math from sklearn.preprocessing import LabelEncoder, OneHotEncoder import re import os import csv from sklearn.neighbors import NearestNeighbors def printgr(obj): print repr(obj).decode('unicode-escape...
agpl-3.0
mayanks43/auto-tag
msd_bof_knn_rf.py
1
4469
import os import glob import hdf5_getters import pickle import numpy as np from sklearn.cluster import KMeans import time import resource import random import sqlite3 from sklearn.neighbors import KNeighborsClassifier from sklearn.grid_search import GridSearchCV from sklearn.pipeline import Pipeline from sklearn.metric...
mit
jcasner/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_gtk.py
69
43991
from __future__ import division import os, sys def fn_name(): return sys._getframe(1).f_code.co_name try: import gobject import gtk; gdk = gtk.gdk import pango except ImportError: raise ImportError("Gtk* backend requires pygtk to be installed.") pygtk_version_required = (2,2,0) if gtk.pygtk_version <...
agpl-3.0
Djabbz/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
tectronics/scipy-cluster
old/cluster.py
5
115147
""" ----------------------------------------- Hierarchical Clustering Library for Scipy Copyright (C) Damian Eads, 2007-2008. New BSD License ----------------------------------------- Flat cluster formation fcluster forms flat clusters from hierarchical clusters. fclusterdata forms fl...
bsd-3-clause
metaml/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/delaunay/testfuncs.py
72
20890
"""Some test functions for bivariate interpolation. Most of these have been yoinked from ACM TOMS 792. http://netlib.org/toms/792 """ import numpy as np from triangulate import Triangulation class TestData(dict): def __init__(self, *args, **kwds): dict.__init__(self, *args, **kwds) self.__dict__ ...
agpl-3.0
anntzer/scikit-learn
benchmarks/bench_feature_expansions.py
34
1761
import matplotlib.pyplot as plt import numpy as np import scipy.sparse as sparse from sklearn.preprocessing import PolynomialFeatures from time import time degree = 2 trials = 3 num_rows = 1000 dimensionalities = np.array([1, 2, 8, 16, 32, 64]) densities = np.array([0.01, 0.1, 1.0]) csr_times = {d: np.zeros(len(dimens...
bsd-3-clause
jwdebelius/break_4w
break4w/tests/test_bool.py
1
3129
from unittest import TestCase, main import pandas as pd import numpy as np # import numpy.testing as npt import pandas.util.testing as pdt from break4w.bool import Bool class BoolTest(TestCase): def setUp(self): self.map_ = pd.DataFrame([['1', '2', '2', '4'], ['TBD', '...
bsd-2-clause
htygithub/bokeh
bokeh/sampledata/periodic_table.py
45
1542
''' This module provides the periodic table as a data set. It exposes an attribute 'elements' which is a pandas dataframe with the following fields elements['atomic Number'] (units: g/cm^3) elements['symbol'] elements['name'] elements['atomic mass'] (units: amu) elements['CPK'] ...
bsd-3-clause
saketkc/ribo-seq-snakemake
configs/Oct_10_2016_HuR_Human.py
1
2325
## Absolute location where all raw files are RAWDATA_DIR = '/home/cmb-06/as/skchoudh/dna/Oct_10_2016_HuR_Human_Mouse_Liver/Ribo-Seq-Human' ## Output directory OUT_DIR = '/staging/as/skchoudh/Oct_10_2016_HuR_Human_Mouse_Liver/Ribo-Seq_human' ## Absolute location to 're-ribo/scripts' directory SRC_DIR = '/home/cmb-...
bsd-3-clause
NSLS-II-SRX/ipython_ophyd
profile_bs/ipython_notebook_config.py
14
24673
# Configuration file for ipython-notebook. c = get_config() #------------------------------------------------------------------------------ # NotebookApp configuration #------------------------------------------------------------------------------ # NotebookApp will inherit config from: BaseIPythonApplication, Appli...
bsd-2-clause
djgroen/flee-release
plot-flee-output.py
1
14013
import pandas as pd import matplotlib matplotlib.use('Pdf') import matplotlib.pyplot as plt import numpy as np import sys import datamanager.handle_refugee_data as handle_refugee_data import warnings import outputanalysis.analysis as a warnings.filterwarnings("ignore") """ This is a generic plotting program. See an ...
bsd-3-clause
ryfeus/lambda-packs
LightGBM_sklearn_scipy_numpy/source/sklearn/datasets/svmlight_format.py
30
18814
"""This module implements a loader and dumper for the svmlight format This format is a text-based format, with one sample per line. It does not store zero valued features hence is suitable for sparse dataset. The first element of each line can be used to store a target variable to predict. This format is used as the...
mit
huangkuan/hack
lib/gcloud/monitoring/test__dataframe.py
7
8218
# Copyright 2016 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 or agree...
apache-2.0
saiwing-yeung/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
NicoliAraujo/rna-precipitacao-manaus
PrevisaoTempo/modules/util/PCA.py
1
5185
# -*- coding: utf-8 -*- ''' Created on 28 de fev de 2017 @author: nicoli ''' import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from sklearn.decomposition import PCA def my_pca(filename, variable_list): all_data = read_data_set(filename) eval_data = np.array(all...
gpl-3.0
tbenthompson/tectosaur
examples/elastic_convergence.py
1
1650
import numpy as np import scipy.sparse import tectosaur.mesh as mesh from tectosaur.constraints import constraints, build_constraint_matrix from tectosaur.dense_integral_op import DenseIntegralOp sm = 1.0 pr = 0.25 w = 4 corners = [[w, w, 0], [w, -w, 0], [-w, -w, 0], [-w, w, 0]] m = mesh.make_rect(4, 4, corners) cs = ...
mit
toobaz/pandas
pandas/tests/reshape/test_melt.py
2
33227
import numpy as np from numpy import nan import pytest import pandas as pd from pandas import DataFrame, lreshape, melt, wide_to_long import pandas.util.testing as tm class TestMelt: def setup_method(self, method): self.df = tm.makeTimeDataFrame()[:10] self.df["id1"] = (self.df["A"] > 0).astype(n...
bsd-3-clause
arunsv/DTE
Python/DTEDriver.py
1
7959
import numpy as np import math import os import sys import time import random import matplotlib.pyplot as plt #Setting parameters def getTEParams(workDir,dMode,pMode) : TEP = TEParams() TEP.progMode = pMode TEP.workPath = workDir TEP.timingFileName = workDir + "/" + "timing.txt" TEP.execPath =...
apache-2.0
lkishline/expyfun
expyfun/analyze/_viz.py
1
19369
"""Analysis visualization functions """ import numpy as np from itertools import chain try: import matplotlib.pyplot as plt from matplotlib import rcParams except ImportError: plt = None try: from pandas.core.frame import DataFrame except ImportError: DataFrame = None from .._utils import string_t...
bsd-3-clause
nolanliou/tensorflow
tensorflow/contrib/metrics/python/ops/metric_ops_test.py
4
262821
# 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
poryfly/scikit-learn
examples/feature_selection/plot_rfe_with_cross_validation.py
226
1384
""" =================================================== Recursive feature elimination with cross-validation =================================================== A recursive feature elimination example with automatic tuning of the number of features selected with cross-validation. """ print(__doc__) import matplotlib.p...
bsd-3-clause
RomainBrault/scikit-learn
examples/gaussian_process/plot_gpr_noisy_targets.py
64
3706
""" ========================================================= Gaussian Processes regression: basic introductory example ========================================================= A simple one-dimensional regression example computed in two different ways: 1. A noise-free case 2. A noisy case with known noise-level per ...
bsd-3-clause
nfsli926/tushare
tushare/util/dateu.py
27
2184
# -*- coding:utf-8 -*- import datetime import pandas as pd def year_qua(date): mon = date[5:7] mon = int(mon) return[date[0:4], _quar(mon)] def _quar(mon): if mon in [1, 2, 3]: return '1' elif mon in [4, 5, 6]: return '2' elif mon in [7, 8, 9]: ...
bsd-3-clause
dpshelio/scikit-image
doc/examples/plot_multiblock_local_binary_pattern.py
22
2498
""" =========================================================== Multi-Block Local Binary Pattern for texture classification =========================================================== This example shows how to compute multi-block local binary pattern (MB-LBP) features as well as how to visualize them. The features ar...
bsd-3-clause
drewdru/AOI
controllers/segmentationController.py
1
18817
""" @package segmentationController Controller for qml Segmentation """ import sys import os import numpy import matplotlib.pyplot as plt import random import time import math sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/' + '../..')) from imageProcessor import colorModel, histogramService, im...
gpl-3.0
willgrass/pandas
pandas/lib/tests/test_tseries.py
1
3175
import unittest import numpy as np from pandas import Index import pandas.util.testing as common import pandas.lib.tseries as tseries class TestTseriesUtil(unittest.TestCase): def test_combineFunc(self): pass def test_reindex(self): pass def test_isnull(self): pass def test...
bsd-3-clause
freephys/python_ase
ase/gui/bulk_modulus.py
14
1044
# -*- coding: utf-8 -*- from math import sqrt import numpy as np from ase.units import kJ from ase.utils.eos import EquationOfState def BulkModulus(images): v = np.array([abs(np.linalg.det(A)) for A in images.A]) #import matplotlib.pyplot as plt import pylab as plt plt.ion() EquationOfState(v, i...
gpl-3.0
nismod/energy_demand
energy_demand/plotting/fig_total_demand_peak.py
1
9915
"""Plot peak and total demand for """ import os import numpy as np import matplotlib.pyplot as plt import pandas as pd from energy_demand.basic import conversions from energy_demand.technologies import tech_related from energy_demand.plotting import basic_plot_functions from energy_demand.read_write import write_data...
mit
rtogo/sap-cost-center-hierarchy
hierarquia.py
1
2165
# -*- coding: utf-8 -*- import logging log = logging.getLogger(__name__) import pandas as pd def transform_hierarquia(df_ks13, df_ksh3): log.info('Convertendo hierarquia de centros de custo') # Remove os centros de custo afim de manter somente as hierarquias # no dataframe df_ksh3 = df_ksh3.query('...
mit
tomlof/scikit-learn
sklearn/ensemble/tests/test_voting_classifier.py
19
10873
"""Testing for the VotingClassifier""" import numpy as np from sklearn.utils.testing import assert_almost_equal, assert_array_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_raise_message from sklearn.exceptions import NotFittedError from sklearn.linear_model import Logist...
bsd-3-clause
softwaremechanic/Miscellaneous
Python/causality_ex.py
1
1299
import numpy import pandas as pd from causality.inference.search import IC from causality.inference.independence_tests import RobustRegressionTest SIZE = 2000 x1 = numpy.random.normal(size=SIZE) x2 = x1 + numpy.random.normal(size=SIZE) x3 = x1 + numpy.random.normal(size=SIZE) x4 = x2 + x3 + numpy.random.normal(size=S...
gpl-2.0
drufat/sympy
sympy/utilities/runtests.py
7
82184
""" This is our testing framework. Goals: * it should be compatible with py.test and operate very similarly (or identically) * doesn't require any external dependencies * preferably all the functionality should be in this file only * no magic, just import the test file and execute the test functions, that's it * po...
bsd-3-clause
mjabri/holoviews
holoviews/core/io.py
1
33268
""" Module defining input/output interfaces to HoloViews. There are two components for input/output: Exporters: Process (composite) HoloViews objects one at a time. For instance, an exporter may render a HoloViews object as a svg or perhaps pickle it. Archives: A collection of HoloViews objects...
bsd-3-clause
dgwakeman/mne-python
examples/visualization/plot_evoked_erf_erp.py
12
1182
""" ================================= Plotting ERF/ERP with evoked data ================================= Load evoked data and plot. """ # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) import matplotlib.pyplot as plt from mne.datasets import sample from mne import ...
bsd-3-clause
miaecle/deepchem
setup.py
2
1915
import sys import time from setuptools import setup, find_packages if '--release' in sys.argv: IS_RELEASE = True sys.argv.remove('--release') else: # Build a nightly package by default. IS_RELEASE = False # get the version from deepchem/__init__.py def _get_version(): with open('deepchem/__init__.py') as f...
mit
quheng/scikit-learn
examples/missing_values.py
233
3056
""" ====================================================== Imputing missing values before building an estimator ====================================================== This example shows that imputing the missing values can give better results than discarding the samples containing any missing value. Imputing does not ...
bsd-3-clause
LohithBlaze/scikit-learn
sklearn/mixture/tests/test_gmm.py
200
17427
import unittest import copy import sys from nose.tools import assert_true import numpy as np from numpy.testing import (assert_array_equal, assert_array_almost_equal, assert_raises) from scipy import stats from sklearn import mixture from sklearn.datasets.samples_generator import make_spd_ma...
bsd-3-clause
jmenglund/pandas-validation
setup.py
1
1045
from setuptools import setup, find_packages from os.path import join, dirname setup( name='pandas-validation', version='0.5.0', description=( 'A Python package for validating data with pandas'), long_description=open( join(dirname(__file__), 'README.rst'), encoding='utf-8').read(), ...
mit
sachinpro/sachinpro.github.io
tensorflow/contrib/learn/python/learn/tests/dataframe/test_feeding_queue_runner.py
1
3214
# pylint: disable=g-bad-file-header # 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/LICENS...
apache-2.0
simonalford42/Better
Germain Python/Germain.py
1
1134
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import csv import dateutil.parser import matplotlib.pyplot as plt import matplotlib.dates as dates import numpy as np f = open('First_Small.csv', 'r', encoding = 'latin1') reader = csv.reader(f) rows = [row for row in reader][1:] times = [row[0].replace('.', ':', 2) for r...
mit
michigraber/scikit-learn
examples/mixture/plot_gmm.py
248
2817
""" ================================= Gaussian Mixture Model Ellipsoids ================================= Plot the confidence ellipsoids of a mixture of two Gaussians with EM and variational Dirichlet process. Both models have access to five components with which to fit the data. Note that the EM model will necessari...
bsd-3-clause
enixdark/Data-Practices
paratices/datawrangling/SQL_Exersice.py
1
8073
import pandas import pandasql def select_first_50(filename): # Read in our aadhaar_data csv to a pandas dataframe. Afterwards, we rename the columns # by replacing spaces with underscores and setting all characters to lowercase, so the # column names more closely resemble columns names one might find in a...
lgpl-3.0
manashmndl/scikit-learn
examples/svm/plot_svm_scale_c.py
223
5375
""" ============================================== Scaling the regularization parameter for SVCs ============================================== The following example illustrates the effect of scaling the regularization parameter when using :ref:`svm` for :ref:`classification <svm_classification>`. For SVC classificati...
bsd-3-clause
fyffyt/scikit-learn
sklearn/metrics/cluster/tests/test_supervised.py
206
7643
import numpy as np from sklearn.metrics.cluster import adjusted_rand_score from sklearn.metrics.cluster import homogeneity_score from sklearn.metrics.cluster import completeness_score from sklearn.metrics.cluster import v_measure_score from sklearn.metrics.cluster import homogeneity_completeness_v_measure from sklearn...
bsd-3-clause
jjx02230808/project0223
sklearn/metrics/scorer.py
17
13148
""" The :mod:`sklearn.metrics.scorer` submodule implements a flexible interface for model selection and evaluation using arbitrary score functions. A scorer object is a callable that can be passed to :class:`sklearn.model_selection.GridSearchCV` or :func:`sklearn.model_selection.cross_val_score` as the ``scoring`` par...
bsd-3-clause
XiaoTaoWang/HiC_pipeline
runHiC/quality.py
1
9574
# Created on Thu Sep 13 21:44:24 2018 # Author: XiaoTao Wang import os, time import numpy as np import matplotlib, pickle, glob matplotlib.use('Agg') import matplotlib.pyplot as plt ## Plot Settings import matplotlib.pyplot as plt # Matplotlib Settings matplotlib.rcParams['xtick.direction'] = 'out' matplotlib.rcParam...
gpl-3.0
louispotok/pandas
pandas/tests/indexing/test_partial.py
3
23230
""" test setting *parts* of objects both positionally and label based TOD: these should be split among the indexer tests """ import pytest from warnings import catch_warnings import numpy as np import pandas as pd from pandas import Series, DataFrame, Panel, Index, date_range from pandas.util import testing as tm ...
bsd-3-clause
srjoglekar246/sympy
examples/intermediate/mplot3d.py
5
1252
#!/usr/bin/env python """Matplotlib 3D plotting example Demonstrates plotting with matplotlib. """ import sys from sample import sample from sympy import sin, Symbol from sympy.external import import_module def mplot3d(f, var1, var2, show=True): """ Plot a 3d function using matplotlib/Tk. """ im...
bsd-3-clause
nkmk/python-snippets
notebook/pandas_to_csv_float.py
1
1820
import pandas as pd df = pd.DataFrame({'col1': [0.123456789, 1000000000.0], 'col2': [123456789.0, 0.0], 'col3': [123456789, 0]}) print(df) # col1 col2 col3 # 0 1.234568e-01 123456789.0 123456789 # 1 1.000000e+09 0.0 0 print(df.dtypes...
mit