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
dbjohnson/flhackday
categorical.py
1
1439
from matplotlib import colors as clr import pylab as plt import seaborn as sns import numpy as np background = -1<<30 def heatmap(image, ncolors=None, transform=True): distinct_values = list(sorted(np.unique(image))) if background in distinct_values: distinct_values.remove(background) if ncolors...
mit
Alkxzv/categorical-kernels
kcat/kernels/search.py
1
8564
"""Classes to perform GridSearch on the custom kernels defined in :mod:`kcat.kernels.functions`. Their interface is very similar to scikit-learn's `GridSearchCV <http://scikit-learn.org/stable/modules/generated/sklearn\ .grid_search.GridSearchCV.html#sklearn.grid_search.GridSearchCV>`_, and the same parameters should ...
mit
kou/arrow
python/pyarrow/tests/test_plasma.py
4
44011
# 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 u...
apache-2.0
aetilley/scikit-learn
sklearn/linear_model/stochastic_gradient.py
130
50966
# Authors: Peter Prettenhofer <peter.prettenhofer@gmail.com> (main author) # Mathieu Blondel (partial_fit support) # # License: BSD 3 clause """Classification and regression using Stochastic Gradient Descent (SGD).""" import numpy as np import scipy.sparse as sp from abc import ABCMeta, abstractmethod from ...
bsd-3-clause
cvanoort/USDrugUseAnalysis
Report1/Code/afu_use30.py
1
2851
import csv import matplotlib.pyplot as plt import numpy as np import scipy.stats as stats from scipy.optimize import curve_fit def countKey(key,listDataDicts): outDict = {} for row in listDataDicts: try: outDict[row[key]] += 1 except KeyError: outDict[row[key]] = 1 ...
isc
wzbozon/scikit-learn
sklearn/feature_selection/tests/test_from_model.py
244
1593
import numpy as np import scipy.sparse as sp from nose.tools import assert_raises, assert_true from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_greater from sklearn.datasets import load_iris from sklearn.linear_model import LogisticRegression from sklearn.linear_model import SGD...
bsd-3-clause
mikemull/midaspy
tests/test_mix.py
1
6296
import pytest import datetime import pandas as pd from midas import mix @pytest.fixture() def lf_data(): df = pd.DataFrame({'date': ['2009-04-01', '2009-07-01', '2009-10-01', '2010-01-01', '2010-04-01'], 'val': [1.0, 2.0, 3.0, 4.0, 5.0]}) df['date'] = pd.to_datetime(df['date']) df....
mit
RouxRC/gazouilleur
gazouilleur/lib/plots.py
1
3416
#!/usr/bin/env python # -*- coding: utf-8 -*- # punchcard drawing adapted from HgPunchcard (GPL 2+ https://bitbucket.org/birkenfeld/hgpunchcard/src/f4d38c737147cdf966909c2957a79573a6a5c517/hgpunchcard.py?at=default ) import os import matplotlib matplotlib.use('Agg', warn=False) import matplotlib.pyplot as plt from pyla...
agpl-3.0
sserkez/ocelot
utils/correlate_field.py
2
1249
from ocelot.adaptors.genesis import * import matplotlib.animation as anim import numpy as np import matplotlib.pyplot as plt #file='/home/iagapov/data/fel/genesis_runs/flash_40fsec/2900A/run_1/run.1.gout' file='/home/iagapov/tmp/workshop/run_1/run.1.gout' g = readGenesisOutput(file) npoints = g('ncar') zstop = g('zst...
gpl-3.0
ryandougherty/mwa-capstone
MWA_Tools/build/matplotlib/lib/matplotlib/backends/backend_wx.py
1
78403
from __future__ import division """ backend_wx.py A wxPython backend for matplotlib, based (very heavily) on backend_template.py and backend_gtk.py Author: Jeremy O'Donoghue (jeremy@o-donoghue.com) Derived from original copyright work by John Hunter (jdhunter@ace.bsd.uchicago.edu) Copyright (C) Jeremy O'Don...
gpl-2.0
tgquintela/pythonUtils
pythonUtils/ExploreDA/Statistics/stats_functions.py
1
1108
""" Calcular estadistiques. """ import numpy as np import pandas as pd ## Creation of cnae index at a given level def cnae_index_level(col_cnae, level): pass # Distance def distance_cnae(col_cnae): pass def finantial_per_year(servicios): """Function which transform the servicios data to a data for ...
mit
IamMoondance/Attempts
Упрощённый метод Ньютона.py
1
8430
#Шибанова Дарья ИУ7-22 # Метод: упрощённый метод Ньютона. # 1. Уточнение корней уравнения. Задание большого отрезка, # шага, точности, максимального числа итераций. # Вывести: полученный корень, значение функции в точке корня # по спецификации типа e с минимальным числом цифр в мантиссе, # реально...
mit
GbalsaC/bitnamiP
venv/share/doc/networkx-1.7/examples/multigraph/chess_masters.py
4
5136
#!/usr/bin/env python """ An example of the MultiDiGraph clas The function chess_pgn_graph reads a collection of chess matches stored in the specified PGN file (PGN ="Portable Game Notation") Here the (compressed) default file --- chess_masters_WCC.pgn.bz2 --- contains all 685 World Chess Championship matches from...
agpl-3.0
ltiao/scikit-learn
sklearn/__init__.py
4
3052
""" Machine learning module for Python ================================== sklearn is a Python module integrating classical machine learning algorithms in the tightly-knit world of scientific Python packages (numpy, scipy, matplotlib). It aims to provide simple and efficient solutions to learning problems that are acc...
bsd-3-clause
kernelmilowill/PDMQBACKTEST
vn.datayes/storage.py
29
18623
import os import json import pymongo import pandas as pd from datetime import datetime, timedelta from api import Config, PyApi from api import BaseDataContainer, History, Bar from errors import (VNPAST_ConfigError, VNPAST_RequestError, VNPAST_DataConstructorError, VNPAST_DatabaseError) class DBConfig(Co...
mit
yonglehou/scikit-learn
examples/semi_supervised/plot_label_propagation_versus_svm_iris.py
286
2378
""" ===================================================================== Decision boundary of label propagation versus SVM on the Iris dataset ===================================================================== Comparison for decision boundary generated on iris dataset between Label Propagation and SVM. This demon...
bsd-3-clause
harisbal/pandas
pandas/tests/frame/test_analytics.py
2
87234
# -*- coding: utf-8 -*- from __future__ import print_function import warnings from datetime import timedelta import operator import pytest from string import ascii_lowercase from numpy import nan from numpy.random import randn import numpy as np from pandas.compat import lrange, PY35 from pandas import (compat, isn...
bsd-3-clause
vybstat/scikit-learn
examples/manifold/plot_mds.py
261
2616
""" ========================= Multi-dimensional scaling ========================= An illustration of the metric and non-metric MDS on generated noisy data. The reconstructed points using the metric MDS and non metric MDS are slightly shifted to avoid overlapping. """ # Author: Nelle Varoquaux <nelle.varoquaux@gmail....
bsd-3-clause
jamesturner246/mpfa
experiments/fig5/fig5.py
1
7145
import numpy as np import matplotlib.pyplot as plt from contextlib import ExitStack from itertools import islice # SETUP # %load_ext autoreload # %autoreload 2 # from experiments.experiment_2 import experiment_2 # ##### def experiment_2 (): experiment = 'fig2' experiment_new = 'fig5' v_name = 'nrn1_V_...
lgpl-3.0
AlexGrig/GPy
GPy/plotting/matplot_dep/svig_plots.py
15
1323
# Copyright (c) 2012, James Hensman and Nicolo' Fusi # Licensed under the BSD 3-clause license (see LICENSE.txt) import numpy as np from matplotlib import pyplot as pb def plot(model, ax=None, fignum=None, Z_height=None, **kwargs): if ax is None: fig = pb.figure(num=fignum) ax = fig.add_subplot(...
bsd-3-clause
roryk/exomeCov
ecov/variants.py
1
1705
import os import os.path as op import pandas as pd # from collections import Counter from bcbio.utils import rbind, file_exists, splitext_plus from bcbio.provenance import do from bcbio.distributed.transaction import file_transaction from bcbio.log import logger from bcbio.pipeline import config_utils from bcbio impor...
mit
tosolveit/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
zihua/scikit-learn
sklearn/tests/test_isotonic.py
34
14159
import warnings import numpy as np import pickle import copy from sklearn.isotonic import (check_increasing, isotonic_regression, IsotonicRegression) from sklearn.utils.testing import (assert_raises, assert_array_equal, assert_true, assert_false, assert...
bsd-3-clause
jtaylor/pysfm
sfm/model.py
1
8435
import numpy as np from util import norm, normed, rotvecs_to_Rs def point_set_error(Ps, Qs): return norm(Ps - Qs, axis=1).mean(axis=-1) class Scene(object): def __init__(self, Ss = None, S = None, Rs = None, Ts = None): # Try to use S if Ss is not defined. if Ss == None: ...
bsd-3-clause
anjalisood/spark-tk
regression-tests/generatedata/gmm_datagen.py
14
1129
# vim: set encoding=utf-8 # Copyright (c) 2016 Intel Corporation  # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # #       http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
apache-2.0
lamastex/scalable-data-science
dbcArchives/2021/000_0-sds-3-x-projects/student-project-13_group-Genomics/01_1000genomes.py
1
25595
# Databricks notebook source # MAGIC %md # MAGIC ScaDaMaLe Course [site](https://lamastex.github.io/scalable-data-science/sds/3/x/) and [book](https://lamastex.github.io/ScaDaMaLe/index.html) # COMMAND ---------- # MAGIC %md # MAGIC # MAGIC # Genomics Analysis with Glow and Spark # MAGIC # MAGIC # MAGIC **Link to ...
unlicense
cheeseywhiz/cheeseywhiz
math/Taylor Series/main.py
1
1884
#!/usr/bin/python3 import math import sys import inspect import matplotlib.pyplot as plt import differentiable xmin, xmax = -2, 4 ymin, ymax = -4, 4 h = 1 / 1000 dx = differentiable.equations() def taylor(f, center, order): """Plot a Taylor polynomial and its parent function taylor(differentiable equation f...
mit
alexeyum/scikit-learn
examples/ensemble/plot_isolation_forest.py
65
2363
""" ========================================== IsolationForest example ========================================== An example using IsolationForest for anomaly detection. The IsolationForest 'isolates' observations by randomly selecting a feature and then randomly selecting a split value between the maximum and minimu...
bsd-3-clause
abhishekgahlot/scikit-learn
sklearn/datasets/__init__.py
74
3616
""" The :mod:`sklearn.datasets` module includes utilities to load datasets, including methods to load and fetch popular reference datasets. It also features some artificial data generators. """ from .base import load_diabetes from .base import load_digits from .base import load_files from .base import load_iris from ....
bsd-3-clause
ptorrey/torrey_cmf
examples/plot_illustris_cvdf.py
1
1204
import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as colors import torrey_cmf tc = torrey_cmf.number_density() redshift_list = np.arange(7) n_bin = 100 l_min_vd = 1.8 l_max_vd = 2.7 r = l_max_vd - l_min_vd vd_array = np.arange(l_min_vd, l_max_vd, r / n_bin) fontsize=14 cm = pl...
gpl-2.0
Supermem/ibis
ibis/expr/api.py
6
47950
# Copyright 2015 Cloudera 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 writing, so...
apache-2.0
godfatherofpolka/SaliencyMapInPython
saliency.py
1
3107
#!/usr/bin/env python ''' Copyright 2015 Samuel Bucheli This file is part of SaliencyMapInPython. SaliencyMapInPython 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 (at your...
gpl-2.0
calico/basenji
bin/basenji_sad_ref.py
1
12179
#!/usr/bin/env python # Copyright 2017 Calico 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
apache-2.0
shusenl/scikit-learn
sklearn/feature_extraction/tests/test_feature_hasher.py
258
2861
from __future__ import unicode_literals import numpy as np from sklearn.feature_extraction import FeatureHasher from nose.tools import assert_raises, assert_true from numpy.testing import assert_array_equal, assert_equal def test_feature_hasher_dicts(): h = FeatureHasher(n_features=16) assert_equal("dict",...
bsd-3-clause
vsmolyakov/ml
sgd/python/sgd_lr.py
1
4627
import numpy as np import matplotlib.pyplot as plt import time from sklearn.datasets import load_iris np.random.seed(0) class sgdlr: def __init__(self): self.num_iter = 100 self.lmbda = 1e-9 self.tau0 = 10 self.kappa = 1 self.batchsize = 200 ...
mit
samshara/Stock-Market-Analysis-and-Prediction
smap_nepse/prediction/recurrent.py
1
3734
# time series prediction of stock data # using recurrent neural network with LSTM layer from pybrain.datasets import SequentialDataSet from itertools import cycle from pybrain.tools.shortcuts import buildNetwork from pybrain.structure.modules import LSTMLayer from pybrain.supervised import RPropMinusTrainer from pybrai...
mit
COOLMASON/ThinkStats2
code/brfss.py
69
4708
"""This file contains code for use with "Think Stats", by Allen B. Downey, available from greenteapress.com Copyright 2010 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ from __future__ import print_function import math import sys import pandas import numpy as np import thinkstats2 impo...
gpl-3.0
yonghenglh6/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
fabioticconi/scikit-learn
benchmarks/bench_random_projections.py
397
8900
""" =========================== Random projection benchmark =========================== Benchmarks for random projections. """ from __future__ import division from __future__ import print_function import gc import sys import optparse from datetime import datetime import collections import numpy as np import scipy.s...
bsd-3-clause
TitasNandi/Summer_Project
yodaqa/data/ml/answertrain.py
3
12914
""" Generic framework for training answer classifiers using sklearn on an answer TSV dataset. This module contains a generic train / test function and cross-validation routine, but does not define the actual classifier to use; it is expected that the calling scripts will provide these. """ import math from multiproce...
apache-2.0
CalebBell/thermo
thermo/utils/t_dependent_property.py
1
145532
# -*- coding: utf-8 -*- '''Chemical Engineering Design Library (ChEDL). Utilities for process modeling. Copyright (C) 2016, 2017, 2018, 2019, 2020 Caleb Bell <Caleb.Andrew.Bell@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (t...
mit
mogeiwang/nest
pynest/examples/twoneurons.py
8
1209
# -*- coding: utf-8 -*- # # twoneurons.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
bmcage/stickproject
stick/utils/process_bednetdata.py
1
1426
import os import fipy import matplotlib.pyplot as plt import numpy as np treshold = 2e-6 FIGFILEEXT = '.png' times = [] xpos = None for file in sorted(os.listdir('.')): if file[-3:] == '.gz': data = fipy.tools.dump.read(file) times.append(data['time']) if xpos is None: xpos = d...
gpl-2.0
zymsys/sms-tools
lectures/04-STFT/plots-code/window-size.py
22
1498
import math import matplotlib.pyplot as plt import numpy as np import time, os, sys sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/')) import dftModel as DF import utilFunctions as UF (fs, x) = UF.wavread('../../../sounds/oboe-A4.wav') N = 128 start = .81*fs x1 =...
agpl-3.0
dankolbman/CleverTind
figures/wc_hist.py
1
1432
# Create a histogram for word count data # Dan Kolbman 2014 import sys import numpy as np import matplotlib.pyplot as plt import matplotlib font = {'family' : 'normal', 'weight' : 'bold', 'size' : 28} matplotlib.rc('font', **font) def main( path ): wc = [] pct = [] # Read wc data with ope...
mit
Eric89GXL/scikit-learn
sklearn/cluster/tests/test_affinity_propagation.py
8
2686
""" Testing for Clustering methods """ import numpy as np from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_array_equal from sklearn.cluster.affinity_propagation_ import Affinit...
bsd-3-clause
lukauskas/scipy
scipy/stats/morestats.py
20
92783
# Author: Travis Oliphant, 2002 # # Further updates and enhancements by many SciPy developers. # from __future__ import division, print_function, absolute_import import math import warnings from collections import namedtuple import numpy as np from numpy import (isscalar, r_, log, around, unique, asarray, ...
bsd-3-clause
rjeli/scikit-image
doc/examples/features_detection/plot_blob.py
12
2998
""" ============== Blob Detection ============== Blobs are bright on dark or dark on bright regions in an image. In this example, blobs are detected using 3 algorithms. The image used in this case is the Hubble eXtreme Deep Field. Each bright dot in the image is a star or a galaxy. Laplacian of Gaussian (LoG) -------...
bsd-3-clause
mrshu/scikit-learn
examples/cluster/plot_adjusted_for_chance_measures.py
5
4318
""" ========================================================== 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
antoinecarme/pyaf
tests/time_res/test_ozone_Daily.py
1
1760
import pandas as pd import numpy as np import pyaf.ForecastEngine as autof import pyaf.Bench.TS_datasets as tsds #get_ipython().magic('matplotlib inline') b1 = tsds.load_ozone() df = b1.mPastData for k in [1 , 5]: df[b1.mTimeVar + "_" + str(k) + '_Daily'] = pd.date_range('2000-1-1', periods=df.shape[0], freq=st...
bsd-3-clause
AlexRobson/scikit-learn
examples/neighbors/plot_species_kde.py
282
4059
""" ================================================ Kernel Density Estimate of Species Distributions ================================================ This shows an example of a neighbors-based query (in particular a kernel density estimate) on geospatial data, using a Ball Tree built upon the Haversine distance metric...
bsd-3-clause
pyoceans/python-ctd
ctd/extras.py
2
8451
""" Extra functionality for plotting and post-processing. """ import matplotlib.pyplot as plt import numpy as np import numpy.ma as ma from pandas import Series def _extrap1d(interpolator): """ How to make scipy.interpolate return an extrapolated result beyond the input range. This is usually bad in...
bsd-3-clause
h2oai/h2o-dev
h2o-py/tests/testdir_algos/pca/pyunit_PUBDEV_4314_varimp.py
2
1303
from __future__ import print_function import sys sys.path.insert(1,"../../../") import h2o from tests import pyunit_utils from h2o.estimators.pca import H2OPrincipalComponentAnalysisEstimator as H2OPCA from h2o.utils.typechecks import assert_is_type from pandas import DataFrame # This test aims to test that our PCA w...
apache-2.0
riccardoklinger/gis-code-answer
points2stations/__init__.py
1
8219
# -*- coding: utf-8 -*- """ /*************************************************************************** points to bus A python workflow derives bus stations from point data ------------------- begin : 2016-03-01 git sha : $Format:%H$ copyright : (C) 2016 by Riccardo Klinger email ...
gpl-3.0
mbayon/TFG-MachineLearning
vbig/lib/python2.7/site-packages/scipy/fftpack/basic.py
7
21733
""" Discrete Fourier Transforms - basic.py """ # Created by Pearu Peterson, August,September 2002 from __future__ import division, print_function, absolute_import __all__ = ['fft','ifft','fftn','ifftn','rfft','irfft', 'fft2','ifft2'] from numpy import zeros, swapaxes import numpy from . import _fftpack im...
mit
kenshay/ImageScripter
ProgramData/SystemFiles/Python/Lib/site-packages/pandas/tests/frame/test_apply.py
7
17403
# -*- coding: utf-8 -*- from __future__ import print_function from datetime import datetime import warnings import numpy as np from pandas import (notnull, DataFrame, Series, MultiIndex, date_range, Timestamp, compat) import pandas as pd from pandas.types.dtypes import CategoricalDtype from pand...
gpl-3.0
linearregression/airflow
airflow/hooks/presto_hook.py
2
2601
from pyhive import presto from pyhive.exc import DatabaseError from airflow.hooks.dbapi_hook import DbApiHook import logging logging.getLogger("pyhive").setLevel(logging.INFO) class PrestoException(Exception): pass class PrestoHook(DbApiHook): """ Interact with Presto through PyHive! >>> ph = Pre...
apache-2.0
tdhopper/scikit-learn
examples/preprocessing/plot_robust_scaling.py
221
2702
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Robust Scaling on Toy Data ========================================================= Making sure that each Feature has approximately the same scale can be a crucial preprocessing step. However, when data contains o...
bsd-3-clause
manjunaths/tensorflow
tensorflow/tools/dist_test/python/census_widendeep.py
54
11900
# 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
yipenggao/moose
modules/combined/test/tests/thm_rehbinder/thm_rehbinder.py
3
5870
#!/usr/bin/env python import os import sys import numpy as np import matplotlib.pyplot as plt def rehbinder(r): # Results from Rehbinder with parameters used in the MOOSE simulation. # Rehbinder's manuscript contains a few typos - I've corrected them here. # G Rehbinder "Analytic solutions of stationary c...
lgpl-2.1
foreversand/QSTK
Bin/investors_report.py
5
6911
# # report.py # # Generates a html file containing a report based # off a timeseries of funds from a pickle file. # # Drew Bratcher # from pylab import * import numpy from QSTK.qstkutil import DataAccess as da from QSTK.qstkutil import qsdateutil as du from QSTK.qstkutil import tsutil as tsu from QSTK.q...
bsd-3-clause
justacec/bokeh
examples/app/crossfilter/main.py
6
6813
import math import numpy as np import pandas as pd from functools import partial from bokeh import palettes from bokeh.io import curdoc from bokeh.models import HBox, Select from bokeh.plotting import Figure from bokeh.sampledata.autompg import autompg from models import StyleableBox, StatsBox from models.helpers im...
bsd-3-clause
Adai0808/scikit-learn
benchmarks/bench_sparsify.py
323
3372
""" Benchmark SGD prediction time with dense/sparse coefficients. Invoke with ----------- $ kernprof.py -l sparsity_benchmark.py $ python -m line_profiler sparsity_benchmark.py.lprof Typical output -------------- input data sparsity: 0.050000 true coef sparsity: 0.000100 test data sparsity: 0.027400 model sparsity:...
bsd-3-clause
mtb-za/fatiando
cookbook/seismic_wavefd_rayleigh_wave.py
9
2865
""" Seismic: 2D finite difference simulation of elastic P and SV wave propagation in a medium with a discontinuity (i.e., Moho), generating Rayleigh waves """ import numpy as np from matplotlib import animation from fatiando import gridder from fatiando.seismic import wavefd from fatiando.vis import mpl # Set the para...
bsd-3-clause
jowr/jopy
jopy/styles/__init__.py
1
2133
import matplotlib.pyplot as plt try: from .plots import Figure except: from jopy.styles.plots import Figure def get_figure(orientation='landscape',width=110,fig=None,axs=False): """Creates a figure with some initial properties The object can be customised with the parameters. But since it is an...
mit
aewhatley/scikit-learn
examples/linear_model/plot_lasso_model_selection.py
311
5431
""" =================================================== Lasso model selection: Cross-Validation / AIC / BIC =================================================== Use the Akaike information criterion (AIC), the Bayes Information criterion (BIC) and cross-validation to select an optimal value of the regularization paramet...
bsd-3-clause
jrcohen02/brainx_archive2
brainx/version.py
4
2781
"""brainx version/release information""" # Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z" _version_major = 0 _version_minor = 1 _version_micro = '' # use '' for first of series, number for 1 and above _version_extra = 'dev' #_version_extra = '' # Uncomment this for full releases # Construc...
bsd-3-clause
louisLouL/pair_trading
capstone_env/lib/python3.6/site-packages/pandas/tests/series/test_operators.py
6
70514
# coding=utf-8 # pylint: disable-msg=E1101,W0612 import pytest from collections import Iterable from datetime import datetime, timedelta import operator from itertools import product, starmap from numpy import nan, inf import numpy as np import pandas as pd from pandas import (Index, Series, DataFrame, isnull, bdat...
mit
STREAM3/pyisc
unittests/test_p_ConditionalGaussianDependencyMatrix.py
1
4102
import unittest from unittest import TestCase from numpy import array,r_ from numpy.ma.testutils import assert_close from numpy.testing.utils import assert_allclose, assert_equal from scipy.stats import norm from scipy.stats.stats import pearsonr from sklearn.utils import shuffle from pyisc import AnomalyDetector, ...
lgpl-3.0
AlexRobson/nilmtk
nilmtk/datastore/hdfdatastore.py
6
11833
from __future__ import print_function, division import pandas as pd from itertools import repeat, tee from time import time from copy import deepcopy from collections import OrderedDict import numpy as np import yaml from os.path import isdir, isfile, join, exists, dirname from os import listdir, makedirs, rem...
apache-2.0
thorwhalen/ut
daf/plot.py
1
1671
__author__ = 'thor' import numpy as np import ut.pplot.hist import pandas as pd import matplotlib.pylab as plt from ut.util.utime import utc_ms_to_utc_datetime def count_hist(sr, sort_by='value', reverse=True, horizontal=None, ratio=False, **kwargs): horizontal = horizontal or isinstance(sr.iloc[0], str) ut....
mit
agdestine/machine-learning
code/abalone.py
3
1912
# abalone # Classification and Clustering of Wheat Dataset # # Author: Author: Benjamin Bengfort <bbengfort@districtdatalabs.com> # Created: Thu Feb 26 17:56:52 2015 -0500 # # Copyright (C) 2015 District Data Labs # For license information, see LICENSE.txt # # ID: abalone.py [] benjamin@bengfort.com $ """ Classif...
mit
marcino239/vtracker
common.py
1
6362
#!/usr/bin/env python ''' This module contains some common routines used by other samples. ''' import numpy as np import cv2 # built-in modules import os import itertools as it from contextlib import contextmanager image_extensions = ['.bmp', '.jpg', '.jpeg', '.png', '.tif', '.tiff', '.pbm', '.pgm', '.ppm'] class ...
gpl-2.0
StructuralNeurobiologyLab/SyConn
syconn/proc/image.py
1
17513
# -*- coding: utf-8 -*- # SyConn - Synaptic connectivity inference toolkit # # Copyright (c) 2016 - now # Max Planck Institute of Neurobiology, Martinsried, Germany # Authors: Sven Dorkenwald, Philipp Schubert, Joergen Kornfeld import numpy as np from ..proc import log_proc __cv2__ = True try: from cv2 import cre...
gpl-2.0
jskDr/keraspp
old/ae_conv_mnist.py
1
3199
######################################################### # Convolutional layer based AE with MNIST, Models/Class ######################################################### ########################### # AE 모델링 ########################### from keras import layers, models def Conv2D(filters, kernel_size, padding='same'...
mit
mailhexu/pyDFTutils
build/lib/pyDFTutils/tightbinding/mypythTB.py
2
18994
# -*- coding: utf-8 -*- #!/usr/bin/env python3 from pythtb import tb_model,w90 from ase.calculators.interface import Calculator,DFTCalculator from ase.dft.dos import DOS from ase.dft.kpoints import monkhorst_pack import numpy as np #from tetrahedronDos import tetrahedronDosClass from occupations import Occupations from...
lgpl-3.0
Khreas/Tiramisu-authorRecognition
mlp.py
1
10720
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import os import sys import random import numpy import argparse import matplotlib.pyplot as plt from sklearn import datasets from sklearn.preprocessing import StandardScaler from sklearn.neural_network import MLPClassifier alphabet...
unlicense
BonexGu/Blik2D-SDK
Blik2D/addon/tensorflow-1.2.1_for_blik/tensorflow/contrib/learn/python/learn/learn_io/data_feeder_test.py
71
12923
# 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...
mit
louispotok/pandas
pandas/tests/indexing/test_ix.py
3
12521
""" test indexing with ix """ import pytest from warnings import catch_warnings import numpy as np import pandas as pd from pandas.core.dtypes.common import is_scalar from pandas.compat import lrange from pandas import Series, DataFrame, option_context, MultiIndex from pandas.util import testing as tm from pandas.e...
bsd-3-clause
wchan/tensorflow
tensorflow/contrib/learn/python/learn/estimators/_sklearn.py
1
6535
"""sklearn cross-support.""" # Copyright 2015-present The Scikit Flow 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/LI...
apache-2.0
ThomasMiconi/htmresearch
projects/sequence_prediction/continuous_sequence/run_tm_model.py
3
16639
## ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013-2015, 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 ...
agpl-3.0
GiggleLiu/QuRBM
sstate.py
1
2572
'''Sparse State Representation.''' from numpy import * import numbers __all__=['SparseState','visualize_sstate','vec2sstate','soverlap'] def _compact_form(ws,configs): '''Merge duplicate configs.''' ws,configs=asarray(ws),asarray(configs) order=lexsort(configs.T) configs=configs[order] ws=ws[orde...
mit
reuk/wayverb
demo/evaluation/receivers/binaural.py
2
1438
#!/usr/local/bin/python import numpy as np import matplotlib render = True if render: matplotlib.use('pgf') import matplotlib.pyplot as plt import matplotlib.mlab as mlab from string import split import scipy.signal as signal import pysndfile import math import os import re import json def main(): files = [ ...
gpl-2.0
bnaul/scikit-learn
sklearn/tree/tests/test_export.py
6
18311
""" Testing for export functions of decision trees (sklearn.tree.export). """ from re import finditer, search from textwrap import dedent from numpy.random import RandomState import pytest from sklearn.base import is_classifier from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor from sklearn.ensemb...
bsd-3-clause
dhruv13J/scikit-learn
examples/covariance/plot_outlier_detection.py
235
3891
""" ========================================== Outlier detection with several methods. ========================================== When the amount of contamination is known, this example illustrates two different ways of performing :ref:`outlier_detection`: - based on a robust estimator of covariance, which is assumin...
bsd-3-clause
kwailamchan/programming-languages
python/tensorflow/demos/tensorflow/concepts/conway.py
3
1463
import numpy as np import tensorflow as tf from scipy.signal import convolve2d from matplotlib import pyplot as plt import matplotlib.animation as animation class Conway(object): def __init__(self): self.shape = (50, 50) self.session = tf.Session() def run(self): initial_board = se...
mit
ElDeveloper/qiime
qiime/make_distance_boxplots.py
15
12397
#!/usr/bin/env python from __future__ import division __author__ = "Jai Ram Rideout" __copyright__ = "Copyright 2012, The QIIME project" __credits__ = ["Jai Ram Rideout"] __license__ = "GPL" __version__ = "1.9.1-dev" __maintainer__ = "Jai Ram Rideout" __email__ = "jai.rideout@gmail.com" """Contains functions used in ...
gpl-2.0
geoscixyz/em_examples
em_examples/InductionSphereTEM.py
1
19333
from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals import numpy as np import scipy as sp import matplotlib.pyplot as plt from matplotlib.ticker import ScalarFormatter, FormatStrFormatter from matplotlib.path import Path import matplotlib.patches as patc...
mit
mxjl620/scikit-learn
sklearn/svm/classes.py
126
40114
import warnings import numpy as np from .base import _fit_liblinear, BaseSVC, BaseLibSVM from ..base import BaseEstimator, RegressorMixin from ..linear_model.base import LinearClassifierMixin, SparseCoefMixin, \ LinearModel from ..feature_selection.from_model import _LearntSelectorMixin from ..utils import check_X...
bsd-3-clause
ForschungszentrumJuelich/phenoVein
General/Modules/Macros/FZJveinThickness/veinThickness_fitInLogSpace.py
1
7063
# Copyright (c) 2015, Forschungszentrum Jülich GmbH # All rights reserved. # Contributors: Jonas Bühler, Daniel Pflugfelder, Siegfried Jahnke # Address: Institute of Bio- and Geosciences, Plant Sciences (IBG-2), Forschungszentrum Jülich GmbH, 52428 Jülich, Germany # # Redistribution and use in source and binary forms,...
bsd-3-clause
tjkemp/image-tractor
test_feature_sets.py
1
1958
import numpy as np import pandas as pd from datetime import datetime from sklearn.metrics import accuracy_score from sklearn.metrics import confusion_matrix from sklearn.svm import LinearSVC from sklearn.model_selection import train_test_split from sklearn.preprocessing import normalize def get_features(inputfile): ...
mit
gieseke/bufferkdtree
docs/sphinxext/docscrape_sphinx.py
1
9437
from __future__ import division, absolute_import, print_function import sys, re, inspect, textwrap, pydoc import sphinx import collections from docscrape import NumpyDocString, FunctionDoc, ClassDoc if sys.version_info[0] >= 3: sixu = lambda s: s else: sixu = lambda s: unicode(s, 'unicode_escape') class Sph...
gpl-2.0
kubeflow/kfserving
docs/samples/explanation/art/mnist/query_explain.py
1
2045
import requests import json from matplotlib import pyplot as plt import numpy as np from aix360.datasets import MNISTDataset import time import sys if len(sys.argv) < 3: raise Exception("No endpoint specified. ") endpoint = sys.argv[1] headers = { 'Host': sys.argv[2] } data = MNISTDataset() test_num = 349 is_...
apache-2.0
colin2328/asciiclass
lectures/lec6/match.py
3
4033
import csv from sklearn import tree import editdist import re #def string_match(s1,s2): def string_match_score(p1,p2,field): s1 = p1[field] s2 = p2[field] return editdist.distance(s1.lower(),s2.lower())/float(len(s1)) def jaccard_score(p1,p2,field): name1 = p1[field] name2 = p2[field] set1 = ...
mit
nicolas998/Op_Alarmas
02_Codigos/alarmas.py
1
6511
#!/usr/bin/env python import os import pandas as pd from wmf import wmf import numpy as np import glob ######################################################################## # VARIABLES GLOBALES ruta_store = None ruta_store_bck = None ######################################################################## # ...
gpl-3.0
IronManMark20/pyside2
doc/inheritance_diagram.py
10
12497
# -*- coding: utf-8 -*- r""" sphinx.ext.inheritance_diagram ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Defines a docutils directive for inserting inheritance diagrams. Provide the directive with one or more classes or modules (separated by whitespace). For modules, all of the classes in that module will ...
lgpl-2.1
cuevas1208/Traffic_Sign_Classifier
preprocess_augmentation.py
1
8132
## File: preprocess _augmentation.py ## Name: Manuel Cuevas ## Date: 01/14/2017 ## Project: CarND - LaneLines ## Desc: Augmentation pipeline; techniques like Random rotations, Zoom, ## brightness, shear, translation and color tones are used here. ## Usage: Data augmentation allows the network to learn the importa...
gpl-3.0
jairideout/scikit-bio
skbio/diversity/beta/tests/test_unifrac.py
6
30062
# ---------------------------------------------------------------------------- # 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
jokerbea/GOAT_Genetic_Output_Analysis_Tool
bokeh_GOAT/views.py
2
9957
# 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 u...
apache-2.0
sahands/pelican_article_recommender
article_recommender.py
1
3461
""" Article recommender plug-in that uses the content of the posts to determine post similarity. Uses scikit-learn, and nltk. """ from __future__ import unicode_literals from __future__ import print_function from codecs import open as codec_open from docutils.frontend import OptionParser from docutils.nodes import Fix...
mit