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
wzbozon/scikit-learn
sklearn/tests/test_learning_curve.py
225
10791
# Author: Alexander Fabisch <afabisch@informatik.uni-bremen.de> # # License: BSD 3 clause import sys from sklearn.externals.six.moves import cStringIO as StringIO import numpy as np import warnings from sklearn.base import BaseEstimator from sklearn.learning_curve import learning_curve, validation_curve from sklearn.u...
bsd-3-clause
irblsensitivity/irblsensitivity
scripts/analysis/MWU_Project_EMSE.py
1
9231
#-*- coding: utf-8 -*- ''' Created on 2017. 02. 12 Updated on 2017. 02. 12 ''' from __future__ import print_function import os import re import matplotlib # Force matplotlib to not use any Xwindows backend. matplotlib.use('Agg') from scipy.stats import mannwhitneyu, pearsonr from ExpBase import ExpBase ...
apache-2.0
fmfn/UnbalancedDataset
examples/under-sampling/plot_illustration_tomek_links.py
2
3180
""" ============================================== Illustration of the definition of a Tomek link ============================================== This example illustrates what is a Tomek link. """ # Authors: Guillaume Lemaitre <g.lemaitre58@gmail.com> # License: MIT # %% print(__doc__) import matplotlib.pyplot as pl...
mit
waylonflinn/bquery
bquery/benchmarks/bench_groupby.py
2
2465
from __future__ import print_function # bench related imports import numpy as np import shutil import bquery import pandas as pd import itertools as itt import cytoolz import cytoolz.dicttoolz from toolz import valmap, compose from cytoolz.curried import pluck import blaze as blz # other imports import contextlib impor...
bsd-3-clause
HiSPARC/sapphire
scripts/simulations/analyze_shower_front.py
1
5153
import numpy as np import tables from scipy.optimize import curve_fit from scipy.stats import scoreatpercentile from artist import GraphArtist from pylab import * import matplotlib.pyplot as plt import utils USE_TEX = False # For matplotlib plots if USE_TEX: rcParams['font.serif'] = 'Computer Modern' rcPar...
gpl-3.0
jmbeuken/abinit
scripts/post_processing/abinit_eignc_to_bandstructure.py
3
47417
#!/usr/bin/python #=================================================================# # Script to plot the bandstructure from an abinit bandstructure # # _EIG.nc netcdf file or from a wannier bandstructure, or from # # an _EIG.nc file+GW file+ bandstructure _EIG.nc file # #=============================...
gpl-3.0
robios/PyTES
pytes/Util.py
1
32573
import warnings import numpy as np import time from struct import unpack from scipy.stats import norm from scipy.signal import tukey from Filter import median_filter import Analysis, Filter, Constants def savefits(data, filename, vmax=1.0, sps=1e6, bits=14, noise=False, clobber=True): """ Save pulse/noise to F...
mit
mwv/scikit-learn
examples/linear_model/plot_sgd_loss_functions.py
249
1095
""" ========================== SGD: convex loss functions ========================== A plot that compares the various convex loss functions supported by :class:`sklearn.linear_model.SGDClassifier` . """ print(__doc__) import numpy as np import matplotlib.pyplot as plt def modified_huber_loss(y_true, y_pred): z ...
bsd-3-clause
openfisca/openfisca-france-indirect-taxation
openfisca_france_indirect_taxation/examples/transports/plot_legislation/plot_ticpe_taux_implicite.py
4
2264
# -*- coding: utf-8 -*- """ Created on Mon Aug 17 18:06:45 2015 @author: thomas.douenne TICPE: Taxe intérieure sur la consommation des produits énergétiques """ # L'objectif de ce script est d'illustrer graphiquement l'évolution du taux implicite de la TICPE depuis 1993. # On étudie ce taux pour le diesel, et pour l...
agpl-3.0
jmontgom10/Mimir_pyPol
oldCode/04b_avgBAABditherHWPimages.py
1
17054
# -*- coding: utf-8 -*- """ Combines all the images for a given (TARGET, FILTER, HWP) combination to produce a single, average image. Estimates the sky background level of the on-target position at the time of the on-target observation using a bracketing pair of off-target observations through the same HWP polaroid ro...
mit
jldbc/pybaseball
pybaseball/standings.py
1
3820
from typing import List, Optional import pandas as pd import requests from bs4 import BeautifulSoup, Comment, PageElement, ResultSet from . import cache from .utils import most_recent_season def get_soup(year: int) -> BeautifulSoup: url = f'http://www.baseball-reference.com/leagues/MLB/{year}-standings.shtml' ...
mit
BrainTech/openbci
obci/analysis/csp/MLogit.py
1
11792
#!/usr/bin/env python #-*- coding:utf-8 -*- """This is a class for Multinomial Logit Regression Class uses scipy.optimize package for minimalization of a cost function. The gradient of the cost function is passed to the minimizer. Piotr Milanowski, November 2011, Warsaw """ from scipy.optimize import fmin_ncg, fmin_...
gpl-3.0
vortex-exoplanet/VIP
vip_hci/negfc/utils_negfc.py
2
8821
#! /usr/bin/env python """ Module with post-processing related functions called from within the NFC algorithm. """ __author__ = 'Carlos Alberto Gomez Gonzalez' __all__ = ['cube_planet_free'] import numpy as np from ..metrics import cube_inject_companions import math from matplotlib.pyplot import plot, xlim, ylim, ax...
mit
chaluemwut/smcdemo
demo_filter.py
1
2602
import pickle from feature_process import FeatureMapping import feature_process from text_processing import TextProcessing from sklearn.cross_validation import train_test_split is_not_important = {9:0, 13:0, 18:0, 19:0, 23:0, 28:0, 29:0, 33:0, 34:0, 37:0, 40:0, 44:0, 46:0, 50:0, 55:0, 59:0, 61:0, 62:0, 63:0, 72:0, 73:...
apache-2.0
ChanChiChoi/scikit-learn
examples/exercises/plot_iris_exercise.py
323
1602
""" ================================ SVM Exercise ================================ A tutorial exercise for using different SVM kernels. This exercise is used in the :ref:`using_kernels_tut` part of the :ref:`supervised_learning_tut` section of the :ref:`stat_learn_tut_index`. """ print(__doc__) import numpy as np i...
bsd-3-clause
ianatpn/nupictest
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 ...
gpl-3.0
ShujiaHuang/AsmVar
src/AsmvarGenotype/GMM/GMM2D.py
2
18363
""" ================================================ My own Gaussion Mixture Model for SV genotyping. Learn form scikit-learn ================================================ Author : Shujia Huang Date : 2014-01-06 14:33:45 """ import sys import numpy as np from scipy import linalg from sklearn import cluster from ...
mit
kcyu1993/ML_course_kyu
projects/project1/scripts/model.py
1
19450
from __future__ import absolute_import from abc import ABCMeta, abstractmethod import copy from data_utils import build_k_indices from learning_model import * from regularizer import * from helpers import save_numpy_array import numpy as np class Model(object): """ Author: Kaicheng Yu Machine learning mo...
mit
jmetzen/scikit-learn
sklearn/base.py
22
18131
"""Base classes for all estimators.""" # Author: Gael Varoquaux <gael.varoquaux@normalesup.org> # License: BSD 3 clause import copy import warnings import numpy as np from scipy import sparse from .externals import six from .utils.fixes import signature from .utils.deprecation import deprecated from .exceptions impor...
bsd-3-clause
htygithub/bokeh
bokeh/sampledata/gapminder.py
41
2655
from __future__ import absolute_import import pandas as pd from os.path import join import sys from . import _data_dir ''' This module provides a pandas DataFrame instance of four of the datasets from gapminder.org. These are read in from csvs that have been downloaded from Bokeh's sample data on S3. But the origina...
bsd-3-clause
huongttlan/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
joelfrederico/SciSalt
scisalt/qt/mplwidget.py
1
13557
from PyQt4 import QtGui from PyQt4 import QtCore from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as _FigureCanvas from matplotlib.backends.backend_qt4 import NavigationToolbar2QT as _NavigationToolbar import matplotlib as _mpl import numpy as _np from .Rectangle import Rectangle import pdb import tra...
mit
mathhun/scipy_2015_sklearn_tutorial
notebooks/figures/plot_kneighbors_regularization.py
25
1363
import numpy as np import matplotlib.pyplot as plt from sklearn.neighbors import KNeighborsRegressor def make_dataset(n_samples=100): rnd = np.random.RandomState(42) x = np.linspace(-3, 3, n_samples) y_no_noise = np.sin(4 * x) + x y = y_no_noise + rnd.normal(size=len(x)) return x, y def plot_re...
cc0-1.0
qifeigit/scikit-learn
examples/decomposition/plot_pca_3d.py
354
2432
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Principal components analysis (PCA) ========================================================= These figures aid in illustrating how a point cloud can be very flat in one direction--which is where PCA comes in to ch...
bsd-3-clause
sonyahanson/assaytools
examples/ipynbs/data-analysis/spectra/2015-12-18/xml2png4scans-spectra.py
8
5636
# This script takes xml data file output from the Tecan Infinite m1000 Pro plate reader # and makes quick and dirty images of the raw data. # But with scans and not just singlet reads. # This script specifically combines four spectrum scripts (AB, CD, EF, GH) into a single dataframe and plot. # The same procedure can...
lgpl-2.1
nikitasingh981/scikit-learn
examples/text/hashing_vs_dict_vectorizer.py
93
3243
""" =========================================== FeatureHasher and DictVectorizer Comparison =========================================== Compares FeatureHasher and DictVectorizer by using both to vectorize text documents. The example demonstrates syntax and speed only; it doesn't actually do anything useful with the e...
bsd-3-clause
RomainBrault/scikit-learn
sklearn/neighbors/graph.py
36
6650
"""Nearest Neighbors graph functions""" # Author: Jake Vanderplas <vanderplas@astro.washington.edu> # # License: BSD 3 clause (C) INRIA, University of Amsterdam from .base import KNeighborsMixin, RadiusNeighborsMixin from .unsupervised import NearestNeighbors def _check_params(X, metric, p, metric_params): """C...
bsd-3-clause
micahcochran/geopandas
geopandas/_version.py
3
16750
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains t...
bsd-3-clause
zycdragonball/tensorflow
tensorflow/contrib/learn/python/learn/estimators/linear_test.py
58
71789
# 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
yqzhang/OpenANN
benchmarks/iris/benchmark.py
5
3308
## \page IrisBenchmark Iris Flower Dataset # # The iris dataset is a standard machine learning dataset. # See e.g. the <a href="http://en.wikipedia.org/wiki/Iris_flower_data_set" # target=_blank>Wikipedia article</a> for more details. # # You can start the benchmark with the script: # \verbatim # python benchmark...
gpl-3.0
alexei-matveev/ase-local
doc/exercises/siesta1/answer1.py
3
1197
# -*- coding: utf-8 -*- # creates: ener.png distance.png angle.png import os import matplotlib matplotlib.use('Agg') import pylab as plt e_s = [0.01,0.1,0.2,0.3,0.4,0.5] E = [-463.2160, -462.9633, -462.4891, -462.0551, -461.5426, -461.1714] d = [1.1131, 1.1046, 1.0960, 1.0901, 1.0857, 1.0810] alpha = [100....
gpl-2.0
mugwizaleon/PCRasterMapstacks
pcrastermapstackvisualisation.py
1
17920
# -*- coding: utf-8 -*- """ /*************************************************************************** PcrasterMapstackVisualisation A QGIS plugin PCRaster Mapstack visualisation ------------------- begin : 2014-06-28 copy...
apache-2.0
jreback/pandas
pandas/io/formats/latex.py
2
25201
""" Module for formatting output data in Latex. """ from abc import ABC, abstractmethod from typing import Iterator, List, Optional, Sequence, Tuple, Type, Union import numpy as np from pandas.core.dtypes.generic import ABCMultiIndex from pandas.io.formats.format import DataFrameFormatter def _split_into_full_shor...
bsd-3-clause
trungnt13/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
michelp/pywt
util/refguide_check.py
2
27051
#!/usr/bin/env python """ refguide_check.py [OPTIONS] [-- ARGS] Check for a PyWavelets submodule whether the objects in its __all__ dict correspond to the objects included in the reference guide. Example of usage:: $ python refguide_check.py optimize Note that this is a helper script to be able to check if thin...
mit
samklr/spark-timeseries
python/sparkts/test/test_timeseriesrdd.py
6
5407
from test_utils import PySparkTestCase from sparkts.timeseriesrdd import * from sparkts.timeseriesrdd import _TimeSeriesSerializer from sparkts.datetimeindex import * import pandas as pd import numpy as np from unittest import TestCase from io import BytesIO from pyspark.sql import SQLContext class TimeSeriesSerialize...
apache-2.0
jblackburne/scikit-learn
sklearn/tree/tests/test_tree.py
7
55471
""" Testing for the tree module (sklearn.tree). """ import pickle from functools import partial from itertools import product import struct import numpy as np from scipy.sparse import csc_matrix from scipy.sparse import csr_matrix from scipy.sparse import coo_matrix from sklearn.random_projection import sparse_random...
bsd-3-clause
andaag/scikit-learn
examples/semi_supervised/plot_label_propagation_versus_svm_iris.py
286
2378
""" ===================================================================== Decision boundary of label propagation versus SVM on the Iris dataset ===================================================================== Comparison for decision boundary generated on iris dataset between Label Propagation and SVM. This demon...
bsd-3-clause
liberatorqjw/scikit-learn
sklearn/tree/export.py
30
4529
""" This module defines export functions for decision trees. """ # Authors: Gilles Louppe <g.louppe@gmail.com> # Peter Prettenhofer <peter.prettenhofer@gmail.com> # Brian Holt <bdholt1@gmail.com> # Noel Dawe <noel@dawe.me> # Satrajit Gosh <satrajit.ghosh@gmail.com> # Licence: BSD 3 ...
bsd-3-clause
crichardson17/starburst_atlas
Low_resolution_sims/DustFree_LowRes/Padova_inst/padova_inst_6/Optical1.py
33
7366
import csv import matplotlib.pyplot as plt from numpy import * import scipy.interpolate import math from pylab import * from matplotlib.ticker import MultipleLocator, FormatStrFormatter import matplotlib.patches as patches from matplotlib.path import Path import os # --------------------------------------------------...
gpl-2.0
rphlypo/parietalretreat
setup_data_path_salma.py
1
6001
import glob import os.path from pandas import DataFrame import pandas def get_all_paths(data_set=None, root_dir="/"): # TODO # if data_set ... collections.Sequence # iterate over list if data_set is None: data_set = {"hcp", "henson2010faces", "ds105", "ds107"} list_ = list() head, tail...
bsd-2-clause
debsankha/bedtime-programming
ls222/visual-lotka.py
1
5120
#!/usr/bin/env python from math import * import thread import random import time import pygtk pygtk.require("2.0") import gtk import gtk.glade import commands import matplotlib.pyplot class rodent: def __init__(self): self.time_from_last_childbirth=0 class felix: def __init__(self): self.size=0 self.is_virgin...
gpl-3.0
blaze/distributed
distributed/protocol/tests/test_collection_cuda.py
1
2448
import pytest from distributed.protocol import serialize, deserialize from dask.dataframe.utils import assert_eq import pandas as pd @pytest.mark.parametrize("collection", [tuple, dict]) @pytest.mark.parametrize("y,y_serializer", [(50, "cuda"), (None, "pickle")]) def test_serialize_cupy(collection, y, y_serializer):...
bsd-3-clause
nicholaschris/landsatpy
utils.py
1
2693
import operator import pandas as pd import numpy as np from numpy import ma from scipy.misc import imresize import scipy.ndimage as ndimage from skimage.morphology import disk, dilation def get_truth(input_one, input_two, comparison): # too much abstraction ops = {'>': operator.gt, '<': operator.lt, ...
mit
kwilliams-mo/iris
lib/iris/tests/test_plot.py
1
32122
# (C) British Crown Copyright 2010 - 2013, Met Office # # This file is part of Iris. # # Iris is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option) any l...
gpl-3.0
kaichogami/scikit-learn
sklearn/utils/multiclass.py
40
12966
# Author: Arnaud Joly, Joel Nothman, Hamzeh Alsalhi # # License: BSD 3 clause """ Multi-class / multi-label utility function ========================================== """ from __future__ import division from collections import Sequence from itertools import chain from scipy.sparse import issparse from scipy.sparse....
bsd-3-clause
ONEcampaign/humanitarian-data-service
displacement_tracker_data.py
1
27157
import requests import pandas as pd import os.path import resources.constants import json from pandas.io.json import json_normalize from utils.data_utils import get_ordinal_number """ This script aggregates data from multiple endpoints and returns a single .json file containing all data used in the displacement tracke...
mit
Tong-Chen/scikit-learn
sklearn/tests/test_cross_validation.py
4
30858
"""Test the cross_validation module""" from __future__ import division import warnings import numpy as np from scipy.sparse import coo_matrix from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing im...
bsd-3-clause
ahoyosid/scikit-learn
examples/applications/plot_stock_market.py
227
8284
""" ======================================= Visualizing the stock market structure ======================================= This example employs several unsupervised learning techniques to extract the stock market structure from variations in historical quotes. The quantity that we use is the daily variation in quote ...
bsd-3-clause
DESatAPSU/DAWDs
python/origBandpass_FITSToCSV.py
1
1930
# Converts STD_BANDPASSES_Y3A1_FGCM_20170630_extend3000.fits to # y3a2_std_passband_extend3000_ugrizYatm.csv # # To run (bash): # python origBandpass_FITSToCSV.py > origBandpass_FITSToCSV.log 2>&1 & # # To run (tcsh): # python origBandpass_FITSToCSV.py >& origBandpass_FITSToCSV.log & # # DLT, 2017-06-30 # bas...
mit
nmartensen/pandas
asv_bench/benchmarks/gil.py
7
11003
from .pandas_vb_common import * from pandas.core.algorithms import take_1d try: from cStringIO import StringIO except ImportError: from io import StringIO try: from pandas._libs import algos except ImportError: from pandas import algos try: from pandas.util.testing import test_parallel have...
bsd-3-clause
great-expectations/great_expectations
tests/datasource/test_batch_generators.py
1
6706
import os from great_expectations.datasource.batch_kwargs_generator import ( DatabricksTableBatchKwargsGenerator, GlobReaderBatchKwargsGenerator, SubdirReaderBatchKwargsGenerator, ) try: from unittest import mock except ImportError: from unittest import mock def test_file_kwargs_generator( d...
apache-2.0
jblackburne/scikit-learn
sklearn/gaussian_process/gpc.py
42
31571
"""Gaussian processes classification.""" # Authors: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de> # # License: BSD 3 clause import warnings from operator import itemgetter import numpy as np from scipy.linalg import cholesky, cho_solve, solve from scipy.optimize import fmin_l_bfgs_b from scipy.special import erf...
bsd-3-clause
dsquareindia/scikit-learn
sklearn/decomposition/tests/test_fastica.py
70
7808
""" Test the fastica algorithm. """ import itertools import warnings import numpy as np from scipy import stats from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_less ...
bsd-3-clause
untom/scikit-learn
sklearn/decomposition/base.py
313
5647
"""Principal Component Analysis Base Classes""" # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Denis A. Engemann <d.engemann@fz-juelich.de> # Kyle Kastner <kastnerkyle@gmail.com> # # Licen...
bsd-3-clause
dmargala/qusp
examples/compare_delta.py
1
7364
#!/usr/bin/env python import argparse import numpy as np import numpy.ma as ma import h5py import qusp import matplotlib.pyplot as plt import scipy.interpolate import fitsio class DeltaLOS(object): def __init__(self, thing_id): path = '/data/lya/deltas/delta-%d.fits' % thing_id hdulist = fitsio....
mit
guildai/guild
examples/iris-svm/plot_iris_exercise.py
1
1702
""" A tutorial exercise for using different SVM kernels. Adapted from: https://scikit-learn.org/stable/auto_examples/exercises/plot_iris_exercise.html """ import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from sklearn import datasets, svm kernel = 'linear' # choice of line...
apache-2.0
jzt5132/scikit-learn
examples/svm/plot_rbf_parameters.py
132
8096
''' ================== RBF SVM parameters ================== This example illustrates the effect of the parameters ``gamma`` and ``C`` of the Radial Basis Function (RBF) kernel SVM. Intuitively, the ``gamma`` parameter defines how far the influence of a single training example reaches, with low values meaning 'far' a...
bsd-3-clause
etkirsch/scikit-learn
examples/semi_supervised/plot_label_propagation_digits.py
268
2723
""" =================================================== Label Propagation digits: Demonstrating performance =================================================== This example demonstrates the power of semisupervised learning by training a Label Spreading model to classify handwritten digits with sets of very few labels....
bsd-3-clause
nmartensen/pandas
asv_bench/benchmarks/categoricals.py
3
2803
from .pandas_vb_common import * try: from pandas.api.types import union_categoricals except ImportError: try: from pandas.types.concat import union_categoricals except ImportError: pass class Categoricals(object): goal_time = 0.2 def setup(self): N = 100000 self.s ...
bsd-3-clause
YinongLong/scikit-learn
examples/preprocessing/plot_function_transformer.py
158
1993
""" ========================================================= Using FunctionTransformer to select columns ========================================================= Shows how to use a function transformer in a pipeline. If you know your dataset's first principle component is irrelevant for a classification task, you ca...
bsd-3-clause
newville/scikit-image
doc/examples/plot_rank_mean.py
17
1499
""" ============ Mean filters ============ This example compares the following mean filters of the rank filter package: * **local mean**: all pixels belonging to the structuring element to compute average gray level. * **percentile mean**: only use values between percentiles p0 and p1 (here 10% and 90%). * *...
bsd-3-clause
dipanjanS/text-analytics-with-python
Old-First-Edition/Ch06_Text_Similarity_and_Clustering/utils.py
1
1097
# -*- coding: utf-8 -*- """ Created on Sun Sep 11 23:06:06 2016 @author: DIP """ from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer def build_feature_matrix(documents, feature_type='frequency', ngram_range=(1, 1), min_df=0.0, max_df=1.0): feature_type = featur...
apache-2.0
billy-inn/scikit-learn
examples/decomposition/plot_ica_vs_pca.py
306
3329
""" ========================== FastICA on 2D point clouds ========================== This example illustrates visually in the feature space a comparison by results using two different component analysis techniques. :ref:`ICA` vs :ref:`PCA`. Representing ICA in the feature space gives the view of 'geometric ICA': ICA...
bsd-3-clause
hrjn/scikit-learn
sklearn/cluster/tests/test_hierarchical.py
33
20167
""" Several basic tests for hierarchical clustering procedures """ # Authors: Vincent Michel, 2010, Gael Varoquaux 2012, # Matteo Visconti di Oleggio Castello 2014 # License: BSD 3 clause from tempfile import mkdtemp import shutil from functools import partial import numpy as np from scipy import sparse from...
bsd-3-clause
mne-tools/mne-python
mne/viz/circle.py
14
15879
"""Functions to plot on circle as for connectivity.""" # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Denis Engemann <denis.engemann@gmail.com> # Martin Luessi <mluessi@nmr.mgh.harvard.edu> # # License: Simplified BSD from itertools import cycle from functools import partial import ...
bsd-3-clause
zorroblue/scikit-learn
examples/model_selection/plot_roc.py
102
5056
""" ======================================= 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
harshaneelhg/scikit-learn
examples/cluster/plot_lena_compress.py
271
2229
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Vector Quantization Example ========================================================= The classic image processing example, Lena, an 8-bit grayscale bit-depth, 512 x 512 sized image, is used here to illustrate how ...
bsd-3-clause
JosmanPS/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
smorante/continuous-goal-directed-actions
demonstration-feature-selection/src/alternatives/main_dtw_mds_norm.py
2
3731
# -*- coding: utf-8 -*- """ Author: Santiago Morante Robotics Lab. Universidad Carlos III de Madrid """ ########################## DTW #################################### import libmddtw import matplotlib.pyplot as plt from dtw import dtw ########################## MDS #################################### impo...
mit
wavycloud/pyboto3
pyboto3/glue.py
1
692979
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud 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 restriction, including without limitation the rights to use, copy, modify, merge, p...
mit
alekz112/statsmodels
statsmodels/datasets/tests/test_utils.py
26
1697
import os import sys from statsmodels.datasets import get_rdataset, webuse, check_internet from numpy.testing import assert_, assert_array_equal, dec cur_dir = os.path.dirname(os.path.abspath(__file__)) def test_get_rdataset(): # smoke test if sys.version_info[0] >= 3: #NOTE: there's no way to test bo...
bsd-3-clause
vene/ambra
ambra/cross_validation.py
1
9371
import numbers import time import numpy as np from sklearn.utils import safe_indexing from sklearn.base import is_classifier, clone from sklearn.metrics.scorer import check_scoring from sklearn.externals.joblib import Parallel, delayed, logger from ambra.backports import _num_samples, indexable from sklearn.cross_val...
bsd-2-clause
jlegendary/scikit-learn
sklearn/decomposition/tests/test_dict_learning.py
47
8095
import numpy as np from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_raises ...
bsd-3-clause
glouppe/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
dahlstrom-g/intellij-community
python/helpers/pydev/_pydevd_bundle/pydevd_vars.py
7
26282
""" pydevd_vars deals with variables: resolution/conversion to XML. """ import math import pickle from _pydev_bundle.pydev_imports import quote from _pydev_imps._pydev_saved_modules import thread from _pydevd_bundle.pydevd_constants import get_frame, get_current_thread_id, xrange, NUMPY_NUMERIC_TYPES, NUMPY_FLOATI...
apache-2.0
rmm-fcul/workshops
2015_graz/binary_choice/two_arenas_real_real/casu_utils.py
5
8116
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' a library of functions used in CASU controller dynamics. Got a lot of messy code that would be neater like this RM, Feb 2015 ''' import numpy as np from assisipy import casu #import matplotlib.cm as cm from datetime import datetime import parsing import time ### ==...
lgpl-3.0
zooniverse/aggregation
docs/source/conf.py
1
9778
# -*- coding: utf-8 -*- # # Zooniverse Aggregation Engine documentation build configuration file, created by # sphinx-quickstart on Mon Mar 14 11:15:07 2016. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # aut...
apache-2.0
akloster/bokeh
bokeh/properties.py
20
42601
""" Properties are objects that can be assigned as class level attributes on Bokeh models, to provide automatic serialization and validation. For example, the following defines a model that has integer, string, and list[float] properties:: class Model(HasProps): foo = Int bar = String baz ...
bsd-3-clause
trustedanalytics/spark-tk
regression-tests/sparktkregtests/testcases/frames/boxcox_test.py
12
5074
# vim: set encoding=utf-8 # Copyright (c) 2016 Intel Corporation  # # 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
yonglehou/scikit-learn
examples/applications/plot_stock_market.py
227
8284
""" ======================================= Visualizing the stock market structure ======================================= This example employs several unsupervised learning techniques to extract the stock market structure from variations in historical quotes. The quantity that we use is the daily variation in quote ...
bsd-3-clause
phoebe-project/phoebe2-docs
2.1/examples/minimal_contact_binary.py
1
5694
#!/usr/bin/env python # coding: utf-8 # Minimal Contact Binary System # ============================ # # Setup # ----------------------------- # Let's first make sure we have the latest version of PHOEBE 2.1 installed. (You can comment out this line if you don't use pip for your installation or don't want to update ...
gpl-3.0
jereze/scikit-learn
examples/cluster/plot_feature_agglomeration_vs_univariate_selection.py
218
3893
""" ============================================== Feature agglomeration vs. univariate selection ============================================== This example compares 2 dimensionality reduction strategies: - univariate feature selection with Anova - feature agglomeration with Ward hierarchical clustering Both metho...
bsd-3-clause
jeremiedecock/snippets
python/matplotlib/hist_logscale_x.py
1
1804
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Make a histogram using a logarithmic scale on X axis See: - http://stackoverflow.com/questions/6855710/how-to-have-logarithmic-bins-in-a-python-histogram """ import numpy as np import matplotlib.pyplot as plt # SETUP ###############################################...
mit
daodaoliang/bokeh
bokeh/charts/builder/tests/test_line_builder.py
33
2376
""" This is the Bokeh charts testing interface. """ #----------------------------------------------------------------------------- # Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved. # # Powered by the Bokeh Development Team. # # The full license is in the file LICENSE.txt, distributed with thi...
bsd-3-clause
pypot/scikit-learn
examples/decomposition/plot_pca_vs_lda.py
182
1743
""" ======================================================= Comparison of LDA and PCA 2D projection of Iris dataset ======================================================= The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour and Virginica) with 4 attributes: sepal length, sepal width, petal length a...
bsd-3-clause
JackKelly/neuralnilm_prototype
scripts/experiment029.py
2
3262
from __future__ import division import matplotlib.pyplot as plt import numpy as np import theano import theano.tensor as T import lasagne from gen_data_029 import gen_data, N_BATCH, LENGTH theano.config.compute_test_value = 'raise' # Number of units in the hidden (recurrent) layer N_HIDDEN = 5 # SGD learning rate LEA...
mit
zmr/namsel
accuracy_test.py
1
2139
#encoding: utf-8 import cPickle as pickle from classify import load_cls, label_chars from cv2 import GaussianBlur from feature_extraction import get_zernike_moments, get_hu_moments, \ extract_features, normalize_and_extract_features from functools import partial import glob from multiprocessing.pool import Pool im...
mit
ephes/scikit-learn
examples/decomposition/plot_pca_vs_lda.py
182
1743
""" ======================================================= Comparison of LDA and PCA 2D projection of Iris dataset ======================================================= The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour and Virginica) with 4 attributes: sepal length, sepal width, petal length a...
bsd-3-clause
aguirrea/lucy
tests/lfootGraph.py
1
6007
#! /usr/bin/env python # -*- coding: utf-8 -*- # Andrés Aguirre Dorelo # # MINA/INCO/UDELAR # # module for finding the steps in the tutors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; eith...
gpl-3.0
otmaneJai/Zipline
zipline/utils/tradingcalendar_bmf.py
17
7576
# # Copyright 2014 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
kylerbrown/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
nasseralkmim/SaPy
sapy/plotter.py
1
4743
import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from mpl_toolkits.mplot3d.art3d import Line3D from matplotlib.lines import Line2D import numpy as np def window(name): return plt.figure(name) def show(): plt.show() return None def undeformed(model): """Plot the undeformed st...
gpl-3.0
hennersz/pySpace
basemap/doc/users/figures/omerc.py
6
1065
from mpl_toolkits.basemap import Basemap import numpy as np import matplotlib.pyplot as plt # setup oblique mercator basemap. # width is width of map projection region in km (xmax-xmin_ # height is height of map projection region in km (ymax-ymin) # lon_0, lat_0 are the central longitude and latitude of the projection....
gpl-3.0
jlegendary/scikit-learn
examples/plot_multilabel.py
87
4279
# Authors: Vlad Niculae, Mathieu Blondel # License: BSD 3 clause """ ========================= Multilabel classification ========================= This example simulates a multi-label document classification problem. The dataset is generated randomly based on the following process: - pick the number of labels: n ...
bsd-3-clause
ephes/scikit-learn
sklearn/decomposition/dict_learning.py
83
44062
""" 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
melqkiades/yelp
source/python/topicmodeling/external/topicensemble/unsupervised/nmf.py
2
1622
import numpy as np from sklearn import decomposition import logging as log # -------------------------------------------------------------- class SklNMF: """ Wrapper class backed by the scikit-learn package NMF implementation. """ def __init__( self, max_iters = 100, init_strategy = "random" ): self.max_iters =...
lgpl-2.1
zrhans/pythonanywhere
.virtualenvs/django19/lib/python3.4/site-packages/matplotlib/tri/triplot.py
8
3150
from __future__ import (absolute_import, division, print_function, unicode_literals) from matplotlib.externals import six import numpy as np from matplotlib.tri.triangulation import Triangulation def triplot(ax, *args, **kwargs): """ Draw a unstructured triangular grid as lines and/o...
apache-2.0
joshgabriel/dft-crossfilter
CompleteApp/crossfilter_app/old_mains/old_main.py
3
10263
# main.py that controls the whole app # to run: just run bokeh serve --show crossfilter_app in the benchmark-view repo from random import random import os from bokeh.layouts import column from bokeh.models import Button from bokeh.models.widgets import Select, MultiSelect, Slider from bokeh.palettes import RdYlBu3 fr...
mit
Tuyki/TT_RNN
MNISTSeq.py
1
14227
__author__ = "Yinchong Yang" __copyright__ = "Siemens AG, 2018" __licencse__ = "MIT" __version__ = "0.1" """ MIT License Copyright (c) 2018 Siemens AG 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 Softwa...
mit