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
dsquareindia/scikit-learn
examples/model_selection/grid_search_digits.py
33
2764
""" ============================================================ Parameter estimation using grid search with cross-validation ============================================================ This examples shows how a classifier is optimized by cross-validation, which is done using the :class:`sklearn.model_selection.GridS...
bsd-3-clause
kernc/scikit-learn
sklearn/metrics/cluster/tests/test_bicluster.py
394
1770
"""Testing for bicluster metrics module""" import numpy as np from sklearn.utils.testing import assert_equal, assert_almost_equal from sklearn.metrics.cluster.bicluster import _jaccard from sklearn.metrics import consensus_score def test_jaccard(): a1 = np.array([True, True, False, False]) a2 = np.array([T...
bsd-3-clause
fzalkow/scikit-learn
examples/mixture/plot_gmm_classifier.py
250
3918
""" ================== GMM classification ================== Demonstration of Gaussian mixture models for classification. See :ref:`gmm` for more information on the estimator. Plots predicted labels on both training and held out test data using a variety of GMM classifiers on the iris dataset. Compares GMMs with sp...
bsd-3-clause
bendudson/BOUT
tools/pylib/boututils/plotdata.py
4
2488
# Plot a data set try: import numpy as np import matplotlib import matplotlib.cm as cm import matplotlib.mlab as mlab import matplotlib.pyplot as plt except ImportError: print "ERROR: plotdata needs numpy and matplotlib to work" raise matplotlib.rcParams['xtick.direction'] = 'out' matplotl...
gpl-3.0
endolith/scipy
scipy/stats/_qmc.py
5
47162
"""Quasi-Monte Carlo engines and helpers.""" from __future__ import annotations import os import copy import numbers from abc import ABC, abstractmethod import math from typing import ( ClassVar, List, Optional, overload, TYPE_CHECKING, ) import warnings import numpy as np if TYPE_CHECKING: i...
bsd-3-clause
ryfeus/lambda-packs
Keras_tensorflow_nightly/source2.7/numpy/lib/twodim_base.py
10
25817
""" Basic functions for manipulating 2d arrays """ from __future__ import division, absolute_import, print_function from numpy.core.numeric import ( absolute, asanyarray, arange, zeros, greater_equal, multiply, ones, asarray, where, int8, int16, int32, int64, empty, promote_types, diagonal, nonzero ) ...
mit
cauchycui/scikit-learn
examples/classification/plot_classifier_comparison.py
181
4699
#!/usr/bin/python # -*- coding: utf-8 -*- """ ===================== Classifier comparison ===================== A comparison of a several classifiers in scikit-learn on synthetic datasets. The point of this example is to illustrate the nature of decision boundaries of different classifiers. This should be taken with ...
bsd-3-clause
luo66/scikit-learn
sklearn/tests/test_grid_search.py
83
28713
""" Testing for grid search module (sklearn.grid_search) """ from collections import Iterable, Sized from sklearn.externals.six.moves import cStringIO as StringIO from sklearn.externals.six.moves import xrange from itertools import chain, product import pickle import sys import numpy as np import scipy.sparse as sp ...
bsd-3-clause
ultimateprogramer/formhub
odk_viewer/tests/test_exports.py
4
88316
from sys import stdout import os import datetime import json import StringIO import csv import tempfile import zipfile import shutil from openpyxl import load_workbook from time import sleep from pyxform.builder import create_survey_from_xls from django.conf import settings from main.tests.test_base import MainTestCase...
bsd-2-clause
argriffing/scipy
scipy/signal/wavelets.py
67
10523
from __future__ import division, print_function, absolute_import import numpy as np from numpy.dual import eig from scipy.special import comb from scipy import linspace, pi, exp from scipy.signal import convolve __all__ = ['daub', 'qmf', 'cascade', 'morlet', 'ricker', 'cwt'] def daub(p): """ The coefficient...
bsd-3-clause
CivilNet/Gemfield
src/python/caffe2/resnet50_gemfield.py
1
11628
# Author: Gemfield import argparse import numpy as np import time import os import sys import cv2 from matplotlib import pyplot from caffe2.python import core,workspace,utils,net_drawer,cnn,optimizer,model_helper,brew,visualize from caffe2.proto import caffe2_pb2 from caffe2.python.modeling.initializers import Initial...
gpl-3.0
kanhua/pypvcell
tests/test_filters.py
1
3099
__author__ = 'kanhua' import unittest from illumination import BpFilter, qe_filter, illumination import numpy as np from photocurrent import gen_square_qe_array import matplotlib.pyplot as plt from units_system import UnitsSystem us = UnitsSystem() # TODO Need to do some work here. Apprently this test class does not...
apache-2.0
victor-prado/broker-manager
environment/lib/python3.5/site-packages/pandas/tseries/common.py
7
7836
""" datetimelike delegation """ import numpy as np from pandas.types.common import (_NS_DTYPE, _TD_DTYPE, is_period_arraylike, is_datetime_arraylike, is_integer_dtype, is_datetime64_dtype, is_datetime64tz_dtype, ...
mit
pnedunuri/scikit-learn
examples/model_selection/plot_roc_crossval.py
247
3253
""" ============================================================= Receiver Operating Characteristic (ROC) with cross validation ============================================================= Example of Receiver Operating Characteristic (ROC) metric to evaluate classifier output quality using cross-validation. ROC curv...
bsd-3-clause
vshtanko/scikit-learn
examples/model_selection/plot_train_error_vs_test_error.py
349
2577
""" ========================= Train error vs Test error ========================= Illustration of how the performance of an estimator on unseen data (test data) is not the same as the performance on training data. As the regularization increases the performance on train decreases while the performance on test is optim...
bsd-3-clause
dgies/incubator-airflow
airflow/contrib/hooks/salesforce_hook.py
30
12110
# -*- coding: utf-8 -*- # # 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 writing, software ...
apache-2.0
jonycgn/scipy
scipy/stats/morestats.py
1
82932
# Author: Travis Oliphant, 2002 # # Further updates and enhancements by many SciPy developers. # from __future__ import division, print_function, absolute_import import math import warnings from collections import namedtuple import numpy as np from numpy import (isscalar, r_, log, sum, around, unique, asarray, ...
bsd-3-clause
josephbakarji/Gluvn
gluvn_python/run2hands.py
1
1290
from __init__ import keyboard_portname, EXPDIR, testDir, settingsDir, figDir, portL, portR, baud from run_glove import RunGlove from data_analysis import Analyze, Stats, Analyze2Hands from learning import Learn import numpy as np import matplotlib.pyplot as plt import sys import copy class play2hands: def __init_...
mit
TeamHG-Memex/eli5
eli5/formatters/as_dataframe.py
1
6571
from itertools import chain from typing import Any, Dict, List, Optional import warnings import pandas as pd import eli5 from eli5.base import ( Explanation, FeatureImportances, TargetExplanation, TransitionFeatureWeights, ) from eli5.base_utils import singledispatch def explain_weights_df(estimator, **kwar...
mit
mayblue9/bokeh
bokeh/charts/builder/tests/test_area_builder.py
33
3666
""" 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
bgroveben/python3_machine_learning_projects
oreilly_GANs_for_beginners/oreilly_GANs_for_beginners/probabilistic_programming_from_scratch/main.py
3
8309
import itertools import random import matplotlib.pyplot as plt ### Probabilistic Programming From Scratch ### ## A simple algorithm for Bayesian inference ## # Let's take a specific data analysis problem: a simple A/B test for a website. # Suppose our site has two layouts. # During our test, 4% of visitors to layout...
mit
raincoatrun/basemap
examples/plotmap_oo.py
4
2650
# make plot of etopo bathymetry/topography data on # lambert conformal conic map projection, drawing coastlines, state and # country boundaries, and parallels/meridians. # the data is interpolated to the native projection grid. ################################## # pyplot/pylab-free version of plotmap.py #############...
gpl-2.0
blokeley/forcelib
setup.py
1
3321
"""Setup commands for the forcelib package. See: https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject """ # Always prefer setuptools over distutils from setuptools import setup # To use a consistent encoding from codecs import open import io from os import path import re he...
mit
mbayon/TFG-MachineLearning
venv/lib/python3.6/site-packages/sklearn/linear_model/stochastic_gradient.py
3
55745
# Authors: Peter Prettenhofer <peter.prettenhofer@gmail.com> (main author) # Mathieu Blondel (partial_fit support) # # License: BSD 3 clause """Classification and regression using Stochastic Gradient Descent (SGD).""" import numpy as np import warnings from abc import ABCMeta, abstractmethod from ..external...
mit
GaryLv/GaryLv.github.io
codes/k-nearest neighbours/knn1.py
1
2049
# -*- coding: utf-8 -*- """ knn分类iris的前两个属性,并可视化分类结果 """ from sklearn.datasets import load_iris from collections import Counter import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap iris = load_iris() # X_train, X_test, y_train, y_test = cross_validation.train_test_split(iris.d...
apache-2.0
silicon-beach/news-in-short
summarizer/train2.7.py
1
11554
import os, random, sys, h5py import cPickle as pickle from sklearn.model_selection import train_test_split import numpy as np from keras.preprocessing import sequence from keras.utils import np_utils from keras.models import Sequential from keras.layers.core import Dense, Activation, Dropout, RepeatVector, Lambda from ...
mit
linebp/pandas
asv_bench/benchmarks/packers.py
6
9228
from .pandas_vb_common import * from numpy.random import randint import pandas as pd from collections import OrderedDict from pandas.compat import BytesIO import sqlite3 import os from sqlalchemy import create_engine import numpy as np from random import randrange class _Packers(object): goal_time = 0.2 def _...
bsd-3-clause
joshamilton/Hamilton_acI_2017
code/auxotrophies/01auxotrophyCOGs.py
1
4852
############################################################################### # auxotrophyCOGs.py # Copyright (c) 2017, Joshua J Hamilton and Katherine D McMahon # Affiliation: Department of Bacteriology # University of Wisconsin-Madison, Madison, Wisconsin, USA # URL: http://http://mcmahonlab.wisc.edu/ ...
mit
imprm/nummet_I
esenummet.py
1
7807
import numpy as np import matplotlib import matplotlib.pyplot as plt import scipy.optimize as scop import scipy.interpolate as scip from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes from mpl_toolkits.axes_grid1.inset_locator import mark_inset # ================ # NONLINER SESSION # ===============...
mit
mbonsma/phageParser
parserscripts/filterByExpect.py
3
2149
# filterByExpect_all_v2 # for each xml output file, use NCBIXML to extract the important things # Note: this requires blast output in xml format (set 'outfmt = 5') """ USAGE: python filterByExpect.py <indir> <outdir> """ import os import sys import pandas as pd def parse_blast(resultfile): """takes in the BLA...
mit
p0cisk/Quantum-GIS
python/plugins/processing/algs/qgis/BarPlot.py
7
3278
# -*- coding: utf-8 -*- """ *************************************************************************** BarPlot.py --------------------- Date : January 2013 Copyright : (C) 2013 by Victor Olaya Email : volayaf at gmail dot com ******************************...
gpl-2.0
moinulkuet/machine-learning
Part 3 - Classification/Section 16 - Support Vector Machine (SVM)/classification_template.py
37
2538
# Classification template # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('Social_Network_Ads.csv') X = dataset.iloc[:, [2, 3]].values y = dataset.iloc[:, 4].values # Splitting the dataset into the Training set and Test se...
gpl-3.0
pradyu1993/scikit-learn
examples/manifold/plot_mds.py
3
2421
""" ========================= Multi-dimensional scaling ========================= An illustration of the metric and non-metric MDS on generated noisy data. The reconstructed points using the metric MDS and non metric MDS are slightly shifted to avoid overlapping. """ # Author: Nelle Varoquaux <nelle.varoquaux@gmail....
bsd-3-clause
bkj/wit
wit/dep/forum-testing.py
2
3544
import pandas as pd import urllib2 from pprint import pprint from matplotlib import pyplot as plt from keras.layers.convolutional import Convolution1D, MaxPooling1D import sys sys.path.append('/Users/BenJohnson/projects/what-is-this/wit/') from wit import * # -- # Config + Init num_features = 500 # Character ma...
apache-2.0
rajul/mne-python
mne/viz/tests/test_topomap.py
3
8994
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Denis Engemann <denis.engemann@gmail.com> # Martin Luessi <mluessi@nmr.mgh.harvard.edu> # Eric Larson <larson.eric.d@gmail.com> # # License: Simplified BSD import os.path as op import warnings import numpy as np from ...
bsd-3-clause
JDTimlin/QSO_Clustering
highz_clustering/classification/SpIESHighzQuasarsS82all_JTmultiproc_lz.py
1
6238
from astropy.table import Table import numpy as np import matplotlib.pyplot as plt from time import time # Read in training file #data = Table.read('GTR-ADM-QSO-ir-testhighz_findbw_lup_2016_starclean.fits') #My path to the Training file #data = Table.read('../Training_set/GTR-ADM-QSO-ir-testhighz_findbw_lup_2016_star...
mit
tknomanzr/scripts
tint2/executors/bitcoin/show_bitcoin_detail.py
1
1333
#! /usr/bin/python # A simple utility that will calculate bitcoin balance from an electrum wallet. # Requires: gdax, pandas, matplotlib # Assumes: you currently have bitcoin stored in an electrum wallet. # Author: William Bradley # BunsenLabs Forum Handle: tknomanzr # License: GPL3.0. import gdax import pandas as pd i...
gpl-3.0
shyamalschandra/scikit-learn
examples/model_selection/plot_confusion_matrix.py
47
2495
""" ================ Confusion matrix ================ Example of confusion matrix usage to evaluate the quality of the output of a classifier on the iris data set. The diagonal elements represent the number of points for which the predicted label is equal to the true label, while off-diagonal elements are those that ...
bsd-3-clause
padraic-padraic/bad-boids
boids/tests/test_boids.py
1
4651
import matplotlib matplotlib.use('Agg') from boids.flock import Flock from mock import Mock, patch from nose.tools import assert_equal, assert_almost_equal import os import yaml def test_bad_boids_regression(): regression_data=yaml.load(open(os.path.join(os.path.dirname(__file__), ...
gpl-2.0
zaxtax/scikit-learn
examples/ensemble/plot_gradient_boosting_regression.py
87
2510
""" ============================ Gradient Boosting regression ============================ Demonstrate Gradient Boosting on the Boston housing dataset. This example fits a Gradient Boosting model with least squares loss and 500 regression trees of depth 4. """ print(__doc__) # Author: Peter Prettenhofer <peter.prett...
bsd-3-clause
amueller/astro_hackweek
plots/plot_2d_separator.py
41
1513
import numpy as np import matplotlib.pyplot as plt def plot_2d_separator(classifier, X, fill=False, ax=None, eps=None): if eps is None: eps = X.std() / 2. x_min, x_max = X[:, 0].min() - eps, X[:, 0].max() + eps y_min, y_max = X[:, 1].min() - eps, X[:, 1].max() + eps xx = np.linspace(x_min, x_m...
bsd-2-clause
carlgogo/vip_exoplanets
vip_hci/stats/im_stats.py
2
3777
#! /usr/bin/env python """ Module for image statistics. """ __author__ = 'Carlos Alberto Gomez Gonzalez' __all__ = ['frame_histo_stats', 'frame_average_radprofile'] import numpy as np import pandas as pd from matplotlib import pyplot as plt from ..var import frame_center from ..conf.utils_conf import chec...
bsd-3-clause
TomAugspurger/pandas
pandas/core/computation/eval.py
1
13106
""" Top level ``eval`` module. """ import tokenize from typing import Optional import warnings from pandas._libs.lib import no_default from pandas.util._validators import validate_bool_kwarg from pandas.core.computation.engines import _engines from pandas.core.computation.expr import Expr, _parsers from pandas.core....
bsd-3-clause
MaryanMorel/utopical-brotherhood
actors/Learner.py
1
1576
#! /usr/bin/python2 # -*- coding: utf8 -*- import pykka import time from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer from sklearn.pipeline import Pipeline from sklearn.cluster import SpectralClustering, AffinityPropagation from datetime import datetime class Learner(pykka.ThreadingActor):...
mit
jungla/ICOM-fluidity-toolbox
Detectors/plot_Tracer_v.py
1
1660
import os, sys import fio import numpy as np import matplotlib as mpl mpl.use('ps') import matplotlib.pyplot as plt import myfun #label = 'm_25_2_512' label = 'm_25_1_particles' dayi = 0 #10*24*2 dayf = 600 #10*24*4 days = 1 #label = sys.argv[1] #basename = sys.argv[2] #dayi = int(sys.argv[3]) #dayf = int(sys.a...
gpl-2.0
cs60050/TeamGabru
helpers/PlotDataAndResults.py
1
1089
import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap import numpy as np def plot_data_points(first_dimension, second_dimension, result_labels): #result_labels = 0 or 1 figure = plt.figure(figsize=(8,8)) cm = plt.cm.RdBu cm_bright = ListedColormap(['#FF0000', '#0000FF']) plt....
mit
blachlylab/mucor
build/scripts-2.7/mucor.py
1
33732
#!/home/OSUMC.EDU/blac96/source/venv/test_mucor_pip/bin/python # -*- coding: utf8 # Copyright 2013-2015 James S Blachly, MD and The Ohio State University # # This file is part of Mucor. # # Mucor is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License a...
gpl-3.0
tdhopper/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
Vvucinic/Wander
venv_2_7/lib/python2.7/site-packages/pandas/stats/math.py
25
3253
# pylint: disable-msg=E1103 # pylint: disable-msg=W0212 from __future__ import division from pandas.compat import range import numpy as np import numpy.linalg as linalg def rank(X, cond=1.0e-12): """ Return the rank of a matrix X based on its generalized inverse, not the SVD. """ X = np.asarray(...
artistic-2.0
johnbachman/indra
indra/assemblers/indranet/net.py
3
14200
import json import logging from os import path import numpy as np import pandas as pd import networkx as nx from decimal import Decimal import indra from indra.belief import SimpleScorer from indra.statements import Evidence from indra.statements import Statement logger = logging.getLogger(__name__) simple_scorer = ...
bsd-2-clause
GeoffEvans/aol_model
aol_model/aod_model_tune.py
1
2450
# take the expt data, fit model trnasducer using least squares # use smoothing splene to join up points # check second order import numpy as np from scipy.constants import pi from aol_model.ray import Ray from aol_model.acoustics import Acoustics import expt_data as data import aol_model.set_up_utils as setup import sc...
gpl-3.0
jonyroda97/redbot-amigosprovaveis
lib/mpl_toolkits/axes_grid1/inset_locator.py
2
18678
""" A collection of functions and objects for creating or placing inset axes. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from matplotlib import docstring import six from matplotlib.offsetbox import AnchoredOffsetbox from matplotlib.patches import Pa...
gpl-3.0
shahankhatch/scikit-learn
examples/neural_networks/plot_rbm_logistic_classification.py
258
4609
""" ============================================================== Restricted Boltzmann Machine features for digit classification ============================================================== For greyscale image data where pixel values can be interpreted as degrees of blackness on a white background, like handwritten...
bsd-3-clause
asnorkin/sentiment_analysis
site/lib/python2.7/site-packages/sklearn/utils/tests/test_metaestimators.py
86
2304
from sklearn.utils.testing import assert_true, assert_false from sklearn.utils.metaestimators import if_delegate_has_method class Prefix(object): def func(self): pass class MockMetaEstimator(object): """This is a mock meta estimator""" a_prefix = Prefix() @if_delegate_has_method(delegate="a...
mit
mengyun1993/RNN-binary
rnn07.py
1
27067
""" Vanilla RNN @author Graham Taylor """ import numpy as np import theano import theano.tensor as T from sklearn.base import BaseEstimator import logging import time import os import datetime import pickle as pickle import math import matplotlib.pyplot as plt plt.ion() mode = theano.Mode(linker='cvm') #mode = '...
bsd-3-clause
chiotlune/ext
gnuradio-3.7.0.1/gr-filter/examples/interpolate.py
58
8816
#!/usr/bin/env python # # Copyright 2009,2012,2013 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 ...
gpl-2.0
nwillemse/misc-scripts
adj-split-div/plot_ohlc.py
1
1355
#!/usr/bin/env python2 """ plot_ohlc.py Created on Sun Jul 17 19:53:29 2016 @author: nwillemse """ import matplotlib matplotlib.use('Qt4Agg') import click import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from bokeh.plotting import figure, output_file, show from os import path @click.comman...
mit
dsullivan7/scikit-learn
examples/covariance/plot_sparse_cov.py
300
5078
""" ====================================== Sparse inverse covariance estimation ====================================== Using the GraphLasso estimator to learn a covariance and sparse precision from a small number of samples. To estimate a probabilistic model (e.g. a Gaussian model), estimating the precision matrix, t...
bsd-3-clause
lucidfrontier45/scikit-learn
sklearn/decomposition/tests/test_dict_learning.py
2
6643
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 SkipTest from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_less from ...
bsd-3-clause
bloyl/mne-python
tutorials/evoked/30_eeg_erp.py
3
18032
""" .. _tut-erp: EEG processing and Event Related Potentials (ERPs) ================================================== This tutorial shows how to perform standard ERP analyses in MNE-Python. Most of the material here is covered in other tutorials too, but for convenience the functions and methods most useful for ERP ...
bsd-3-clause
RyanChinSang/LeagueLatency
History/Raw/v2.0a Stable/LoLPing.py
1
5603
import sys import subprocess import matplotlib import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib import style from datetime import datetime from matplotlib.widgets import RadioButtons CREATE_NO_WINDOW = 0x08000000 style.use('seaborn-darkgrid') ltimes = [] lpings = [] avg_lis = []...
gpl-3.0
bitemyapp/ggplot
ggplot/components/loess.py
13
1602
from __future__ import (absolute_import, division, print_function, unicode_literals) """ loess(formula, data, weights, subset, na.action, model = FALSE, span = 0.75, enp.target, degree = 2, parametric = FALSE, drop.square = FALSE, normalize = TRUE, family = c("gaussian", "symme...
bsd-2-clause
pv/scikit-learn
sklearn/covariance/tests/test_robust_covariance.py
213
3359
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Gael Varoquaux <gael.varoquaux@normalesup.org> # Virgile Fritsch <virgile.fritsch@inria.fr> # # License: BSD 3 clause import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_alm...
bsd-3-clause
DSLituiev/scikit-learn
examples/svm/plot_svm_anova.py
85
2024
""" ================================================= SVM-Anova: SVM with univariate feature selection ================================================= This example shows how to perform univariate feature selection before running a SVC (support vector classifier) to improve the classification scores. """ print(__doc_...
bsd-3-clause
eblur/AstroHackWeek2015
day3-machine-learning/plots/plot_interactive_forest.py
40
1279
import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import make_blobs from sklearn.ensemble import RandomForestClassifier X, y = make_blobs(centers=[[0, 0], [1, 1]], random_state=61526, n_samples=50) def plot_forest(max_depth=1): plt.figure() ax = plt.gca() h = 0.02 x_min, x_m...
gpl-2.0
dhruv13J/scikit-learn
sklearn/ensemble/tests/test_bagging.py
127
25365
""" Testing for the bagging ensemble module (sklearn.ensemble.bagging). """ # Author: Gilles Louppe # License: BSD 3 clause import numpy as np from sklearn.base import BaseEstimator from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.te...
bsd-3-clause
feilchenfeldt/enrichme
setup.py
1
1752
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup, find_packages # Always prefer setuptools over distutils from codecs import open # To use a consistent encoding import sys, os import enrichme def publish(): """Publish to PyPi""" os.system("python setup.py bdist_wheel sdist upload"...
mit
jkarnows/scikit-learn
sklearn/tests/test_dummy.py
129
17774
from __future__ import division import numpy as np import scipy.sparse as sp from sklearn.base import clone 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_eq...
bsd-3-clause
LiaoPan/scikit-learn
examples/linear_model/plot_sgd_weighted_samples.py
344
1458
""" ===================== SGD: Weighted samples ===================== Plot decision function of a weighted dataset, where the size of points is proportional to its weight. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from sklearn import linear_model # we create 20 points np.random.seed(0) X ...
bsd-3-clause
massmutual/scikit-learn
sklearn/linear_model/tests/test_sgd.py
1
44284
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
unsiloai/syntaxnet-ops-hack
tensorflow/python/estimator/inputs/queues/feeding_queue_runner_test.py
116
5164
# Copyright 2017 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
stylianos-kampakis/scikit-learn
examples/model_selection/plot_precision_recall.py
249
6150
""" ================ Precision-Recall ================ Example of Precision-Recall metric to evaluate classifier output quality. In information retrieval, precision is a measure of result relevancy, while recall is a measure of how many truly relevant results are returned. A high area under the curve represents both ...
bsd-3-clause
terkkila/scikit-learn
examples/linear_model/plot_polynomial_interpolation.py
251
1895
#!/usr/bin/env python """ ======================== Polynomial interpolation ======================== This example demonstrates how to approximate a function with a polynomial of degree n_degree by using ridge regression. Concretely, from n_samples 1d points, it suffices to build the Vandermonde matrix, which is n_samp...
bsd-3-clause
justincely/classwork
UMD/AST630/HW2/hw2.py
1
4890
"""Functions and script for problems in HW2 For problem 3: -------------- class oblate: provides the mechanics for calulating the desired orbital values from an initilized object of a given mass, radius, and moments. function problem_3(): function to output results using the oblate class on given scenarios ...
bsd-3-clause
wateraccounting/wa
Collect/MOD17/DataAccessGPP.py
1
15230
# -*- coding: utf-8 -*- """ Authors: Tim Hessels UNESCO-IHE 2016 Contact: t.hessels@unesco-ihe.org Repository: https://github.com/wateraccounting/wa Module: Collect/MOD17 """ # import general python modules import os import numpy as np import pandas as pd import gdal import urllib import urllib2 from bs4 impo...
apache-2.0
nguyentu1602/statsmodels
statsmodels/examples/ex_univar_kde.py
34
5127
""" This example tests the nonparametric estimator for several popular univariate distributions with the different bandwidth selction methods - CV-ML; CV-LS; Scott's rule of thumb. Produces six different plots for each distribution 1) Beta 2) f 3) Pareto 4) Laplace 5) Weibull 6) Poisson """ from __future__ import p...
bsd-3-clause
richford/AFQ-viz
afqbrowser/tests/test_browser.py
3
1236
import os.path as op import afqbrowser as afqb import tempfile import json import pandas as pd import numpy.testing as npt def test_assemble(): data_path = op.join(afqb.__path__[0], 'site') tdir = tempfile.mkdtemp() afqb.assemble(op.join(data_path, 'client', 'data', 'afq.mat'), target=td...
bsd-3-clause
mjudsp/Tsallis
sklearn/datasets/base.py
11
23497
""" Base IO code for all datasets """ # Copyright (c) 2007 David Cournapeau <cournape@gmail.com> # 2010 Fabian Pedregosa <fabian.pedregosa@inria.fr> # 2010 Olivier Grisel <olivier.grisel@ensta.org> # License: BSD 3 clause import os import csv import sys import shutil from os import environ...
bsd-3-clause
Lawrence-Liu/scikit-learn
examples/decomposition/plot_incremental_pca.py
244
1878
""" =============== Incremental PCA =============== Incremental principal component analysis (IPCA) is typically used as a replacement for principal component analysis (PCA) when the dataset to be decomposed is too large to fit in memory. IPCA builds a low-rank approximation for the input data using an amount of memo...
bsd-3-clause
trdean/grEME
gr-filter/examples/fir_filter_fff.py
6
4018
#!/usr/bin/env python # # Copyright 2013 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
ssaeger/scikit-learn
examples/covariance/plot_covariance_estimation.py
99
5074
""" ======================================================================= Shrinkage covariance estimation: LedoitWolf vs OAS and max-likelihood ======================================================================= When working with covariance estimation, the usual approach is to use a maximum likelihood estimator,...
bsd-3-clause
dingocuster/scikit-learn
sklearn/utils/tests/test_linear_assignment.py
421
1349
# Author: Brian M. Clapper, G Varoquaux # License: BSD import numpy as np # XXX we should be testing the public API here from sklearn.utils.linear_assignment_ import _hungarian def test_hungarian(): matrices = [ # Square ([[400, 150, 400], [400, 450, 600], [300, 225, 300]], ...
bsd-3-clause
lthurlow/Network-Grapher
proj/external/matplotlib-1.2.1/examples/pylab_examples/barchart_demo.py
6
1134
#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt N = 5 menMeans = (20, 35, 30, 35, 27) menStd = (2, 3, 4, 1, 2) ind = np.arange(N) # the x locations for the groups width = 0.35 # the width of the bars plt.subplot(111) rects1 = plt.bar(ind, menMeans, width, color...
mit
lewisodriscoll/sasview
src/sas/sasgui/plottools/SimpleFont.py
3
4024
""" This software was developed by Institut Laue-Langevin as part of Distributed Data Analysis of Neutron Scattering Experiments (DANSE). Copyright 2012 Institut Laue-Langevin """ # this is a dead simple dialog for getting font family, size,style and weight import wx from matplotlib.font_manager import FontPropert...
bsd-3-clause
qiime2-plugins/feature-table
q2_feature_table/_summarize/_vega_spec.py
1
12366
# ---------------------------------------------------------------------------- # Copyright (c) 2016-2020, QIIME 2 development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
bsd-3-clause
arielmakestuff/loadlimit
test/unit/stat/test_timeseries.py
1
6054
# -*- coding: utf-8 -*- # test/unit/stat/test_timeseries.py # Copyright (C) 2016 authors and contributors (see AUTHORS file) # # This module is released under the MIT License. """Test timeseries()""" # ============================================================================ # Imports # ===========================...
mit
Rossonero/bmlswp
ch06/04_sent.py
22
10125
# This code is supporting material for the book # Building Machine Learning Systems with Python # by Willi Richert and Luis Pedro Coelho # published by PACKT Publishing # # It is made available under the MIT License # # This script trains tries to tweak hyperparameters to improve P/R AUC # import time start_time = ti...
mit
rs2/pandas
pandas/tests/reshape/test_melt.py
1
37168
import numpy as np import pytest import pandas as pd from pandas import DataFrame, lreshape, melt, wide_to_long import pandas._testing as tm class TestMelt: def setup_method(self, method): self.df = tm.makeTimeDataFrame()[:10] self.df["id1"] = (self.df["A"] > 0).astype(np.int64) self.df["...
bsd-3-clause
all-umass/metric-learn
setup.py
1
1748
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup import os import io version = {} with io.open(os.path.join('metric_learn', '_version.py')) as fp: exec(fp.read(), version) # Get the long description from README.md with io.open('README.rst', encoding='utf-8') as f: long_description = f.re...
mit
WangWenjun559/Weiss
summary/sumy/sklearn/tests/test_multiclass.py
72
24581
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_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_false from sklearn.utils.testing ...
apache-2.0
siutanwong/scikit-learn
examples/model_selection/plot_learning_curve.py
250
4171
""" ======================== Plotting Learning Curves ======================== On the left side the learning curve of a naive Bayes classifier is shown for the digits dataset. Note that the training score and the cross-validation score are both not very good at the end. However, the shape of the curve can be found in ...
bsd-3-clause
tuulos/luigi
examples/pyspark_wc.py
56
3361
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
apache-2.0
alexsavio/scikit-learn
examples/gaussian_process/plot_gpr_prior_posterior.py
104
2878
""" ========================================================================== Illustration of prior and posterior Gaussian process for different kernels ========================================================================== This example illustrates the prior and posterior of a GPR with different kernels. Mean, st...
bsd-3-clause
fxia22/pointGAN
show_gan_rnn2.py
1
1289
from __future__ import print_function from show3d_balls import * import argparse import os import random import numpy as np import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.optim as optim import torch.utils.data import torchvision.datasets as dset import torc...
mit
rishikksh20/scikit-learn
examples/applications/plot_outlier_detection_housing.py
110
5681
""" ==================================== Outlier detection on a real data set ==================================== This example illustrates the need for robust covariance estimation on a real data set. It is useful both for outlier detection and for a better understanding of the data structure. We selected two sets o...
bsd-3-clause
gxyang/hstore
scripts/anticache/plotter.py
9
2968
#!/usr/bin/env python import os import sys import csv import logging import matplotlib.pyplot as plot import pylab OPT_GRAPH_WIDTH = 1200 OPT_GRAPH_HEIGHT = 600 OPT_GRAPH_DPI = 100 ## ============================================== ## main ## ============================================== if __name__ == '__main__': ...
gpl-3.0
kyleabeauchamp/HMCNotes
code/optimize/old/test_optimize_hyper.py
2
3950
import sklearn.grid_search import scipy.stats.distributions import lb_loader import simtk.openmm.app as app import numpy as np import pandas as pd import simtk.openmm as mm from simtk import unit as u from openmmtools import hmc_integrators, testsystems pd.set_option('display.width', 1000) n_steps = 1500 temperature =...
gpl-2.0
zfrenchee/pandas
pandas/core/dtypes/api.py
16
2399
# flake8: noqa import sys from .common import (pandas_dtype, is_dtype_equal, is_extension_type, # categorical is_categorical, is_categorical_dtype, # interval is_interva...
bsd-3-clause
m-takeuchi/ilislife_wxp
test/test3.py
2
3375
#!/usr/bin/env python """ An example of how to use wx or wxagg in an application with a custom toolbar """ # matplotlib requires wxPython 2.8+ # set the wxPython version in lib\site-packages\wx.pth file # or if you have wxversion installed un-comment the lines below #import wxversion #wxversion.ensureMinimal('2.8') f...
mit
ecohealthalliance/eidr-connect
.scripts/gen_region_to_countries.py
1
3213
import json import pandas as pd import requests from io import StringIO import re continent_names = { "AF": "Africa", "AS": "Asia", "EU": "Europe", "NA": "North America", "OC": "Oceania", "SA": "South America", "AN": "Antarctica", } continent_geonameids = { "AF": "6255146", "AS": "6...
apache-2.0