repo_name
stringlengths
7
92
path
stringlengths
5
149
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
911
693k
license
stringclasses
15 values
srus/django-kickstartvenv
boot/ipython/ipython_config.py
3
19804
# Configuration file for ipython. c = get_config() #------------------------------------------------------------------------------ # InteractiveShellApp configuration #------------------------------------------------------------------------------ # A Mixin for applications that start InteractiveShell instances. # # ...
mit
eickenberg/scikit-learn
sklearn/metrics/cluster/unsupervised.py
10
8104
""" Unsupervised evaluation metrics. """ # Authors: Robert Layton <robertlayton@gmail.com> # # License: BSD 3 clause import numpy as np from ...utils import check_random_state from ..pairwise import pairwise_distances def silhouette_score(X, labels, metric='euclidean', sample_size=None, random...
bsd-3-clause
jason-z-hang/airflow
airflow/contrib/plugins/metastore_browser/main.py
42
5126
from datetime import datetime import json from flask import Blueprint, request from flask.ext.admin import BaseView, expose import pandas as pd from airflow.hooks import HiveMetastoreHook, MySqlHook, PrestoHook, HiveCliHook from airflow.plugins_manager import AirflowPlugin from airflow.www import utils as wwwutils M...
apache-2.0
mjudsp/Tsallis
examples/classification/plot_digits_classification.py
34
2409
""" ================================ Recognizing hand-written digits ================================ An example showing how the scikit-learn can be used to recognize images of hand-written digits. This example is commented in the :ref:`tutorial section of the user manual <introduction>`. """ print(__doc__) # Autho...
bsd-3-clause
rexshihaoren/scikit-learn
examples/linear_model/plot_sgd_penalties.py
249
1563
""" ============== SGD: Penalties ============== Plot the contours of the three penalties. All of the above are supported by :class:`sklearn.linear_model.stochastic_gradient`. """ from __future__ import division print(__doc__) import numpy as np import matplotlib.pyplot as plt def l1(xs): return np.array([np....
bsd-3-clause
gtrensch/nest-simulator
pynest/examples/clopath_synapse_small_network.py
8
7493
# -*- coding: utf-8 -*- # # clopath_synapse_small_network.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 ...
gpl-2.0
huzq/scikit-learn
sklearn/tests/test_random_projection.py
9
13850
import functools from typing import List, Any import numpy as np import scipy.sparse as sp import pytest from sklearn.metrics import euclidean_distances from sklearn.random_projection import johnson_lindenstrauss_min_dim from sklearn.random_projection import _gaussian_random_matrix from sklearn.random_projection im...
bsd-3-clause
appapantula/scikit-learn
examples/neural_networks/plot_rbm_logistic_classification.py
258
4609
""" ============================================================== Restricted Boltzmann Machine features for digit classification ============================================================== For greyscale image data where pixel values can be interpreted as degrees of blackness on a white background, like handwritten...
bsd-3-clause
selective-inference/selective-inference
doc/learning_examples/HIV/stability_CV_6000.py
3
3166
import functools import numpy as np from scipy.stats import norm as ndist import regreg.api as rr # load in the X matrix from selection.tests.instance import HIV_NRTI X_full = HIV_NRTI(datafile="NRTI_DATA.txt", standardize=False)[0] from selection.learning.utils import full_model_inference, liu_inference, pivot_pl...
bsd-3-clause
evanthebouncy/nnhmm
radar_lstm/draw.py
6
2538
import numpy as np import matplotlib.pylab as plt import multiprocessing as mp from matplotlib import figure # m = [[0.0, 1.47, 2.43, 3.44, 1.08, 2.83, 1.08, 2.13, 2.11, 3.7], [1.47, 0.0, 1.5, 2.39, 2.11, 2.4, 2.11, 1.1, 1.1, 3.21], [2.43, 1.5, 0.0, 1.22, 2.69, 1.33, 3.39, 2.15, 2.12, 1.87], [3.44, 2.39, 1.22, 0....
mit
zhujianwei31415/dcnnfold
scripts/evaluation/evaluate_spec_sens_three_levels.py
2
1892
#! /usr/bin/env python # # Copyright # Author: zhujianwei@ict.ac.cn (Jianwei Zhu) from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import sys from sklearn.metrics import precision_recall_curve from sklearn.metrics import average_precision_s...
gpl-3.0
jcrist/blaze
blaze/compute/tests/test_bcolz_compute.py
9
5874
from __future__ import absolute_import, division, print_function import pytest bcolz = pytest.importorskip('bcolz') from datashape import discover, dshape import numpy as np import pandas.util.testing as tm from odo import into from blaze import by from blaze.expr import symbol from blaze.compute.core import compu...
bsd-3-clause
kmike/scikit-learn
examples/plot_lda_qda.py
12
4758
""" ==================================================================== Linear and Quadratic Discriminant Analysis with confidence ellipsoid ==================================================================== Plot the confidence ellipsoids of each class and decision boundary """ print(__doc__) from scipy import lin...
bsd-3-clause
BoldingBruggeman/gotm
gui.py/xmlplot/data/gotmtext.py
1
35659
import os, StringIO import numpy import xmlstore.xmlstore import xmlplot.common class LinkedFileVariableStore(xmlplot.common.VariableStore,xmlstore.datatypes.DataFileEx): # XML store-derived class for storing (cached) metadata of a data file, # such as coordinate ranges. # This is implemented as XML sto...
gpl-2.0
arjoly/scikit-learn
sklearn/covariance/tests/test_covariance.py
34
11120
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Gael Varoquaux <gael.varoquaux@normalesup.org> # Virgile Fritsch <virgile.fritsch@inria.fr> # # License: BSD 3 clause import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_alm...
bsd-3-clause
RayMick/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
Jay-Jay-D/LeanSTP
Algorithm.Framework/Portfolio/MinimumVariancePortfolioOptimizer.py
3
4622
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. # Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect 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 Lice...
apache-2.0
mayblue9/scikit-learn
sklearn/feature_extraction/tests/test_text.py
41
35602
from __future__ import unicode_literals import warnings from sklearn.feature_extraction.text import strip_tags from sklearn.feature_extraction.text import strip_accents_unicode from sklearn.feature_extraction.text import strip_accents_ascii from sklearn.feature_extraction.text import HashingVectorizer from sklearn.fe...
bsd-3-clause
Weihonghao/ECM
Vpy34/lib/python3.5/site-packages/pandas/io/sql.py
7
58343
# -*- coding: utf-8 -*- """ Collection of query wrappers / abstractions to both facilitate data retrieval and to reduce dependency on DB-specific API. """ from __future__ import print_function, division from datetime import datetime, date, time import warnings import re import numpy as np import pandas._libs.lib as ...
agpl-3.0
vshtanko/scikit-learn
sklearn/cluster/tests/test_birch.py
342
5603
""" Tests for the birch clustering algorithm. """ from scipy import sparse import numpy as np from sklearn.cluster.tests.common import generate_clustered_data from sklearn.cluster.birch import Birch from sklearn.cluster.hierarchical import AgglomerativeClustering from sklearn.datasets import make_blobs from sklearn.l...
bsd-3-clause
liuwenf/moose
modules/porous_flow/doc/tests/dispersion.py
14
1881
#!/usr/bin/env python import os import sys import numpy as np import matplotlib.pyplot as plt from scipy.special import erfc import pandas as pd # # Diffusion-only test # # Read MOOSE simulation data data = pd.read_csv("../../tests/dispersion/diff01_out_xmass_0021.csv") # The analytical solution is erfc(u) where u i...
lgpl-2.1
zifeo/nest-simulator
topology/pynest/tests/test_plotting.py
13
4111
# -*- coding: utf-8 -*- # # test_plotting.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, ...
gpl-2.0
kcavagnolo/astroML
book_figures/chapter6/fig_great_wall_MST.py
3
5216
""" Euclidean Minimum Spanning Tree ------------------------------- Figure 6.15 An approximate Euclidean minimum spanning tree over the two-dimensional projection of the SDSS Great Wall. The upper panel shows the input points, and the middle panel shows the dendrogram connecting them. The lower panel shows clustering ...
bsd-2-clause
aflaxman/scikit-learn
sklearn/decomposition/tests/test_truncated_svd.py
66
8261
"""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
Petr-Kovalev/nupic-win32
external/linux32/lib/python2.6/site-packages/matplotlib/_mathtext_data.py
69
57988
""" font data tables for truetype and afm computer modern fonts """ # this dict maps symbol names to fontnames, glyphindex. To get the # glyph index from the character code, you have to use get_charmap """ from matplotlib.ft2font import FT2Font font = FT2Font('/usr/local/share/matplotlib/cmr10.ttf') items = font.get_...
gpl-3.0
vybstat/scikit-learn
sklearn/externals/joblib/parallel.py
79
35628
""" Helpers for embarrassingly parallel code. """ # Author: Gael Varoquaux < gael dot varoquaux at normalesup dot org > # Copyright: 2010, Gael Varoquaux # License: BSD 3 clause from __future__ import division import os import sys import gc import warnings from math import sqrt import functools import time import thr...
bsd-3-clause
glemaitre/UnbalancedDataset
imblearn/under_sampling/prototype_generation/cluster_centroids.py
2
7740
"""Class to perform under-sampling by generating centroids based on clustering.""" # Authors: Guillaume Lemaitre <g.lemaitre58@gmail.com> # Fernando Nogueira # Christos Aridas # License: MIT from __future__ import division, print_function import numpy as np from scipy import sparse from sklearn.cl...
mit
gkoh/pynab
scripts/nzedb_pre_import.py
2
7655
""" Pynab nzedb pre import Imports pre files from nzedb dropbox Usage: nzedb_pre_import.py large|small Options: -h --help Show this screen. --version Show version. """ # This is quite possibly the most hilariously complex import process... # What I can gather as the column name...
gpl-2.0
JackKelly/neuralnilm_prototype
scripts/e288.py
2
5039
from __future__ import print_function, division import matplotlib import logging from sys import stdout matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! from neuralnilm import (Net, RealApplianceSource, BLSTMLayer, DimshuffleLayer, Bidirectio...
mit
etraiger/PCWG
plots.py
2
15226
import os import pandas as pd from Analysis import chckMake np = pd.np class MatplotlibPlotter(object): def __init__(self,path, analysis): self.path = path self.analysis = analysis def plot_multiple(self, windSpeedCol, powerCol, meanPowerCurveObj): try: from matplotlib impo...
mit
herberthudson/pynance
pynance/common.py
2
5485
""" .. Copyright (c) 2014, 2015 Marshall Farrier license http://opensource.org/licenses/MIT Common - generic functions (:mod:`pynance.common`) ================================================== .. currentmodule:: pynance.common """ import pandas as pd def featurize(equity_data, n_sessions, **kwargs): """ ...
mit
herilalaina/scikit-learn
sklearn/decomposition/tests/test_factor_analysis.py
112
3203
# Author: Christian Osendorfer <osendorf@gmail.com> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD3 import numpy as np from sklearn.utils.testing import assert_warns from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_greater from sklearn.utils.testing im...
bsd-3-clause
BillyLiggins/fitting
first.py
1
7031
import copy import echidna import echidna.output.plot as plot import echidna.core.spectra as spectra from echidna.output import store import matplotlib.pyplot as plt import argparse import glob import numpy as np import os def convertor(path): flist=np.array(glob.glob(path)) for ntuple in flist: os.sy...
mit
jobelenus/thegreco
ignore/tracegen.py
1
1364
#!/usr/bin/env python # vim:ts=4:sts=4:sw=4:et:wrap:ai:fileencoding=utf-8: import collections #import matplotlib.pyplot as plt factor = 1/4 class TraceGenerator(): def __init__(self): fname='/Users/jobelenus/work/thegreco/cpu.entries' self.fname = fname with open(self.fname) as ...
gpl-3.0
seckcoder/lang-learn
python/sklearn/sklearn/decomposition/tests/test_kernel_pca.py
1
7069
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_raises from sklearn.decomposition import PCA, KernelPCA from sklearn.datasets import make_circles from sklearn.linear_model i...
unlicense
fzalkow/scikit-learn
sklearn/linear_model/tests/test_omp.py
272
7752
# Author: Vlad Niculae # Licence: BSD 3 clause import numpy as np from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equa...
bsd-3-clause
mining/mining
mining/models/cube.py
4
3819
# -*- coding: utf-8 -*- import gc import pandas from datetime import datetime from pandas import DataFrame from sqlalchemy import create_engine from sqlalchemy.sql import text from sqlalchemy.orm import sessionmaker from mining.utils import conf, log_it from mining.utils._pandas import fix_render from mining.db impo...
mit
poojavade/Genomics_Docker
Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/ipython-2.2.0-py2.7.egg/IPython/testing/iptestcontroller.py
7
21202
# -*- coding: utf-8 -*- """IPython Test Process Controller This module runs one or more subprocesses which will actually run the IPython test suite. """ #----------------------------------------------------------------------------- # Copyright (C) 2009-2011 The IPython Development Team # # Distributed under the t...
apache-2.0
pprett/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
yavalvas/yav_com
build/matplotlib/lib/mpl_examples/widgets/slider_demo.py
13
1179
import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import Slider, Button, RadioButtons fig, ax = plt.subplots() plt.subplots_adjust(left=0.25, bottom=0.25) t = np.arange(0.0, 1.0, 0.001) a0 = 5 f0 = 3 s = a0*np.sin(2*np.pi*f0*t) l, = plt.plot(t,s, lw=2, color='red') plt.axis([0, 1, -10, 10]) a...
mit
heliopython/heliopy
doc/source/conf.py
1
11504
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ # heliopy documentation build configuration file, created by # sphinx-quickstart # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All c...
gpl-3.0
tfwillems/STRValidator
pedigree_analysis.py
1
23183
import matplotlib as mpl mpl.use('Agg') import collections import sys import numpy import matplotlib.pyplot as plt import vcf from matplotlib.backends.backend_pdf import PdfPages from fractions import Fraction class TRIO: def __init__(self, child, mother, father): self.child = child self.mother =...
gpl-3.0
DTOcean/dtocean-core
tests/test_data_definitions_xgrid2d.py
1
4013
import pytest import numpy as np import matplotlib.pyplot as plt from aneris.control.factory import InterfaceFactory from dtocean_core.core import (AutoFileInput, AutoFileOutput, AutoPlot, Core) from dtocean_core.data import ...
gpl-3.0
aajtodd/zipline
tests/risk/answer_key.py
39
11989
# # Copyright 2014 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 wr...
apache-2.0
thp44/delphin_6_automation
data_process/2d_1d/archieve/temperature.py
1
18075
__author__ = "Christian Kongsgaard" __license__ = 'MIT' # -------------------------------------------------------------------------------------------------------------------- # # IMPORTS # Modules import matplotlib.pyplot as plt import numpy as np import os import datetime import matplotlib.dates as mdates import pan...
mit
BiaDarkia/scikit-learn
examples/semi_supervised/plot_label_propagation_digits_active_learning.py
33
4174
""" ======================================== Label Propagation digits active learning ======================================== Demonstrates an active learning technique to learn handwritten digits using label propagation. We start by training a label propagation model with only 10 labeled points, then we select the t...
bsd-3-clause
stharrold/ARCHIVED_bench_fastq
bench_fastq/utils.py
2
15946
#!/usr/bin/env python """Utils to parse the terminal output from bench_compress.sh """ from __future__ import print_function, division, absolute_import import os import sys import json import datetime as dt import numpy as np import pandas as pd import matplotlib.pyplot as plt def parse_elapsed(elapsed): """Pars...
mit
ESMG/ESMG-configs
CCS1/plot_vort.py
1
2295
import numpy as np import netCDF4 import os import sys import subprocess import pyroms from pyroms_toolbox import jday2date from mpl_toolkits.basemap import Basemap import numpy as np import matplotlib.pyplot as plt from datetime import datetime # draw line around map projection limb. # color background of map projec...
gpl-3.0
mrcslws/htmresearch
projects/thing_classification/thing_convergence.py
3
13625
# 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 program is free software: you can redistribute it and/or modify # it under the ...
agpl-3.0
GuessWhoSamFoo/pandas
pandas/tests/frame/conftest.py
1
5594
import numpy as np import pytest from pandas import DataFrame, NaT, compat, date_range import pandas.util.testing as tm @pytest.fixture def float_frame(): """ Fixture for DataFrame of floats with index of unique strings Columns are ['A', 'B', 'C', 'D']. """ return DataFrame(tm.getSeriesData()) ...
bsd-3-clause
r-mart/scikit-learn
sklearn/manifold/tests/test_t_sne.py
162
9771
import sys from sklearn.externals.six.moves import cStringIO as StringIO import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_raises_regexp ...
bsd-3-clause
anderson1008/NOCulator
hring/src/Script/my_print.py
1
8437
#!/usr/bin/python import sys import os import re import fnmatch import string import matplotlib.pyplot as plt def print_period(stat): # use to profile the application running solo. # stat is an iterator or array i = 0 for item in stat: plt.plot(item, label=str(i)) p...
mit
gfyoung/pandas
pandas/tests/arrays/integer/test_function.py
5
6401
import numpy as np import pytest import pandas as pd import pandas._testing as tm from pandas.core.arrays import FloatingArray @pytest.mark.parametrize("ufunc", [np.abs, np.sign]) # np.sign emits a warning with nans, <https://github.com/numpy/numpy/issues/15127> @pytest.mark.filterwarnings("ignore:invalid value enco...
bsd-3-clause
nolanliou/tensorflow
tensorflow/contrib/learn/python/learn/estimators/kmeans.py
15
10904
# 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
abretaud/tools-iuc
tools/heinz/heinz_scoring.py
21
3661
#!/usr/bin/env python """Calculate scores for Heinz. This script transform a p-value into a score: 1. Use alpha and lambda to calculate a threshold P-value. 2. Calculate a score based on each P-value by alpha and the threshold. For more details, please refer to the paper doi:10.1093/bioinformatics/btn161 Inp...
mit
MechCoder/scikit-learn
examples/neighbors/plot_kde_1d.py
60
5120
""" =================================== Simple 1D Kernel Density Estimation =================================== This example uses the :class:`sklearn.neighbors.KernelDensity` class to demonstrate the principles of Kernel Density Estimation in one dimension. The first plot shows one of the problems with using histogram...
bsd-3-clause
mjgrav2001/scikit-learn
benchmarks/bench_plot_ward.py
290
1260
""" Benchmark scikit-learn's Ward implement compared to SciPy's """ import time import numpy as np from scipy.cluster import hierarchy import pylab as pl from sklearn.cluster import AgglomerativeClustering ward = AgglomerativeClustering(n_clusters=3, linkage='ward') n_samples = np.logspace(.5, 3, 9) n_features = n...
bsd-3-clause
gingi99/research_dr
python/MLEM2/discrimination.py
1
12551
# coding: utf-8 # python 3.5 import sys import os sys.path.append('/Users/ooki/git/research_dr/python/MLEM2') sys.path.append(os.path.dirname(os.path.abspath("__file__"))+'/../MLEM2') from sklearn.metrics import accuracy_score import copy import importlib import mlem2 import LERS importlib.reload(mlem2) importlib.rel...
mit
istellartech/OpenGoddard
examples/11_Polar_TSTO_Taiki.py
1
19117
# -*- coding: utf-8 -*- # Copyright 2017 Interstellar Technologies Inc. All Rights Reserved. from __future__ import print_function import numpy as np from scipy import interpolate import matplotlib.pyplot as plt from OpenGoddard.optimize import Problem, Guess, Condition, Dynamics class Rocket: # Atmosphere Param...
mit
algorithmic-music-exploration/amen
amen/timing.py
1
3596
#!/usr/bin/env python '''Timing interface''' from bisect import bisect_left, bisect_right import numpy as np import pandas as pd import librosa class TimeSlice(object): """ A slice of time: has a start time, a duration, and a reference to an Audio object. """ def __init__(self, time, duration, au...
bsd-2-clause
akionakamura/scikit-learn
sklearn/tests/test_isotonic.py
230
11087
import numpy as np import pickle from sklearn.isotonic import (check_increasing, isotonic_regression, IsotonicRegression) from sklearn.utils.testing import (assert_raises, assert_array_equal, assert_true, assert_false, assert_equal, ...
bsd-3-clause
ndingwall/scikit-learn
sklearn/datasets/_california_housing.py
11
6174
"""California housing dataset. The original database is available from StatLib http://lib.stat.cmu.edu/datasets/ The data contains 20,640 observations on 9 variables. This dataset contains the average house value as target variable and the following input variables (features): average income, housing average ag...
bsd-3-clause
jorik041/scikit-learn
examples/svm/plot_svm_regression.py
249
1451
""" =================================================================== Support Vector Regression (SVR) using linear and non-linear kernels =================================================================== Toy example of 1D regression using linear, polynomial and RBF kernels. """ print(__doc__) import numpy as np ...
bsd-3-clause
nelango/ViralityAnalysis
model/lib/pandas/tests/test_msgpack/test_extension.py
9
2254
from __future__ import print_function import array import pandas.msgpack as msgpack from pandas.msgpack import ExtType def test_pack_ext_type(): def p(s): packer = msgpack.Packer() packer.pack_ext_type(0x42, s) return packer.bytes() assert p(b'A') == b'\xd4\x42A' # fixe...
mit
bchappet/dnfpy
src/dnfpyUtils/stats/clusterMap.py
1
7473
from dnfpy.core.map2D import Map2D import numpy as np from sklearn.cluster import DBSCAN import scipy.spatial.distance as dist from dnfpyUtils.stats.statistic import Statistic class ClusterMap(Statistic): """ Params: "continuity" : float if different of 0.0, we assume that the cluster are continuous ...
gpl-2.0
kai5263499/networkx
examples/graph/unix_email.py
62
2683
#!/usr/bin/env python """ Create a directed graph, allowing multiple edges and self loops, from a unix mailbox. The nodes are email addresses with links that point from the sender to the recievers. The edge data is a Python email.Message object which contains all of the email message data. This example shows the po...
bsd-3-clause
amolkahat/pandas
pandas/util/_validators.py
4
13052
""" Module that contains many useful utilities for validating data or function arguments """ import warnings from pandas.core.dtypes.common import is_bool def _check_arg_length(fname, args, max_fname_arg_count, compat_args): """ Checks whether 'args' has length of at most 'compat_args'. Raises a TypeErro...
bsd-3-clause
CallaJun/hackprince
indico/matplotlib/gridspec.py
10
15668
""" :mod:`~matplotlib.gridspec` is a module which specifies the location of the subplot in the figure. ``GridSpec`` specifies the geometry of the grid that a subplot will be placed. The number of rows and number of columns of the grid need to be set. Optionally, the subplot layout parameter...
lgpl-3.0
jayantk/pnp
experiments/dipart/scripts/visualize/generate_heatmap.py
1
1411
#!/usr/bin/python # Generate heatmap of points import numpy as np import seaborn as sns sns.set() import matplotlib.pyplot as plt from heatmap_data import * # image_name= # im = plt.imread(image_name); # implot = plt.imshow(im); # Load the example flights dataset and conver to long-form # flights_long = sns.load_da...
apache-2.0
treycausey/scikit-learn
examples/linear_model/plot_ransac.py
250
1673
""" =========================================== Robust linear model estimation using RANSAC =========================================== In this example we see how to robustly fit a linear model to faulty data using the RANSAC algorithm. """ import numpy as np from matplotlib import pyplot as plt from sklearn import ...
bsd-3-clause
vorwerkc/pymatgen
pymatgen/analysis/chemenv/coordination_environments/voronoi.py
5
44209
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ This module contains the object used to describe the possible bonded atoms based on a Voronoi analysis. """ __author__ = "David Waroquiers" __copyright__ = "Copyright 2012, The Materials Project" __credit...
mit
djgagne/scikit-learn
sklearn/linear_model/tests/test_randomized_l1.py
214
4690
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD 3 clause import numpy as np from scipy import sparse from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.linear_model.randomized_l1 i...
bsd-3-clause
adit-chandra/tensorflow
tensorflow/lite/experimental/micro/examples/micro_speech/apollo3/compare_1k.py
11
5011
# Copyright 2018 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
costypetrisor/scikit-learn
sklearn/gaussian_process/tests/test_gaussian_process.py
267
6813
""" Testing for Gaussian Process module (sklearn.gaussian_process) """ # Author: Vincent Dubourg <vincent.dubourg@gmail.com> # Licence: BSD 3 clause from nose.tools import raises from nose.tools import assert_true import numpy as np from sklearn.gaussian_process import GaussianProcess from sklearn.gaussian_process ...
bsd-3-clause
triskadecaepyon/pyworkout-toolkit
pyworkout/parsers/tcxtools.py
1
4560
""" Tools to process TCX files, specifically for parsing and converting to other formats. """ import numpy as np import pandas as pd from lxml import objectify import dateutil.parser import logging TPXNS = "{http://www.garmin.com/xmlschemas/ActivityExtension/v2}TPX" LXNS = "{http://www.garmin.com/xmlschemas/ActivityE...
bsd-3-clause
cdondrup/strands_qsr_lib
qsr_lib/dbg/dbg_template_bounding_boxes_qsrs.py
8
2711
#!/usr/bin/python # import numpy as np from matplotlib import pyplot as plt from matplotlib.patches import Rectangle class Dbg(object): def __init__(self): pass def return_bounding_box_2d(self, x, y, xsize, ysize): """Return the bounding box :param x: x center :param y: y cen...
mit
matthew-tucker/mne-python
mne/viz/tests/test_topo.py
7
4728
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Denis Engemann <denis.engemann@gmail.com> # Martin Luessi <mluessi@nmr.mgh.harvard.edu> # Eric Larson <larson.eric.d@gmail.com> # # License: Simplified BSD import os.path as op import warnings from collections import n...
bsd-3-clause
amitsela/beam
sdks/python/apache_beam/examples/complete/juliaset/juliaset/juliaset.py
9
4504
# # 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 us...
apache-2.0
simon-pepin/scikit-learn
sklearn/ensemble/tests/test_base.py
284
1328
""" Testing for the base module (sklearn.ensemble.base). """ # Authors: Gilles Louppe # License: BSD 3 clause from numpy.testing import assert_equal from nose.tools import assert_true from sklearn.utils.testing import assert_raise_message from sklearn.datasets import load_iris from sklearn.ensemble import BaggingCla...
bsd-3-clause
ElessarWebb/dummy
src/dummy/viewer/formatting/plotformatters.py
1
2788
from dummy.viewer.formatting import ResultFormatter, Formatter import logging logger = logging.getLogger( __name__ ) try: import pylab import numpy @Formatter.register( 'plot' ) class PlotFormatter( ResultFormatter ): def __init__( self, *args, **kwargs ): super( PlotFormatter, self ).__init__( self, *args...
mit
chriscrosscutler/scikit-image
doc/ext/plot_directive.py
89
20530
""" A special directive for generating a matplotlib plot. .. warning:: This is a hacked version of plot_directive.py from Matplotlib. It's very much subject to change! Usage ----- Can be used like this:: .. plot:: examples/example.py .. plot:: import matplotlib.pyplot as plt plt.plot...
bsd-3-clause
maxyeg/beaker-notebook
plugin/ipythonPlugins/src/dist/python3/beaker_runtime3.py
5
18118
# Copyright 2014 TWO SIGMA OPEN SOURCE, 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 or agre...
apache-2.0
pietroquaglio/elephant
elephant/test/test_pandas_bridge.py
2
113211
# -*- coding: utf-8 -*- """ Unit tests for the pandas bridge module. :copyright: Copyright 2014-2016 by the Elephant team, see AUTHORS.txt. :license: Modified BSD, see LICENSE.txt for details. """ from __future__ import division, print_function import unittest from itertools import chain from neo.test.generate_data...
bsd-3-clause
leogulus/pisco_pipeline
pisco_photometry_all_2019.py
1
76497
import sys, os, re, yaml, subprocess, shlex, FITS_tools import pandas as pd import numpy as np import pickle import matplotlib import matplotlib.pyplot as plt from matplotlib import image import matplotlib.cm as cm import matplotlib.image as mpimg from scipy.optimize import curve_fit import scipy.integrate as integr...
mit
burakbayramli/classnotes
stat/stat_065_powerlaw/powerlaw.py
2
106244
#The MIT License (MIT) # #Copyright (c) 2013 Jeff Alstott # #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation files (the "Software"), to deal #in the Software without restriction, including without limitation the rights #to use, copy, modify, me...
gpl-3.0
kdheepak89/RTDT
RTDT/transit.py
1
13035
from __future__ import print_function from google.transit import gtfs_realtime_pb2 import requests import pandas as pd from io import BytesIO import zipfile import os import os.path import datetime import math UTC_OFFSET = int(os.getenv('OFFSET', 7)) DEFAULT_LOCATION = {u'lat': 39.7433814, u'lng': -104.98910989999999}...
bsd-3-clause
yyjiang/scikit-learn
examples/linear_model/plot_ols_3d.py
350
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
MobleyLab/SAMPL6
host_guest/Analysis/Scripts/analyze_sampling.py
1
116143
#!/usr/bin/env python # ============================================================================= # GLOBAL IMPORTS # ============================================================================= import collections import copy import itertools import json import math import os import numpy as np import pandas as ...
mit
ClimbsRocks/scikit-learn
examples/linear_model/plot_sgd_comparison.py
112
1819
""" ================================== Comparing various online solvers ================================== An example showing how different online solvers perform on the hand-written digits dataset. """ # Author: Rob Zinkov <rob at zinkov dot com> # License: BSD 3 clause import numpy as np import matplotlib.pyplot a...
bsd-3-clause
hainm/statsmodels
examples/python/robust_models_1.py
25
8588
## M-Estimators for Robust Linear Modeling from __future__ import print_function import numpy as np from scipy import stats import matplotlib.pyplot as plt import statsmodels.api as sm # * An M-estimator minimizes the function # # $$Q(e_i, \rho) = \sum_i~\rho \left (\frac{e_i}{s}\right )$$ # # where $\rho$ is a...
bsd-3-clause
Unidata/MetPy
v0.6/_downloads/Find_Natural_Neighbors_Verification.py
3
2729
# Copyright (c) 2016 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """ Find Natural Neighbors Verification =================================== Finding natural neighbors in a triangulation A triangle is a natural neighbor of a point if that point i...
bsd-3-clause
ijat/Hotspot-PUTRA-Auto-login
PyInstaller-3.2/PyInstaller/hooks/hook-IPython.py
1
1076
#----------------------------------------------------------------------------- # Copyright (c) 2013-2016, PyInstaller Development Team. # # Distributed under the terms of the GNU General Public License with exception # for distributing bootloader. # # The full license is in the file COPYING.txt, distributed with this s...
gpl-3.0
chaubold/hytra
scripts/train_transition_classifier.py
1
17108
# pythonpath modification to make hytra and empryonic available # for import without requiring it to be installed from __future__ import print_function, absolute_import, nested_scopes, generators, division, with_statement, unicode_literals import os import sys sys.path.insert(0, os.path.abspath('..')) # standard impor...
mit
louisLouL/pair_trading
capstone_env/lib/python3.6/site-packages/pandas/compat/__init__.py
6
11686
""" compat ====== Cross-compatible functions for Python 2 and 3. Key items to import for 2/3 compatible code: * iterators: range(), map(), zip(), filter(), reduce() * lists: lrange(), lmap(), lzip(), lfilter() * unicode: u() [u"" is a syntax error in Python 3.0-3.2] * longs: long (int in Python 3) * callable * iterab...
mit
Brett777/Predict-Risk
ApprovalModel.py
1
1979
# coding: utf-8 # In[ ]: import h2o import pandas as pd # initialize the model scoring server h2o.init(nthreads=1,max_mem_size=1, start_h2o=True, strict_version_check = False) def approve_loan(Loan_Amount,Term,Interest_Rate,Employment_Years,Home_Ownership,Annual_Income,Verification_Status,Loan_Purpose,State, ...
apache-2.0
datacommonsorg/data
scripts/india_census/common/generic_base.py
1
5322
# Copyright 2020 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
apache-2.0
bundgus/python-playground
matplotlib-playground/examples/event_handling/looking_glass.py
1
1280
import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches x, y = np.random.rand(2, 200) fig, ax = plt.subplots() circ = patches.Circle((0.5, 0.5), 0.25, alpha=0.8, fc='yellow') ax.add_patch(circ) ax.plot(x, y, alpha=0.2) line, = ax.plot(x, y, alpha=1.0, clip_path=circ) class EventHand...
mit
zbarge/zeex
zeex/core/views/actions/merge_purge.py
1
33284
""" MIT License Copyright (c) 2016 Zeke Barge Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, di...
mit
heliazandi/volttron-applications
pnnl/PGnE/pgne/agent.py
3
12179
# -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # Copyright (c) 2016, Battelle Memorial Institute # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistri...
bsd-3-clause
tomevans/pyphotom
photom_class.py
1
14267
import numpy as np import matplotlib.pyplot as plt import pdb import os import cPickle import numpy as np import shutil from photom import photom_inspect, photom_reduce, photom_absolute, photom_relative, photom_checks, photom_optimise homestr = os.path.expanduser( '~' ) class photom(): """ """ def __init_...
gpl-2.0