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
henryiii/rootpy
setup.py
1
4868
#!/usr/bin/env python # Copyright 2012 the rootpy developers # distributed under the terms of the GNU General Public License import sys # check Python version if sys.version_info < (2, 6): sys.exit("rootpy only supports python 2.6 and above") # check that ROOT can be imported try: import ROOT except ImportEr...
gpl-3.0
devs1991/test_edx_docmode
venv/lib/python2.7/site-packages/sklearn/cluster/tests/test_spectral.py
2
4661
"""Testing for Spectral Clustering methods""" from cPickle import dumps, loads import nose import numpy as np from numpy.testing import assert_equal from nose.tools import assert_raises from scipy import sparse from sklearn.datasets.samples_generator import make_blobs from sklearn.utils.testing import assert_greater ...
agpl-3.0
cqychen/quants
quants/loaddata/skyeye_ods_tra_day_k.py
1
2243
#coding=utf8 import tushare as ts; import pymysql; import time as dt from datashape.coretypes import string from pandas.io.sql import SQLDatabase import sqlalchemy import datetime from sqlalchemy import create_engine from pandas.io import sql import threading import pandas as pd; import sys sys.path.append('../') #添加配...
epl-1.0
all-umass/metric-learn
metric_learn/mlkr.py
1
5278
""" Metric Learning for Kernel Regression (MLKR), Weinberger et al., MLKR is an algorithm for supervised metric learning, which learns a distance function by directly minimising the leave-one-out regression error. This algorithm can also be viewed as a supervised variation of PCA and can be used for dimensionality red...
mit
466152112/scikit-learn
sklearn/kernel_ridge.py
44
6504
"""Module :mod:`sklearn.kernel_ridge` implements kernel ridge regression.""" # Authors: Mathieu Blondel <mathieu@mblondel.org> # Jan Hendrik Metzen <jhm@informatik.uni-bremen.de> # License: BSD 3 clause import numpy as np from .base import BaseEstimator, RegressorMixin from .metrics.pairwise import pairwise...
bsd-3-clause
Vimos/scikit-learn
examples/calibration/plot_compare_calibration.py
82
5012
""" ======================================== Comparison of Calibration of Classifiers ======================================== Well calibrated classifiers are probabilistic classifiers for which the output of the predict_proba method can be directly interpreted as a confidence level. For instance a well calibrated (bi...
bsd-3-clause
clemkoa/scikit-learn
examples/model_selection/plot_precision_recall.py
7
10356
""" ================ Precision-Recall ================ Example of Precision-Recall metric to evaluate classifier output quality. Precision-Recall is a useful measure of success of prediction when the classes are very imbalanced. In information retrieval, precision is a measure of result relevancy, while recall is a m...
bsd-3-clause
Titan-C/scikit-learn
examples/plot_kernel_ridge_regression.py
4
6351
""" ============================================= Comparison of kernel ridge regression and SVR ============================================= Both kernel ridge regression (KRR) and SVR learn a non-linear function by employing the kernel trick, i.e., they learn a linear function in the space induced by the respective k...
bsd-3-clause
prheenan/Research
Personal/EventDetection/OtherMethods/Roduit2012_OpenFovea/main_minimal_working_example.py
1
1950
# force floating point division. Can still use integer with // from __future__ import division # This file is used for importing the common utilities classes. import numpy as np import matplotlib.pyplot as plt import sys sys.path.append("../../../../../") from Research.Personal.EventDetection.OtherMethods import metho...
gpl-3.0
jmschrei/scikit-learn
examples/model_selection/plot_train_error_vs_test_error.py
349
2577
""" ========================= Train error vs Test error ========================= Illustration of how the performance of an estimator on unseen data (test data) is not the same as the performance on training data. As the regularization increases the performance on train decreases while the performance on test is optim...
bsd-3-clause
dancingdan/tensorflow
tensorflow/contrib/metrics/python/kernel_tests/histogram_ops_test.py
24
9587
# 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
jajcayn/pyclits
examples/8-empirical_model.py
1
5518
""" Examples for pyCliTS -- https://github.com/jajcayn/pyclits """ # now, we'll build similar model as in Kondrashov et al., J. Climate, 18, 2005. that is multi-level model based on idea od # LIM - linear inverse model, so it will be data-based # import modules import pyclits as clt from datetime import date import...
mit
Orcuslc/ECSGCC-Data
scripts/data_prep/get_max_daily_load.py
1
1709
import numpy as np import pandas as pd from matplotlib import pyplot as plt from matplotlib import dates as mdt import datetime as dt def get_max_load(data_path, date_index_path, max_load_path): max_load_list = [] data = pd.read_csv(data_path, encoding='gbk') date_index = pd.read_csv(date_index_path) for...
gpl-3.0
dcolombo/FilFinder
examples/paper_figures/patch_vs_thresh_figure.py
3
1863
# Licensed under an MIT open source license - see LICENSE from fil_finder import fil_finder_2D from astropy.io.fits import getdata import matplotlib.pyplot as p img, hdr = getdata("filaments_updatedhdr.fits", header=True) # Add some noise import numpy as np np.random.seed(500) threshs = [75, 95, 99] patches = [7, 1...
mit
lin-credible/scikit-learn
sklearn/ensemble/tests/test_partial_dependence.py
365
6996
""" Testing for the partial dependence module. """ import numpy as np from numpy.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import if_matplotlib from sklearn.ensemble.partial_dependence import partial_dependence from sklearn.ensemble.partial_dependence...
bsd-3-clause
natanaelfneto/kNN-example
src/apps/kNN/views.py
1
1799
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.core import serializers from django.views.generic.base import TemplateView from django.shortcuts import render from sklearn.datasets import load_iris from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_sp...
mit
TheCoSMoCompany/biopredyn
Prototype/python/biopredyn/output.py
1
14158
#!/usr/bin/env python # coding=utf-8 ## @package biopredyn ## Copyright: [2012-2019] Cosmo Tech, All Rights Reserved ## License: BSD 3-Clause import io, csv from random import gauss import signals import libsbml import libsedml, libnuml from matplotlib import pyplot as plt import colorsys ## Base class for encoding ...
bsd-3-clause
OrkoHunter/networkx
examples/drawing/atlas.py
54
2609
#!/usr/bin/env python """ Atlas of all graphs of 6 nodes or less. """ __author__ = """Aric Hagberg (hagberg@lanl.gov)""" # Copyright (C) 2004 by # Aric Hagberg <hagberg@lanl.gov> # Dan Schult <dschult@colgate.edu> # Pieter Swart <swart@lanl.gov> # All rights reserved. # BSD license. import networkx...
bsd-3-clause
karstenw/nodebox-pyobjc
examples/Extended Application/matplotlib/examples/units/units_scatter.py
1
1573
""" ============= Unit handling ============= The example below shows support for unit conversions over masked arrays. .. only:: builder_html This example requires :download:`basic_units.py <basic_units.py>` """ import numpy as np import matplotlib.pyplot as plt from basic_units import secs, hertz, minutes # no...
mit
apoorvingle/info-ret
parseW.py
1
5137
import os import glob import multiprocessing from nltk.util import ngrams from nltk.stem.porter import PorterStemmer import ast import sys from matplotlib import pyplot from math import log #Stemmer to stem the words ps = PorterStemmer() def digestData(rawData): """generates the ngrams of the given text |...
gpl-3.0
iproduct/course-social-robotics
11-dnn-keras/venv/Lib/site-packages/pandas/tests/frame/methods/test_rename_axis.py
4
4074
import numpy as np import pytest from pandas import DataFrame, Index, MultiIndex import pandas._testing as tm class TestDataFrameRenameAxis: def test_rename_axis_inplace(self, float_frame): # GH#15704 expected = float_frame.rename_axis("foo") result = float_frame.copy() return_val...
gpl-2.0
kiliakis/BLonD-minimal-cpp
python/plot_parameters.py
2
1267
# Copyright 2016 CERN. This software is distributed under the # terms of the GNU General Public Licence version 3 (GPL Version 3), # copied verbatim in the file LICENCE.md. # In applying this licence, CERN does not waive the privileges and immunities # granted to it by virtue of its status as an Intergovernmental Orga...
gpl-3.0
mhallsmoore/qstrader
tests/unit/broker/portfolio/test_portfolio.py
1
12720
import pandas as pd import pytz import pytest from qstrader.broker.portfolio.portfolio import Portfolio from qstrader.broker.portfolio.portfolio_event import PortfolioEvent from qstrader.broker.transaction.transaction import Transaction def test_initial_settings_for_default_portfolio(): """ Test that the ini...
mit
louispotok/pandas
pandas/tests/test_panel.py
1
105261
# -*- coding: utf-8 -*- # pylint: disable=W0612,E1101 from warnings import catch_warnings from datetime import datetime import operator import pytest import numpy as np from pandas.core.dtypes.common import is_float_dtype from pandas import (Series, DataFrame, Index, date_range, isna, notna, pivo...
bsd-3-clause
drpngx/tensorflow
tensorflow/contrib/learn/python/learn/preprocessing/tests/categorical_test.py
137
2219
# encoding: utf-8 # 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 r...
apache-2.0
gautamkmr/incubator-mxnet
example/ssd/detect/detector.py
7
7047
# 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
Kate-Willett/HadISDH_Build
gridbox_sampling_uncertainty.py
2
34644
# python 3 # # Author: Kate Willett # Created: 18 January 2019 # Last update: 24 January 2019 # Location: /data/local/hadkw/HADCRUH2/MARINE/EUSTACEMDS/EUSTACE_SST_MAT/ # GitHub: https://github.com/Kate-Willett/HadISDH_Marine_Build # ----------------------- # CODE PURPOSE AND OUTPUT # ----------------------- # Th...
cc0-1.0
jreback/pandas
pandas/tests/frame/methods/test_set_axis.py
2
3005
import numpy as np import pytest from pandas import DataFrame, Series import pandas._testing as tm class SharedSetAxisTests: @pytest.fixture def obj(self): raise NotImplementedError("Implemented by subclasses") def test_set_axis(self, obj): # GH14636; this tests setting index for both Se...
bsd-3-clause
kenshay/ImageScripter
ProgramData/SystemFiles/Python/Lib/site-packages/scipy/optimize/nonlin.py
4
46969
r""" Nonlinear solvers ----------------- .. currentmodule:: scipy.optimize This is a collection of general-purpose nonlinear multidimensional solvers. These solvers find *x* for which *F(x) = 0*. Both *x* and *F* can be multidimensional. Routines ~~~~~~~~ Large-scale nonlinear solvers: .. autosummary:: newto...
gpl-3.0
khkaminska/scikit-learn
sklearn/linear_model/logistic.py
57
65098
""" Logistic Regression """ # Author: Gael Varoquaux <gael.varoquaux@normalesup.org> # Fabian Pedregosa <f@bianp.net> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Manoj Kumar <manojkumarsivaraj334@gmail.com> # Lars Buitinck # Simon Wu <s8wu@uwaterloo.ca> imp...
bsd-3-clause
jm-begon/scikit-learn
sklearn/neighbors/approximate.py
128
22351
"""Approximate nearest neighbor search""" # Author: Maheshakya Wijewardena <maheshakya.10@cse.mrt.ac.lk> # Joel Nothman <joel.nothman@gmail.com> import numpy as np import warnings from scipy import sparse from .base import KNeighborsMixin, RadiusNeighborsMixin from ..base import BaseEstimator from ..utils.va...
bsd-3-clause
BlueBrain/deap
examples/es/cma_plotting.py
12
4326
# This file is part of DEAP. # # DEAP is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either version 3 of # the License, or (at your option) any later version. # # DEAP is distributed ...
lgpl-3.0
murali-munna/scikit-learn
sklearn/datasets/twenty_newsgroups.py
126
13591
"""Caching loader for the 20 newsgroups text classification dataset The description of the dataset is available on the official website at: http://people.csail.mit.edu/jrennie/20Newsgroups/ Quoting the introduction: The 20 Newsgroups data set is a collection of approximately 20,000 newsgroup documents,...
bsd-3-clause
autocorr/besl
besl/ppv_group.py
1
31445
""" =========================== PPV Grouping and Clustering =========================== Functions and routines to perform clustering analysis on the BGPS HCO+/N2H+ molecular line survey. """ from __future__ import division import numpy as np import pandas as pd import cPickle as pickle from collections import deque ...
gpl-3.0
RuthAngus/granola
granola/seismology/GProtation.py
1
5438
# This script contains the prior, lhf and logprob functions, plus plotting # routines. from __future__ import print_function import numpy as np import matplotlib.pyplot as plt import pandas as pd import os import george from george.kernels import ExpSine2Kernel, ExpSquaredKernel, WhiteKernel import emcee3 import corn...
mit
zorojean/scikit-learn
sklearn/cluster/setup.py
263
1449
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD 3 clause import os from os.path import join import numpy from sklearn._build_utils import get_blas_info def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration cblas_libs, blas_info = ...
bsd-3-clause
abhisg/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
plotly/python-api
packages/python/plotly/plotly/graph_objs/table/_header.py
1
17792
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Header(_BaseTraceHierarchyType): # class properties # -------------------- _parent_path_str = "table" _path_str = "table.header" _valid_props = { "align", "alignsrc", ...
mit
sonnyhu/scikit-learn
examples/ensemble/plot_voting_decision_regions.py
86
2386
""" ================================================== Plot the decision boundaries of a VotingClassifier ================================================== Plot the decision boundaries of a `VotingClassifier` for two features of the Iris dataset. Plot the class probabilities of the first sample in a toy dataset pred...
bsd-3-clause
aaronzink/tensorflow-visual-inspection
models/autoencoder/AutoencoderRunner.py
12
1660
import numpy as np import sklearn.preprocessing as prep import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data from autoencoder_models.Autoencoder import Autoencoder mnist = input_data.read_data_sets('MNIST_data', one_hot = True) def standard_scale(X_train, X_test): preprocessor = pr...
apache-2.0
abonil91/ncanda-data-integration
scripts/redcap/scoring/fh_drug/__init__.py
1
6973
#!/usr/bin/env python ## ## Copyright 2016 SRI International ## See COPYING file distributed along with the package for the copyright and license terms. ## import pandas import string import time import datetime import numpy input_fields = { 'youthreport1' : [ 'youthreport1_ydi6', # number of full sib...
bsd-3-clause
wathen/PhD
MHD/FEniCS/MHD/CG/PicardIter_Direct/DecoupleTest/KappaChange/tests/CDmu.py
1
12388
#!/usr/bin/python # interpolate scalar gradient onto nedelec space from dolfin import * import petsc4py import sys petsc4py.init(sys.argv) from petsc4py import PETSc Print = PETSc.Sys.Print # from MatrixOperations import * import numpy as np #import matplotlib.pylab as plt import PETScIO as IO import common import ...
mit
alexis-roche/nipy
nipy/algorithms/clustering/hierarchical_clustering.py
1
30021
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ These routines perform some hierrachical agglomerative clustering of some input data. The following alternatives are proposed: - Distance based average-link - Similarity-based average-link - Distance ba...
bsd-3-clause
OzFlux/PyFluxPro
utilities/portal_audit.py
1
4554
# standard modules from collections import OrderedDict import datetime import glob import os import pickle import sys # 3rd party modules import dateutil import matplotlib.pyplot as plt import numpy import pylab import xlwt from pandas.plotting import register_matplotlib_converters register_matplotlib_converters() # PF...
bsd-3-clause
nshaud/content-recommendation
distribute/python/python/detect.py
23
5743
#!/usr/bin/env python """ detector.py is an out-of-the-box windowed detector callable from the command line. By default it configures and runs the Caffe reference ImageNet model. Note that this model was trained for image classification and not detection, and finetuning for detection can be expected to improve results...
mit
aminert/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
GingerNinja23/alkane-lysis
application.py
2
1700
from flask import Flask, render_template,request import csv from sklearn import linear_model from scipy.optimize import curve_fit import scipy app = Flask(__name__) def compute_coeffs(): csv_file = open('dop_c2.csv','r') dim1 = [] dim2 = [] lines = csv_file.readlines() for line in lines: row = line.strip('\r\n'...
mit
beepee14/scikit-learn
examples/model_selection/plot_learning_curve.py
250
4171
""" ======================== Plotting Learning Curves ======================== On the left side the learning curve of a naive Bayes classifier is shown for the digits dataset. Note that the training score and the cross-validation score are both not very good at the end. However, the shape of the curve can be found in ...
bsd-3-clause
nju-websoft/JAPE
code/ent2vec_sparse.py
1
8130
import numpy as np import time import sys from scipy import io from sklearn import preprocessing import scipy as sp from data_utils import * SPLIT = '\t' beishu = 10 def read_ents_props(props_file): ents = dict() file = open(props_file, 'r', encoding='utf8') for line in file.readlines(): params ...
mit
jayhetee/BDA_py_demos
demos_ch2/demo2_1.py
19
1659
"""Bayesian Data Analysis, 3rd ed Chapter 2, demo 1 437 girls and 543 boys have been observed. Calculate and plot the posterior distribution of the proportion of girls $\theta$, using uniform prior on $\theta$. """ import numpy as np from scipy.stats import beta import matplotlib.pyplot as plt # Edit default plo...
gpl-3.0
ammarkhann/FinalSeniorCode
lib/python2.7/site-packages/scipy/interpolate/tests/test_rbf.py
14
4604
# Created by John Travers, Robert Hetland, 2007 """ Test functions for rbf module """ from __future__ import division, print_function, absolute_import import numpy as np from numpy.testing import (assert_, assert_array_almost_equal, assert_almost_equal, run_module_suite) from numpy import l...
mit
nguyentu1602/statsmodels
statsmodels/datasets/star98/data.py
25
3880
"""Star98 Educational Testing dataset.""" __docformat__ = 'restructuredtext' COPYRIGHT = """Used with express permission from the original author, who retains all rights.""" TITLE = "Star98 Educational Dataset" SOURCE = """ Jeff Gill's `Generalized Linear Models: A Unified Approach` http://jgill.wustl.e...
bsd-3-clause
ilo10/scikit-learn
benchmarks/bench_lasso.py
297
3305
""" Benchmarks of Lasso vs LassoLars First, we fix a training set and increase the number of samples. Then we plot the computation time as function of the number of samples. In the second benchmark, we increase the number of dimensions of the training set. Then we plot the computation time as function of the number o...
bsd-3-clause
akuefler/fovea
examples/HH_neuron/HH_detailed_demo.py
1
29849
""" This is the main run script for the detailed demo involving Hodgkin-Huxley analysis. """ from PyDSTool.Toolbox.dssrt import * from PyDSTool.Toolbox.phaseplane import * import PyDSTool as dst import numpy as np import scipy as sp import matplotlib.pyplot as plt import sys from fovea.graphics import gui from model...
bsd-3-clause
moosemaniam/learning
ud120-projects/final_project/poi_id.py
2
1799
#!/usr/bin/python import sys import pickle sys.path.append("../tools/") from feature_format import featureFormat, targetFeatureSplit from tester import test_classifier, dump_classifier_and_data ### Task 1: Select what features you'll use. ### features_list is a list of strings, each of which is a feature name. ### T...
cc0-1.0
ephes/scikit-learn
sklearn/linear_model/tests/test_passive_aggressive.py
121
6117
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_array_almost_equal, assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.base import ClassifierMixin from skle...
bsd-3-clause
cpcloud/seaborn
seaborn/tests/test_linearmodels.py
1
30319
import numpy as np import matplotlib.pyplot as plt import pandas as pd import nose.tools as nt import numpy.testing as npt import pandas.util.testing as pdt from numpy.testing.decorators import skipif try: import statsmodels.api as sm _no_statsmodels = False except ImportError: _no_statsmodels = True fro...
bsd-3-clause
lmallin/coverage_test
python_venv/lib/python2.7/site-packages/pandas/core/reshape/util.py
20
1915
import numpy as np from pandas.core.dtypes.common import is_list_like from pandas.compat import reduce from pandas.core.index import Index from pandas.core import common as com def match(needles, haystack): haystack = Index(haystack) needles = Index(needles) return haystack.get_indexer(needles) def ca...
mit
nens/python-subgrid
setup.py
1
2299
from setuptools import setup import sys version = '0.25.dev0' long_description = '\n\n'.join([ open('README.rst').read(), open('CREDITS.rst').read(), open('CHANGES.rst').read(), ]) install_requires = [ 'setuptools', 'numpy', 'pandas', 'webob', 'netCDF4', 'mmi', 'scipy', ...
gpl-3.0
jostep/tensorflow
tensorflow/contrib/learn/python/learn/estimators/estimator.py
3
59364
# 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
apahl/cellpainting
cellpainting/processing.py
1
55494
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ ########## Processing ########## *Created on Thu Jun 1 14:15 2017 by A. Pahl* Processing results from the CellPainting Assay in the Jupyter notebook. This module provides the DataSet class and its methods. Additional functions in this module act on pandas DataFrames...
mit
verdverm/pypge
pypge/benchmarks/explicit.py
1
10968
import sympy import numpy as np import pandas as pd np.random.seed(23) import pprint pp = pprint.PrettyPrinter(indent=4) x = sympy.Symbol('x') y = sympy.Symbol('y') z = sympy.Symbol('z') v = sympy.Symbol('v') w = sympy.Symbol('w') def gen(prob_params, **kwargs): prob_params = prep_params(prob_params, **kwargs) p...
mit
FarnazH/horton
horton/meanfield/scf_diis.py
4
18496
# -*- coding: utf-8 -*- # HORTON: Helpful Open-source Research TOol for N-fermion systems. # Copyright (C) 2011-2017 The HORTON Development Team # # This file is part of HORTON. # # HORTON is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by th...
gpl-3.0
RobertABT/heightmap
build/matplotlib/lib/matplotlib/spines.py
4
18883
from __future__ import division, print_function import matplotlib rcParams = matplotlib.rcParams import matplotlib.artist as martist from matplotlib.artist import allow_rasterization from matplotlib import docstring import matplotlib.transforms as mtransforms import matplotlib.lines as mlines import matplotlib.patche...
mit
btabibian/scikit-learn
sklearn/linear_model/tests/test_least_angle.py
20
26139
import warnings import numpy as np from scipy import linalg from sklearn.model_selection import train_test_split from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_false from ...
bsd-3-clause
kdebrab/pandas
pandas/tests/sparse/series/test_series.py
2
55371
# pylint: disable-msg=E1101,W0612 import operator from datetime import datetime import pytest from numpy import nan import numpy as np import pandas as pd from pandas import (Series, DataFrame, bdate_range, isna, compat, _np_version_under1p12) from pandas.tseries.offsets import BDay import panda...
bsd-3-clause
Unidata/MetPy
v0.12/startingguide-1.py
4
1432
import matplotlib.pyplot as plt import numpy as np import metpy.calc as mpcalc from metpy.plots import SkewT from metpy.units import units fig = plt.figure(figsize=(9, 9)) skew = SkewT(fig) # Create arrays of pressure, temperature, dewpoint, and wind components p = [902, 897, 893, 889, 883, 874, 866, 857, 849, 841, 8...
bsd-3-clause
jmmease/pandas
pandas/tests/io/parser/common.py
3
60098
# -*- coding: utf-8 -*- import csv import os import platform import codecs import re import sys from datetime import datetime import pytest import numpy as np from pandas._libs.lib import Timestamp import pandas as pd import pandas.util.testing as tm from pandas import DataFrame, Series, Index, MultiIndex from pand...
bsd-3-clause
jart/tensorflow
tensorflow/examples/get_started/regression/imports85.py
41
6589
# 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
victorbergelin/scikit-learn
examples/cluster/plot_lena_segmentation.py
271
2444
""" ========================================= Segmenting the picture of Lena in regions ========================================= This example uses :ref:`spectral_clustering` on a graph created from voxel-to-voxel difference on an image to break this image into multiple partly-homogeneous regions. This procedure (spe...
bsd-3-clause
potash/scikit-learn
examples/preprocessing/plot_function_transformer.py
158
1993
""" ========================================================= Using FunctionTransformer to select columns ========================================================= Shows how to use a function transformer in a pipeline. If you know your dataset's first principle component is irrelevant for a classification task, you ca...
bsd-3-clause
huobaowangxi/scikit-learn
sklearn/decomposition/tests/test_pca.py
199
10949
import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_rai...
bsd-3-clause
CartoDB/bigmetadata
tasks/fr/insee.py
1
10692
# -*- coding: utf-8 -*- from tasks.base_tasks import (ColumnsTask, TableTask, TagsTask, RepoFileUnzipTask, CSV2TempTableTask, MetaWrapper, RepoFile) from tasks.util import classpath, copyfile from tasks.meta import current_session, GEOM_REF from collections import OrderedDict from luigi i...
bsd-3-clause
glennq/scikit-learn
sklearn/decomposition/nmf.py
15
47073
""" Non-negative matrix factorization """ # Author: Vlad Niculae # Lars Buitinck # Mathieu Blondel <mathieu@mblondel.org> # Tom Dupre la Tour # Author: Chih-Jen Lin, National Taiwan University (original projected gradient # NMF implementation) # ...
bsd-3-clause
ablifedev/ABLIRC
ABLIRC/bin/public/Extract_Region_sequence.py
1
12799
#!/usr/bin/env python2.7 # -*- coding: utf-8 -*- #################################################################################### ### Copyright (C) 2015-2019 by ABLIFE #################################################################################### #########################################################...
mit
yejingxin/kaggle-ndsb
train_convnet.py
6
9280
import numpy as np import theano import theano.tensor as T import lasagne as nn import time import os import sys import importlib import cPickle as pickle from datetime import datetime, timedelta import string from itertools import izip import matplotlib matplotlib.use('agg') import pylab as plt import data import ...
mit
WarrenWeckesser/scikits-image
doc/examples/plot_marked_watershed.py
8
1999
""" =============================== Markers for watershed transform =============================== The watershed is a classical algorithm used for **segmentation**, that is, for separating different objects in an image. Here a marker image is built from the region of low gradient inside the image. In a gradient imag...
bsd-3-clause
valexandersaulys/airbnb_kaggle_contest
venv/lib/python3.4/site-packages/scipy/spatial/_plotutils.py
53
4034
from __future__ import division, print_function, absolute_import import numpy as np from scipy._lib.decorator import decorator as _decorator __all__ = ['delaunay_plot_2d', 'convex_hull_plot_2d', 'voronoi_plot_2d'] @_decorator def _held_figure(func, obj, ax=None, **kw): import matplotlib.pyplot as plt if ax...
gpl-2.0
StructuralNeurobiologyLab/SyConnFS
syconnfs/representations/skel_based_classifier.py
1
22871
import cPickle as pkl import glob import numpy as np import os import re from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifier, AdaBoostClassifier from sklearn.externals import joblib from sklearn.metrics import precision_recall_fscore_support, precision_recall_curve import matplotlib matplotlib.us...
gpl-2.0
baseband-geek/singlepulse-visualizer
interactive/interactive_sp_plot.py
1
10768
#!/usr/bin/python # DM Sigma Time (s) Sample Downfact import numpy as np import matplotlib as mpl import matplotlib.patches as patches import matplotlib.pyplot as plt from pulsar_tools import disp_delay import math import sys import pandas as pd import bokeh.io from bokeh.io import output_file, show...
mit
brenthuisman/phd_tools
analysis.lyso4.falloff.py
1
6376
#!/usr/bin/env python import numpy as np,plot,auger,subprocess,tableio,dump #OPT: quickly get sorted rundirs # zb autogen | sort -k1.13 -r #OPT: fix seed #np.random.seed(65983247) np.random.seed(983452324) addnoise=False precolli=False #gaan we niet meer doen pgexit = True #if so, then pgprod_ratio must be set. pr...
lgpl-3.0
bavardage/statsmodels
statsmodels/sandbox/tsa/examples/ex_mle_arma.py
4
4490
# -*- coding: utf-8 -*- """ TODO: broken because of changes to arguments and import paths fixing this needs a closer look Created on Thu Feb 11 23:41:53 2010 Author: josef-pktd copyright: Simplified BSD see license.txt """ import numpy as np from numpy.testing import assert_almost_equal import matplotlib.pyplot as p...
bsd-3-clause
marioharper182/Patterns
PatternRecognition/ProgrammingProject1/MaxLiklihood.py
1
2560
__author__ = 'Mario' __author__ = 'Mario' import numpy as np from scipy.stats import multivariate_normal as norm import pandas as pd import matplotlib.pyplot as plt dataTraining = pd.read_table('./Data/iris_training.txt',delim_whitespace=True, header=None) dataTest = pd.read_table('./Data/iris_test.txt',delim_whites...
apache-2.0
ML-KULeuven/socceraction
socceraction/spadl/opta.py
1
60410
# -*- coding: utf-8 -*- """Opta event stream data to SPADL converter.""" import copy import glob import json # type: ignore import os import re import warnings from abc import ABC from datetime import datetime, timedelta from typing import Any, Dict, List, Mapping, Optional, Tuple, Type import pandas as pd # type: i...
mit
JFriel/honours_project
networkx/networkx/tests/test_convert_pandas.py
43
2177
from nose import SkipTest from nose.tools import assert_true import networkx as nx class TestConvertPandas(object): numpy=1 # nosetests attribute, use nosetests -a 'not numpy' to skip test @classmethod def setupClass(cls): try: import pandas as pd except ImportError: ...
gpl-3.0
phaustin/pyman
Book/chap9/Supporting Materials/specFuncPlots.py
3
2545
import numpy as np import scipy.special import matplotlib.pyplot as plt # create a figure window fig = plt.figure(1, figsize=(9,8)) # create arrays for a few Bessel functions and plot them x = np.linspace(0, 20, 256) j0 = scipy.special.jn(0, x) j1 = scipy.special.jn(1, x) y0 = scipy.special.yn(0, x) y1 = scipy.specia...
cc0-1.0
jmschrei/scikit-learn
sklearn/neighbors/base.py
30
30586
"""Base and mixin classes for nearest neighbors""" # Authors: Jake Vanderplas <vanderplas@astro.washington.edu> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Sparseness support by Lars Buitinck <L.J.Buitinck@uva.nl> # Multi-output...
bsd-3-clause
cactusbin/nyt
matplotlib/lib/matplotlib/backends/backend_webagg.py
1
21417
""" Displays Agg images in the browser, with interactivity """ from __future__ import division, print_function import datetime import errno import io import json import os import random import socket import numpy as np try: import tornado except ImportError: raise RuntimeError("The WebAgg backend requires To...
unlicense
BhallaLab/moose-full
moose-examples/neuroml/LIF/twoLIFxml_firing.py
3
3082
# -*- coding: utf-8 -*- ## all SI units ######################################################################################## ## Plot the membrane potential for a leaky integrate and fire neuron with current injection ## Author: Aditya Gilra ## Creation Date: 2012-06-08 ## Modification Date: 2012-06-08 #############...
gpl-2.0
alongwithyou/auto-sklearn
autosklearn/data/split_data.py
5
3748
import numpy as np import sklearn.cross_validation import autosklearn.util.logging_ logger = autosklearn.util.logging_.get_logger(__name__) def split_data(X, Y, classification=None): num_data_points = X.shape[0] num_labels = Y.shape[1] if len(Y.shape) > 1 else 1 X_train, X_valid, Y_train, Y_valid = None...
bsd-3-clause
YuepengGuo/zipline
zipline/utils/tradingcalendar_tse.py
17
10125
# # 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
jkarnows/scikit-learn
sklearn/preprocessing/data.py
113
56747
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Mathieu Blondel <mathieu@mblondel.org> # Olivier Grisel <olivier.grisel@ensta.org> # Andreas Mueller <amueller@ais.uni-bonn.de> # Eric Martin <eric@ericmart.in> # License: BSD 3 clause from itertools import chain, combina...
bsd-3-clause
MichielCottaar/pymc3
pymc3/examples/lasso_missing.py
10
1958
from pymc3 import * import numpy as np import pandas as pd from numpy.ma import masked_values # Import data, filling missing values with sentinels (-999) test_scores = pd.read_csv(get_data_file('pymc3.examples', 'data/test_scores.csv')).fillna(-999) # Extract variables: test score, gender, number of siblings, previou...
apache-2.0
iismd17/scikit-learn
examples/svm/plot_svm_margin.py
318
2328
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= SVM Margins Example ========================================================= The plots below illustrate the effect the parameter `C` has on the separation line. A large value of `C` basically tells our model that w...
bsd-3-clause
andaag/scikit-learn
benchmarks/bench_isotonic.py
268
3046
""" Benchmarks of isotonic regression performance. We generate a synthetic dataset of size 10^n, for n in [min, max], and examine the time taken to run isotonic regression over the dataset. The timings are then output to stdout, or visualized on a log-log scale with matplotlib. This alows the scaling of the algorith...
bsd-3-clause
jseabold/statsmodels
statsmodels/distributions/empirical_distribution.py
5
5236
""" Empirical CDF Functions """ import numpy as np from scipy.interpolate import interp1d def _conf_set(F, alpha=.05): r""" Constructs a Dvoretzky-Kiefer-Wolfowitz confidence band for the eCDF. Parameters ---------- F : array_like The empirical distributions alpha : float Set a...
bsd-3-clause
power-system-simulation-toolbox/psst
psst/case/__init__.py
1
7705
import os import logging import pandas as pd from .descriptors import ( Name, Version, BaseMVA, BusName, Bus, Branch, BranchName, Gen, GenName, GenCost, Load, Period, _Attributes ) from . import matpower from .utils import convert_to_model_one logger = logging.getLogger(__name__) pd.options.display.max_row...
mit
henrykironde/scikit-learn
examples/plot_multioutput_face_completion.py
330
3019
""" ============================================== Face completion with a multi-output estimators ============================================== This example shows the use of multi-output estimator to complete images. The goal is to predict the lower half of a face given its upper half. The first column of images sho...
bsd-3-clause
jmmease/pandas
pandas/plotting/_misc.py
5
18194
# being a bit too dynamic # pylint: disable=E1101 from __future__ import division import numpy as np from pandas.util._decorators import deprecate_kwarg from pandas.core.dtypes.missing import notna from pandas.compat import range, lrange, lmap, zip from pandas.io.formats.printing import pprint_thing from pandas.plo...
bsd-3-clause
DelonShen/Model-Builder-ProtonML
getData.py
1
3423
import os datadir = "/asd" asdf = False # while(os.path.isdir(datadir)==False): # datadir = input("Enter full data directory (e.g. /home/bob/Desktop/data) \nNote that this is case sensitive:\n") # if(os.path.isdir(datadir)==False): # print("That is not a valid directory") import argparse parser = argp...
mit