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
open-risk/concentration_library
examples/python/confidence_interval_example.py
1
1598
# encoding: utf-8 # (c) 2016-2020 Open Risk, all rights reserved # # ConcentrationMetrics is licensed under the MIT license a copy of which is included # in the source distribution of concentrationMetrics. This is notwithstanding any licenses of # third-party software included in this distribution. You may not use thi...
mit
kchodorow/tensorflow
tensorflow/examples/learn/iris.py
19
1651
# 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 appl...
apache-2.0
dcwangmit01/options-screener
app/datareader.py
1
7351
import os import time import sys import re import json import pandas as pd from selenium import webdriver import selenium.webdriver.chrome.service as service from selenium.webdriver.support.ui import Select from pandas_datareader.data import Options import requests_cache #############################################...
mit
nkhuyu/data-science-from-scratch
code/visualizing_data.py
58
5116
import matplotlib.pyplot as plt from collections import Counter def make_chart_simple_line_chart(plt): years = [1950, 1960, 1970, 1980, 1990, 2000, 2010] gdp = [300.2, 543.3, 1075.9, 2862.5, 5979.6, 10289.7, 14958.3] # create a line chart, years on x-axis, gdp on y-axis plt.plot(years, gdp, color='gr...
unlicense
allinpaybusiness/ACS
TLSW_pred/fyzpred02/fyz_pred_02.py
1
4127
# -*- coding: utf-8 -*- """ Spyder Editor 生产模型:creditscore_TLSW_fyz.creditscore_randomforest """ import sys import time import pandas as pd import numpy as np from sklearn.externals import joblib """ parameters = {'idCard':'530125198606102726', 'mobileNum':'13619662783', 'education':'高中', 'maritalStatus':'22', ...
apache-2.0
shusenl/scikit-learn
sklearn/svm/tests/test_svm.py
70
31674
""" Testing for Support Vector Machine module (sklearn.svm) TODO: remove hard coded numerical results when possible """ import numpy as np import itertools from numpy.testing import assert_array_equal, assert_array_almost_equal from numpy.testing import assert_almost_equal from scipy import sparse from nose.tools im...
bsd-3-clause
vighneshbirodkar/scikit-image
skimage/filters/_gabor.py
23
6926
import numpy as np from scipy import ndimage as ndi from .._shared.utils import assert_nD __all__ = ['gabor_kernel', 'gabor'] def _sigma_prefactor(bandwidth): b = bandwidth # See http://www.cs.rug.nl/~imaging/simplecell.html return 1.0 / np.pi * np.sqrt(np.log(2) / 2.0) * \ (2.0 ** b + 1) / (2.0...
bsd-3-clause
cbertinato/pandas
pandas/tests/test_optional_dependency.py
1
1460
import sys import types import pytest from pandas.compat._optional import VERSIONS, import_optional_dependency import pandas.util.testing as tm def test_import_optional(): match = "Missing .*notapackage.* pip .* conda .* notapackage" with pytest.raises(ImportError, match=match): import_optional_dep...
bsd-3-clause
jvbalen/catchy
base_features.py
1
5090
from __future__ import division, print_function import os import numpy as np import pandas as pd import sys import librosa import vamp import utils """ This module provides an interface to several existing audio feature time series extractors. Requires Librosa to be installed, and optional Vamp plug-ins. "...
mit
hammerlab/immuno
immuno/mhc_random.py
1
1775
# Copyright (c) 2014. Mount Sinai School of Medicine # # 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...
apache-2.0
RayMick/scikit-learn
benchmarks/bench_plot_approximate_neighbors.py
244
6011
""" Benchmark for approximate nearest neighbor search using locality sensitive hashing forest. There are two types of benchmarks. First, accuracy of LSHForest queries are measured for various hyper-parameters and index sizes. Second, speed up of LSHForest queries compared to brute force method in exact nearest neigh...
bsd-3-clause
talonchandler/dipsim
paper/figures/triple-arm.py
1
6766
from dipsim import multiframe, util import numpy as np import matplotlib.pyplot as plt import matplotlib import matplotlib.patches as patches import os; import time; start = time.time(); print('Running...') import matplotlib.gridspec as gridspec # Main input parameters col_labels = ['Geometry\n(NA${}_{\\textrm{upper}}...
mit
alexsavio/scikit-learn
sklearn/gaussian_process/gaussian_process.py
6
35051
# -*- coding: utf-8 -*- # Author: Vincent Dubourg <vincent.dubourg@gmail.com> # (mostly translation, see implementation details) # License: BSD 3 clause from __future__ import print_function import numpy as np from scipy import linalg, optimize from ..base import BaseEstimator, RegressorMixin from ..metrics...
bsd-3-clause
WangWenjun559/Weiss
summary/sumy/sklearn/feature_selection/__init__.py
244
1088
""" The :mod:`sklearn.feature_selection` module implements feature selection algorithms. It currently includes univariate filter selection methods and the recursive feature elimination algorithm. """ from .univariate_selection import chi2 from .univariate_selection import f_classif from .univariate_selection import f_...
apache-2.0
hjweide/cifar-10-uncertainty
plot.py
1
2213
#!/usr/bin/env python import cPickle as pickle import cv2 import matplotlib.pyplot as plt import numpy as np from collections import defaultdict from mpl_toolkits.axes_grid1 import ImageGrid from os import listdir from os.path import join, splitext def make_image_grid(img_list, probs_list, name): max_per_row = ...
mit
d-lee/airflow
airflow/hooks/base_hook.py
18
2571
# -*- coding: utf-8 -*- # # 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, software ...
apache-2.0
musically-ut/statsmodels
statsmodels/regression/tests/test_regression.py
18
38246
""" Test functions for models.regression """ # TODO: Test for LM from statsmodels.compat.python import long, lrange import warnings import pandas import numpy as np from numpy.testing import (assert_almost_equal, assert_approx_equal, assert_, assert_raises, assert_equal, assert_allclose) fro...
bsd-3-clause
blab/antibody-response-pulse
bcell-array/code/Virus_Memory_Naive_Antibody_model.py
1
14663
# -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # <markdowncell> # # Antibody Response Pulse # https://github.com/blab/antibody-response-pulse # # ### B-cells evolution --- cross-reactive antibody response after influenza virus infection or vaccination # ### Adaptive immune response for repeated infection # <cod...
gpl-2.0
thientu/scikit-learn
examples/calibration/plot_compare_calibration.py
241
5008
""" ======================================== 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
dschien/PyExcelModelingHelper
tests/test_growth_coefficients.py
1
7189
import unittest from datetime import datetime import numpy as np import pandas as pd from excel_helper import ParameterRepository, ExcelParameterLoader, Parameter class MyTestCase(unittest.TestCase): def test_negative_growth(self): """ If start and end are one month apart, we expect an array of ...
mit
YinongLong/scikit-learn
sklearn/feature_selection/rfe.py
10
16481
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Vincent Michel <vincent.michel@inria.fr> # Gilles Louppe <g.louppe@gmail.com> # # License: BSD 3 clause """Recursive feature elimination for feature ranking""" import numpy as np from ..utils import check_X_y, safe_sqr from ..utils.metaes...
bsd-3-clause
CKehl/pylearn2
pylearn2/sandbox/cuda_convnet/bench.py
44
3589
__authors__ = "Ian Goodfellow" __copyright__ = "Copyright 2010-2012, Universite de Montreal" __credits__ = ["Ian Goodfellow"] __license__ = "3-clause BSD" __maintainer__ = "LISA Lab" __email__ = "pylearn-dev@googlegroups" from pylearn2.testing.skip import skip_if_no_gpu skip_if_no_gpu() import numpy as np from theano....
bsd-3-clause
Laurawly/tvm-1
tutorials/frontend/from_tflite.py
1
6325
# 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
pianomania/scikit-learn
sklearn/mixture/tests/test_bayesian_mixture.py
84
17929
# Author: Wei Xue <xuewei4d@gmail.com> # Thierry Guillemot <thierry.guillemot.work@gmail.com> # License: BSD 3 clause import numpy as np from scipy.special import gammaln from sklearn.utils.testing import assert_raise_message from sklearn.utils.testing import assert_almost_equal from sklearn.mixture.bayesian...
bsd-3-clause
jnez71/kalmaNN
demos/2d_classify.py
1
1766
#!/usr/bin/env python """ Training and using a KNN for classification of 2D data. Comparison of training methods, EKF vs SGD. """ from __future__ import division import numpy as np import matplotlib.pyplot as plt import kalmann # Get some noisy training data classifications, spirals! n = 100 stdev = 0.2 U = np.zeros(...
mit
rhiever/sklearn-benchmarks
model_code/random_search/LogisticRegression.py
1
1120
import sys import pandas as pd import numpy as np from sklearn.preprocessing import RobustScaler from sklearn.linear_model import LogisticRegression from evaluate_model import evaluate_model dataset = sys.argv[1] num_param_combinations = int(sys.argv[2]) random_seed = int(sys.argv[3]) np.random.seed(random_seed) pip...
mit
ajc158/HoneyBee-Angular-Velocity-Detection
AVDU_model/Paper_detector_behaviour/analyse_FigX.py
1
2109
#!/usr/bin/python import xml.etree.ElementTree as ET import sml_log_parser from subprocess import call, Popen import os.path import os import time, stat, random, math import ctypes import struct import csv import numpy from os import listdir import matplotlib.pyplot as plt print 'Script to generate Figure for the pap...
gpl-3.0
techbureau/zaifbot
zaifbot/indicators/bollinger_bands.py
1
1328
import pandas as pd from talib import MA_Type from .indicator import Indicator class BBANDS(Indicator): _NAME = 'bbands' def __init__(self, currency_pair='btc_jpy', period='1d', length=25, matype=MA_Type.EMA): super().__init__(currency_pair, period) self._length = self._bounded_length(length)...
mit
lordkman/burnman
burnman/tools.py
3
28641
# This file is part of BurnMan - a thermoelastic and thermodynamic toolkit for the Earth and Planetary Sciences # Copyright (C) 2012 - 2017 by the BurnMan team, released under the GNU # GPL v2 or later. from __future__ import absolute_import from __future__ import print_function import operator import bisect import o...
gpl-2.0
openEduConnect/eduextractor
eduextractor/sis/illuminate/illuminate_exporter.py
1
1702
import pandas as pd from ...config import _load_secrets import sqlalchemy import os from tqdm import tqdm class IlluminateSQLInterface: """A class representing a SQL interface to Illuminate """ def __init__(self, secrets=None): if secrets is None: secrets = _load_secrets() ...
mit
LeeKamentsky/CellProfiler
cellprofiler/modules/calculateimageoverlap.py
1
50378
import cellprofiler.icons from cellprofiler.gui.help import PROTIP_RECOMEND_ICON __doc__ = ''' <b>Calculate Image Overlap </b> calculates how much overlap occurs between the white portions of two black and white images <hr> This module calculates overlap by determining a set of statistics that measure the closeness of...
gpl-2.0
abhishekkrthakur/scikit-learn
sklearn/decomposition/tests/test_sparse_pca.py
31
6002
# Author: Vlad Niculae # License: BSD 3 clause import sys import numpy as np from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import SkipTest from sklearn.utils.testing import ass...
bsd-3-clause
davidgbe/scikit-learn
examples/datasets/plot_random_multilabel_dataset.py
278
3402
""" ============================================== Plot randomly generated multilabel dataset ============================================== This illustrates the `datasets.make_multilabel_classification` dataset generator. Each sample consists of counts of two features (up to 50 in total), which are differently distri...
bsd-3-clause
MohammedWasim/scikit-learn
sklearn/manifold/isomap.py
229
7169
"""Isomap for manifold learning""" # Author: Jake Vanderplas -- <vanderplas@astro.washington.edu> # License: BSD 3 clause (C) 2011 import numpy as np from ..base import BaseEstimator, TransformerMixin from ..neighbors import NearestNeighbors, kneighbors_graph from ..utils import check_array from ..utils.graph import...
bsd-3-clause
IndraVikas/scikit-learn
examples/applications/plot_model_complexity_influence.py
323
6372
""" ========================== Model Complexity Influence ========================== Demonstrate how model complexity influences both prediction accuracy and computational performance. The dataset is the Boston Housing dataset (resp. 20 Newsgroups) for regression (resp. classification). For each class of models we m...
bsd-3-clause
ndingwall/scikit-learn
benchmarks/bench_hist_gradient_boosting_higgsboson.py
12
4210
from urllib.request import urlretrieve import os from gzip import GzipFile from time import time import argparse import numpy as np import pandas as pd from joblib import Memory from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score, roc_auc_score # To use this experimental fea...
bsd-3-clause
huffpostdata/python-pollster
pollster/api_client.py
1
25298
# coding: utf-8 """ Copyright 2016 SmartBear Software 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 l...
bsd-2-clause
sanketloke/scikit-learn
examples/cluster/plot_segmentation_toy.py
91
3522
""" =========================================== Spectral clustering for image segmentation =========================================== In this example, an image with connected circles is generated and spectral clustering is used to separate the circles. In these settings, the :ref:`spectral_clustering` approach solve...
bsd-3-clause
jorik041/scikit-learn
sklearn/neural_network/tests/test_rbm.py
142
6276
import sys import re import numpy as np from scipy.sparse import csc_matrix, csr_matrix, lil_matrix from sklearn.utils.testing import (assert_almost_equal, assert_array_equal, assert_true) from sklearn.datasets import load_digits from sklearn.externals.six.moves import cStringIO as ...
bsd-3-clause
iABC2XYZ/abc
Epics/testSpeed.py
1
1081
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Oct 27 16:19:01 2017 @author: p """ import matplotlib.pyplot as plt import numpy as np plt.close('all') cHV=np.round(np.random.random((14))*300-150)/10. cHV_BK=cHV plt.figure('cHV') plt.plot(cHV,'-r') flagHV=np.ones((14)) Amp=3.5 nFresh=30 for i...
gpl-3.0
saketkc/statsmodels
statsmodels/tsa/ar_model.py
20
34034
from __future__ import division from statsmodels.compat.python import iteritems, range, string_types, lmap import numpy as np from numpy import dot, identity from numpy.linalg import inv, slogdet from scipy.stats import norm from statsmodels.regression.linear_model import OLS from statsmodels.tsa.tsatools import (lagm...
bsd-3-clause
OSSHealth/ghdata
augur/metrics/insight.py
1
1339
#SPDX-License-Identifier: MIT """ Metrics that provide data about with insight detection and reporting """ import sqlalchemy as s import pandas as pd from augur.util import register_metric @register_metric(type="repo_group_only") def top_insights(self, repo_group_id, num_repos=6): """ Timeseries of pull reque...
mit
evgchz/scikit-learn
sklearn/metrics/tests/test_ranking.py
7
33931
from __future__ import division, print_function import numpy as np from itertools import product import warnings from sklearn import datasets from sklearn import svm from sklearn import ensemble from sklearn.datasets import make_multilabel_classification from sklearn.random_projection import sparse_random_matrix fro...
bsd-3-clause
YerevaNN/mimic3-benchmarks
mimic3benchmark/scripts/create_length_of_stay.py
1
3792
from __future__ import absolute_import from __future__ import print_function import os import argparse import numpy as np import pandas as pd import random random.seed(49297) from tqdm import tqdm def process_partition(args, partition, sample_rate=1.0, shortest_length=4.0, eps=1e-6): output_dir = os.path.join(ar...
mit
JT5D/scikit-learn
sklearn/ensemble/partial_dependence.py
5
14809
"""Partial dependence plots for tree ensembles. """ # Authors: Peter Prettenhofer # License: BSD 3 clause from itertools import count from sklearn.externals.six.moves import zip import numbers import numpy as np from scipy.stats.mstats import mquantiles from ..utils.extmath import cartesian from ..externals.jobl...
bsd-3-clause
and2egg/philharmonic
philharmonic/energy_meter/simple_visualiser.py
2
1414
''' Created on Jun 15, 2012 @author: kermit ''' #from pylab import * import matplotlib.pyplot as plt import numpy as np from haley_api import Wattmeter from continuous_energy_meter import ContinuousEnergyMeter from runner_til_keypressed import RunnerTilKeypressed machines = ["snowwhite", "grumpy"] metrics = ["active...
gpl-3.0
bavardage/statsmodels
statsmodels/nonparametric/_kernel_base.py
3
17942
""" Module containing the base object for multivariate kernel density and regression, plus some utilities. """ import copy import numpy as np from scipy import optimize from scipy.stats.mstats import mquantiles try: import joblib has_joblib = True except ImportError: has_joblib = False import kernels ...
bsd-3-clause
EPFL-LCN/neuronaldynamics-exercises
neurodynex3/cable_equation/passive_cable.py
1
6153
""" Implements compartmental model of a passive cable. See Neuronal Dynamics `Chapter 3 Section 2 <http://neuronaldynamics.epfl.ch/online/Ch3.S2.html>`_ """ # This file is part of the exercise code repository accompanying # the book: Neuronal Dynamics (see http://neuronaldynamics.epfl.ch) # located at http://github.c...
gpl-2.0
johnh2o2/cuvarbase
docs/source/plots/bls_example.py
1
3320
import cuvarbase.bls as bls import numpy as np import matplotlib.pyplot as plt def phase(t, freq, phi0=0.): phi = (t * freq - phi0) phi -= np.floor(phi) return phi def transit_model(t, freq, y0=0.0, delta=1., q=0.01, phi0=0.5): phi = phase(t, freq, phi0=phi0) transit = phi < q y = y0 * np....
gpl-3.0
amueller/pystruct
examples/multiclass_comparision_svm_struct.py
4
6536
""" ================================= Comparing PyStruct and SVM-Struct ================================= This example compares the performance of pystruct and SVM^struct on a multi-class problem. For the example to work, you need to install SVM^multiclass and set the path in this file. We are not using SVM^python, as ...
bsd-2-clause
peret/visualize-bovw
svm_visualization.py
1
1912
from visualization import Visualization from sklearn.svm import LinearSVC from vcd import VisualConceptDetection import numpy as np from datamanagers.CaltechManager import CaltechManager from itertools import izip import sys import os def get_image_title(prediction, real): """Returns a string that describes whe...
gpl-2.0
Remper/sociallink
align-train/pairwise_models/model.py
1
8491
import json from os import path from sklearn.utils import shuffle import tensorflow as tf import time import numpy as np class Model: def __init__(self, name): self._name = name self._desc = name self._graph = None self._session = None self._saver = None self._rea...
apache-2.0
ceholden/yatsm
bench/benchmarks/algorithms/ccdc.py
3
6321
import inspect import os import numpy as np import sklearn.linear_model from yatsm.algorithms import CCDCesque from ..bench_utils.example_timeseries import PixelTimeseries n = 50 # Hack for goof up in API previous to v0.6.0 def version_kwargs(d): """ Fix API calls for kwargs dict ``d`` that should have key ``...
mit
ocefpaf/iris
lib/iris/tests/test_pandas.py
5
18054
# Copyright Iris contributors # # This file is part of Iris and is released under the LGPL license. # See COPYING and COPYING.LESSER in the root of the repository for full # licensing details. # import iris tests first so that some things can be initialised before # importing anything else import iris.tests as tests ...
lgpl-3.0
Roboticmechart22/sms-tools
lectures/07-Sinusoidal-plus-residual-model/plots-code/hpsModelFrame.py
22
2075
import numpy as np import matplotlib.pyplot as plt from scipy.signal import hamming, triang, blackmanharris, resample import math from scipy.fftpack import fft, ifft, fftshift import sys, os, functools, time sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/')) import ...
agpl-3.0
srjit/fakenewschallange
code/modelsv2/train.py
1
8348
from tqdm import tqdm, tqdm_pandas import pandas as pd import string import numpy as np import datetime import os from functools import reduce import gensim.models.keyedvectors as word2vec from sklearn.model_selection import train_test_split tqdm.pandas(tqdm()) __author__ = "Sreejith Sreekumar" __email__ = "sreekuma...
gpl-3.0
zihua/scikit-learn
examples/gaussian_process/plot_compare_gpr_krr.py
67
5191
""" ========================================================== Comparison of kernel ridge and Gaussian process regression ========================================================== Both kernel ridge regression (KRR) and Gaussian process regression (GPR) learn a target function by employing internally the "kernel trick...
bsd-3-clause
raoulbq/scipy
doc/source/tutorial/stats/plots/kde_plot3.py
132
1229
import numpy as np import matplotlib.pyplot as plt from scipy import stats np.random.seed(12456) x1 = np.random.normal(size=200) # random data, normal distribution xs = np.linspace(x1.min()-1, x1.max()+1, 200) kde1 = stats.gaussian_kde(x1) kde2 = stats.gaussian_kde(x1, bw_method='silverman') fig = plt.figure(figsi...
bsd-3-clause
justinbois/bebi103_utils
bebi103/deprecated/emcee.py
2
15081
import collections import warnings import numpy as np import pandas as pd import emcee import ptemcee def generic_log_posterior(log_prior, log_likelihood, params, logpargs=(), loglargs=()): """ Generic log posterior for MCMC calculations Parameters ---------- log_prior ...
mit
alekz112/statsmodels
examples/python/robust_models_0.py
33
2992
## Robust Linear Models from __future__ import print_function import numpy as np import statsmodels.api as sm import matplotlib.pyplot as plt from statsmodels.sandbox.regression.predstd import wls_prediction_std # ## Estimation # # Load data: data = sm.datasets.stackloss.load() data.exog = sm.add_constant(data.ex...
bsd-3-clause
rohanp/scikit-learn
examples/neighbors/plot_approximate_nearest_neighbors_hyperparameters.py
102
5177
""" ================================================= Hyper-parameters of Approximate Nearest Neighbors ================================================= This example demonstrates the behaviour of the accuracy of the nearest neighbor queries of Locality Sensitive Hashing Forest as the number of candidates and the numb...
bsd-3-clause
IshankGulati/scikit-learn
benchmarks/bench_mnist.py
38
6799
""" ======================= MNIST dataset benchmark ======================= Benchmark on the MNIST dataset. The dataset comprises 70,000 samples and 784 features. Here, we consider the task of predicting 10 classes - digits from 0 to 9 from their raw images. By contrast to the covertype dataset, the feature space is...
bsd-3-clause
gdementen/larray
larray/inout/pandas.py
2
15308
from __future__ import absolute_import, print_function from itertools import product import numpy as np import pandas as pd from larray.core.array import Array from larray.core.axis import Axis, AxisCollection from larray.core.constants import nan from larray.util.misc import unique from larray.util.compat import ba...
gpl-3.0
ambikeshwar1991/gnuradio
gr-filter/examples/decimate.py
13
5841
#!/usr/bin/env python # # Copyright 2009,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your optio...
gpl-3.0
datapythonista/pandas
pandas/tests/indexes/test_indexing.py
1
8571
""" test_indexing tests the following Index methods: __getitem__ get_loc get_value __contains__ take where get_indexer slice_locs asof_locs The corresponding tests.indexes.[index_type].test_indexing files contain tests for the corresponding methods specific to those Index subclasses...
bsd-3-clause
rdipietro/pyrvm
rvm.py
1
8538
import itertools import numpy as np from sklearn.metrics import pairwise import pulp class RVM(object): """Ranking Vector Machine Learn and predict orderings of vectors using large-margin criteria. This is an implementation of the ranking-vector-machine algorithm from Yu, Hwanjo and Kim, Sung...
mit
lbeltrame/bcbio-nextgen
bcbio/qc/qualimap.py
1
18318
"""Quality control using Qualimap. http://qualimap.bioinfo.cipf.es/ """ import glob import os import shutil import pandas as pd import pybedtools import toolz as tz import toolz.dicttoolz as dtz from bcbio.log import logger from bcbio import bam, utils from bcbio.bam import readstats from bcbio.ngsalign import posta...
mit
iaklampanos/bde-pilot-2
backend/api_methods.py
1
39958
""" CLASS INFO --------------------------------------------------------------------------- This class acts as the model (from MVC framework) for the SC5 #3 pilot. --------------------------------------------------------------------------- """ from Dataset_transformations import Dataset_transformations from...
apache-2.0
jstoxrocky/statsmodels
statsmodels/examples/ex_univar_kde.py
34
5127
""" This example tests the nonparametric estimator for several popular univariate distributions with the different bandwidth selction methods - CV-ML; CV-LS; Scott's rule of thumb. Produces six different plots for each distribution 1) Beta 2) f 3) Pareto 4) Laplace 5) Weibull 6) Poisson """ from __future__ import p...
bsd-3-clause
imaculate/scikit-learn
sklearn/metrics/tests/test_classification.py
2
54750
from __future__ import division, print_function import numpy as np from scipy import linalg from functools import partial from itertools import product import warnings from sklearn import datasets from sklearn import svm from sklearn.datasets import make_multilabel_classification from sklearn.preprocessing import la...
bsd-3-clause
kfogel/batman
batman/tests.py
1
1757
# The batman package: fast computation of exoplanet transit light curves # Copyright (C) 2015 Laura Kreidberg # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License...
gpl-3.0
smartscheduling/scikit-learn-categorical-tree
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
amirchohan/HDR
img_hist.py
1
3159
#!/usr/bin/python # RGB Hitogram # This script will create a histogram image based on the RGB content of # an image. It uses PIL to do most of the donkey work but then we just # draw a pretty graph out of it. # # May 2009, Scott McDonough, www.scottmcdonough.co.uk # import os import sys import Image, ImageDraw, Image...
bsd-3-clause
amozie/amozie
studzie/time_series_feature_select.py
1
1046
import numpy as np import pandas as pd import matplotlib.pyplot as plt from statsmodels.graphics.tsaplots import plot_acf from statsmodels.graphics.tsaplots import plot_pacf from sklearn.ensemble import RandomForestRegressor as rfr from sklearn.feature_selection import RFE # 加载数据 series = pd.Series.from_csv('./dataset...
apache-2.0
planetarymike/IDL-Colorbars
IDL_py_test/011_BLUE-RED.py
1
5973
from matplotlib.colors import LinearSegmentedColormap from numpy import nan, inf cm_data = [[0., 0., 0.], [0., 0.00392157, 0.00392157], [0., 0.00784314, 0.00784314], [0., 0.0117647, 0.0117647], [0., 0.0156863, 0.0156863], [0., 0.0313725, 0.0313725], [0., 0.0470588, 0.0470588], [0., 0.0627451, 0.0627451], [0., 0.0823529...
gpl-2.0
hunering/demo-code
python/books/DLWP/5.4.3-cam.py
1
1670
from keras import models from keras.preprocessing import image from keras.applications.vgg16 import VGG16, preprocess_input, decode_predictions from keras import backend as K import numpy as np import matplotlib.pyplot as plt import cv2 from utils import init_keras init_keras() img_path = r"C:\Users\huxiaomi\Download...
gpl-3.0
rbrecheisen/pyminer
pyminer/network/classifiers.py
1
9893
__author__ = 'Ralph' import os import numpy as np import pandas as pd from sklearn.svm import SVC from sklearn.grid_search import GridSearchCV from sklearn.cross_validation import StratifiedKFold from sklearn.externals import joblib from sklearn.metrics import accuracy_score from sklearn.metrics import precision_sco...
apache-2.0
robwarm/gpaw-symm
gpaw/atom/generator2.py
1
40677
# -*- coding: utf-8 -*- import sys from math import pi, exp, sqrt, log import numpy as np from scipy.optimize import fsolve from scipy import __version__ as scipy_version from ase.utils import prnt, devnull from ase.units import Hartree from ase.data import atomic_numbers, chemical_symbols from gpaw.spline import Spl...
gpl-3.0
macronucleus/chromagnon
setup.py
1
4536
#!/usr/bin/env python """ Usage: python setup.py [py2app/sdist/install] on Mac 20180202: modify python3.6.sysconfig._get_sysconfigdata_name(check_exists=None) ln -s /Users/USER/miniconda3/lib/libpython3.6m.dylib libpython3.6.dylib then pythonw setup.py py2app to import javabridge install numpy wit...
mit
TomAugspurger/pandas
pandas/tests/scalar/interval/test_arithmetic.py
1
1477
from datetime import timedelta import numpy as np import pytest from pandas import Interval, Timedelta, Timestamp @pytest.mark.parametrize("method", ["__add__", "__sub__"]) @pytest.mark.parametrize( "interval", [ Interval(Timestamp("2017-01-01 00:00:00"), Timestamp("2018-01-01 00:00:00")), I...
bsd-3-clause
bert9bert/statsmodels
examples/python/predict.py
33
1580
## Prediction (out of sample) from __future__ import print_function import numpy as np import statsmodels.api as sm # ## Artificial data nsample = 50 sig = 0.25 x1 = np.linspace(0, 20, nsample) X = np.column_stack((x1, np.sin(x1), (x1-5)**2)) X = sm.add_constant(X) beta = [5., 0.5, 0.5, -0.02] y_true = np.dot(X, b...
bsd-3-clause
kylerbrown/scikit-learn
sklearn/decomposition/tests/test_truncated_svd.py
240
6055
"""Test truncated SVD transformer.""" import numpy as np import scipy.sparse as sp from sklearn.decomposition import TruncatedSVD from sklearn.utils import check_random_state from sklearn.utils.testing import (assert_array_almost_equal, assert_equal, assert_raises, assert_greater, ...
bsd-3-clause
mahak/spark
python/pyspark/pandas/series.py
9
197528
# # 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
xwolf12/scikit-learn
sklearn/feature_extraction/text.py
110
50157
# -*- coding: utf-8 -*- # Authors: Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Lars Buitinck <L.J.Buitinck@uva.nl> # Robert Layton <robertlayton@gmail.com> # Jochen Wersdörfer <jochen@wersdoerfer.de> # Roman Sinayev <roman.sinayev@gma...
bsd-3-clause
xhqu1981/pymatgen
pymatgen/analysis/diffraction/xrd.py
2
14977
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. from __future__ import division, unicode_literals from math import sin, cos, asin, pi, degrees, radians import os import collections import numpy as np import json from pymatgen.symmetry.analyzer import Spac...
mit
adamgreenhall/scikit-learn
examples/classification/plot_classification_probability.py
242
2624
""" =============================== Plot classification probability =============================== Plot the classification probability for different classifiers. We use a 3 class dataset, and we classify it with a Support Vector classifier, L1 and L2 penalized logistic regression with either a One-Vs-Rest or multinom...
bsd-3-clause
iver56/cross-adaptive-audio
plot.py
1
6325
import argparse import json import numpy as np import matplotlib from matplotlib.font_manager import FontProperties import os import settings from itertools import cycle class Plot(object): """ Plot cumulative max similarity for all experiments """ def __init__(self): # Python 2 and 3 compati...
gpl-3.0
zak-k/cartopy
lib/cartopy/examples/wmts.py
3
1039
__tags__ = ['Web services'] """ Interactive WMTS (Web Map Tile Service) --------------------------------------- This example demonstrates the interactive pan and zoom capability supported by an OGC web services Web Map Tile Service (WMTS) aware axes. The example WMTS layer is a single composite of data sampled over n...
lgpl-3.0
quantopian/research_public
research/ml_algo.py
2
17465
# https://www.quantopian.com/posts/machine-learning-alpha-with-risk-constraints # https://www.quantopian.com/posts/machine-learning-on-quantopian-part-3-building-an-algorithm?utm_campaign=machine-learning-on-quantopian-part-3-building-an-algorithm&utm_medium=email&utm_source=forums from collections import OrderedDict f...
apache-2.0
philrosenfield/TPAGB-calib
tpagb_calibration/plotting/interactive_match_cmdlimits.py
1
7262
#!/usr/bin/env python import argparse import matplotlib.pylab as plt import numpy as np import os import sys import time from astropy.io import fits from ResolvedStellarPops.tpagb_path_config import tpagb_path def move_on(ok, msg='0 to move on: '): ok = int(raw_input(msg)) time.sleep(1) return ok def fin...
bsd-3-clause
modflowpy/flopydoc
docs/pysrc/ex_lake.py
1
3491
# ExampleLake - Flopy example of multi-layer steady model with one fixed head cell # This is an example of steady flow in a multi-layer model. # Heads are fixed along all outer boundaries to 100 meters. # In the center cell in the top layer, the head is fixed to 90 meters. # Import the Python packages that w...
bsd-3-clause
seanli9jan/tensorflow
tensorflow/contrib/learn/python/learn/estimators/multioutput_test.py
136
1696
# 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
Curly-Mo/sample-recognition
ann.py
1
4427
import logging import numpy as np logger = logging.getLogger(__name__) FLANN_ALGS = ['kdtree', 'kmeans', 'composite', 'lsh', 'autotuned'] CV_ALGS = ['kdtree', 'kmeans', 'composite', 'lsh', 'autotuned'] SKLEARN_ALGS = ['kd_tree', 'ball_tree', 'brute', 'auto'] def train_matcher(data, algorithm='kdtree'): # if algo...
apache-2.0
jlegendary/scikit-learn
sklearn/feature_selection/tests/test_feature_select.py
143
22295
""" Todo: cross-check the F-value with stats model """ from __future__ import division import itertools import warnings import numpy as np from scipy import stats, sparse from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_raises...
bsd-3-clause
AlexRobson/scikit-learn
sklearn/utils/tests/test_murmurhash.py
261
2836
# Author: Olivier Grisel <olivier.grisel@ensta.org> # # License: BSD 3 clause import numpy as np from sklearn.externals.six import b, u from sklearn.utils.murmurhash import murmurhash3_32 from numpy.testing import assert_array_almost_equal from numpy.testing import assert_array_equal from nose.tools import assert_equa...
bsd-3-clause
choldgraf/ecogtools
ecogtools/tfr.py
1
2902
import mne from glob import glob import pandas as pd import numpy as np import sys from tqdm import tqdm __all__ = ['extract_amplitude'] def extract_amplitude(inst, freqs, n_cycles=7, normalize=False, n_hilbert=None, picks=None, n_jobs=1, ): """Extract the time-varying amplitude for a frequ...
bsd-2-clause
jszymon/pacal
pacal/depvars/copulas.py
1
34667
"""Set of copulas different types""" from __future__ import print_function from pacal.integration import * from pacal.interpolation import * from matplotlib.collections import PolyCollection import pacal.distr #from pacal import * from pacal.segments import PiecewiseDistribution, MInfSegment, PInfSegment, Segment, _...
gpl-3.0
BhallaLab/benchmarks
neuro_morpho/buildCA1Pyr.py
1
5403
import moogli import numpy import pylab import moose from moose import neuroml from PyQt4 import Qt, QtCore, QtGui import matplotlib.pyplot as plt import sys import os from moose.neuroml.ChannelML import ChannelML PI = 3.14159265359 frameRunTime = 0.001 runtime = 1.0 inject = 25e-10 simdt = 5e-5 FaradayConst = 96845.3...
gpl-2.0
bthirion/scikit-learn
sklearn/utils/estimator_checks.py
16
64623
from __future__ import print_function import types import warnings import sys import traceback import pickle from copy import deepcopy import numpy as np from scipy import sparse from scipy.stats import rankdata import struct from sklearn.externals.six.moves import zip from sklearn.externals.joblib import hash, Memor...
bsd-3-clause
zrhans/pythonanywhere
.virtualenvs/django19/lib/python3.4/site-packages/pandas/sandbox/qtpandas.py
13
4347
''' Easy integration of DataFrame into pyqt framework @author: Jev Kuznetsov ''' # GH9615 import warnings warnings.warn("The pandas.sandbox.qtpandas module is deprecated and will be " "removed in a future version. We refer users to the external package " "here: https://github.com/datalyze...
apache-2.0