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
shreyas15/Product-Recommender-Engine
metadata_preprocessor.py
1
2879
# metadata_preprocessor.py # # Standalone Python/Spark program to perform data pre-processing.. # Reads Ratings data and meta data to combine where necessary # and encode labels to a form fit for processing. # # # Usage: spark-submit data_preprocessor.py <inputdatafile> # Example usage: spark-submit data_preprocessor.p...
mit
agomariz/scikit-neuralnetwork
sknn/tests/test_sklearn.py
5
2706
import unittest from nose.tools import (assert_equal, assert_raises, assert_in, assert_not_in) import numpy from scipy.stats import randint, uniform from sklearn.grid_search import GridSearchCV, RandomizedSearchCV from sklearn.cross_validation import cross_val_score from sknn.mlp import Regressor as MLPR, Classifier...
bsd-3-clause
zaxliu/deepnap
experiments/kdd-exps/experiment_DynaQNN_130_Feb12_2215.py
1
5180
# System built-in modules import time from datetime import datetime import sys import os from multiprocessing import Pool # Project dependency modules import pandas as pd pd.set_option('mode.chained_assignment', None) # block warnings due to DataFrame value assignment import lasagne # Project modules sys.path.append('...
bsd-3-clause
clairetang6/bokeh
bokeh/charts/builders/line_builder.py
8
9446
"""This is the Bokeh charts interface. It gives you a high level API to build complex plot is a simple way. This is the Line class which lets you build your Line charts just passing the arguments to the Chart class and calling the proper functions. """ # ----------------------------------------------------------------...
bsd-3-clause
matteorr/coco-analyze
analysisAPI/sizeSensitivity.py
1
8981
## imports import os, time import numpy as np import matplotlib.pyplot as plt def sizeSensitivity( coco_analyze, oks, saveDir ): loc_dir = saveDir + '/benchmarks_sensitivity/size' if not os.path.exists(loc_dir): os.makedirs(loc_dir) os.makedirs(loc_dir + '/all_plots') f = open('%s/std_out.t...
mit
ryandougherty/mwa-capstone
MWA_Tools/build/matplotlib/doc/mpl_toolkits/axes_grid/examples/inset_locator_demo2.py
8
1255
import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes from mpl_toolkits.axes_grid1.inset_locator import mark_inset import numpy as np def get_demo_image(): from matplotlib.cbook import get_sample_data import numpy as np f = get_sample_data("axes_grid/bivariat...
gpl-2.0
idaholab/raven
plugins/ExamplePlugin/src/CorrelationPlot.py
1
3426
""" Author: talbpaul Date : 2021-04-02 """ import os import numpy as np import matplotlib.pyplot as plt from PluginBaseClasses.OutStreamPlotPlugin import PlotPlugin, InputTypes, InputData class Correlation(PlotPlugin): # Example Plot plugin class @classmethod def getInputSpecification(cls): """ ...
apache-2.0
RPGOne/Skynet
scikit-learn-0.18.1/examples/semi_supervised/plot_label_propagation_versus_svm_iris.py
50
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
luamct/WebSci14
features/color/stats.py
1
1332
''' Created on 13/08/2013 @author: Felipe Costa ''' from math import sqrt, atan2, pi import matplotlib.pyplot as pp import numpy as np import utils class Statistics : def __init__(self): self.table_name = "stats" def get_table_name(self): return self.table_name def process(self,rgb_img): #...
gpl-3.0
tapomayukh/projects_in_python
classification/Classification_with_kNN/Single_Contact_Classification/Scaled_Features/results/2_categories/test10_cross_validate_categories_mov_fixed_1200ms_scaled_method_v.py
1
4633
# Principal Component Analysis Code : from numpy import mean,cov,double,cumsum,dot,linalg,array,rank,size,flipud from pylab import * import numpy as np import matplotlib.pyplot as pp #from enthought.mayavi import mlab import scipy.ndimage as ni import roslib; roslib.load_manifest('sandbox_tapo_darpa_m3') import ro...
mit
ycaihua/scikit-learn
examples/plot_kernel_ridge_regression.py
230
6222
""" ============================================= Comparison of kernel ridge regression and SVR ============================================= Both kernel ridge regression (KRR) and SVR learn a non-linear function by employing the kernel trick, i.e., they learn a linear function in the space induced by the respective k...
bsd-3-clause
yl565/statsmodels
statsmodels/sandbox/tsa/fftarma.py
30
16438
# -*- coding: utf-8 -*- """ Created on Mon Dec 14 19:53:25 2009 Author: josef-pktd generate arma sample using fft with all the lfilter it looks slow to get the ma representation first apply arma filter (in ar representation) to time series to get white noise but seems slow to be useful for fast estimation for nobs=1...
bsd-3-clause
neurotechuoft/MindType
Code/V1/src/p300_service/tests/plot_data.py
1
1662
import numpy as np import scipy.stats as st import pickle from p300_service import ml import matplotlib.pyplot as plt N = 120 # number of trials M = 4 # number of channels F = 256 # number of features with open('data/train_data.pickle', 'rb') as f: train_data = pickle.load(f) with open('data/test_...
agpl-3.0
rahul-c1/scikit-learn
sklearn/datasets/tests/test_mldata.py
384
5221
"""Test functionality of mldata fetching utilities.""" import os import shutil import tempfile import scipy as sp from sklearn import datasets from sklearn.datasets import mldata_filename, fetch_mldata from sklearn.utils.testing import assert_in from sklearn.utils.testing import assert_not_in from sklearn.utils.test...
bsd-3-clause
jblackburne/scikit-learn
examples/cluster/plot_cluster_iris.py
350
2593
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= K-means Clustering ========================================================= The plots display firstly what a K-means algorithm would yield using three clusters. It is then shown what the effect of a bad initializa...
bsd-3-clause
michrawson/SVM_Implicit_Surface_Reconstruction
KernelRidgeRegression.py
2
1721
from sklearn.datasets import make_regression from sklearn.cross_validation import train_test_split from sklearn.kernel_ridge import KernelRidge import sys import numpy as np def kernel(a,b): return np.dot(a,b) assert kernel([1,1],[1,-1]) == 0 def kernel_ridge_regression(X_train,y_train, Lambda): y_train = np...
mit
ARudiuk/mne-python
tutorials/plot_sensors_time_frequency.py
3
5104
""" .. _tut_sensors_time_frequency: ============================================= Frequency and time-frequency sensors analysis ============================================= The objective is to show you how to explore the spectral content of your data (frequency and time-frequency). Here we'll work on Epochs. We wi...
bsd-3-clause
XueqingLin/tensorflow
tensorflow/contrib/learn/python/learn/estimators/linear_test.py
1
57602
# 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
dimroc/tensorflow-mnist-tutorial
lib/python3.6/site-packages/matplotlib/backends/tkagg.py
10
1250
from __future__ import (absolute_import, division, print_function, unicode_literals) import six from six.moves import tkinter as Tk import numpy as np from matplotlib.backends import _tkagg def blit(photoimage, aggimage, bbox=None, colormode=1): tk = photoimage.tk if bbox is not Non...
apache-2.0
joernhees/scikit-learn
examples/ensemble/plot_forest_iris.py
18
6190
""" ==================================================================== Plot the decision surfaces of ensembles of trees on the iris dataset ==================================================================== Plot the decision surfaces of forests of randomized trees trained on pairs of features of the iris dataset. ...
bsd-3-clause
michaelaye/scikit-image
skimage/viewer/canvastools/base.py
43
3877
import numpy as np from matplotlib import lines __all__ = ['CanvasToolBase', 'ToolHandles'] def _pass(*args): pass class CanvasToolBase(object): """Base canvas tool for matplotlib axes. Parameters ---------- manager : Viewer or PlotPlugin. Skimage viewer or plot plugin object. on_m...
bsd-3-clause
adamtiger/tensorflow
tensorflow/contrib/learn/python/learn/learn_io/pandas_io.py
92
4535
# 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
eickenberg/scikit-learn
sklearn/tests/test_naive_bayes.py
16
12584
import pickle from io import BytesIO import numpy as np import scipy.sparse from sklearn.datasets import load_digits from sklearn.cross_validation import cross_val_score from sklearn.externals.six.moves import zip from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equ...
bsd-3-clause
jjx02230808/project0223
sklearn/utils/tests/test_random.py
230
7344
from __future__ import division import numpy as np import scipy.sparse as sp from scipy.misc import comb as combinations from numpy.testing import assert_array_almost_equal from sklearn.utils.random import sample_without_replacement from sklearn.utils.random import random_choice_csc from sklearn.utils.testing import ...
bsd-3-clause
bjlittle/iris
docs/gallery_code/general/plot_inset.py
1
2280
""" Test Data Showing Inset Plots ============================= This example demonstrates the use of a single 3D data cube with time, latitude and longitude dimensions to plot a temperature series for a single latitude coordinate, with an inset plot of the data region. """ import cartopy.crs as ccrs import matplotli...
lgpl-3.0
zhenv5/scikit-learn
sklearn/utils/fixes.py
39
13318
"""Compatibility fixes for older version of python, numpy and scipy If you add content to this file, please give the version of the package at which the fixe is no longer needed. """ # Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org> # Gael Varoquaux <gael.varoquaux@normalesup.org> # ...
bsd-3-clause
robin-lai/scikit-learn
examples/linear_model/plot_iris_logistic.py
283
1678
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Logistic Regression 3-class Classifier ========================================================= Show below is a logistic-regression classifiers decision boundaries on the `iris <http://en.wikipedia.org/wiki/Iris_f...
bsd-3-clause
craigcitro/pydatalab
datalab/bigquery/_table.py
4
35527
# Copyright 2015 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
yask123/scikit-learn
examples/ensemble/plot_adaboost_regression.py
311
1529
""" ====================================== Decision Tree Regression with AdaBoost ====================================== A decision tree is boosted using the AdaBoost.R2 [1] algorithm on a 1D sinusoidal dataset with a small amount of Gaussian noise. 299 boosts (300 decision trees) is compared with a single decision tr...
bsd-3-clause
hjanime/bcbio-nextgen
bcbio/pipeline/qcsummary.py
1
44083
"""Quality control and summary metrics for next-gen alignments and analysis. """ import collections import contextlib import csv import os import shutil import subprocess import pandas as pd import lxml.html import yaml from datetime import datetime # allow graceful during upgrades try: import matplotlib matpl...
mit
prasadtalasila/MailingListParser
lib/input/mbox/keyword_clustering.py
1
7021
import json import mailbox import numpy as np from nltk.corpus import stopwords from nltk.stem import WordNetLemmatizer from sklearn.cluster import KMeans from sklearn.feature_extraction.text import TfidfVectorizer from lib.analysis.author import ranking from lib.util import custom_stopwords from lib.util....
gpl-3.0
gviejo/ThalamusPhysio
python/main_test_final_classification_XGB_KL.py
1
15477
import ternary import numpy as np import pandas as pd from functions import * import sys from functools import reduce from sklearn.manifold import * from sklearn.cluster import * from sklearn.linear_model import * from sklearn.ensemble import * from pylab import * import _pickle as cPickle from skimage.filters import g...
gpl-3.0
quantumlib/Cirq
cirq-core/cirq/experiments/cross_entropy_benchmarking_test.py
1
5377
# Copyright 2019 The Cirq Developers # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
apache-2.0
shijieice/cuda-convnet2
convdata.py
174
14675
# Copyright 2014 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
poidl/yassy
doc/python/frei_appendix_B1.py
1
1579
#!/bin/python # pylint: disable=C0103 """Python translation of Frei Appendix B1.""" # Frei, B.: Digital sound generation. Institute for Computer Music and # Sound Technology (ICST) Zurich University of the Arts. import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt # parameters ...
gpl-2.0
numenta-archive/htmresearch
projects/vehicle-control/agent/run_sm.py
6
7819
#!/usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2015, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions ...
agpl-3.0
andyraib/data-storage
python_scripts/env/lib/python3.6/site-packages/matplotlib/contour.py
10
68919
""" These are classes to support contour plotting and labelling for the axes class """ from __future__ import (absolute_import, division, print_function, unicode_literals) import six from six.moves import xrange import warnings import matplotlib as mpl import numpy as np from numpy import ma ...
apache-2.0
kiwifb/numpy
numpy/lib/npyio.py
1
73745
from __future__ import division, absolute_import, print_function import sys import os import re import itertools import warnings import weakref from operator import itemgetter, index as opindex import numpy as np from . import format from ._datasource import DataSource from numpy.core.multiarray import packbits, unpa...
bsd-3-clause
NICTA/dora
dora/regressors/gp/demo.py
1
3125
""" simple_regression.py This demo shows how to construct a simple regression by composing a kernel and optimising its hyperparameters. """ import numpy as np import matplotlib.pyplot as pl import dora.regressors.gp as gp def main(): nTrain = 20 nQuery = 100 nDraws = 20 nDims = 1 seed = 100...
apache-2.0
MatthieuBizien/scikit-learn
sklearn/ensemble/gradient_boosting.py
25
71089
"""Gradient Boosted Regression Trees This module contains methods for fitting gradient boosted regression trees for both classification and regression. The module structure is the following: - The ``BaseGradientBoosting`` base class implements a common ``fit`` method for all the estimators in the module. Regressio...
bsd-3-clause
udacity/deep-learning
image-classification/helper.py
155
5631
import pickle import numpy as np import matplotlib.pyplot as plt from sklearn.preprocessing import LabelBinarizer def _load_label_names(): """ Load the label names from file """ return ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck'] def load_cfar10_batch(ci...
mit
changyy/py-MLHelper
org/changyy/ml/feature_engineering.py
1
3172
def fill_value_via_statistics_handler(panda_obj, column_name='age', max_value=120): import pandas import numpy if type(panda_obj) is not pandas.core.frame.DataFrame: return panda_obj panda_obj.loc[ panda_obj[column_name][panda_obj[column_name] > max_value ].index , column_name ] = numpy.nan value_avg = panda_ob...
mit
wdurhamh/statsmodels
statsmodels/sandbox/examples/example_garch.py
31
2294
import numpy as np import matplotlib.pyplot as plt #import scikits.timeseries as ts #import scikits.timeseries.lib.plotlib as tpl import statsmodels.api as sm #from statsmodels.sandbox import tsa from statsmodels.sandbox.tsa.garch import * # local import #dta2 = ts.tsfromtxt(r'gspc_table.csv', # datecols=0, ...
bsd-3-clause
astocko/statsmodels
statsmodels/tools/testing.py
23
1443
"""assert functions from numpy and pandas testing """ import re from distutils.version import StrictVersion import numpy as np import numpy.testing as npt import pandas import pandas.util.testing as pdt # for pandas version check def strip_rc(version): return re.sub(r"rc\d+$", "", version) def is_pandas_min_v...
bsd-3-clause
Neurita/darwin
darwin/gini.py
1
4714
# -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt import scipy.stats as stats from sklearn.ensemble import ExtraTreesClassifier from sklearn.cross_validation import LeaveOneOut from .pipeline import ClassificationPipeline class FeaturesGiniIndex(object): """This class wraps a classificat...
bsd-3-clause
WarrenWeckesser/scipy
scipy/signal/bsplines.py
12
19509
from numpy import (logical_and, asarray, pi, zeros_like, piecewise, array, arctan2, tan, zeros, arange, floor) from numpy.core.umath import (sqrt, exp, greater, less, cos, add, sin, less_equal, greater_equal) # From splinemodule.c from .spline import cspline2d, sepfir2d...
bsd-3-clause
caseyclements/blaze
blaze/compute/pandas.py
2
16522
""" >>> from blaze.expr import symbol >>> from blaze.compute.pandas import compute >>> accounts = symbol('accounts', 'var * {name: string, amount: int}') >>> deadbeats = accounts[accounts['amount'] < 0]['name'] >>> from pandas import DataFrame >>> data = [['Alice', 100], ['Bob', -50], ['Charlie', -20]] >>> df = Data...
bsd-3-clause
johnmgregoire/vanDover_CHESS
xrdUI.py
1
428115
global XRFALLOWED try: from xrf_analysis import * XRFALLOWED=True except: XRFALLOWED=False from PyQt4.QtCore import * from PyQt4.QtGui import * from XRDdefaults import * from xrd_fileIO_fcns import * from xrd_math_fcns import * from xrdPLOT import * from xrd_diffraction_conversion_fcns import * from xrf_de...
bsd-3-clause
gfyoung/pandas
pandas/tests/io/parser/test_c_parser_only.py
1
21552
""" Tests that apply specifically to the CParser. Unless specifically stated as a CParser-specific issue, the goal is to eventually move as many of these tests out of this module as soon as the Python parser can accept further arguments when parsing. """ from io import BytesIO, StringIO, TextIOWrapper import mmap impo...
bsd-3-clause
bloyl/mne-python
mne/datasets/sleep_physionet/tests/test_physionet.py
12
8388
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Joan Massich <mailsik@gmail.com> # # License: BSD Style. import os.path as op import numpy as np import pytest from numpy.testing import assert_array_equal import mne from mne.utils import requires_good_network from mne.utils import requires_pand...
bsd-3-clause
pypot/scikit-learn
examples/datasets/plot_random_dataset.py
348
2254
""" ============================================== Plot randomly generated classification dataset ============================================== Plot several randomly generated 2D classification datasets. This example illustrates the :func:`datasets.make_classification` :func:`datasets.make_blobs` and :func:`datasets....
bsd-3-clause
jjx02230808/project0223
examples/ensemble/plot_voting_decision_regions.py
230
2386
""" ================================================== Plot the decision boundaries of a VotingClassifier ================================================== Plot the decision boundaries of a `VotingClassifier` for two features of the Iris dataset. Plot the class probabilities of the first sample in a toy dataset pred...
bsd-3-clause
lin-credible/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
raincoatrun/basemap
lib/mpl_toolkits/basemap/proj.py
1
17835
import numpy as np from mpl_toolkits.basemap import pyproj import math from matplotlib.cbook import dedent __version__ = '1.2.2' _dg2rad = math.radians(1.) _rad2dg = math.degrees(1.) _cylproj = ['cyl','merc','mill','gall'] _pseudocyl = ['moll','kav7','eck4','robin','sinu','mbtfpq','vandg','hammer'] _upper_right_out_...
gpl-2.0
florian-f/sklearn
sklearn/hmm.py
3
45124
# Hidden Markov Models # # Author: Ron Weiss <ronweiss@gmail.com> # and Shiqiao Du <lucidfrontier.45@gmail.com> # API changes: Jaques Grobler <jaquesgrobler@gmail.com> """ The :mod:`sklearn.hmm` module implements hidden Markov models. **Warning:** :mod:`sklearn.hmm` is orphaned, undocumented and has known numerical s...
bsd-3-clause
ZiqianXY/MLEN
src/p0_titanic_survival_exploration/titanic_visualizations.py
24
5425
import numpy as np import pandas as pd import matplotlib.pyplot as plt def filter_data(data, condition): """ Remove elements that do not match the condition provided. Takes a data list as input and returns a filtered list. Conditions should be a list of strings of the following format: '<field> <...
mit
BubuLK/sfepy
probe.py
5
9831
#!/usr/bin/env python # 12.01.2007, c """ Probe finite element solutions in points defined by various geometrical probes. Generation mode --------------- python probe.py [generation options] <input file> <results file> Probe the data in the results file corresponding to the problem defined in the input file. The inpu...
bsd-3-clause
IQSS/geoconnect
gc_apps/gis_tabular/tab_file_stats.py
1
6000
""" Gather tabular file information: number of rows, column names, etc """ from csv import QUOTE_NONNUMERIC import pandas as pd from django.core.files.base import ContentFile from gc_apps.gis_tabular.models import TabularFileInfo from gc_apps.geo_utils.file_field_helper import get_file_path_or_url from gc_apps.geo_ut...
apache-2.0
cactusbin/nyt
matplotlib/examples/pylab_examples/annotation_demo.py
6
5582
""" Some examples of how to annotate points in figures. You specify an annotation point xy=(x,y) and a text point xytext=(x,y) for the annotated points and text location, respectively. Optionally, you can specify the coordinate system of xy and xytext with one of the following strings for xycoords and textcoords (def...
unlicense
palash1992/GEM
tests/test_karate.py
1
2625
''' Run the graph embedding methods on Karate graph and evaluate them on graph reconstruction and visualization. Please copy the gem/data/karate.edgelist to the working directory ''' import matplotlib.pyplot as plt from time import time from gem.utils import graph_util, plot_util from gem.evaluation import visu...
bsd-3-clause
Unidata/MetPy
v0.6/_downloads/NEXRAD_Level_3_File.py
2
1569
# Copyright (c) 2015 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """ NEXRAD Level 3 File =================== Use MetPy to read information from a NEXRAD Level 3 (NIDS product) file and plot """ import matplotlib.pyplot as plt import numpy as np ...
bsd-3-clause
RPGOne/Skynet
scikit-learn-0.18.1/examples/plot_johnson_lindenstrauss_bound.py
67
7474
r""" ===================================================================== The Johnson-Lindenstrauss bound for embedding with random projections ===================================================================== The `Johnson-Lindenstrauss lemma`_ states that any high dimensional dataset can be randomly projected i...
bsd-3-clause
adamgreenhall/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
sonnyhu/scikit-learn
examples/covariance/plot_robust_vs_empirical_covariance.py
73
6451
r""" ======================================= Robust vs Empirical covariance estimate ======================================= The usual covariance maximum likelihood estimate is very sensitive to the presence of outliers in the data set. In such a case, it would be better to use a robust estimator of covariance to guar...
bsd-3-clause
wiki2014/Learning-Summary
alps/cts/apps/CameraITS/tests/scene1/test_param_sensitivity.py
3
2539
# Copyright 2013 The Android Open Source Project # # 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 a...
gpl-3.0
petosegan/scikit-learn
sklearn/ensemble/voting_classifier.py
178
8006
""" Soft Voting/Majority Rule classifier. This module contains a Soft Voting/Majority Rule classifier for classification estimators. """ # Authors: Sebastian Raschka <se.raschka@gmail.com>, # Gilles Louppe <g.louppe@gmail.com> # # Licence: BSD 3 clause import numpy as np from ..base import BaseEstimator f...
bsd-3-clause
gaborfodor/TNP
extract_features.py
1
17673
import pandas as pd import numpy as np from os import listdir, makedirs, getcwd, remove from os.path import isfile, join, abspath, exists, isdir import datetime as dt MIN_FREQ, LOCATION_CAT, FEATURE_CAT, FAULT_LOOKBACK, SHIFT = 20, 4, 5, 10, 1 print MIN_FREQ, LOCATION_CAT, FEATURE_CAT, FAULT_LOOKBACK, SHIFT ...
mit
ntucllab/striatum
setup.py
1
1415
#!/usr/bin/env python import os from setuptools import setup on_rtd = os.environ.get('READTHEDOCS', None) == 'True' # read the docs could not compile numpy and c extensions if on_rtd: setup_requires = [] install_requires = [] else: setup_requires = [ 'nose', 'coverage', ] install_r...
bsd-2-clause
asljivo1/802.11ah-ns3
ns-3/src/core/examples/sample-rng-plot.py
188
1246
# -*- Mode:Python; -*- # /* # * This program is free software; you can redistribute it and/or modify # * it under the terms of the GNU General Public License version 2 as # * published by the Free Software Foundation # * # * This program is distributed in the hope that it will be useful, # * but WITHOUT ANY WARRA...
gpl-2.0
1a1a11a/mimircache
PyMimircache/profiler/profilerUtils.py
1
8030
# coding=utf-8 """ This module provides some common utils shared by profilers Author: Jason Yang <peter.waynechina@gmail.com> 2017/10 """ import os import math import time import pickle import numpy as np import matplotlib # matplotlib.use("Agg") # pypy3 fails on this import matplotlib.pyplot as plt impo...
gpl-3.0
bccp/bananaplots
bananas/bananas.py
1
12737
import numpy __version__ = "0.0.3" from .model import GMM, Confidence, CombinedModel from functools import reduce def _sorteditems(d, orderby): """ return items from a dict of dict, sorted by the orderby item of the dict """ s = sorted([(i[orderby], k) for k, i in d.items()]) return [(k, d[k]) for i, k in...
apache-2.0
gregsharp/vowpal_wabbit
python/tests/test_sklearn_vw.py
6
5431
from collections import namedtuple import numpy as np import pytest from vowpalwabbit.sklearn_vw import VW, VWClassifier, VWRegressor, tovw from sklearn import datasets from sklearn.utils.validation import NotFittedError from scipy.sparse import csr_matrix """ Test utilities to support integration of Vowpal Wabbit a...
bsd-3-clause
henrytao-me/openerp.positionq
openerp/addons/resource/faces/timescale.py
170
3902
############################################################################ # Copyright (C) 2005 by Reithinger GmbH # mreithinger@web.de # # This file is part of faces. # # faces is free software; you can redistribute it and/or modify # ...
agpl-3.0
baudren/montepython_public
montepython/likelihoods/BK14/__init__.py
2
17975
""" .. module:: BK14 :synopsis: BK14 likelihood from http://arxiv.org/pdf/1510.09217.pdf, http://bicepkeck.org/bk14_2015_release.html .. moduleauthor:: Thomas Tram <thomas.tram@port.ac.uk> Last updated July 20, 2016. Based on the CosmoMC module. """ import numpy as np import pandas as pd import scipy.linalg as la ...
mit
pramodh-bn/learn-data-edx
Week 7/qp100.py
1
5618
import numpy as np from sklearn.svm import SVC def getSample(pointA, pointB, numberOfPoints): pointList = list(zip(np.random.uniform(-1,1.00,numberOfPoints),np.random.uniform(-1,1.00,numberOfPoints))) sample = np.array([(i[0], i[1], isLeft(pointA, pointB, i)) for i in pointList]) y = sample[:,2] breakp...
unlicense
arjoly/scikit-learn
sklearn/tests/test_dummy.py
186
17778
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
sonnyhu/scikit-learn
examples/linear_model/plot_ridge_path.py
55
2138
""" =========================================================== Plot Ridge coefficients as a function of the regularization =========================================================== Shows the effect of collinearity in the coefficients of an estimator. .. currentmodule:: sklearn.linear_model :class:`Ridge` Regressi...
bsd-3-clause
ChristianSch/skml
test/test_dataset.py
1
1443
from chai import Chai from scipy import sparse from sklearn.linear_model import LogisticRegression from skml.problem_transformation.probabilistic_classifier_chain \ import ProbabilisticClassifierChain from skml.datasets import load_dataset, sample_down_label_space class TestDataset(Chai): def test_load_yeast(...
mit
larsoner/mne-python
examples/simulation/plot_simulate_raw_data.py
19
2830
""" =========================== Generate simulated raw data =========================== This example generates raw data by repeating a desired source activation multiple times. """ # Authors: Yousra Bekhti <yousra.bekhti@gmail.com> # Mark Wronkiewicz <wronk.mark@gmail.com> # Eric Larson <larson.eric....
bsd-3-clause
jjx02230808/project0223
sklearn/decomposition/tests/test_kernel_pca.py
32
8066
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import (assert_array_almost_equal, assert_less, assert_equal, assert_not_equal, assert_raises) from sklearn.decomposition import PCA, KernelPCA from sklearn.datasets import mak...
bsd-3-clause
daureg/illalla
utils.py
1
6495
#! /usr/bin/python2 # vim: set fileencoding=utf-8 from collections import Counter from persistent import load_var import json import arguments from random import uniform import CommonMongo as cm from geographiclib.geodesic import Geodesic EARTH = Geodesic.WGS84 from datetime import datetime as dt import numpy as np d...
mit
ddervs/GreenGraph
greengraph/classes/Map.py
1
1580
import numpy as np import requests from StringIO import StringIO from matplotlib import image as img class Map(object): def __init__(self, latitude, longitude, satellite=True, zoom=10, size=(400, 400), sensor=False): base = "http://maps.googleapis.com/maps/api/staticmap?" params...
mit
cython-testbed/pandas
pandas/tests/io/parser/compression.py
2
4740
# -*- coding: utf-8 -*- """ Tests compressed data parsing functionality for all of the parsers defined in parsers.py """ import pytest import pandas as pd import pandas.compat as compat import pandas.util.testing as tm import pandas.util._test_decorators as td import gzip import bz2 try: lzma = compat.import_lz...
bsd-3-clause
biln/airflow
airflow/hooks/base_hook.py
18
2571
# -*- 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
landmanbester/Copernicus
Plotter.py
1
19513
#!/usr/bin/env python import numpy as np from scipy.interpolate import UnivariateSpline as uvs import matplotlib as mpl mpl.use('Agg') mpl.rcParams.update({'font.size': 14, 'font.family': 'serif'}) import matplotlib.pyplot as plt from statsmodels.distributions.empirical_distribution import ECDF from genFLRW import FLRW...
gpl-3.0
anirudhjayaraman/scikit-learn
examples/applications/svm_gui.py
287
11161
""" ========== Libsvm GUI ========== A simple graphical frontend for Libsvm mainly intended for didactic purposes. You can create data points by point and click and visualize the decision region induced by different kernels and parameter settings. To create positive examples click the left mouse button; to create neg...
bsd-3-clause
mantidproject/mantid
qt/python/mantidqt/widgets/test/test_fitpropertybrowserplotinteraction.py
3
10600
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2020 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + impo...
gpl-3.0
tata-antares/jet_tagging_LHCb
utils/utils.py
1
10379
from __future__ import print_function, division import numpy import pandas from matplotlib import pyplot as plt import matplotlib from matplotlib import cm from sklearn.metrics import roc_auc_score from collections import OrderedDict from rep.utils import get_efficiencies from rep.plotting import ErrorPlot from rep.uti...
apache-2.0
popgengui/negui
setup.py
1
1916
''' Description ''' __filename__ = "setup.py" __date__ = "20171105" __author__ = "Ted Cosart<ted.cosart@umontana.edu>" import os from setuptools import setup, find_packages def get_version(): PARAMNAME="progversion" PARAM_VAL_DELIMIT="=" IDX_VAL=1 STARTUP_INFO_LOC="/agestrucne/resources/startup.info" s_versio...
agpl-3.0
jniediek/combinato
combinato/plot/plot_sorted.py
1
4903
#!/usr/bin/env python3 # JN 2015-02-18 # pylint: disable=E1101,star-args """ plot all clusters from a channel in one overview figure """ from __future__ import print_function, division, absolute_import import os import numpy as np import matplotlib.pyplot as mpl from matplotlib.gridspec import GridSpec from .. i...
mit
lbdreyer/cartopy
lib/cartopy/examples/effects_of_the_ellipse.py
5
4876
""" The effect of badly referencing an ellipse ------------------------------------------ This example demonstrates the effect of referencing your data to an incorrect ellipse. First we define two coordinate systems - one using the World Geodetic System established in 1984 and the other using a spherical globe. Next ...
lgpl-3.0
Chuban/moose
modules/porous_flow/doc/tests/dirackernels.py
10
7355
#!/usr/bin/env python import os import sys import numpy as np from scipy.special import erf import matplotlib.pyplot as plt def bh02_expected(pressure): perm = 1.0E-12 ele_length = 2 radius = 0.1 bh_length = 1 re = 0.28 r0 = re * np.sqrt(ele_length**2 + ele_length**2) / 2.0 wc = 2 * np.pi ...
lgpl-2.1
sriharshams/mlnd
customer_segments/visuals.py
21
6047
########################################### # Suppress matplotlib user warnings # Necessary for newer version of matplotlib import warnings warnings.filterwarnings("ignore", category = UserWarning, module = "matplotlib") # # Display inline matplotlib plots with IPython from IPython import get_ipython get_ipython().run_...
apache-2.0
rameez3333/skylab
doc/examples/weighted_sensitivity.py
2
1818
# -*-coding:utf8-*- import data import numpy as np from skylab.ps_injector import PointSourceInjector from skylab.utils import poisson_weight import matplotlib matplotlib.use("QT4Agg") import matplotlib.pyplot as plt if __name__=="__main__": # init likelihood class llh = data.init(1000, 1000, ncpu=4) ...
gpl-3.0
baojianzhou/DLReadingGroup
keras/keras/callbacks.py
1
39787
from __future__ import absolute_import from __future__ import print_function import os import csv import six import numpy as np import time import json import warnings from collections import deque from collections import OrderedDict from collections import Iterable from .utils.generic_utils import Progbar from . im...
apache-2.0
jblackburne/scikit-learn
sklearn/tests/test_base.py
2
11255
# Author: Gael Varoquaux # License: BSD 3 clause import sys import numpy as np import scipy.sparse as sp import sklearn from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_false from sklearn.utils.testing import assert_equal from...
bsd-3-clause
ehogan/iris
docs/iris/example_code/Meteorology/wind_speed.py
11
2361
""" Plotting wind direction using quiver =========================================================== This example demonstrates using quiver to plot wind speed contours and wind direction arrows from wind vector component input data. The vector components are co-located in space in this case. For the second plot, the ...
lgpl-3.0
WalkingMachine/sara_commun
wm_ork/capture/sandbox/orb_template_gen.py
1
2597
#!/usr/bin/env python import ecto from ecto_opencv import cv_bp from ecto_opencv.highgui import imread, MatWriter from ecto_opencv.features2d import ORB, ORBstats, DescriptorAccumulator, KeypointsToMat from ecto_opencv.imgproc import cvtColor, Conversion from ecto_opencv.calib import PointsTo3d from ecto.opts import sc...
apache-2.0
ZENGXH/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
lifei96/Medium-crawler-with-data-analyzer
User_Crawler/xgb_pr.py
2
1512
# -*- coding: utf-8 -*- import pandas as pd import xgboost as xgb from sklearn.metrics import classification_report from sklearn.metrics import f1_score import numpy as np def f1(preds, dtrain): return 'f1-score', -f1_score(dtrain.get_label(), preds, average='weighted') def xgb_pr(): train_set = pd.read_cs...
mit