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
pong3489/TEST_Mission
Lib/site-packages/scipy/misc/common.py
53
10116
""" Functions which are common and require SciPy Base and Level 1 SciPy (special, linalg) """ from numpy import exp, asarray, arange, newaxis, hstack, product, array, \ where, zeros, extract, place, pi, sqrt, eye, poly1d, dot, r_ __all__ = ['factorial','factorial2','factorialk','comb', 'c...
gpl-3.0
bigdataelephants/scikit-learn
examples/neighbors/plot_regression.py
349
1402
""" ============================ Nearest Neighbors regression ============================ Demonstrate the resolution of a regression problem using a k-Nearest Neighbor and the interpolation of the target using both barycenter and constant weights. """ print(__doc__) # Author: Alexandre Gramfort <alexandre.gramfort@...
bsd-3-clause
StanczakDominik/PythonBiotSavart
biot.py
1
30332
from __future__ import division, print_function import numpy as np import matplotlib.pyplot as plt from numpy import pi, sin, cos, mgrid from mayavi import mlab import os.path import scipy.spatial import sys import shutil import h5py import pdb import sys #Grid parameters NGRID=50 NZGRID=NGRID #Region parameters xmax...
gpl-3.0
olologin/scikit-learn
sklearn/ensemble/tests/test_forest.py
21
41768
""" Testing for the forest module (sklearn.ensemble.forest). """ # Authors: Gilles Louppe, # Brian Holt, # Andreas Mueller, # Arnaud Joly # License: BSD 3 clause import pickle from collections import defaultdict from itertools import combinations from itertools import product import numpy ...
bsd-3-clause
cavestruz/MLPipeline
PCAManifold.py
1
2769
# coding: utf-8 # In[ ]: import numpy as np from matplotlib import pyplot as plt from matplotlib import ticker from sklearn import manifold, datasets, decomposition # In[ ]: from astroML.plotting import setup_text_plots setup_text_plots(fontsize=8, usetex=True) # In[ ]: np.random.seed(0) n_points = 4000 #110...
mit
dhenrygithub/QGIS
python/plugins/processing/algs/qgis/VectorLayerHistogram.py
15
3006
# -*- coding: utf-8 -*- """ *************************************************************************** EquivalentNumField.py --------------------- Date : January 2013 Copyright : (C) 2013 by Victor Olaya Email : volayaf at gmail dot com *******************...
gpl-2.0
probml/pyprobml
scripts/lms_demo.py
1
6196
# SGD on linear regression aka least mean squares # Written by Duane Rich # Based on https://github.com/probml/pmtk3/blob/master/demos/LMSdemoSimple.m import numpy as np import matplotlib.pyplot as plt from pyprobml_utils import save_fig #from mpl_toolkits.mplot3d import Axes3D from scipy.optimize import minimize ...
mit
mufid/berkilau
ws/CSUIBotClass2014/test/test_plot_particles.py
1
1997
#!/usr/bin/python # @author: vektor dewanto # @obj: demonstrate how to plot particles in an occupancy grid map, _although_, for now, all positions are valid import matplotlib.pyplot as plt import numpy as np import math import matplotlib.cm as cmx from matplotlib import colors # Construct the occupancy grid map grid...
mit
devincornell/semanticanlysis
dictionary.py
1
5447
import spacy from .parallel import * import re import functools #from .topicmodel import TopicModel ''' This class parses data according to the MFD format. Available are the empath, mft and mft2.0 dictionaries. For further information about the format of the dictionary files, see Haidt et al.'s example: http://www.m...
mit
DarkEnergyScienceCollaboration/Twinkles
python/desc/twinkles/obsHistIDOrdering.py
2
10882
from __future__ import absolute_import, division, print_function import os import numpy as np import pandas as pd from sqlalchemy import create_engine from lsst.utils import getPackageDir from .phosim_cpu_pred import CpuPred __all__ = ['OpSimOrdering'] class OpSimOrdering(object): """ Code to split the Twink...
mit
phoebe-project/phoebe2
tests/nosetests/test_mesh/test_marching_meshing.py
1
4816
""" Testing marching triangulation algorithm directly from libphoebe """ import numpy as np from numpy import linalg as la import libphoebe import matplotlib.pyplot as plt def potential_roche(r, q, F, d): r1 = np.array([r[0]- d, r[1], r[2]]); return 1/la.norm(r) + q*(1/la.norm(r1) - r[0]/d**2) + F**2*(1+q)*(r[...
gpl-3.0
deepesch/Data-Science-45min-Intros
support-vector-machines-101/rbf-circles.py
26
1504
#!/usr/bin/env python # -*- coding: UTF-8 -*- __author__="Josh Montague" __license__="MIT License" import sys import json import numpy as np import matplotlib.pyplot as plt try: import seaborn as sns except ImportError as e: sys.stderr.write("seaborn not installed. Using default matplotlib templates.") from sk...
unlicense
mlperf/training_results_v0.6
Intel/benchmarks/minigo/implementations/tensorflow/oneoffs/embeddings_graphs.py
8
3394
#!/usr/bin/env python3 # Copyright 2018 Google LLC # # 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 o...
apache-2.0
sam81/pychoacoustics
tests/test_weighted_up_down.py
1
2655
#! /usr/bin/env python # -*- coding: utf-8 -*- import numpy, os, sys, unittest import pandas as pd from test_utility_functions import* rootPath = "../../pychoacoustics_data/test_data/" class TestWeightedUpDown(unittest.TestCase): def testGeometric(self): resFileRoot = "res_geometric" removePrevio...
gpl-3.0
biosustain/marsi
marsi/cli/controllers/modeling.py
1
11810
# Copyright 2017 Chr. Hansen A/S and The Novo Nordisk Foundation Center for Biosustainability, DTU. # 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....
apache-2.0
zaxtax/scikit-learn
examples/cluster/plot_cluster_comparison.py
246
4684
""" ========================================================= Comparing different clustering algorithms on toy datasets ========================================================= This example aims at showing characteristics of different clustering algorithms on datasets that are "interesting" but still in 2D. The last ...
bsd-3-clause
intelligent-agent/redeem
tools/bed_compensation.py
1
6746
""" This script allows plotting the surface of the bed. """ import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import random single = True # With reset of probe before = [{ "Y": 0.0, "X": 0.065, "Z": -0.0020124999999999991 }, { "Y": 0.0325, "X": 0.05629, ...
gpl-3.0
steverobbins/mycli
mycli/packages/tabulate.py
28
38075
# -*- coding: utf-8 -*- """Pretty-print tabular data.""" from __future__ import print_function from __future__ import unicode_literals from collections import namedtuple from decimal import Decimal from platform import python_version_tuple from wcwidth import wcswidth import re if python_version_tuple()[0] < "3": ...
bsd-3-clause
andyraib/data-storage
python_scripts/env/lib/python3.6/site-packages/pandas/tests/series/test_constructors.py
7
28387
# coding=utf-8 # pylint: disable-msg=E1101,W0612 from datetime import datetime, timedelta from numpy import nan import numpy as np import numpy.ma as ma import pandas as pd from pandas.types.common import is_categorical_dtype, is_datetime64tz_dtype from pandas import Index, Series, isnull, date_range, period_range f...
apache-2.0
caseyclements/blaze
blaze/tests/test_interactive.py
2
10339
from blaze.interactive import Data, compute, concrete_head, expr_repr, to_html import datetime from odo import into, append from odo.backends.csv import CSV from blaze import discover, transform from blaze.compute.core import compute from blaze.compute.python import compute from blaze.expr import symbol from datashape...
bsd-3-clause
zorojean/scikit-learn
sklearn/datasets/base.py
196
18554
""" 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 shutil from os import environ from os.pa...
bsd-3-clause
winklerand/pandas
pandas/tests/plotting/common.py
2
19541
#!/usr/bin/env python # coding: utf-8 import pytest import os import warnings from pandas import DataFrame, Series from pandas.compat import zip, iteritems from pandas.util._decorators import cache_readonly from pandas.core.dtypes.api import is_list_like import pandas.util.testing as tm from pandas.util.testing impor...
bsd-3-clause
plotly/python-api
packages/python/plotly/plotly/figure_factory/_ohlc.py
2
10741
from __future__ import absolute_import from plotly import exceptions from plotly.graph_objs import graph_objs from plotly.figure_factory import utils # Default colours for finance charts _DEFAULT_INCREASING_COLOR = "#3D9970" # http://clrs.cc _DEFAULT_DECREASING_COLOR = "#FF4136" def validate_ohlc(open, high, low,...
mit
qiime2/qiime2
qiime2/metadata/base.py
2
2057
# ---------------------------------------------------------------------------- # Copyright (c) 2016-2021, 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
mbayon/TFG-MachineLearning
venv/lib/python3.6/site-packages/sklearn/utils/tests/test_extmath.py
6
24129
# Authors: Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Denis Engemann <denis-alexander.engemann@inria.fr> # # License: BSD 3 clause import numpy as np from scipy import sparse from scipy import linalg from scipy import stats from sklearn.utils.testing import ...
mit
lthurlow/Network-Grapher
proj/external/matplotlib-1.2.1/lib/matplotlib/table.py
2
17111
""" Place a table below the x-axis at location loc. The table consists of a grid of cells. The grid need not be rectangular and can have holes. Cells are added by specifying their row and column. For the purposes of positioning the cell at (0, 0) is assumed to be at the top left and the cell at (max_row, max_col) i...
mit
IngoKl/TweetPinna
TweetPinnaGraphs.py
1
7816
#!/usr/bin/env python # -*- coding: utf-8 -*- """TweetPinna - Twitter Status Archiver - Dashboard. TweetPinna streams Twitter statuses into a MongoDB database based on given search terms. It is also capable of retrieving a user's timeline. This script generates graphs for the dashboard. It is supposed to run...
mit
nathawkins/PHY451_FS_2017
Cavendish_Experiment/Scripts/reduce-2.py
2
34081
# -*- coding: utf-8 -*- """ Spinlab Curve Fitting Library File: SpinlabCF.py Author: Steve Fromm Last Modified: 2017-09-05 This library provides an easy to use interface to perform non-linear function fitting to a provided data set. The underlying curve-fitting algorithm is from the scipy.optimize package....
gpl-3.0
appapantula/scikit-learn
sklearn/datasets/tests/test_samples_generator.py
35
15016
from __future__ import division from collections import defaultdict from functools import partial import numpy as np from sklearn.externals.six.moves import zip from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_almost_equal fr...
bsd-3-clause
dilawar/moose-full
moose-examples/snippets/gssaCylinderDiffusion.py
2
6418
######################################################################### ## This program is part of 'MOOSE', the ## Messaging Object Oriented Simulation Environment. ## Copyright (C) 2014 Upinder S. Bhalla. and NCBS ## It is made available under the terms of the ## GNU Lesser General Public License version 2...
gpl-2.0
modelblocks/modelblocks-release
resource-naturalstoriesfmri/scripts/get_sound_power.py
1
4677
import sys import re import numpy as np import pandas as pd import librosa import argparse argparser = argparse.ArgumentParser(''' Utility for computing sound power metrics from the Natural Stories audio stimuli ''') argparser.add_argument('files', nargs='+', help='Paths to audio files for processing') argpars...
gpl-3.0
bearishtrader/trading-with-python
lib/classes.py
76
7847
""" worker classes @author: Jev Kuznetsov Licence: GPL v2 """ __docformat__ = 'restructuredtext' import os import logger as logger import yahooFinance as yahoo from functions import returns, rank from datetime import date from pandas import DataFrame, Series import numpy as np import pandas as pd im...
bsd-3-clause
timnon/pyschedule
examples/switch-types.py
1
1505
import sys sys.path += ['../src','src'] import getopt opts, _ = getopt.getopt(sys.argv[1:], 't:', ['test']) from pyschedule import Scenario, solvers, plotters horizon = 20 S = Scenario('switch',horizon=horizon) # Set some colors for the tasks task_colors = dict() task_group_colors = { 'A': 'green', 'B': 'red', 'C':'b...
apache-2.0
eblossom/gnuradio
gr-analog/examples/fmtest.py
40
7941
#!/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-3.0
googledatalab/pydatalab
google/datalab/ml/_dataset.py
2
8647
# Copyright 2017 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
dsquareindia/scikit-learn
sklearn/metrics/cluster/supervised.py
25
31477
"""Utilities to evaluate the clustering performance of models. Functions named as *_score return a scalar value to maximize: the higher the better. """ # Authors: Olivier Grisel <olivier.grisel@ensta.org> # Wei LI <kuantkid@gmail.com> # Diego Molla <dmolla-aliod@gmail.com> # Arnaud Fouchet ...
bsd-3-clause
markomanninen/strongs
isopsephy/search.py
5
1537
#!/usr/local/bin/python # -*- coding: utf-8 -*- # file: search.py def find_cumulative_indices(list_of_numbers, search_sum): """ find_cumulative_indices([70, 58, 81, 909, 70, 215, 70, 1022, 580, 930, 898], 285) -> [[4, 5],[5, 6]] """ u = 0 y = 0 result = [] for idx, val in enumerate(lis...
mit
pprett/scikit-learn
sklearn/preprocessing/data.py
8
68191
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Mathieu Blondel <mathieu@mblondel.org> # Olivier Grisel <olivier.grisel@ensta.org> # Andreas Mueller <amueller@ais.uni-bonn.de> # Eric Martin <eric@ericmart.in> # Giorgio Patrini <giorgio.patrini@anu.edu.au> # Lic...
bsd-3-clause
OshynSong/scikit-learn
sklearn/tests/test_cross_validation.py
31
46699
"""Test the cross_validation module""" from __future__ import division import warnings import numpy as np from scipy.sparse import coo_matrix from scipy.sparse import csr_matrix from scipy import stats from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_false from sklearn.utils.test...
bsd-3-clause
MVilstrup/visualize
learning_curves.py
1
3902
# I have not had the time to test this method yet # so do not use it in its current state import numpy as np import matplotlib.pyplot as plt def plot_learning_curves(training_data, training_targets, test_data, test_targets, ...
mit
ClimbsRocks/scikit-learn
sklearn/neighbors/tests/test_nearest_centroid.py
305
4121
""" Testing for the nearest centroid module. """ import numpy as np from scipy import sparse as sp from numpy.testing import assert_array_equal from numpy.testing import assert_equal from sklearn.neighbors import NearestCentroid from sklearn import datasets from sklearn.metrics.pairwise import pairwise_distances # t...
bsd-3-clause
subutai/htmresearch
htmresearch/frameworks/union_temporal_pooling/activation/excite_functions/excite_functions_all.py
9
3762
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2016, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This progra...
agpl-3.0
qwertzuhr/2015_Data_Analyst_Project_3
Project/audit_quality_map.py
3
3625
## Note: you must install Levenshtein module # pip install python-Levenshtein # for this Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27 # more info - see: http://stackoverflow.com/questions/18134437/where-can-the-documentation-for-python-levenshtein-be-found-online from pymongo import Mongo...
agpl-3.0
suku248/nest-simulator
pynest/examples/spatial/connex_ew.py
14
2269
# -*- coding: utf-8 -*- # # connex_ew.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or #...
gpl-2.0
capaulson/pyKriging
pyKriging/GlobalSensitivity.py
1
3359
""" Created on Tue Dec 23 09:18:20 2014 @author: Giorgos """ import numpy as np from matplotlib import pyplot as plt # at the moment this class is working only for a two dimensional proplem. I will # improve it very soon to work for more variables. class SobolSensitivity(): """ class which calculates the Glo...
mit
stonebig/bokeh
examples/plotting/file/custom_tooltip.py
2
1888
import pandas as pd from bokeh.plotting import figure, show from bokeh.sampledata.periodic_table import elements elements = elements.copy() elements = elements[elements.group != "-"] elements.sort_values('metal', inplace=True) colormap = { "alkali metal" : "#a6cee3", "alkaline earth metal" : "#1f78b4...
bsd-3-clause
jjx02230808/project0223
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
xavierwu/scikit-learn
sklearn/metrics/__init__.py
214
3440
""" The :mod:`sklearn.metrics` module includes score functions, performance metrics and pairwise metrics and distance computations. """ from .ranking import auc from .ranking import average_precision_score from .ranking import coverage_error from .ranking import label_ranking_average_precision_score from .ranking imp...
bsd-3-clause
gomesfelipe/BDA_py_demos
demos_ch5/demo5_2.py
19
3326
"""Bayesian Data Analysis, 3rd ed Chapter 5, demo 2 Hierarchical model for SAT-example data (BDA3, p. 102) """ from __future__ import division import numpy as np from scipy.stats import norm import scipy.io # For importing a matlab file import matplotlib.pyplot as plt # Edit default plot settings (colours from colo...
gpl-3.0
phobson/mpl-probscale
probscale/transforms.py
1
3801
import numpy from matplotlib.transforms import Transform def _mask_out_of_bounds(a): """ Return a Numpy array where all values outside ]0, 1[ are replaced with NaNs. If all values are inside ]0, 1[, the original array is returned. """ a = numpy.array(a, float) mask = (a <= 0.0) | (a >= 1.0...
bsd-3-clause
Monika319/EWEF-1
Cw2Rezonans/Karolina/Oscyloskop/Fourier moduł i faza/OscyloskopZ5W2Fourier.py
1
1961
# -*- coding: utf-8 -*- """ Plot oscilloscope files from MultiSim """ import numpy as np import matplotlib.pyplot as plt import sys import os from matplotlib import rc rc('font',family="Consolas") files=["real_zad5_05f_p2.txt"] for NazwaPliku in files: print NazwaPliku Plik=open(NazwaPliku) #print DeltaT ...
gpl-2.0
loli/semisupervisedforests
benchmarks/bench_sample_without_replacement.py
397
8008
""" Benchmarks for sampling without replacement of integer. """ from __future__ import division from __future__ import print_function import gc import sys import optparse from datetime import datetime import operator import matplotlib.pyplot as plt import numpy as np import random from sklearn.externals.six.moves i...
bsd-3-clause
zhenv5/scikit-learn
doc/datasets/mldata_fixture.py
367
1183
"""Fixture module to skip the datasets loading when offline Mock urllib2 access to mldata.org and create a temporary data folder. """ from os import makedirs from os.path import join import numpy as np import tempfile import shutil from sklearn import datasets from sklearn.utils.testing import install_mldata_mock fr...
bsd-3-clause
olafhauk/mne-python
mne/viz/misc.py
3
48874
# -*- coding: utf-8 -*- """Functions to make simple plots with M/EEG data.""" # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Denis Engemann <denis.engemann@gmail.com> # Martin Luessi <mluessi@nmr.mgh.harvard.edu> # Eric Larson <larson.eric.d@gmail.com> # Cathy Nangini...
bsd-3-clause
jereze/scikit-learn
sklearn/datasets/tests/test_lfw.py
230
7880
"""This test for the LFW require medium-size data dowloading and processing If the data has not been already downloaded by running the examples, the tests won't run (skipped). If the test are run, the first execution will be long (typically a bit more than a couple of minutes) but as the dataset loader is leveraging ...
bsd-3-clause
abimannans/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
khadka0/Spotify-Track-Generator
SpotifyPlaylistGenerator.py
1
1203
# Program to create a playlist out of the words of a message from nltk import trigrams from pandas import Series import spotipy # Fetch the message and split it into most popular phrases message = raw_input("Enter text : ") grams = Series(trigrams(message.split())) list_of_phrases = [] for phrase in grams: l...
mit
rmcgibbo/osprey
osprey/config.py
1
13890
from __future__ import print_function, absolute_import, division """config.py This module contains the parser and in-memory representation of the config osprey job file file. The config file has four major sections: - estimator: the specification for the estimator/model to be fit, an instance...
apache-2.0
thunderhoser/GewitterGefahr
gewittergefahr/dissertation/plot_data_augmentation.py
1
9894
"""Plots data augmentation.""" import argparse import numpy import matplotlib matplotlib.use('agg') from matplotlib import pyplot from gewittergefahr.gg_utils import radar_utils from gewittergefahr.gg_utils import time_conversion from gewittergefahr.gg_utils import file_system_utils from gewittergefahr.gg_utils import...
mit
borismarin/genesis2.4gamma
Scripts/gpython-tools/G3Plot.py
1
21705
#!/usr/bin/env python # A prototype of a stand-alone application for plotting the output of # GENESIS 3 models. This uses a basic wxPython frame to hold a matplotlib # figure for plotting. It defines some basic menu items, and a control # panel of buttons and toggles, each with bindings to a function to execute # on...
gpl-2.0
bokeh/bokeh
sphinx/source/docs/user_guide/examples/plotting_band.py
2
1155
import numpy as np import pandas as pd from bokeh.models import Band, ColumnDataSource from bokeh.plotting import figure, output_file, show output_file("band.html", title="band.py example") # Create some random data x = np.random.random(2500) * 140 - 20 y = np.random.normal(size=2500) * 2 + 5 df = pd.DataFrame(data...
bsd-3-clause
timzhangau/ml_nano
finding_donors/visuals.py
11
5391
########################################### # 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_...
mit
mit0110/activepipe
test_activepipe.py
1
11860
import unittest import numpy as np import mock from activepipe import ActivePipeline from corpus import Corpus from featureforge.vectorizer import Vectorizer from scipy.sparse import csr_matrix from sklearn.preprocessing import normalize testing_config = { 'features': Vectorizer([lambda x : x]), 'em_adding_i...
mit
jmargeta/scikit-learn
examples/cluster/plot_cluster_iris.py
4
2573
#!/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
simon-pepin/scikit-learn
sklearn/decomposition/tests/test_truncated_svd.py
240
6055
"""Test truncated SVD transformer.""" import numpy as np import scipy.sparse as sp from sklearn.decomposition import TruncatedSVD from sklearn.utils import check_random_state from sklearn.utils.testing import (assert_array_almost_equal, assert_equal, assert_raises, assert_greater, ...
bsd-3-clause
heli522/scikit-learn
examples/applications/plot_out_of_core_classification.py
255
13919
""" ====================================================== Out-of-core classification of text documents ====================================================== This is an example showing how scikit-learn can be used for classification using an out-of-core approach: learning from data that doesn't fit into main memory. ...
bsd-3-clause
plissonf/scikit-learn
examples/model_selection/randomized_search.py
201
3214
""" ========================================================================= Comparing randomized search and grid search for hyperparameter estimation ========================================================================= Compare randomized search and grid search for optimizing hyperparameters of a random forest. ...
bsd-3-clause
fabianp/scikit-learn
benchmarks/bench_plot_incremental_pca.py
374
6430
""" ======================== IncrementalPCA benchmark ======================== Benchmarks for IncrementalPCA """ import numpy as np import gc from time import time from collections import defaultdict import matplotlib.pyplot as plt from sklearn.datasets import fetch_lfw_people from sklearn.decomposition import Incre...
bsd-3-clause
fixbugs/py-fixbugs-tools
test/machlearn/7650.py
1
5032
#!/usr/bin/env python #coding=utf8 import numpy as np #from scipy import linalg from scipy.sparse.linalg import svds from scipy import sparse #import matplotlib.pyplot as plt # a = np.random.randn(9, 6) + 1.j*np.random.randn(9, 6) # print a # U, s, Vh = linalg.svd(a) # print U.shape, Vh.shape, s.shape # U, s, Vh =...
gpl-3.0
Milias/ModellingSimulation
Shared/python/graphs.py
1
1193
#!/usr/bin/env python # -*- coding: utf8 -*- from numpy import * import matplotlib.pyplot as plt import sys import json def PlotQuantityVsStep(filename, key, ax, start, kwargs): try: f = open(filename, "r") except Exception as e: print(e) return 0.0 data = json.loads(f.read()) f.close() avg = ...
mit
nelson-liu/scikit-learn
sklearn/discriminant_analysis.py
27
26804
""" Linear Discriminant Analysis and Quadratic Discriminant Analysis """ # Authors: Clemens Brunner # Martin Billinger # Matthieu Perrot # Mathieu Blondel # License: BSD 3-Clause from __future__ import print_function import warnings import numpy as np from scipy import linalg from .extern...
bsd-3-clause
epidataio/epidata-community
ipython/test/test_automated_test.py
1
22845
# # Copyright (c) 2015-2017 EpiData, Inc. # from datetime import datetime, timedelta from epidata.context import ec from epidata_common.data_types import Waveform import numpy import pandas from pyspark.sql import Row from pyspark.sql import Column import unittest AutomatedTest = Row( 'company', 'site', ...
apache-2.0
nok/sklearn-porter
examples/estimator/regressor/MLPRegressor/js/basics.pct.py
1
1225
# %% [markdown] # # sklearn-porter # # Repository: [https://github.com/nok/sklearn-porter](https://github.com/nok/sklearn-porter) # # ## MLPRegressor # # Documentation: [sklearn.neural_network.MLPRegressor](http://scikit-learn.org/stable/modules/generated/sklearn.neural_network.MLPRegressor.html) # %% import sys sys.p...
mit
mikebenfield/scikit-learn
sklearn/decomposition/truncated_svd.py
6
8517
"""Truncated SVD for sparse matrices, aka latent semantic analysis (LSA). """ # Author: Lars Buitinck # Olivier Grisel <olivier.grisel@ensta.org> # Michael Becker <mike@beckerfuffle.com> # License: 3-clause BSD. import numpy as np import scipy.sparse as sp try: from scipy.sparse.linalg import svd...
bsd-3-clause
lin-credible/scikit-learn
sklearn/metrics/tests/test_common.py
43
44042
from __future__ import division, print_function from functools import partial from itertools import product import numpy as np import scipy.sparse as sp from sklearn.datasets import make_multilabel_classification from sklearn.preprocessing import LabelBinarizer, MultiLabelBinarizer from sklearn.utils.multiclass impo...
bsd-3-clause
aabadie/scikit-learn
sklearn/linear_model/tests/test_sparse_coordinate_descent.py
94
10801
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_true from sklearn.utils.t...
bsd-3-clause
YinongLong/scikit-learn
sklearn/neural_network/rbm.py
46
12291
"""Restricted Boltzmann Machine """ # Authors: Yann N. Dauphin <dauphiya@iro.umontreal.ca> # Vlad Niculae # Gabriel Synnaeve # Lars Buitinck # License: BSD 3 clause import time import numpy as np import scipy.sparse as sp from ..base import BaseEstimator from ..base import TransformerMixi...
bsd-3-clause
huzq/scikit-learn
sklearn/cluster/tests/test_bicluster.py
6
9508
"""Testing for Spectral Biclustering methods""" import numpy as np import pytest from scipy.sparse import csr_matrix, issparse from sklearn.model_selection import ParameterGrid from sklearn.utils._testing import assert_almost_equal from sklearn.utils._testing import assert_array_equal from sklearn.utils._testing imp...
bsd-3-clause
procoder317/scikit-learn
sklearn/linear_model/least_angle.py
61
54324
""" Least Angle Regression algorithm. See the documentation on the Generalized Linear Model for a complete discussion. """ from __future__ import print_function # Author: Fabian Pedregosa <fabian.pedregosa@inria.fr> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Gael Varoquaux # # License: BSD 3 ...
bsd-3-clause
ningchi/scikit-learn
examples/applications/plot_prediction_latency.py
234
11277
""" ================== Prediction Latency ================== This is an example showing the prediction latency of various scikit-learn estimators. The goal is to measure the latency one can expect when doing predictions either in bulk or atomic (i.e. one by one) mode. The plots represent the distribution of the pred...
bsd-3-clause
TomAugspurger/pandas
pandas/tests/tseries/offsets/test_yqm_offsets.py
3
50930
""" Tests for Year, Quarter, and Month-based DateOffset subclasses """ from datetime import datetime import pytest import pandas as pd from pandas import Timestamp from pandas.tseries.offsets import ( BMonthBegin, BMonthEnd, BQuarterBegin, BQuarterEnd, BYearBegin, BYearEnd, MonthBegin, ...
bsd-3-clause
LohithBlaze/scikit-learn
sklearn/utils/tests/test_extmath.py
130
16270
# Authors: Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Denis Engemann <d.engemann@fz-juelich.de> # # License: BSD 3 clause import numpy as np from scipy import sparse from scipy import linalg from scipy import stats from sklearn.utils.testing import assert_eq...
bsd-3-clause
jlabroquere/SU2
SU2_PY/SU2/util/filter_adjoint.py
6
16496
#!/usr/bin/env python ## \file filter_adjoint.py # \brief Applies various filters to the adjoint surface sensitivities of an airfoil # \author T. Lukaczyk, F. Palacios # \version 4.0.1 "Cardinal" # # SU2 Lead Developers: Dr. Francisco Palacios (Francisco.D.Palacios@boeing.com). # Dr. Thomas D....
lgpl-2.1
wallinm1/kaggle-loan-default
clf_selector.py
1
1837
from sklearn.ensemble import ExtraTreesClassifier, GradientBoostingClassifier from sklearn.cross_validation import ShuffleSplit import numpy as np from sklearn.metrics import f1_score, roc_auc_score def main(): xtrain=np.load('data/x_train.npy') ytrain=np.load('data/y_train.npy') #train-test split ...
mit
MikhailZherebtsov/russian_twitter_analysis
Analysis/Conversation_polarization.py
1
6179
import MySQLdb, sys, logging import pandas as pd #------------------------------------------------------- class ConvoMatrix: ''' This script creates the file 'Polarization_matrices.xlsx' - which is reports the matrix of polarization by community. The Retweets, the mentions and the replies are p...
mit
birlrobotics/HMM
hmm_for_baxter_using_only_success_trials/hmm_model_training.py
1
3082
#!/usr/bin/env python import os import numpy as np from sklearn.externals import joblib from sklearn.preprocessing import ( scale, normalize ) import util import ipdb import copy from birl_hmm.hmm_training import train_model def run(model_save_path, model_type, model_config, score_metric, ...
bsd-3-clause
david-ragazzi/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/backend_bases.py
69
69740
""" Abstract base classes define the primitives that renderers and graphics contexts must implement to serve as a matplotlib backend :class:`RendererBase` An abstract base class to handle drawing/rendering operations. :class:`FigureCanvasBase` The abstraction layer that separates the :class:`matplotlib.fi...
gpl-3.0
isithot/isithotrightnow
databackup/populate_daily-all_files.py
1
3533
'''this script populates databackup/[date]-all.csv type files in the form: 014015,Australia/Darwin,-12.4239,130.8925,32.5,2019-04-10T05:44:00Z,25.3,2019-04-09T21:37:00Z 015590,Australia/Darwin,-23.7951,133.8890,32.8,2019-04-10T05:43:00Z,20.2,2019-04-09T21:24:00Z 066062,Australia/Sydney,-33.8607,151.2050,21.3,2019-04-10...
mit
fducau/AAE_pytorch
script/viz.py
1
2800
import matplotlib import matplotlib.pyplot as plt from matplotlib import gridspec import numpy as np from torch.autograd import Variable import torch def get_X_batch(data_loader, params, size=None): if size is None: size = data_loader.batch_size for X, target in data_loader: break train_b...
gpl-3.0
zhouxiao-coder/Paddle
demo/gan/gan_trainer.py
13
12731
# Copyright (c) 2016 PaddlePaddle 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 applic...
apache-2.0
yanlend/scikit-learn
sklearn/metrics/cluster/bicluster.py
359
2797
from __future__ import division import numpy as np from sklearn.utils.linear_assignment_ import linear_assignment from sklearn.utils.validation import check_consistent_length, check_array __all__ = ["consensus_score"] def _check_rows_and_columns(a, b): """Unpacks the row and column arrays and checks their shap...
bsd-3-clause
kdebrab/pandas
pandas/tests/tslibs/test_period_asfreq.py
7
3951
# -*- coding: utf-8 -*- from pandas._libs.tslibs.frequencies import get_freq from pandas._libs.tslibs.period import period_ordinal, period_asfreq class TestPeriodFreqConversion(object): def test_intraday_conversion_factors(self): assert period_asfreq(1, get_freq('D'), get_freq('H'), False) == 24 ...
bsd-3-clause
QuantSoftware/QuantSoftwareToolkit
Legacy/Legacy/alphaGenerators/Bollingerbands.py
5
5265
''' Created on Jul 30, 2010 @author: sjoshi42 @summary: This module generates alpha values based on bollinger bands ''' import DataAccess import dircache import numpy import alphaDataModel.AlphaDataModel as adm #import alphaGenerator.AlphaDataModel as adm from matplotlib.backends.backend_agg import Figure...
bsd-3-clause
shaunstanislaus/BDA_py_demos
demos_ch3/demo3_6.py
19
2810
"""Bayesian Data Analysis, 3rd ed Chapter 3, demo 6 Illustrate posterior inference for Bioassay data (BDA3 p. 74-). Instructions for exercise (3.11 in BDA3) - Check that the range and spacing of A and B are sensible for the alternative prior - Compute the log-posterior in a grid - Scale the log-posterior by subtra...
gpl-3.0
huzq/scikit-learn
sklearn/preprocessing/_label.py
2
29659
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Mathieu Blondel <mathieu@mblondel.org> # Olivier Grisel <olivier.grisel@ensta.org> # Andreas Mueller <amueller@ais.uni-bonn.de> # Joel Nothman <joel.nothman@gmail.com> # Hamzeh Alsalhi <ha258@cornell.edu> # Licens...
bsd-3-clause
aglankit/recommendation_engine
scripts/algos/cf_users_knn.py
1
3203
import csv import sys import numpy as np from sets import Set from scipy import spatial from sklearn.metrics import mean_absolute_error from sklearn.metrics import mean_squared_error def getReviewsSet(row): global max_items list = Set() for column in range(0,max_items): if Utility[row][column] > 0: lis...
gpl-2.0
fredhusser/scikit-learn
sklearn/decomposition/tests/test_pca.py
199
10949
import numpy as np 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_equal from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_rai...
bsd-3-clause
janhui/test_engine
dev/old/shape/overlap-plot.py
1
1307
# Take collection of circles, see which overlap then plot the shapes with the amended overlaps. from shapely.geometry import Polygon, Point from shapely.ops import cascaded_union from matplotlib import pyplot from shapely.validation import explain_validity # definses one polygon square. plist = [[(0, 0), (0, 2), (2, ...
lgpl-2.1
mikebenfield/scikit-learn
examples/cross_decomposition/plot_compare_cross_decomposition.py
19
4761
""" =================================== Compare cross decomposition methods =================================== Simple usage of various cross decomposition algorithms: - PLSCanonical - PLSRegression, with multivariate response, a.k.a. PLS2 - PLSRegression, with univariate response, a.k.a. PLS1 - CCA Given 2 multivari...
bsd-3-clause
russel1237/scikit-learn
sklearn/metrics/classification.py
95
67713
"""Metrics to assess performance on classification task given classe prediction Functions named as ``*_score`` return a scalar value to maximize: the higher the better Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize: the lower the better """ # Authors: Alexandre Gramfort <alexandre.gram...
bsd-3-clause