repo_name
stringlengths
6
67
path
stringlengths
5
185
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
1.02k
962k
license
stringclasses
15 values
rhyswhitley/spatial_plots
src/grid_spatial_plot.py
1
4357
#!/usr/bin/env python2.7 import os import pickle import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from mpl_toolkits.basemap import Basemap from matplotlib.cm import get_cmap from matplotlib.patches import PathPatch from matplotlib.colors import SymLogNorm #PowerNorm # -------...
cc0-1.0
CVML/scikit-learn
sklearn/tree/tree.py
113
34767
""" This module gathers tree-based methods, including decision, regression and randomized trees. Single and multi-output problems are both handled. """ # Authors: Gilles Louppe <g.louppe@gmail.com> # Peter Prettenhofer <peter.prettenhofer@gmail.com> # Brian Holt <bdholt1@gmail.com> # Noel Da...
bsd-3-clause
jreback/pandas
pandas/tests/indexing/multiindex/test_multiindex.py
2
2956
import numpy as np import pandas._libs.index as _index from pandas.errors import PerformanceWarning import pandas as pd from pandas import DataFrame, Index, MultiIndex, Series import pandas._testing as tm class TestMultiIndexBasic: def test_multiindex_perf_warn(self): df = DataFrame( { ...
bsd-3-clause
rvilalta/OFC_TAPI_SC
tapi_app/tapi_app.py
1
2858
#!/usr/bin/python # -*- coding: utf-8 -*- import requests from requests.auth import HTTPBasicAuth import json import matplotlib.pyplot as plt import networkx as nx import random IP = '127.0.0.1' PORT = '8080' def retrieveTopologies(ip, port, user='', password=''): print ("Reading network-topology") topologi...
apache-2.0
phdowling/scikit-learn
examples/covariance/plot_outlier_detection.py
235
3891
""" ========================================== Outlier detection with several methods. ========================================== When the amount of contamination is known, this example illustrates two different ways of performing :ref:`outlier_detection`: - based on a robust estimator of covariance, which is assumin...
bsd-3-clause
maigimenez/jon-siamese
src/test.py
1
11410
import tensorflow as tf from os.path import join, abspath, curdir import matplotlib.pyplot as plt plt.switch_backend('agg') import argparse from utils import read_flags, load_binarize_data, input_pipeline_test, best_score from siamese import Siamese from double_siamese import DoubleSiamese def get_arguments(): pa...
gpl-3.0
MartinIsoz/CFD_oF
03_texturedPlate/02_transTexture/00_Scripts/caseConstructorV3.py
2
25437
#!/usr/bin/python #FILE DESCRIPTION======================================================= #~ Python script used for foam case construction (as automatic, as #~ possible) #~ #~ NOTES: #~ - mesh grading in z direction #~ USAGE: #~ - modify and run the script #~ TO DO: #LICENSE=======================...
gpl-2.0
hmendozap/auto-sklearn
autosklearn/pipeline/components/data_preprocessing/imputation.py
1
2104
from HPOlibConfigSpace.configuration_space import ConfigurationSpace from HPOlibConfigSpace.hyperparameters import CategoricalHyperparameter from autosklearn.pipeline.components.base import AutoSklearnPreprocessingAlgorithm from autosklearn.pipeline.constants import * class Imputation(AutoSklearnPreprocessingAlgorit...
bsd-3-clause
pySTEPS/pysteps
examples/plot_ensemble_verification.py
1
5819
#!/bin/env python """ Ensemble verification ===================== In this tutorial we perform a verification of a probabilistic extrapolation nowcast using MeteoSwiss radar data. """ from datetime import datetime import matplotlib.pyplot as plt import numpy as np from pprint import pprint from pysteps import io, no...
bsd-3-clause
mwv/scikit-learn
sklearn/neighbors/tests/test_neighbors.py
22
45265
from itertools import product import pickle import numpy as np from scipy.sparse import (bsr_matrix, coo_matrix, csc_matrix, csr_matrix, dok_matrix, lil_matrix) from sklearn import metrics from sklearn.cross_validation import train_test_split, cross_val_score from sklearn.utils.testing impor...
bsd-3-clause
jdanbrown/pydatalab
google/datalab/stackdriver/monitoring/_query_metadata.py
10
3318
# 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 agreed...
apache-2.0
aashish24/seaborn
seaborn/tests/test_linearmodels.py
1
33161
import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import pandas as pd import nose.tools as nt import numpy.testing as npt import pandas.util.testing as pdt from numpy.testing.decorators import skipif from nose import SkipTest try: import statsmodels.regression.linear_model as smlm _n...
bsd-3-clause
ryandougherty/mwa-capstone
MWA_Tools/build/matplotlib/doc/mpl_examples/pylab_examples/contour_label_demo.py
3
2238
#!/usr/bin/env python """ Illustrate some of the more advanced things that one can do with contour labels. See also contour_demo.py. """ import matplotlib import numpy as np import matplotlib.cm as cm import matplotlib.mlab as mlab import matplotlib.ticker as ticker import matplotlib.pyplot as plt matplotlib.rcParams...
gpl-2.0
cauchycui/scikit-learn
sklearn/linear_model/tests/test_sgd.py
129
43401
import pickle import unittest import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_greater from sklearn.utils.testing ...
bsd-3-clause
mojoboss/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
Sentient07/scikit-learn
examples/linear_model/plot_logistic.py
73
1568
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Logistic function ========================================================= Shown in the plot is how the logistic regression would, in this synthetic dataset, classify values as either 0 or 1, i.e. class one or tw...
bsd-3-clause
jonyroda97/redbot-amigosprovaveis
lib/matplotlib/backend_bases.py
2
113596
""" Abstract base classes define the primitives that renderers and graphics contexts must implement to serve as a matplotlib backend :class:`RendererBase` An abstract base class to handle drawing/rendering operations. :class:`FigureCanvasBase` The abstraction layer that separates the :class:`matplotlib.fi...
gpl-3.0
makmac213/Tsupytero
tsupytero/core.py
1
3997
import datetime import requests import time from matplotlib import pyplot from matplotlib.dates import DateFormatter, WeekdayLocator, DayLocator, MONDAY from matplotlib.finance import candlestick_ohlc from pylab import * #from .exceptions import SymbolNotFoundException # inspired by https://github.com/edgedalmacio/p...
unlicense
CDSFinance/zipline
zipline/sources/data_frame_source.py
26
5253
# # Copyright 2015 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
tjhei/burnman_old
main.py
1
11849
#system libs: import numpy import scipy.optimize as opt import math import matplotlib.pyplot as pyplot #own libs: import geotherm import prem from tools import * from eos_from_ian import birch_murnaghan import seismic # TODO: add up weight percent and check <100 and tell them how much molar_mass = {'Fe':55.845, 'Mg'...
gpl-2.0
larsmans/scikit-learn
benchmarks/bench_lasso.py
297
3305
""" Benchmarks of Lasso vs LassoLars First, we fix a training set and increase the number of samples. Then we plot the computation time as function of the number of samples. In the second benchmark, we increase the number of dimensions of the training set. Then we plot the computation time as function of the number o...
bsd-3-clause
vortex-ape/scikit-learn
sklearn/tests/test_discriminant_analysis.py
4
13934
import numpy as np from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert...
bsd-3-clause
akionakamura/scikit-learn
examples/applications/plot_tomography_l1_reconstruction.py
204
5442
""" ====================================================================== Compressive sensing: tomography reconstruction with L1 prior (Lasso) ====================================================================== This example shows the reconstruction of an image from a set of parallel projections, acquired along dif...
bsd-3-clause
sergiohr/NeuroDB
test/test_cluster_assig.py
1
4742
''' Created on Mar 16, 2015 @author: sergio ''' import numpy as np import ctypes import numpy.ctypeslib as npct import matplotlib.pyplot as plt import psycopg2 import time import neurodb.neodb.core from math import e, pow from scipy.optimize import leastsq from mpl_toolkits.mplot3d import Axes3D from neurodb.cfsfdp im...
gpl-3.0
robbymeals/scikit-learn
doc/tutorial/text_analytics/solutions/exercise_01_language_train_model.py
254
2253
"""Build a language detector model The goal of this exercise is to train a linear classifier on text features that represent sequences of up to 3 consecutive characters so as to be recognize natural languages by using the frequencies of short character sequences as 'fingerprints'. """ # Author: Olivier Grisel <olivie...
bsd-3-clause
Weihonghao/ECM
Vpy34/lib/python3.5/site-packages/pandas/core/frame.py
3
219601
""" DataFrame --------- An efficient 2D container for potentially mixed-type time series or other labeled data series. Similar to its R counterpart, data.frame, except providing automatic data alignment and a host of useful data manipulation methods having to do with the labeling information """ from __future__ import...
agpl-3.0
bikong2/scikit-learn
sklearn/linear_model/ridge.py
60
44642
""" Ridge regression """ # Author: Mathieu Blondel <mathieu@mblondel.org> # Reuben Fletcher-Costin <reuben.fletchercostin@gmail.com> # Fabian Pedregosa <fabian@fseoane.net> # Michael Eickenberg <michael.eickenberg@nsup.org> # License: BSD 3 clause from abc import ABCMeta, abstractmethod impor...
bsd-3-clause
Titan-C/scikit-learn
sklearn/neighbors/tests/test_nearest_centroid.py
12
4111
""" Testing for the nearest centroid module. """ import numpy as np from scipy import sparse as sp from numpy.testing import assert_array_equal from numpy.testing import assert_equal from numpy.testing import assert_raises from sklearn.neighbors import NearestCentroid from sklearn import datasets # toy sample X = [[...
bsd-3-clause
chrsrds/scikit-learn
examples/cluster/plot_digits_linkage.py
21
3092
""" ============================================================================= Various Agglomerative Clustering on a 2D embedding of digits ============================================================================= An illustration of various linkage option for agglomerative clustering on a 2D embedding of the di...
bsd-3-clause
selective-inference/selective-inference
doc/learning_examples/keras/keras_example.py
3
3325
import functools import numpy as np from scipy.stats import norm as ndist import regreg.api as rr from selection.tests.instance import gaussian_instance from selection.learning.utils import (full_model_inference, pivot_plot, liu_inference) from...
bsd-3-clause
eg-zhang/scikit-learn
sklearn/decomposition/tests/test_online_lda.py
49
13124
import numpy as np from scipy.linalg import block_diag from scipy.sparse import csr_matrix from scipy.special import psi from sklearn.decomposition import LatentDirichletAllocation from sklearn.decomposition._online_lda import (_dirichlet_expectation_1d, _dirichlet_expect...
bsd-3-clause
jcrudy/py-earth
doc/xkcdify.py
3
8298
""" XKCD plot generator ------------------- Author: Jake Vanderplas This is a script that will take any matplotlib line diagram, and convert it to an XKCD-style plot. It will work for plots with line & text elements, including axes labels and titles (but not axes tick labels). The idea for this comes from work by Da...
bsd-3-clause
mcstrother/dicom-sr-qi
inquiries/modality_usage.py
2
6552
from srqi.core import inquiry, my_utils def get_period_sum(period, val_func, event_types = ()): """ Parameters: period : a list of Events val_func : a function that takes an Event and returns the value of the event to be summed. For example `lambda x:x.Dose_RP` would be ...
bsd-2-clause
timcera/tsgettoolbox
tsgettoolbox/functions/terraclimate.py
1
10519
# -*- coding: utf-8 -*- """Download data from terraclimate.""" # http://thredds.northwestknowledge.net:8080/thredds/terraclimate_aggregated.html from datetime import date, datetime import mando import numpy as np import pandas as pd try: from mando.rst_text_formatter import RSTHelpFormatter as HelpFormatter exc...
bsd-3-clause
wasade/qiime
scripts/make_bootstrapped_tree.py
1
2269
#!/usr/bin/env python # File created on 09 Feb 2010 from __future__ import division __author__ = "Justin Kuczynski" __copyright__ = "Copyright 2011, The QIIME Project" __credits__ = [ "Justin Kuczynski", "Jesse Stombaugh", "Jose Antonio Navas Molina"] __license__ = "GPL" __version__ = "1.8.0-dev" __maintai...
gpl-2.0
michael-hoffman/titanic-revisited
titanic_preprocessing.py
1
5755
# # Set of functions used for preprocessing Titanic data. # # Author: Charlie Bonfield # Last Modified: July 2017 # Import statements import fancyimpute import numpy as np import pandas as pd #from sklearn import preprocessing class Useful_Preprocessing(object): def one_hot_encode(self, x, n_classes): ...
gpl-3.0
ZENGXH/scikit-learn
sklearn/linear_model/coordinate_descent.py
42
73973
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Olivier Grisel <olivier.grisel@ensta.org> # Gael Varoquaux <gael.varoquaux@inria.fr> # # License: BSD 3 clause import sys import warnings from abc import ABCMeta, abstractmethod import n...
bsd-3-clause
nhuntwalker/astroML
book_figures/chapter9/fig_rrlyrae_kernelsvm.py
3
4615
""" Kernel SVM Classification of photometry --------------------------------------- Figure 9.11 Kernel SVM applied to the RR Lyrae data (see caption of figure 9.3 for details). This example uses a Gaussian kernel with gamma = 20. With all four colors, kernel SVM achieves a completeness of 1.0 and a contamination of 0....
bsd-2-clause
SelinaChe/Complex-Object-Detection-StackGAN
stackGAN-demo/demo.py
1
9679
from __future__ import division from __future__ import print_function import sys sys.path.append(".") import matplotlib.pyplot as plt import prettytensor as pt import tensorflow as tf import numpy as np import scipy.misc import os import argparse import torchfile from PIL import Image, ImageDraw, ImageFont import re...
mit
wanggang3333/scikit-learn
examples/ensemble/plot_ensemble_oob.py
259
3265
""" ============================= OOB Errors for Random Forests ============================= The ``RandomForestClassifier`` is trained using *bootstrap aggregation*, where each new tree is fit from a bootstrap sample of the training observations :math:`z_i = (x_i, y_i)`. The *out-of-bag* (OOB) error is the average er...
bsd-3-clause
sonnyhu/scikit-learn
examples/svm/plot_weighted_samples.py
95
1943
""" ===================== SVM: Weighted samples ===================== Plot decision function of a weighted dataset, where the size of points is proportional to its weight. The sample weighting rescales the C parameter, which means that the classifier puts more emphasis on getting these points right. The effect might ...
bsd-3-clause
EmreAtes/spack
var/spack/repos/builtin/packages/julia/package.py
3
10019
############################################################################## # Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
lgpl-2.1
mne-tools/mne-tools.github.io
0.13/_downloads/plot_decoding_csp_space.py
9
3982
""" ==================================================================== Decoding in sensor space data using the Common Spatial Pattern (CSP) ==================================================================== Decoding applied to MEG data in sensor space decomposed using CSP. Here the classifier is applied to feature...
bsd-3-clause
imaculate/scikit-learn
sklearn/feature_selection/rfe.py
16
16420
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Vincent Michel <vincent.michel@inria.fr> # Gilles Louppe <g.louppe@gmail.com> # # License: BSD 3 clause """Recursive feature elimination for feature ranking""" import numpy as np from ..utils import check_X_y, safe_sqr from ..utils.metaes...
bsd-3-clause
ray-project/ray
python/setup.py
1
17074
import argparse import errno import glob import io import logging import os import re import shutil import subprocess import sys import tarfile import tempfile import zipfile from itertools import chain from itertools import takewhile import urllib.error import urllib.parse import urllib.request logger = logging.get...
apache-2.0
lazywei/scikit-learn
examples/cluster/plot_dict_face_patches.py
337
2747
""" Online learning of a dictionary of parts of faces ================================================== This example uses a large dataset of faces to learn a set of 20 x 20 images patches that constitute faces. From the programming standpoint, it is interesting because it shows how to use the online API of the sciki...
bsd-3-clause
amontefusco/gnuradio-amontefusco
gr-msdd6000/src/python-examples/msdd_spectrum_waterfall.py
8
11670
#!/usr/bin/env python # # Copyright 2008 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) ...
gpl-3.0
mdeger/nest-simulator
extras/ConnPlotter/colormaps.py
21
6941
# -*- coding: utf-8 -*- # # colormaps.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
DreamLiMu/ML_Python
tools/Ch07/adaboost.py
4
5423
''' Created on Nov 28, 2010 Adaboost is short for Adaptive Boosting @author: Peter ''' from numpy import * def loadSimpData(): datMat = matrix([[ 1. , 2.1], [ 2. , 1.1], [ 1.3, 1. ], [ 1. , 1. ], [ 2. , 1. ]]) classLabels = [1.0, 1.0, -1.0, -1.0, 1.0] return datMat,clas...
gpl-2.0
dpaiton/OpenPV
pv-core/analysis/python/plot_inh_roc.py
1
40370
""" Plot the highest activity of four different bar positionings """ import sys import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as mlab import matplotlib.cm as cm import PVReadSparse as rs import PVReadWeights as rw import PVConversions as conv import scipy.cluster.vq as sp import math def ...
epl-1.0
thorwhalen/ut
daf/plot.py
1
1671
__author__ = 'thor' import numpy as np import ut.pplot.hist import pandas as pd import matplotlib.pylab as plt from ut.util.utime import utc_ms_to_utc_datetime def count_hist(sr, sort_by='value', reverse=True, horizontal=None, ratio=False, **kwargs): horizontal = horizontal or isinstance(sr.iloc[0], str) ut....
mit
Habasari/sms-tools
lectures/07-Sinusoidal-plus-residual-model/plots-code/LPC.py
24
1191
import numpy as np import matplotlib.pyplot as plt from scipy.signal import hamming, hanning, triang, blackmanharris, resample import math import sys, os, time from scipy.fftpack import fft, ifft import essentia.standard as ess sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../softwar...
agpl-3.0
ioam/holoviews
holoviews/tests/operation/testtimeseriesoperations.py
2
3148
from unittest import SkipTest, skipIf try: import pandas as pd except: raise SkipTest('Pandas not available') try: import scipy # noqa except: scipy = None scipy_skip = skipIf(scipy is None, "SciPy is not available.") import numpy as np from holoviews import Curve, Scatter from holoviews.element.com...
bsd-3-clause
chengsoonong/acton
acton/plot.py
1
2501
"""Script to plot a dump of predictions.""" import itertools import sys from typing import Iterable from typing.io import BinaryIO import acton.proto.io from acton.proto.acton_pb2 import Predictions import acton.proto.wrappers import click import matplotlib.pyplot as plt import sklearn.metrics def plot(predictions:...
bsd-3-clause
friedrichromstedt/matplotlayers
matplotlayers/backends/PIL/figure_canvas.py
1
2080
# Copyright (c) 2010 Friedrich Romstedt <friedrichromstedt@gmail.com> # See also <www.friedrichromstedt.org> (if e-mail has changed) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without...
mit
SaganBolliger/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/projections/geo.py
69
19738
import math import numpy as np import numpy.ma as ma import matplotlib rcParams = matplotlib.rcParams from matplotlib.artist import kwdocd from matplotlib.axes import Axes from matplotlib import cbook from matplotlib.patches import Circle from matplotlib.path import Path from matplotlib.ticker import Formatter, Locat...
agpl-3.0
vybstat/scikit-learn
sklearn/discriminant_analysis.py
19
26162
""" Linear Discriminant Analysis and Quadratic Discriminant Analysis """ # Authors: Clemens Brunner # Martin Billinger # Matthieu Perrot # Mathieu Blondel # License: BSD 3-Clause from __future__ import print_function import warnings import numpy as np from scipy import linalg from .extern...
bsd-3-clause
carrillo/scikit-learn
examples/calibration/plot_calibration_curve.py
225
5903
""" ============================== Probability Calibration curves ============================== When performing classification one often wants to predict not only the class label, but also the associated probability. This probability gives some kind of confidence on the prediction. This example demonstrates how to di...
bsd-3-clause
romil93/SentimentAnalysis-CSCI544-Fall2016
romil/flask-app/main.py
1
2125
from flask import Flask, render_template, redirect, request from sklearn.externals import joblib import urllib, os import pandas as pd import numpy as np import re, nltk from sklearn.feature_extraction.text import CountVectorizer from nltk.stem.porter import PorterStemmer from sklearn.linear_model import LogisticRegres...
apache-2.0
f3r/scikit-learn
benchmarks/bench_sparsify.py
323
3372
""" Benchmark SGD prediction time with dense/sparse coefficients. Invoke with ----------- $ kernprof.py -l sparsity_benchmark.py $ python -m line_profiler sparsity_benchmark.py.lprof Typical output -------------- input data sparsity: 0.050000 true coef sparsity: 0.000100 test data sparsity: 0.027400 model sparsity:...
bsd-3-clause
vivekmishra1991/scikit-learn
sklearn/neighbors/tests/test_neighbors.py
76
45197
from itertools import product import pickle import numpy as np from scipy.sparse import (bsr_matrix, coo_matrix, csc_matrix, csr_matrix, dok_matrix, lil_matrix) from sklearn import metrics from sklearn.cross_validation import train_test_split, cross_val_score from sklearn.utils.testing impor...
bsd-3-clause
pompiduskus/scikit-learn
sklearn/mixture/gmm.py
128
31069
""" Gaussian Mixture Models. This implementation corresponds to frequentist (non-Bayesian) formulation of Gaussian Mixture Models. """ # Author: Ron Weiss <ronweiss@gmail.com> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Bertrand Thirion <bertrand.thirion@inria.fr> import warnings import numpy as...
bsd-3-clause
okfn-brasil/gastos_abertos
utils/build_search_index.py
2
1896
# -*- coding: utf-8 -*- ''' Build the search indexes. Usage: ./build_search_index [RESOURCE] ./build_search_index (-h | --help) Options: -h --help Show this message. ''' import os import pandas as pd from concurrent import futures from gastosabertos.contratos.models import Contrato from utils import...
agpl-3.0
kadubarbosa/hydra1
only_plot.py
1
7042
# -*- coding: utf-8 -*- """ Created on Mon Mar 31 01:09:38 2014 @author: kadu Make plot of examples of pPFX fitting. Equivalent of only_plot_dat in Lodo's IDL program, but much slower. """ import os import pickle import numpy as np import pyfits as pf import matplotlib.pyplot as plt from matplotlib.backends.backend...
gpl-2.0
huzq/scikit-learn
sklearn/ensemble/_hist_gradient_boosting/tests/test_binning.py
9
11588
import numpy as np from numpy.testing import assert_array_equal, assert_allclose import pytest from sklearn.ensemble._hist_gradient_boosting.binning import ( _BinMapper, _find_binning_thresholds as _find_binning_thresholds_orig, _map_to_bins ) from sklearn.ensemble._hist_gradient_boosting.common import X_D...
bsd-3-clause
rs2/pandas
pandas/tests/extension/conftest.py
8
3785
import operator import pytest from pandas import Series @pytest.fixture def dtype(): """A fixture providing the ExtensionDtype to validate.""" raise NotImplementedError @pytest.fixture def data(): """ Length-100 array for this type. * data[0] and data[1] should both be non missing * data[...
bsd-3-clause
h2oai/h2o
py/testdir_single_jvm/test_KMeans_hastie_shuffle_fvec.py
9
5295
# Dataset created from this: # Elements of Statistical Learning 2nd Ed.; Hastie, Tibshirani, Friedman; Feb 2011 # example 10.2 page 357 # Ten features, standard independent Gaussian. Target y is: # y[i] = 1 if sum(X[i]) > .34 else -1 # 9.34 is the median of a chi-squared random variable with 10 degrees of freedom # ...
apache-2.0
fzalkow/scikit-learn
examples/cluster/plot_kmeans_digits.py
230
4524
""" =========================================================== A demo of K-Means clustering on the handwritten digits data =========================================================== In this example we compare the various initialization strategies for K-means in terms of runtime and quality of the results. As the gr...
bsd-3-clause
mayavanand/RMMAFinalProject
build/lib/azimuth/models/DNN.py
3
3068
import numpy as np import scipy as sp import sklearn def DNN_on_fold(feature_sets, train, test, y, y_all, X, dim, dimsum, learn_options): import theanets from sklearn.metrics import accuracy_score y = np.array(y_all[learn_options['DNN target variable']].values, dtype=float) y_train, X_train = y[train][...
bsd-3-clause
asoliveira/NumShip
scripts/plot/r-cg-plt.py
1
1980
#!/usr/bin/env python # -*- coding: utf-8 -*- #É adimensional? adi = False #É para salvar as figuras(True|False)? save = True #Caso seja para salvar, qual é o formato desejado? formato = 'jpg' #Caso seja para salvar, qual é o diretório que devo salvar? dircg = 'fig-sen' #Caso seja para salvar, qual é o nome do arquivo...
gpl-3.0
jyt109/BDA_py_demos
demos_ch2/demo2_3.py
19
1931
"""Bayesian Data Analysis, 3rd ed Chapter 2, demo 3 Simulate samples from Beta(438,544), draw a histogram with quantiles, and do the same for a transformed variable. """ import numpy as np from scipy.stats import beta import matplotlib.pyplot as plt # Edit default plot settings (colours from colorbrewer2.org) plt...
gpl-3.0
ofgulban/scikit-image
doc/examples/features_detection/plot_gabor.py
21
4450
""" ============================================= Gabor filter banks for texture classification ============================================= In this example, we will see how to classify textures based on Gabor filter banks. Frequency and orientation representations of the Gabor filter are similar to those of the huma...
bsd-3-clause
chenyyx/scikit-learn-doc-zh
examples/zh/exercises/plot_iris_exercise.py
1
2434
# -*- coding:UTF-8 -*- """ ================================ SVM 练习 ================================ 使用不同的 SVM kernels 的教程练习。 这个教程应用于 :ref:`supervised_learning_tut` 章节的 :ref:`stat_learn_tut_index` 的 :ref:`using_kernels_tut` 这一部分。 """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from sklearn impo...
gpl-3.0
mne-tools/mne-tools.github.io
0.21/_downloads/d3272d21ad495ecb95dfdfa6465d8d29/plot_decoding_unsupervised_spatial_filter.py
29
2496
""" ================================================================== Analysis of evoked response using ICA and PCA reduction techniques ================================================================== This example computes PCA and ICA of evoked or epochs data. Then the PCA / ICA components, a.k.a. spatial filters,...
bsd-3-clause
NixaSoftware/CVis
venv/lib/python2.7/site-packages/pandas/core/sparse/series.py
2
29566
""" Data structures for sparse float data. Life is made simpler by dealing only with float64 data """ # pylint: disable=E1101,E1103,W0231 import numpy as np import warnings from pandas.core.dtypes.missing import isna, notna from pandas.core.dtypes.common import is_scalar from pandas.core.common import _values_from_o...
apache-2.0
clarka34/exploringShipLogbooks
exploringShipLogbooks/tests/test_fuzz_replacement.py
2
2899
""" Unit tests for basic_utils.py """ import exploringShipLogbooks import pep8 import unittest import numpy as np import pandas as pd import exploringShipLogbooks.fuzz_replacement as fr class TestFuzzReplacement(unittest.TestCase): def setUp(self): self.all_log_values = [ 'dutch', ...
mit
ldirer/scikit-learn
examples/linear_model/plot_ols_3d.py
350
2040
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Sparsity Example: Fitting only features 1 and 2 ========================================================= Features 1 and 2 of the diabetes-dataset are fitted and plotted below. It illustrates that although feature...
bsd-3-clause
pico12/trading-with-python
nautilus/nautilus.py
77
5403
''' Created on 26 dec. 2011 Copyright: Jev Kuznetsov License: BSD ''' from PyQt4.QtCore import * from PyQt4.QtGui import * from ib.ext.Contract import Contract from ib.opt import ibConnection from ib.ext.Order import Order import tradingWithPython.lib.logger as logger from tradingWithPython.lib.eve...
bsd-3-clause
rileymcdowell/genomic-neuralnet
genomic_neuralnet/config/data_definitions.py
1
3378
from __future__ import print_function import os import pandas as pd _data_dir = os.path.join(os.path.dirname(__file__), '..', 'data') class DataDefinition(object): def __init__(self, trait_name, *args, **kwargs): """ Defines a datatype to predict. Parameters: trait_name: The...
mit
manipopopo/tensorflow
tensorflow/examples/tutorials/input_fn/boston.py
76
2920
# 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
nhejazi/scikit-learn
sklearn/neural_network/tests/test_mlp.py
20
22194
""" Testing for Multi-layer Perceptron module (sklearn.neural_network) """ # Author: Issam H. Laradji # License: BSD 3 clause import sys import warnings import numpy as np from numpy.testing import assert_almost_equal, assert_array_equal from sklearn.datasets import load_digits, load_boston, load_iris from sklearn...
bsd-3-clause
robbymeals/scikit-learn
sklearn/cluster/__init__.py
364
1228
""" The :mod:`sklearn.cluster` module gathers popular unsupervised clustering algorithms. """ from .spectral import spectral_clustering, SpectralClustering from .mean_shift_ import (mean_shift, MeanShift, estimate_bandwidth, get_bin_seeds) from .affinity_propagation_ import affinity_propagati...
bsd-3-clause
ChanderG/scikit-learn
sklearn/metrics/tests/test_common.py
27
44210
from __future__ import division, print_function from functools import partial from itertools import product import numpy as np import scipy.sparse as sp from sklearn.datasets import make_multilabel_classification from sklearn.preprocessing import LabelBinarizer, MultiLabelBinarizer from sklearn.utils.multiclass impo...
bsd-3-clause
google/graph_distillation
classification/run.py
1
8507
# Copyright 2018 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 ...
apache-2.0
mahak/spark
python/pyspark/pandas/tests/test_stats.py
9
18900
# # 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
yavalvas/yav_com
build/matplotlib/lib/mpl_examples/animation/unchained.py
3
1875
""" Comparative path demonstration of frequency from a fake signal of a pulsar. (mostly known because of the cover for Joy Division's Unknown Pleasures) Author: Nicolas P. Rougier """ import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation # Create new Figure with black background ...
mit
mrahim/adni_fdg_pet_analysis
learn_voxels_norm_baseline_fdg_pet_adni.py
1
4688
""" A script that : - computes a Masker from FDG PET (baseline uniform) - cross-validates a linear SVM classifier - computes a ROC curve and AUC """ import os, glob import numpy as np import matplotlib.pyplot as plt import pandas as pd import nibabel as nib from sklearn import svm from sklearn import cross_validation ...
gpl-2.0
noelevans/sandpit
kaggle/cross-device-conns/analyse_home_rolled.py
1
1941
import pandas as pd from collections import Counter class Homogeneity(object): SAME = 's' # eg "b b b b" MIX = 'm' # eg "a b a a" DIFF = 'd' # eg "a b c d" @classmethod def categorise(cls, ul): if len(ul) == len(set(ul)): return cls.DIFF if len(set(ul)) == ...
mit
icdishb/scikit-learn
examples/linear_model/plot_logistic.py
312
1426
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Logit function ========================================================= Show in the plot is how the logistic regression would, in this synthetic dataset, classify values as either 0 or 1, i.e. class one or two, u...
bsd-3-clause
rahuldhote/scikit-learn
sklearn/cluster/setup.py
263
1449
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD 3 clause import os from os.path import join import numpy from sklearn._build_utils import get_blas_info def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration cblas_libs, blas_info = ...
bsd-3-clause
meduz/NeuroTools
examples/matlab_vs_python/smallnet.py
3
3997
# Created by Eugene M. Izhikevich, 2003 Modified by S. Fusi 2007 # Ported to Python by Eilif Muller, 2008. # # Notes: # # Requires matplotlib,ipython,numpy>=1.0.3 # On a debian/ubuntu based system: # $ apt-get install python-matplotlib python-numpy ipython # # Start ipython with threaded plotting support: # $ ipython -...
gpl-2.0
OshynSong/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
cxhernandez/mdentropy
mdentropy/utils.py
1
2859
from __future__ import print_function import time from numpy import dtype, finfo, float32, nan_to_num, random, unique, void from scipy.spatial import cKDTree from scipy.special import digamma __all__ = ['floor_threshold', 'shuffle', 'Timing', 'unique_row_count', 'avgdigamma'] EPS = finfo(float32).eps ...
gpl-3.0
jereze/scikit-learn
sklearn/pipeline.py
61
21271
""" The :mod:`sklearn.pipeline` module implements utilities to build a composite estimator, as a chain of transforms and estimators. """ # Author: Edouard Duchesnay # Gael Varoquaux # Virgile Fritsch # Alexandre Gramfort # Lars Buitinck # Licence: BSD from collections import defaultdict...
bsd-3-clause
sideshownick/Snaking_Networks
MyPython/Snaking/plot_bifdiag1.py
2
1420
# -*- coding: utf-8 -*- """ Created on Thu Dec 17 09:52:41 2015 @author: nm268 """ import matplotlib.pyplot as plt import numpy as np import pandas as pd plt.rcParams.update({'font.size': 16, 'figure.autolayout': True}) fig = plt.figure(figsize=(8,8)) ax = fig.add_subplot(111) df = pd.read_table('b.workfile', heade...
gpl-2.0
wzbozon/scikit-learn
benchmarks/bench_plot_ward.py
290
1260
""" Benchmark scikit-learn's Ward implement compared to SciPy's """ import time import numpy as np from scipy.cluster import hierarchy import pylab as pl from sklearn.cluster import AgglomerativeClustering ward = AgglomerativeClustering(n_clusters=3, linkage='ward') n_samples = np.logspace(.5, 3, 9) n_features = n...
bsd-3-clause
mugizico/scikit-learn
sklearn/mixture/gmm.py
128
31069
""" Gaussian Mixture Models. This implementation corresponds to frequentist (non-Bayesian) formulation of Gaussian Mixture Models. """ # Author: Ron Weiss <ronweiss@gmail.com> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Bertrand Thirion <bertrand.thirion@inria.fr> import warnings import numpy as...
bsd-3-clause
ajlongart/Tesis-UIP
AnalisisFourier.py
1
3552
#!/usr/bin/env python ''' Modulo 2 Toolbox Analisis Cuantitativo de la Imagen Tesis Underwater Image Pre-processing Armando Longart 10-10844 ajzlongart@gmail.com #-----Analisis Cuantitativo de la Imagen------------------------------------------------ Se realiza analisis de Entropia de las imagenes originales y resulta...
gpl-3.0
ElDeveloper/scikit-learn
sklearn/neural_network/rbm.py
11
12298
"""Restricted Boltzmann Machine """ # Authors: Yann N. Dauphin <dauphiya@iro.umontreal.ca> # Vlad Niculae # Gabriel Synnaeve # Lars Buitinck # License: BSD 3 clause import time import numpy as np import scipy.sparse as sp from ..base import BaseEstimator from ..base import TransformerMixi...
bsd-3-clause
vrieni/orange
Orange/clustering/kmeans.py
6
21404
""" ******************************* K-means clustering (``kmeans``) ******************************* .. index:: single: clustering, kmeans .. index:: agglomerative clustering .. autoclass:: Orange.clustering.kmeans.Clustering(data=None, centroids=3, maxiters=None, minscorechange=None, stopchanges=0, nstart=1, init...
gpl-3.0