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
TaxIPP-Life/Til
til/data/archives/Patrimoine/test_matching.py
2
6752
# -*- coding:utf-8 -*- ''' Created on 25 juil. 2013 @author: a.eidelman ''' import pandas as pd import pdb import numpy as np import time # #TODO: J'aime bien l'idée de regarder sur les valeurs potentielles, de séléctionner la meilleure et de prendre quelqu'un dans cette case. # # L'avantage c'est qu'au lieu de rega...
gpl-3.0
Srisai85/scikit-learn
sklearn/feature_extraction/dict_vectorizer.py
234
12267
# Authors: Lars Buitinck # Dan Blanchard <dblanchard@ets.org> # License: BSD 3 clause from array import array from collections import Mapping from operator import itemgetter import numpy as np import scipy.sparse as sp from ..base import BaseEstimator, TransformerMixin from ..externals import six from ..ext...
bsd-3-clause
anntzer/scikit-learn
sklearn/datasets/tests/test_openml.py
1
52574
"""Test the openml loader. """ import gzip import warnings import json import os import re from io import BytesIO import numpy as np import scipy.sparse import sklearn import pytest from sklearn import config_context from sklearn.datasets import fetch_openml from sklearn.datasets._openml import (_open_openml_url, ...
bsd-3-clause
jayflo/scikit-learn
sklearn/svm/tests/test_svm.py
116
31653
""" Testing for Support Vector Machine module (sklearn.svm) TODO: remove hard coded numerical results when possible """ import numpy as np import itertools from numpy.testing import assert_array_equal, assert_array_almost_equal from numpy.testing import assert_almost_equal from scipy import sparse from nose.tools im...
bsd-3-clause
vigilv/scikit-learn
examples/plot_multilabel.py
236
4157
# Authors: Vlad Niculae, Mathieu Blondel # License: BSD 3 clause """ ========================= Multilabel classification ========================= This example simulates a multi-label document classification problem. The dataset is generated randomly based on the following process: - pick the number of labels: n ...
bsd-3-clause
Unidata/MetPy
v1.0/_downloads/651190fdc2d21b9d54206699c3284920/surface_declarative.py
6
2177
# Copyright (c) 2019 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """ ========================================= Surface Analysis using Declarative Syntax ========================================= The MetPy declarative syntax allows for a simplifie...
bsd-3-clause
spectralDNS/shenfun
demo/laguerre_dirichlet_poisson1D.py
1
1587
r""" Solve Poisson equation in 1D with homogeneous Dirichlet bcs on the domain [0, inf) \nabla^2 u = f, The equation to solve for a Laguerre basis is (\nabla u, \nabla v) = -(f, v) """ import os import sys from sympy import symbols, sin, exp, lambdify import numpy as np from shenfun import inner, grad, Tes...
bsd-2-clause
hehongliang/tensorflow
tensorflow/contrib/labeled_tensor/python/ops/ops.py
27
46439
# 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
rishikksh20/scikit-learn
examples/neighbors/plot_classification.py
58
1790
""" ================================ Nearest Neighbors Classification ================================ Sample usage of Nearest Neighbors classification. It will plot the decision boundaries for each class. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColorm...
bsd-3-clause
grollins/orts
run.py
1
2840
import numpy as np import pandas as pd from timer import Timer def bubblesort(x): bound = len(x)-1 while 1: t = 0 for j in range(bound): if x[j] > x[j+1]: x[j], x[j+1] = x[j+1], x[j] t = j if t == 0: break bound = t re...
unlicense
zorroblue/scikit-learn
sklearn/preprocessing/tests/test_label.py
10
18657
import numpy as np from scipy.sparse import issparse from scipy.sparse import coo_matrix from scipy.sparse import csc_matrix from scipy.sparse import csr_matrix from scipy.sparse import dok_matrix from scipy.sparse import lil_matrix from sklearn.utils.multiclass import type_of_target from sklearn.utils.testing impor...
bsd-3-clause
MohammedWasim/scikit-learn
sklearn/metrics/cluster/tests/test_supervised.py
206
7643
import numpy as np from sklearn.metrics.cluster import adjusted_rand_score from sklearn.metrics.cluster import homogeneity_score from sklearn.metrics.cluster import completeness_score from sklearn.metrics.cluster import v_measure_score from sklearn.metrics.cluster import homogeneity_completeness_v_measure from sklearn...
bsd-3-clause
Kleptobismol/scikit-bio
skbio/stats/distance/tests/test_permanova.py
1
8466
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. # --------------------------------------------...
bsd-3-clause
pydata/vbench
vbench/db.py
3
5573
from pandas import DataFrame from sqlalchemy import Table, Column, MetaData, create_engine, ForeignKey from sqlalchemy import types as sqltypes from sqlalchemy import sql import logging log = logging.getLogger('vb.db') class BenchmarkDB(object): """ Persist vbench results in a sqlite3 database """ d...
mit
herilalaina/scikit-learn
sklearn/gaussian_process/gpr.py
9
20571
"""Gaussian processes regression. """ # Authors: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de> # # License: BSD 3 clause import warnings from operator import itemgetter import numpy as np from scipy.linalg import cholesky, cho_solve, solve_triangular from scipy.optimize import fmin_l_bfgs_b from sklearn.base im...
bsd-3-clause
fmfn/UnbalancedDataset
imblearn/over_sampling/_smote/tests/test_borderline_smote.py
3
1920
import pytest import numpy as np from sklearn.neighbors import NearestNeighbors from sklearn.utils._testing import assert_allclose from sklearn.utils._testing import assert_array_equal from imblearn.over_sampling import BorderlineSMOTE @pytest.fixture def data(): X = np.array( [ [0.11622591,...
mit
jcatw/scnn
scnn/data.py
1
6116
__author__ = 'jatwood' import numpy as np import cPickle as cp import inspect import os current_dir = os.path.dirname(os.path.abspath(inspect.stack()[0][1])) def parse_cora(plot=False): path = "%s/data/cora/" % (current_dir,) id2index = {} label2index = { 'Case_Based': 0, 'Genetic_Algo...
mit
harsham05/image_space
flann_index/image_match.py
12
4269
# import the necessary packages from optparse import OptionParser from scipy.spatial import distance as dist import matplotlib.pyplot as plt import numpy as np import argparse import glob import cv2 import sys import pickle ########################### def image_match_histogram( all_files, options ): histograms = {...
apache-2.0
andaag/scikit-learn
sklearn/linear_model/tests/test_sparse_coordinate_descent.py
244
9986
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
nelango/ViralityAnalysis
model/lib/sklearn/preprocessing/__init__.py
268
1319
""" The :mod:`sklearn.preprocessing` module includes scaling, centering, normalization, binarization and imputation methods. """ from ._function_transformer import FunctionTransformer from .data import Binarizer from .data import KernelCenterer from .data import MinMaxScaler from .data import MaxAbsScaler from .data ...
mit
GuessWhoSamFoo/pandas
pandas/core/strings.py
1
100753
# -*- coding: utf-8 -*- import codecs import re import textwrap import warnings import numpy as np import pandas._libs.lib as lib import pandas._libs.ops as libops import pandas.compat as compat from pandas.compat import zip from pandas.util._decorators import Appender, deprecate_kwarg from pandas.core.dtypes.common...
bsd-3-clause
sekikn/incubator-airflow
tests/providers/salesforce/hooks/test_salesforce.py
7
9659
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
apache-2.0
VulpesCorsac/Ire-Polus
Find PID/Find_PID.py
2
5265
# (c) VulpesCorsac import matplotlib.pyplot as plt import numpy import random T_in_0 = 30 # Starting internal temperature T_out_0 = 20 # Starting external temperature T_needed = 35 # Temperature, we should reach and stabilise t_delay ...
gpl-2.0
aabadie/scikit-learn
sklearn/cross_decomposition/pls_.py
35
30767
""" The :mod:`sklearn.pls` module implements Partial Least Squares (PLS). """ # Author: Edouard Duchesnay <edouard.duchesnay@cea.fr> # License: BSD 3 clause from distutils.version import LooseVersion from sklearn.utils.extmath import svd_flip from ..base import BaseEstimator, RegressorMixin, TransformerMixin from ..u...
bsd-3-clause
jniediek/mne-python
examples/preprocessing/plot_rereference_eeg.py
9
2271
""" ============================= Re-referencing the EEG signal ============================= Load raw data and apply some EEG referencing schemes. """ # Authors: Marijn van Vliet <w.m.vanvliet@gmail.com> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) import mne fr...
bsd-3-clause
jzt5132/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
ggventurini/dualscope123
dualscope123/main.py
1
40618
#!/usr/bin/env python """ Oscilloscope + spectrum analyser in Python for the NIOS server. Modified version from the original code by R. Fearick. Giuseppe Venturini, July 2012-2013 Original copyright notice follows. The same license applies. ------------------------------------------------------------ Copyright (C)...
gpl-3.0
eshavlyugin/Preferans
newalgo/tf_train_py2.py
1
14069
import csv import argparse import sklearn import sklearn.ensemble import numpy from sklearn.metrics import accuracy_score from itertools import count batch_size = 512 num_steps = 200000 num_hidden1 = 50 num_hidden2 = 1 def prepare_train_data(data, label_names, label_name, feature_set, num_labels, use_regression): ...
gpl-2.0
solenoid-bandits/leviosa
controller.py
1
1687
import numpy as np from matplotlib import pyplot as plt from net import Net class Controller(object): def __init__(self): pass def current(self, pos, target, dt): # t = time return (target - pos) * 1.0 # proportional class PIDController(Controller): def __init__(self, k_p=1.0, k_i=...
mit
mbayon/TFG-MachineLearning
venv/lib/python3.6/site-packages/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]], ...
mit
devanshdalal/scikit-learn
sklearn/manifold/tests/test_t_sne.py
28
24487
import sys from sklearn.externals.six.moves import cStringIO as StringIO import numpy as np import scipy.sparse as sp from sklearn.neighbors import BallTree from sklearn.utils.testing import assert_less_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from skle...
bsd-3-clause
pymedusa/Medusa
ext/dateutil/parser/_parser.py
8
58804
# -*- coding: utf-8 -*- """ This module offers a generic date/time string parser which is able to parse most known formats to represent a date and/or time. This module attempts to be forgiving with regards to unlikely input formats, returning a datetime object even for dates which are ambiguous. If an element of a dat...
gpl-3.0
tengerye/orthogonal-denoising-autoencoder
TensorFlow/demo.py
2
2335
import matplotlib import numpy as np import scipy as sp import matplotlib.pyplot as plt import scipy.io from sklearn.cross_decomposition import CCA from orthAE import OrthdAE # generate toy data for multi-view learning from paper "Factorized Latent Spaces with Structured Sparsity" t = np.arange(-1, 1, 0.02) x = np....
apache-2.0
zfrenchee/pandas
pandas/tests/indexes/period/test_period.py
1
26492
import pytest import numpy as np import pandas as pd import pandas.util._test_decorators as td from pandas.util import testing as tm from pandas import (PeriodIndex, period_range, notna, DatetimeIndex, NaT, Index, Period, Int64Index, Series, DataFrame, date_range, offsets) fro...
bsd-3-clause
gweidner/incubator-systemml
scripts/perftest/python/google_docs/update.py
15
4666
#!/usr/bin/env python3 # ------------------------------------------------------------- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses ...
apache-2.0
rhyolight/nupic.research
htmresearch/support/sp_paper_utils.py
4
12897
#!/usr/bin/env python # ---------------------------------------------------------------------- # 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 ...
gpl-3.0
altairpearl/scikit-learn
examples/model_selection/plot_validation_curve.py
141
1931
""" ========================== Plotting Validation Curves ========================== In this plot you can see the training scores and validation scores of an SVM for different values of the kernel parameter gamma. For very low values of gamma, you can see that both the training score and the validation score are low. ...
bsd-3-clause
KAPPS-/vincent
tests/test_vega.py
9
32992
# -*- coding: utf-8 -*- ''' Test Vincent.vega ----------------- ''' from datetime import datetime, timedelta from itertools import product import time import json from vincent.charts import Line from vincent.core import (grammar, GrammarClass, GrammarDict, KeyedList, LoadError, ValidationErr...
mit
sumspr/scikit-learn
sklearn/neighbors/tests/test_kde.py
208
5556
import numpy as np from sklearn.utils.testing import (assert_allclose, assert_raises, assert_equal) from sklearn.neighbors import KernelDensity, KDTree, NearestNeighbors from sklearn.neighbors.ball_tree import kernel_norm from sklearn.pipeline import make_pipeline from sklearn.dataset...
bsd-3-clause
aditipawde/TimeTable1
TimeTable1/main_rajeshree.py
1
6024
import dataAccessSQLAlchemy as da import pandas as pd import random import numpy as np def isSlotAvailable(req_all, timetable_np, c, r_day, r_slot, r_lecnumber, req_id): #If slot is of duration 1 SlotsAvailable = 0 for i in range(req_all[req_id, 'eachSlot']): #Fetching how many lectures do we require to sl...
lgpl-3.0
hainm/statsmodels
statsmodels/sandbox/examples/example_gam.py
33
2343
'''original example for checking how far GAM works Note: uncomment plt.show() to display graphs ''' example = 2 # 1,2 or 3 import numpy as np import numpy.random as R import matplotlib.pyplot as plt from statsmodels.sandbox.gam import AdditiveModel from statsmodels.sandbox.gam import Model as GAM #? from statsmode...
bsd-3-clause
APMonitor/arduino
0_Test_Device/Python/test_Second_Order.py
1
5010
import tclab import numpy as np import time import matplotlib.pyplot as plt from scipy.optimize import minimize import random # Second order model of TCLab # initial parameter guesses Kp = 0.2 taus = 50.0 zeta = 1.2 # magnitude of step M = 80 # overdamped 2nd order step response def model(y0,t,M,Kp,...
apache-2.0
Achuth17/scikit-learn
sklearn/tests/test_base.py
216
7045
# Author: Gael Varoquaux # License: BSD 3 clause import numpy as np import scipy.sparse as sp 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 sklearn.utils.testing impo...
bsd-3-clause
MechCoder/scikit-learn
sklearn/ensemble/__init__.py
153
1382
""" The :mod:`sklearn.ensemble` module includes ensemble-based methods for classification, regression and anomaly detection. """ from .base import BaseEnsemble from .forest import RandomForestClassifier from .forest import RandomForestRegressor from .forest import RandomTreesEmbedding from .forest import ExtraTreesCla...
bsd-3-clause
henrykironde/scikit-learn
sklearn/mixture/gmm.py
128
31069
""" Gaussian Mixture Models. This implementation corresponds to frequentist (non-Bayesian) formulation of Gaussian Mixture Models. """ # Author: Ron Weiss <ronweiss@gmail.com> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Bertrand Thirion <bertrand.thirion@inria.fr> import warnings import numpy as...
bsd-3-clause
brentp/goleft
indexcov/paper/plot-eiee-15.py
1
1375
from matplotlib import pyplot as plt import pandas as pd import seaborn as sns sns.set_style('white') df = pd.read_table('eiee.15.bed.gz', compression='gzip') print(df.head()) cols = list(df.columns) cols[0] = "chrom" cols = [c for c in cols[3:] if c != '15-0022964' and c != '15-0022989'] fig, ax = plt.subplots(1) ...
mit
MohammedWasim/scikit-learn
examples/cluster/plot_adjusted_for_chance_measures.py
286
4353
""" ========================================================== Adjustment for chance in clustering performance evaluation ========================================================== The following plots demonstrate the impact of the number of clusters and number of samples on various clustering performance evaluation me...
bsd-3-clause
mmessick/Tax-Calculator
taxcalc/tests/test_decorators.py
2
8784
import os import sys cur_path = os.path.abspath(os.path.dirname(__file__)) sys.path.append(os.path.join(cur_path, "../../")) sys.path.append(os.path.join(cur_path, "../")) import numpy as np import pandas as pd from pandas import DataFrame from pandas.util.testing import assert_frame_equal from numba import jit, vector...
mit
DonBeo/statsmodels
statsmodels/nonparametric/_kernel_base.py
29
18238
""" Module containing the base object for multivariate kernel density and regression, plus some utilities. """ from statsmodels.compat.python import range, string_types import copy import numpy as np from scipy import optimize from scipy.stats.mstats import mquantiles try: import joblib has_joblib = True exce...
bsd-3-clause
Myasuka/scikit-learn
examples/bicluster/plot_spectral_coclustering.py
276
1736
""" ============================================== A demo of the Spectral Co-Clustering algorithm ============================================== This example demonstrates how to generate a dataset and bicluster it using the the Spectral Co-Clustering algorithm. The dataset is generated using the ``make_biclusters`` f...
bsd-3-clause
jimboatarm/workload-automation
wlauto/instrumentation/energy_model/__init__.py
2
42149
# Copyright 2015 ARM Limited # # 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 writin...
apache-2.0
exepulveda/swfc
python/plot_cross_stats_bm.py
1
7207
import sys import random import logging import collections import math import sys from scipy.stats import gaussian_kde import matplotlib as mpl #mpl.use('agg') import matplotlib.pyplot as plt import numpy as np import scipy.stats import pandas as pd from case_study_bm import setup_case_study_ore, attributes def c...
gpl-3.0
hsuantien/scikit-learn
examples/neighbors/plot_approximate_nearest_neighbors_scalability.py
225
5719
""" ============================================ Scalability of Approximate Nearest Neighbors ============================================ This example studies the scalability profile of approximate 10-neighbors queries using the LSHForest with ``n_estimators=20`` and ``n_candidates=200`` when varying the number of sa...
bsd-3-clause
themrmax/scikit-learn
examples/model_selection/plot_underfitting_overfitting.py
78
2702
""" ============================ Underfitting vs. Overfitting ============================ This example demonstrates the problems of underfitting and overfitting and how we can use linear regression with polynomial features to approximate nonlinear functions. The plot shows the function that we want to approximate, wh...
bsd-3-clause
Mohitsharma44/citibike-challenge
citibike_1.py
2
3200
import numpy as np from datetime import datetime, timedelta from sys import argv import matplotlib.pyplot as plt class CitiBikeChallenge(): def __init__(self): pass def load_file(self, path): print 'Loading data ... ' self.data = np.genfromtxt(path, dtype=None, ...
mit
vsjha18/finplots
candlestick.py
1
7937
""" Created on 05-Apr-2015 @author: vivejha """ #from . import log import pandas as pd import numpy as np import matplotlib import matplotlib.pyplot as plt import matplotlib.dates as mdates import matplotlib.ticker as mticker from matplotlib.finance import candlestick_ohlc from finplots.overlays import plot_sma from...
gpl-3.0
gem/oq-engine
openquake/hazardlib/tests/gsim/sgobba_2020_test.py
1
10324
# -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright (C) 2020, GEM Foundation # # OpenQuake is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, ...
agpl-3.0
ephes/scikit-learn
sklearn/grid_search.py
103
36232
""" The :mod:`sklearn.grid_search` includes utilities to fine-tune the parameters of an estimator. """ from __future__ import print_function # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>, # Gael Varoquaux <gael.varoquaux@normalesup.org> # Andreas Mueller <amueller@ais.uni-bonn.de> # ...
bsd-3-clause
IndraVikas/scikit-learn
benchmarks/bench_plot_neighbors.py
287
6433
""" Plot the scaling of the nearest neighbors algorithms with k, D, and N """ from time import time import numpy as np import pylab as pl from matplotlib import ticker from sklearn import neighbors, datasets def get_data(N, D, dataset='dense'): if dataset == 'dense': np.random.seed(0) return np....
bsd-3-clause
andaag/scikit-learn
examples/neighbors/plot_approximate_nearest_neighbors_scalability.py
225
5719
""" ============================================ Scalability of Approximate Nearest Neighbors ============================================ This example studies the scalability profile of approximate 10-neighbors queries using the LSHForest with ``n_estimators=20`` and ``n_candidates=200`` when varying the number of sa...
bsd-3-clause
YudinYury/Python_Netology_homework
less_4_2_hw_1_visualization.py
1
3030
"""lesson_4_2_Homework "Data visualization" """ import os import pandas as pd source_path = 'D:\Python_my\Python_Netology_homework\data_names' source_dir_path = os.path.normpath(os.path.abspath(source_path)) def download_year_data(year): source_file = os.path.normpath(os.path.join(source_dir_path, 'yob{}.txt'...
gpl-3.0
shusenl/scikit-learn
doc/sphinxext/numpy_ext/docscrape_sphinx.py
408
8061
import re import inspect import textwrap import pydoc from .docscrape import NumpyDocString from .docscrape import FunctionDoc from .docscrape import ClassDoc class SphinxDocString(NumpyDocString): def __init__(self, docstring, config=None): config = {} if config is None else config self.use_plots...
bsd-3-clause
alubbock/pysb
pysb/examples/cupsoda/run_michment_cupsoda.py
5
1878
from pysb.examples.michment import model from pysb.simulator.cupsoda import run_cupsoda import numpy as np import matplotlib.pyplot as plt import itertools def run(): # factors to multiply the values of the initial conditions multipliers = np.linspace(0.8, 1.2, 11) # 2D array of initial concentrations ...
bsd-2-clause
erdc/proteus
proteus/mprans/beamFEM.py
1
16450
from __future__ import division from builtins import range from builtins import object from past.utils import old_div import numpy as np #import scipy as sp #import matplotlib.pyplot as plt import math import numpy.linalg as linalg class FEMTools(object): def __init__(self, L=1.0, ...
mit
thehackerwithin/berkeley
code_examples/numpyVectorization/diffusion.py
9
5427
''' Functions for comparing vectorization performance of simplified diffusion in 1D and 2D. http://en.wikipedia.org/wiki/Finite_difference_method#Example:_The_heat_equation ''' import numpy as np from matplotlib import pyplot as plt plt.ion() def diff1d_loop( n_iter=200, rate=.5, n_x=100, plotUpdate=True, ...
bsd-3-clause
mayblue9/bokeh
examples/charts/file/boxplot.py
37
1117
from collections import OrderedDict import pandas as pd from bokeh.charts import BoxPlot, output_file, show from bokeh.sampledata.olympics2014 import data # create a DataFrame with the sample data df = pd.io.json.json_normalize(data['data']) # filter by countries with at least one medal and sort df = df[df['medals....
bsd-3-clause
cragis/SimpleSpectrumAnalyzer
SAv9.py
1
9409
#by Craig Howald 2017 to remain free from restriction #mods added by Kevin Thomas from matplotlib.figure import Figure import numpy as np import matplotlib.pyplot as plt import rtlsdr from matplotlib.mlab import psd import tkinter as Tk from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg import rtlsdr ...
gpl-3.0
mutirri/bokeh
bokeh/session.py
42
20253
''' The session module provides the Session class, which encapsulates a connection to a Document that resides on a Bokeh server. The Session class provides methods for creating, loading and storing documents and objects, as well as methods for user-authentication. These are useful when the server is run in multi-user ...
bsd-3-clause
rayNymous/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/dviread.py
69
29920
""" An experimental module for reading dvi files output by TeX. Several limitations make this not (currently) useful as a general-purpose dvi preprocessor. Interface:: dvi = Dvi(filename, 72) for page in dvi: # iterate over pages w, h, d = page.width, page.height, page.descent for x,y,font,gl...
agpl-3.0
gclenaghan/scikit-learn
sklearn/manifold/isomap.py
229
7169
"""Isomap for manifold learning""" # Author: Jake Vanderplas -- <vanderplas@astro.washington.edu> # License: BSD 3 clause (C) 2011 import numpy as np from ..base import BaseEstimator, TransformerMixin from ..neighbors import NearestNeighbors, kneighbors_graph from ..utils import check_array from ..utils.graph import...
bsd-3-clause
mverleg/paxsync_backups
cleanup.py
2
3773
from argparse import ArgumentParser from collections import OrderedDict from datetime import datetime, timedelta from os import listdir from os.path import join from random import randint from re import findall from shutil import rmtree def find_backups(dir, dry=True): for name in listdir(dir): match = findall(r'...
mit
Just-CJ/SketchRetrieval
python/GFHOG.py
1
3062
# coding=utf-8 import cv2 import numpy as np import sklearn SKETCH = 1 IMAGE = 2 test = np.array([]) class GFHOG: __gradient = None __hog = None def __init__(self): self.__hog = cv2.HOGDescriptor('hog.xml') def compute(self, img, t=SKETCH): if t == SKETCH: ...
mit
harshaneelhg/scikit-learn
sklearn/utils/graph.py
289
6239
""" Graph utilities and algorithms Graphs are represented with their adjacency matrices, preferably using sparse matrices. """ # Authors: Aric Hagberg <hagberg@lanl.gov> # Gael Varoquaux <gael.varoquaux@normalesup.org> # Jake Vanderplas <vanderplas@astro.washington.edu> # License: BSD 3 clause impo...
bsd-3-clause
CallaJun/hackprince
indico/matplotlib/tests/test_axes.py
9
108913
from __future__ import (absolute_import, division, print_function, unicode_literals) import six from six.moves import xrange from nose.tools import assert_equal, assert_raises, assert_false, assert_true import datetime import numpy as np from numpy import ma import matplotlib from matplotlib...
lgpl-3.0
quantopian/zipline
zipline/data/resample.py
1
26927
# Copyright 2016 Quantopian, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
apache-2.0
devs1991/test_edx_docmode
venv/lib/python2.7/site-packages/sklearn/utils/tests/test_svd.py
3
5384
# Author: Olivier Grisel <olivier.grisel@ensta.org> # License: BSD import numpy as np from scipy import sparse from scipy import linalg from numpy.testing import assert_equal from numpy.testing import assert_almost_equal from sklearn.utils.testing import assert_greater from sklearn.utils.extmath import randomized_s...
agpl-3.0
Bulochkin/tensorflow_pack
tensorflow/contrib/learn/python/learn/tests/dataframe/arithmetic_transform_test.py
62
2343
# 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
rajat1994/scikit-learn
sklearn/linear_model/tests/test_coordinate_descent.py
114
25281
# Authors: Olivier Grisel <olivier.grisel@ensta.org> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD 3 clause from sys import version_info import numpy as np from scipy import interpolate, sparse from copy import deepcopy from sklearn.datasets import load_boston from sklearn.utils.testing ...
bsd-3-clause
ChrisThoung/fsic
examples/godley-lavoie_2007/5_lp1.py
1
8990
# -*- coding: utf-8 -*- """ 5_lp1 ===== FSIC implementation of Model *LP1*, a model of long-term bonds, capital gains and liquidity preference, from Chapter 5 of Godley and Lavoie (2007). Parameter values come from Zezza (2006). Godley and Lavoie (2007) analyse Model *LP1* beginning from an initial stationary state. T...
mit
rimio/wifi-rc
BehavioralCloning/model.py
1
5118
import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from keras.models import Sequential from keras.optimizers import Adam from keras.callbacks import ModelCheckpoint from keras.layers import Lambda, Conv2D, MaxPooling2D, Dropout, Dense, Flatten from utils import INPUT_SHAPE, batc...
gpl-3.0
nhejazi/scikit-learn
examples/linear_model/plot_ols_3d.py
53
2040
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Sparsity Example: Fitting only features 1 and 2 ========================================================= Features 1 and 2 of the diabetes-dataset are fitted and plotted below. It illustrates that although feature...
bsd-3-clause
jreback/pandas
pandas/tests/io/excel/test_openpyxl.py
2
3933
import numpy as np import pytest import pandas as pd from pandas import DataFrame import pandas._testing as tm from pandas.io.excel import ExcelWriter, _OpenpyxlWriter openpyxl = pytest.importorskip("openpyxl") pytestmark = pytest.mark.parametrize("ext", [".xlsx"]) def test_to_excel_styleconverter(ext): from ...
bsd-3-clause
KellenSunderland/sockeye
setup.py
1
3763
import sys import os import re import logging import argparse import subprocess from setuptools import setup, find_packages from contextlib import contextmanager ROOT = os.path.dirname(__file__) def get_long_description(): with open(os.path.join(ROOT, 'README.md'), encoding='utf-8') as f: markdown_txt = ...
apache-2.0
mxjl620/scikit-learn
sklearn/utils/extmath.py
70
21951
""" Extended math utilities. """ # Authors: Gael Varoquaux # Alexandre Gramfort # Alexandre T. Passos # Olivier Grisel # Lars Buitinck # Stefan van der Walt # Kyle Kastner # License: BSD 3 clause from __future__ import division from functools import partial import ...
bsd-3-clause
pybrain2/pybrain2
examples/rl/environments/shipsteer/shipbench_sde.py
26
3454
from __future__ import print_function #!/usr/bin/env python ######################################################################### # Reinforcement Learning with SPE on the ShipSteering Environment # # Requirements: # pybrain (tested on rev. 1195, ship env rev. 1202) # Synopsis: # shipbenchm.py [<True|False> [lo...
bsd-3-clause
robintw/scikit-image
doc/examples/plot_threshold_adaptive.py
22
1307
""" ===================== Adaptive Thresholding ===================== Thresholding is the simplest way to segment objects from a background. If that background is relatively uniform, then you can use a global threshold value to binarize the image by pixel-intensity. If there's large variation in the background intensi...
bsd-3-clause
rosswhitfield/mantid
qt/applications/workbench/workbench/plotting/test/test_figureinteraction.py
3
31775
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2019 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 + # T...
gpl-3.0
jseabold/scikit-learn
examples/gaussian_process/plot_gpr_noisy.py
104
3778
""" ============================================================= Gaussian process regression (GPR) with noise-level estimation ============================================================= This example illustrates that GPR with a sum-kernel including a WhiteKernel can estimate the noise level of data. An illustration...
bsd-3-clause
JessicaGarson/MovieSentiment
bagginglargerrange.py
1
1537
import pandas as pd import numpy as np from ggplot import * from sklearn.feature_extraction.text import CountVectorizer from sklearn.linear_model import LogisticRegression from sklearn.cross_validation import cross_val_score from sklearn.metrics import auc_score train = pd.read_csv('/Users/jessicagarson/Downloads/Movi...
unlicense
loli/semisupervisedforests
sklearn/ensemble/weight_boosting.py
26
40570
"""Weight Boosting This module contains weight boosting estimators for both classification and regression. The module structure is the following: - The ``BaseWeightBoosting`` base class implements a common ``fit`` method for all the estimators in the module. Regression and classification only differ from each ot...
bsd-3-clause
expfactory/expfactory-docker
expdj/apps/experiments/views.py
2
46466
import csv import datetime import hashlib import json import os import re import shutil import uuid import numpy import pandas from django.contrib.auth.decorators import login_required from django.core.exceptions import PermissionDenied, ValidationError from django.forms.models import model_to_dict from django.http im...
mit
chetan51/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/colorbar.py
69
27260
''' Colorbar toolkit with two classes and a function: :class:`ColorbarBase` the base class with full colorbar drawing functionality. It can be used as-is to make a colorbar for a given colormap; a mappable object (e.g., image) is not needed. :class:`Colorbar` the derived class ...
gpl-3.0
ryfeus/lambda-packs
Sklearn_scipy_numpy/source/scipy/stats/tests/test_morestats.py
17
50896
# Author: Travis Oliphant, 2002 # # Further enhancements and tests added by numerous SciPy developers. # from __future__ import division, print_function, absolute_import import warnings import numpy as np from numpy.random import RandomState from numpy.testing import (TestCase, run_module_suite, assert_array_equal, ...
mit
cainiaocome/scikit-learn
examples/linear_model/lasso_dense_vs_sparse_data.py
348
1862
""" ============================== Lasso on dense and sparse data ============================== We show that linear_model.Lasso provides the same results for dense and sparse data and that in the case of sparse data the speed is improved. """ print(__doc__) from time import time from scipy import sparse from scipy ...
bsd-3-clause
costypetrisor/scikit-learn
sklearn/ensemble/tests/test_gradient_boosting_loss_functions.py
221
5517
""" Testing for the gradient boosting loss functions and initial estimators. """ import numpy as np from numpy.testing import assert_array_equal from numpy.testing import assert_almost_equal from numpy.testing import assert_equal from nose.tools import assert_raises from sklearn.utils import check_random_state from ...
bsd-3-clause
zrhans/pythonanywhere
.virtualenvs/django19/lib/python3.4/site-packages/matplotlib/testing/decorators.py
3
14097
from __future__ import (absolute_import, division, print_function, unicode_literals) from matplotlib.externals import six import functools import gc import os import sys import shutil import warnings import unittest import nose import numpy as np import matplotlib as mpl import matplotlib.st...
apache-2.0
sampathweb/cs109_twitterapp
app/twitterword_old.py
1
3270
#------------------------------------------------------------------------------- # Name: twitter recommender # Purpose: for cs109 call # # Author: bconnaughton # # Created: 08/12/2013 # Copyright: (c) bconnaughton 2013 # Licence: <your licence> #--------------------------------------...
mit
1iyiwei/pyml
code/ch03/share.py
2
1904
import numpy as np from matplotlib.colors import ListedColormap import matplotlib.pyplot as plt import warnings def versiontuple(v): return tuple(map(int, (v.split(".")))) def plot_decision_regions(X, y, classifier, test_idx=None, resolution=0.02, xlabel='', ylabel='', title=''): # setup marker generator and...
mit
cbertinato/pandas
pandas/io/json/json.py
1
33725
from io import StringIO from itertools import islice import os import numpy as np import pandas._libs.json as json from pandas._libs.tslibs import iNaT from pandas.errors import AbstractMethodError from pandas.core.dtypes.common import ensure_str, is_period_dtype from pandas import DataFrame, MultiIndex, Series, is...
bsd-3-clause
qPCR4vir/orange3
Orange/tests/test_tree.py
1
3871
# Test methods with long descriptive names can omit docstrings # pylint: disable=missing-docstring import unittest import numpy as np import sklearn.tree as skl_tree from sklearn.tree._tree import TREE_LEAF from Orange.data import Table from Orange.classification import TreeLearner from Orange.regression import Tree...
bsd-2-clause