repo_name stringlengths 6 67 | path stringlengths 5 185 | copies stringlengths 1 3 | size stringlengths 4 6 | content stringlengths 1.02k 962k | license stringclasses 15
values |
|---|---|---|---|---|---|
Zsailer/epistasis | epistasis/models/classifiers/base.py | 2 | 2387 | import numpy as np
import pandas as pd
# Scikit-learn classifiers
from sklearn.preprocessing import binarize
from epistasis.mapping import EpistasisMap
from epistasis.models.base import BaseModel, use_sklearn
from epistasis.models.utils import (XMatrixException, arghandler)
from epistasis.models.linear import Epista... | unlicense |
OthmanEmpire/project_monies | test/unit/test_unit_visualise.py | 1 | 4289 | import unittest
import datetime as dt
import numpy as np
import pandas as pd
from pandas.util.testing import assert_frame_equal
import monies.monies.visualise as vis
def disabled(func):
def _wrapper(f):
print(str(f) + " test is disabled!")
return _wrapper(func)
class VisualiseUnit(unittest.TestCas... | mit |
anaderi/hep_ml | hep_ml/reweight.py | 3 | 11419 | """
**hep_ml.reweight** contains reweighting algorithms.
Reweighting is procedure of finding such weights for original distribution,
that make distribution of one or several variables identical in original distribution and target distribution.
Remark: if each variable has identical distribution in two samples,
this d... | apache-2.0 |
corochann/chainer-hands-on-tutorial | src/05_ptb_rnn/ptb/train_ptb.py | 2 | 5504 | """
RNN Training code with Penn Treebank (ptb) dataset
Ref: https://github.com/chainer/chainer/blob/master/examples/ptb/train_ptb.py
"""
from __future__ import print_function
import os
import sys
import argparse
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import chaine... | mit |
MonoCloud/zipline | tests/test_tradesimulation.py | 21 | 2735 | #
# 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 |
cpcloud/bokeh | bokeh/sampledata/daylight.py | 4 | 2482 | """Daylight hours from http://www.sunrisesunset.com """
import re
import datetime
import requests
from six.moves import xrange
from os.path import join, abspath, dirname
import pandas as pd
url = "http://sunrisesunset.com/calendar.asp"
r0 = re.compile("<[^>]+>| |[\r\n\t]")
r1 = re.compile(r"(\d+)(DST Begins|D... | bsd-3-clause |
leonardolepus/pubmad | experiments/features_20140601/distribution.py | 1 | 1833 | import pickle
import os, sys
import itertools
import matplotlib.pyplot as plt
from scipy import stats
sys.path.insert(1, os.path.abspath('../../'))
from toolbox.graph_io.kegg.parse_KGML import KGML2Graph
features = {}
for feature_file in os.listdir('../../data/evex/Homo_Sapiens/features/'):
with open('../../data... | gpl-2.0 |
glue-viz/glue-3d-viewer | glue_vispy_viewers/compat/axis.py | 3 | 22545 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -----------------------------------------------------------------------------
... | bsd-2-clause |
bulik/ldsc | ldscore/regressions.py | 1 | 29518 | '''
(c) 2014 Brendan Bulik-Sullivan and Hilary Finucane
Estimators of heritability and genetic correlation.
Shape convention is (n_snp, n_annot) for all classes.
Last column = intercept.
'''
from __future__ import division
import numpy as np
import pandas as pd
from scipy.stats import norm, chi2
import jackknife as ... | gpl-3.0 |
sanja7s/EEDC | src/distributions/job_steps_distribution.py | 1 | 3676 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
author: sanja7s
---------------
plot the distribution
"""
import os
import datetime as dt
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from collections import defaultdict
from matplotlib import colors
from mpl_toolkits.axes... | apache-2.0 |
vybstat/scikit-learn | examples/ensemble/plot_gradient_boosting_oob.py | 230 | 4762 | """
======================================
Gradient Boosting Out-of-Bag estimates
======================================
Out-of-bag (OOB) estimates can be a useful heuristic to estimate
the "optimal" number of boosting iterations.
OOB estimates are almost identical to cross-validation estimates but
they can be compute... | bsd-3-clause |
flyingpoops/kaggle-digit-recognizer-team-learning | submit.py | 1 | 1922 | import os
os.environ["THEANO_FLAGS"] = "mode=FAST_RUN,device=gpu,floatX=float32,lib.cnmem=1,dnn.enabled=False"
import pandas as pd
import time
##########################################################
# Input varialbles
flag = 1 #0 for sklearn and 1 for keras
classifier_file_name = 'model/cnn2.json' #'C:\kaggle\dr\rf... | apache-2.0 |
joshloyal/scikit-learn | sklearn/tests/test_metaestimators.py | 52 | 4990 | """Common tests for metaestimators"""
import functools
import numpy as np
from sklearn.base import BaseEstimator
from sklearn.externals.six import iterkeys
from sklearn.datasets import make_classification
from sklearn.utils.testing import assert_true, assert_false, assert_raises
from sklearn.pipeline import Pipeline... | bsd-3-clause |
ShipJ/Code | Projects/M2020/pass.py | 1 | 1169 | import sys
import pandas as pd
import numpy as np
from Code.config import get_path
from collections import Counter
pd.set_option('display.width', 500)
def main():
path = get_path() # File path to data store
sessions = pd.DataFrame(pd.read_csv(path+'/PassGroup/sessions.csv'))
names = pd.DataFrame(pd.re... | mit |
StefReck/Km3-Autoencoder | scripts/plotting/plot_occurance_in_dataset.py | 1 | 2648 | # -*- coding: utf-8 -*-
"""
Plot number of events vs Energy, binned.
and # up events vs Energy, binned.
"""
import numpy as np
import h5py
import matplotlib.pyplot as plt
import sys
sys.path.append('scripts/util/')
#sys.path.append('../util/')
from saved_setups_for_plot_statistics import get_plot_statistics_plot_size... | mit |
RPGOne/Skynet | scikit-learn-c604ac39ad0e5b066d964df3e8f31ba7ebda1e0e/sklearn/externals/joblib/parallel.py | 3 | 28122 | """
Helpers for embarrassingly parallel code.
"""
# Author: Gael Varoquaux < gael dot varoquaux at normalesup dot org >
# Copyright: 2010, Gael Varoquaux
# License: BSD 3 clause
import os
import sys
import gc
import warnings
from collections import Sized
from math import sqrt
import functools
import time
import thread... | bsd-3-clause |
hsiaoyi0504/scikit-learn | sklearn/linear_model/randomized_l1.py | 95 | 23365 | """
Randomized Lasso/Logistic: feature selection based on Lasso and
sparse Logistic Regression
"""
# Author: Gael Varoquaux, Alexandre Gramfort
#
# License: BSD 3 clause
import itertools
from abc import ABCMeta, abstractmethod
import warnings
import numpy as np
from scipy.sparse import issparse
from scipy import spar... | bsd-3-clause |
peraktong/Cannon-Experiment | DR13_red_clump/0324_read_table_rc_atelast4_plot.py | 1 | 7213 | import numpy as np
from astropy.table import Table
from astropy.io import fits
import matplotlib.pyplot as plt
import matplotlib
import pickle
from matplotlib import cm
from numpy.random import randn
# table path
path = "/Users/caojunzhi/Downloads/upload_20170322/red_clump_dr13.fits"
star = fits.open(path)
table =... | mit |
drammock/mne-python | mne/decoding/tests/test_csp.py | 13 | 13483 | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Romain Trachel <trachelr@gmail.com>
# Alexandre Barachant <alexandre.barachant@gmail.com>
# Jean-Remi King <jeanremi.king@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import numpy as np
import pytest
from numpy.testing... | bsd-3-clause |
bullocke/ge-cdd | python/postprocess/train.py | 1 | 3201 | """
Train classifier from multiple images, multiple shapefiles for training a classifier
Usage:
train.py <train_data_path> <output_fname> [--verbose] [--logfile=<logfile>] [--bands=<bands>]
classify.py -h | --help
The <input_list> argument must be the path to a csv file containing paths to output CDD raster f... | mit |
etkirsch/scikit-learn | sklearn/metrics/pairwise.py | 49 | 44088 | # -*- coding: utf-8 -*-
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Robert Layton <robertlayton@gmail.com>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Philippe Gervais <philippe.gervais@inria.fr>
# Lars Buitinck ... | bsd-3-clause |
MaciCrowell/TCGA_DataScience | TCGAlogReg.py | 1 | 13158 | import random
import glm
import re
import thinkstats2
import thinkplot
import math
import numpy as np
import matplotlib.pyplot as pyplot
import DataUtilities
def run_regression_and_print(survey, version, means):
"""Runs a logistic regression and prints results
survey: Survey
version: which model to run
means: ma... | mit |
MohammedWasim/scikit-learn | examples/ensemble/plot_voting_decision_regions.py | 230 | 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 |
timothy1191xa/project-epsilon-1 | code/utils/scripts/convolution_normal_script.py | 3 | 3081 |
"""
Purpose:
-----------------------------------------------------------------------------------
We generate convolved hemodynamic neural prediction into seperated txt files for
all four conditions (task, gain, lost, distance), and also generate plots for 4
BOLD signals over time for each of them too.
Steps:
-----... | bsd-3-clause |
theoryno3/scikit-learn | sklearn/covariance/__init__.py | 389 | 1157 | """
The :mod:`sklearn.covariance` module includes methods and algorithms to
robustly estimate the covariance of features given a set of points. The
precision matrix defined as the inverse of the covariance is also estimated.
Covariance estimation is closely related to the theory of Gaussian Graphical
Models.
"""
from ... | bsd-3-clause |
AstroVPK/libcarma | tests/test_pickle.py | 2 | 2259 | import math
import numpy as np
import copy
import unittest
import random
import psutil
import os
import sys
import cPickle as pickle
import tempfile
import shutil
import pdb
import matplotlib.pyplot as plt
import matplotlib.cm as colormap
try:
import kali.carma
except ImportError:
print 'Cannot import kali.ca... | gpl-2.0 |
bgroveben/python3_machine_learning_projects | oreilly_GANs_for_beginners/oreilly_GANs_for_beginners/introduction_to_ml_with_python/mglearn/mglearn/make_blobs.py | 6 | 3190 | import numbers
import numpy as np
from sklearn.utils import check_array, check_random_state
from sklearn.utils import shuffle as shuffle_
def make_blobs(n_samples=100, n_features=2, centers=2, cluster_std=1.0,
center_box=(-10.0, 10.0), shuffle=True, random_state=None):
"""Generate isotropic Gaussi... | mit |
Achuth17/scikit-learn | sklearn/ensemble/__init__.py | 217 | 1307 | """
The :mod:`sklearn.ensemble` module includes ensemble-based methods for
classification and regression.
"""
from .base import BaseEnsemble
from .forest import RandomForestClassifier
from .forest import RandomForestRegressor
from .forest import RandomTreesEmbedding
from .forest import ExtraTreesClassifier
from .fores... | bsd-3-clause |
robertwb/incubator-beam | sdks/python/apache_beam/runners/interactive/utils.py | 4 | 9728 | #
# 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 |
hantek/deeplearn_hsi | ksc_joint_SdA.py | 1 | 12752 | __author__ = "Zhouhan LIN"
__date__ = "June 2013"
__version__ = "1.0"
import os
import sys
import time
import pdb
import scipy.io as sio
import numpy
import scipy
import theano
import theano.tensor as T
from scipy.stats import t
from sklearn import svm
from sklearn.metrics import confusion_matrix
from theano.tensor.sh... | bsd-2-clause |
henrykironde/scikit-learn | sklearn/neighbors/tests/test_dist_metrics.py | 230 | 5234 | import itertools
import pickle
import numpy as np
from numpy.testing import assert_array_almost_equal
import scipy
from scipy.spatial.distance import cdist
from sklearn.neighbors.dist_metrics import DistanceMetric
from nose import SkipTest
def dist_func(x1, x2, p):
return np.sum((x1 - x2) ** p) ** (1. / p)
de... | bsd-3-clause |
Djabbz/scikit-learn | sklearn/gaussian_process/gpc.py | 9 | 31542 | """Gaussian processes classification."""
# Authors: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
#
# License: BSD 3 clause
import warnings
from operator import itemgetter
import numpy as np
from scipy.linalg import cholesky, cho_solve, solve
from scipy.optimize import fmin_l_bfgs_b
from scipy.special import erf... | bsd-3-clause |
Rinoahu/POEM | deprecate/lib/deep_operon.py | 1 | 21697 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
# CreateTime: 2016-09-21 16:51:48
import numpy as np
from Bio import SeqIO, Seq, SeqUtils
#from Bio.SeqUtils.CodonUsage import CodonAdaptationIndex
from Bio.SeqUtils import GC
from Bio.SeqUtils.CodonUsage import SynonymousCodons
import math
from math impo... | gpl-3.0 |
BigDataforYou/movie_recommendation_workshop_1 | big_data_4_you_demo_1/venv/lib/python2.7/site-packages/pandas/indexes/numeric.py | 1 | 12538 | import numpy as np
import pandas.lib as lib
import pandas.algos as _algos
import pandas.index as _index
from pandas import compat
from pandas.indexes.base import Index, InvalidIndexError
from pandas.util.decorators import Appender, cache_readonly
import pandas.core.common as com
from pandas.core.common import (is_dtyp... | mit |
annayqho/TheCannon | code/lamost/abundances/check_alpha.py | 1 | 1522 | import numpy as np
import matplotlib.pyplot as plt
import glob
from matplotlib.colors import LogNorm
from matplotlib import rc
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
files = glob.glob("output/*all_cannon_labels.npz")
chisq = glob.glob("output/*cannon_label_chisq.npz")
feh_all = []
#teff_all = []
... | mit |
tswast/google-cloud-python | translate/docs/conf.py | 2 | 11927 | # -*- coding: utf-8 -*-
#
# google-cloud-translate documentation build configuration file
#
# 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 configuration values have a default; values... | apache-2.0 |
rbharath/deepchem | examples/muv/muv_sklearn.py | 3 | 1150 | """
Script that trains Sklearn multitask models on MUV dataset.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import os
import shutil
import numpy as np
import deepchem as dc
from muv_datasets import load_muv
from sklearn.ensemble import RandomForestC... | mit |
boland1992/seissuite_iran | seissuite/ant/psdepthmodel.py | 6 | 9233 | """
Module taking care of the forward modelling: theoretical dispersion
curve given a 1D crustal model of velocities and densities.
Uses the binaries of the Computer Programs in Seismology, with
must be installed in *COMPUTER_PROGRAMS_IN_SEISMOLOGY_DIR*
"""
import numpy as np
import matplotlib.pyplot as plt
import os
... | gpl-3.0 |
travisfcollins/gnuradio | gnuradio-runtime/examples/volk_benchmark/volk_plot.py | 78 | 6117 | #!/usr/bin/env python
import sys, math
import argparse
from volk_test_funcs import *
try:
import matplotlib
import matplotlib.pyplot as plt
except ImportError:
sys.stderr.write("Could not import Matplotlib (http://matplotlib.sourceforge.net/)\n")
sys.exit(1)
def main():
desc='Plot Volk performanc... | gpl-3.0 |
vkscool/nupic | examples/audiostream/audiostream_tp.py | 12 | 9994 | #!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | gpl-3.0 |
xapharius/mrEnsemble | Engine/src/algorithms/neuralnetwork/convolutional/conv_net.py | 2 | 8771 | """
Created on Jul 22, 2014
@author: Simon Hohberg
"""
import numpy as np
from algorithms.neuralnetwork.feedforward.multilayer_perceptron import MultilayerPerceptron, \
SimpleUpdate
import utils.numpyutils as nputils
import copy
import time
from layers import ConvLayer, MaxPoolLayer
from utils import logging
from ... | mit |
mattgiguere/scikit-learn | sklearn/utils/extmath.py | 142 | 21102 | """
Extended math utilities.
"""
# Authors: Gael Varoquaux
# Alexandre Gramfort
# Alexandre T. Passos
# Olivier Grisel
# Lars Buitinck
# Stefan van der Walt
# Kyle Kastner
# License: BSD 3 clause
from __future__ import division
from functools import partial
import ... | bsd-3-clause |
trankmichael/scikit-learn | sklearn/tests/test_cross_validation.py | 70 | 41943 | """Test the cross_validation module"""
from __future__ import division
import warnings
import numpy as np
from scipy.sparse import coo_matrix
from scipy import stats
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_equal
from sklearn... | bsd-3-clause |
reinierbsv/PythonScripts | Scraping.py | 1 | 2498 | import requests
from bs4 import BeautifulSoup
import pandas as pd
# page = requests.get("http://dataquestio.github.io/web-scraping-pages/simple.html")
# print(page.content)
# soup = BeautifulSoup(page.content, 'html.parser')
# print(soup)
# print(list(soup.children))
# print([type(item) for item in list(soup.... | gpl-3.0 |
luo66/scikit-learn | examples/ensemble/plot_adaboost_hastie_10_2.py | 355 | 3576 | """
=============================
Discrete versus Real AdaBoost
=============================
This example is based on Figure 10.2 from Hastie et al 2009 [1] and illustrates
the difference in performance between the discrete SAMME [2] boosting
algorithm and real SAMME.R boosting algorithm. Both algorithms are evaluate... | bsd-3-clause |
RPGOne/scikit-learn | examples/mixture/plot_concentration_prior.py | 25 | 5631 | """
========================================================================
Concentration Prior Type Analysis of Variation Bayesian Gaussian Mixture
========================================================================
This example plots the ellipsoids obtained from a toy dataset (mixture of three
Gaussians) fitte... | bsd-3-clause |
spbguru/repo1 | external/linux32/lib/python2.6/site-packages/matplotlib/projections/polar.py | 69 | 20981 | import math
import numpy as npy
import matplotlib
rcParams = matplotlib.rcParams
from matplotlib.artist import kwdocd
from matplotlib.axes import Axes
from matplotlib import cbook
from matplotlib.patches import Circle
from matplotlib.path import Path
from matplotlib.ticker import Formatter, Locator
from matplotlib.tr... | gpl-3.0 |
databricks/spark-sklearn | python/doc/conf.py | 1 | 8435 | # -*- coding: utf-8 -*-
#
# spark_sklearn documentation build configuration file, created by
# sphinx-quickstart on Wed Dec 16 10:51:51 2015.
#
# 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.... | apache-2.0 |
fidelram/deepTools | deeptools/computeGCBias.py | 1 | 30954 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import multiprocessing
import numpy as np
import argparse
from scipy.stats import poisson
import py2bit
import sys
from deeptoolsintervals import GTF
from deeptools.utilities import tbitToBamChrName, getGC_content
from deeptools import parserCommon, mapReduce... | gpl-3.0 |
kernc/scikit-learn | examples/ensemble/plot_adaboost_twoclass.py | 347 | 3268 | """
==================
Two-class AdaBoost
==================
This example fits an AdaBoosted decision stump on a non-linearly separable
classification dataset composed of two "Gaussian quantiles" clusters
(see :func:`sklearn.datasets.make_gaussian_quantiles`) and plots the decision
boundary and decision scores. The di... | bsd-3-clause |
sinhrks/pyopendata | pyopendata/io/jstat.py | 1 | 4233 | # pylint: disable-msg=E1101,W0613,W0603
from __future__ import unicode_literals
import os
import requests
import numpy as np
import pandas as pd
import pandas.compat as compat
from pyopendata.io.util import _read_content
def read_jstat(path_or_buf, typ='frame', squeeze=True):
"""
Convert a JSON-Stat stri... | bsd-2-clause |
jorge2703/scikit-learn | examples/linear_model/plot_sgd_comparison.py | 167 | 1659 | """
==================================
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 |
djgagne/scikit-learn | examples/linear_model/plot_logistic_l1_l2_sparsity.py | 384 | 2601 | """
==============================================
L1 Penalty and Sparsity in Logistic Regression
==============================================
Comparison of the sparsity (percentage of zero coefficients) of solutions when
L1 and L2 penalty are used for different values of C. We can see that large
values of C give mo... | bsd-3-clause |
yyjiang/scikit-learn | doc/sphinxext/numpy_ext/docscrape_sphinx.py | 408 | 8061 | import re
import inspect
import textwrap
import pydoc
from .docscrape import NumpyDocString
from .docscrape import FunctionDoc
from .docscrape import ClassDoc
class SphinxDocString(NumpyDocString):
def __init__(self, docstring, config=None):
config = {} if config is None else config
self.use_plots... | bsd-3-clause |
sarahgrogan/scikit-learn | examples/covariance/plot_mahalanobis_distances.py | 348 | 6232 | r"""
================================================================
Robust covariance estimation and Mahalanobis distances relevance
================================================================
An example to show covariance estimation with the Mahalanobis
distances on Gaussian distributed data.
For Gaussian dis... | bsd-3-clause |
pratapvardhan/scikit-learn | sklearn/datasets/tests/test_base.py | 33 | 7160 | import os
import shutil
import tempfile
import warnings
import nose
import numpy
from pickle import loads
from pickle import dumps
from sklearn.datasets import get_data_home
from sklearn.datasets import clear_data_home
from sklearn.datasets import load_files
from sklearn.datasets import load_sample_images
from sklearn... | bsd-3-clause |
pompiduskus/scikit-learn | examples/cluster/plot_color_quantization.py | 297 | 3443 | # -*- coding: utf-8 -*-
"""
==================================
Color Quantization using K-Means
==================================
Performs a pixel-wise Vector Quantization (VQ) of an image of the summer palace
(China), reducing the number of colors required to show the image from 96,615
unique colors to 64, while pre... | bsd-3-clause |
text-machine-lab/CliRel | src/note.py | 1 | 14806 | """
Text-Machine Lab: CliRel
File Name : note.py
Creation Date : 30-09-2016
Created By : Renan Campos
Purpose : Internal data representation for a document set.
Each entry consists of a concept pair, a sentence, and a relation
label. The entries are indexed by filename and line number... | apache-2.0 |
liyu1990/sklearn | sklearn/tree/tests/test_tree.py | 13 | 52365 | """
Testing for the tree module (sklearn.tree).
"""
import pickle
from functools import partial
from itertools import product
import platform
import numpy as np
from scipy.sparse import csc_matrix
from scipy.sparse import csr_matrix
from scipy.sparse import coo_matrix
from sklearn.random_projection import sparse_rand... | bsd-3-clause |
lkloh/aimbat-lite | scripts/egplot.py | 1 | 1177 | #!/usr/bin/env python
"""
Example python script for SAC plotting replication: p1, p2, prs.
Xiaoting Lou (xlou@u.northwestern.edu)
03/07/2012
"""
from pylab import *
import matplotlib.transforms as transforms
from pysmo.aimbat.sacpickle import loadData
from pysmo.aimbat.plotphase import getDataOpts, PPConfig, sacp1, s... | gpl-3.0 |
walterreade/scikit-learn | sklearn/linear_model/tests/test_passive_aggressive.py | 169 | 8809 | 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_almost_equal
from sklearn.utils.testing import assert_rais... | bsd-3-clause |
BillyLiggins/alphaBetaClassifier | machineLearning/script.py | 1 | 2465 | """
You have found that this simple logistic regression performs a lot better when you train on the posr and BAB classifier as oppose to the energy.
This is werid!
however may be explained by the .... Think about it.
"""
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model, dataset... | mit |
GFDRR/thinkhazard | support_tools/API_parse/ADM2_api.py | 1 | 1956 | import grequests
import pandas as pd
from collections import defaultdict
"""
Instructions:
You will need to install requests, grequests, and pandas if you have not already done so.
conda install -c conda-forge requests grequests pandas
OR
pip install requests grequests pandas
"""
def parse_resp... | gpl-3.0 |
elijah513/scikit-learn | examples/decomposition/plot_pca_vs_lda.py | 182 | 1743 | """
=======================================================
Comparison of LDA and PCA 2D projection of Iris dataset
=======================================================
The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour
and Virginica) with 4 attributes: sepal length, sepal width, petal length
a... | bsd-3-clause |
andyh616/mne-python | mne/decoding/tests/test_time_gen.py | 3 | 11769 | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Jean-Remi King <jeanremi.king@gmail.com>
#
# License: BSD (3-clause)
import warnings
import copy
import os.path as op
from nose.tools import assert_equal, assert_true, assert_raises
import numpy as np
from numpy.testing import assert_ar... | bsd-3-clause |
sryza/freewaydata | python/playaround.py | 1 | 1776 | import pandas as pd
import matplotlib.pyplot as plot
import pylab
import plotonmap
from sklearn.cluster import KMeans
map_template_path = 'html/showfreeways.html.template'
pylab.show()
pylab.ion()
# load stuff
colnames = ['timestamp', 'station', 'district', 'route', 'direction', 'lanetype', 'stationlen', 'samples', '... | apache-2.0 |
zaxtax/scikit-learn | sklearn/datasets/tests/test_base.py | 33 | 7160 | import os
import shutil
import tempfile
import warnings
import nose
import numpy
from pickle import loads
from pickle import dumps
from sklearn.datasets import get_data_home
from sklearn.datasets import clear_data_home
from sklearn.datasets import load_files
from sklearn.datasets import load_sample_images
from sklearn... | bsd-3-clause |
jpmml/sklearn2pmml | sklearn2pmml/preprocessing/xgboost.py | 1 | 1720 | from sklearn_pandas import DataFrameMapper
from sklearn.compose import ColumnTransformer
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import LabelBinarizer, OneHotEncoder, OrdinalEncoder
from sklearn2pmml import _is_categorical
from sklearn2pmml.preprocessing import PMMLLabelBinarizer
def make_xgbo... | agpl-3.0 |
Ecogenomics/CheckM | setup.py | 1 | 1246 | #!/usr/bin/env python3
import os
from setuptools import setup
def version():
setupDir = os.path.dirname(os.path.realpath(__file__))
versionFile = open(os.path.join(setupDir, 'checkm', 'VERSION'))
return versionFile.readline().strip()
setup(
name='checkm-genome',
version=version(),
author='Don... | gpl-3.0 |
brianmingus/sklearn-emergent | emergent_sklearn.py | 1 | 5839 | from pprint import pprint
import inspect
import socket; socket.setdefaulttimeout(.2) # TODO: may want to tune this
import json
import numpy
from time import sleep
import sklearn
from sklearn.utils.estimator_checks import check_estimator
from sklearn.base import BaseEstimator, RegressorMixin
# http://stackoverflow.com... | gpl-3.0 |
hsuantien/scikit-learn | sklearn/decomposition/tests/test_fastica.py | 272 | 7798 | """
Test the fastica algorithm.
"""
import itertools
import warnings
import numpy as np
from scipy import stats
from nose.tools import assert_raises
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 skl... | bsd-3-clause |
analogdevicesinc/gnuradio | gr-filter/examples/channelize.py | 58 | 7003 | #!/usr/bin/env python
#
# Copyright 2009,2012,2013 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 ... | gpl-3.0 |
michigraber/scikit-learn | doc/sphinxext/numpy_ext/docscrape_sphinx.py | 408 | 8061 | import re
import inspect
import textwrap
import pydoc
from .docscrape import NumpyDocString
from .docscrape import FunctionDoc
from .docscrape import ClassDoc
class SphinxDocString(NumpyDocString):
def __init__(self, docstring, config=None):
config = {} if config is None else config
self.use_plots... | bsd-3-clause |
devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/nltk/probability.py | 12 | 81647 | # -*- coding: utf-8 -*-
# Natural Language Toolkit: Probability and Statistics
#
# Copyright (C) 2001-2012 NLTK Project
# Author: Edward Loper <edloper@gradient.cis.upenn.edu>
# Steven Bird <sb@csse.unimelb.edu.au> (additions)
# Trevor Cohn <tacohn@cs.mu.oz.au> (additions)
# Peter Ljunglöf <pete... | agpl-3.0 |
jmschrei/scikit-learn | sklearn/datasets/mlcomp.py | 289 | 3855 | # Copyright (c) 2010 Olivier Grisel <olivier.grisel@ensta.org>
# License: BSD 3 clause
"""Glue code to load http://mlcomp.org data as a scikit.learn dataset"""
import os
import numbers
from sklearn.datasets.base import load_files
def _load_document_classification(dataset_path, metadata, set_=None, **kwargs):
if ... | bsd-3-clause |
rafwiewiora/msmbuilder | msmbuilder/utils/nearest.py | 12 | 6505 | # Author: Matthew Harrigan <matthew.p.harrigan@gmail.com>
# Contributors:
# Copyright (c) 2015, Stanford University and the Authors
# All rights reserved.
from __future__ import absolute_import, print_function, division
from scipy.spatial import KDTree as sp_KDTree
import numpy as np
from . import check_iter_of_seque... | lgpl-2.1 |
pv/scikit-learn | sklearn/tree/tree.py | 113 | 34767 | """
This module gathers tree-based methods, including decision, regression and
randomized trees. Single and multi-output problems are both handled.
"""
# Authors: Gilles Louppe <g.louppe@gmail.com>
# Peter Prettenhofer <peter.prettenhofer@gmail.com>
# Brian Holt <bdholt1@gmail.com>
# Noel Da... | bsd-3-clause |
ericdill/scikit-xray | doc/sphinxext/tests/test_docscrape.py | 12 | 14257 | # -*- encoding:utf-8 -*-
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from docscrape import NumpyDocString, FunctionDoc, ClassDoc
from docscrape_sphinx import SphinxDocString, SphinxClassDoc
from nose.tools import *
doc_txt = '''\
numpy.multivariate_normal(mean, cov, shape=No... | bsd-3-clause |
UDST/activitysim | activitysim/abm/models/util/test/test_cdap.py | 2 | 3824 | # ActivitySim
# See full license in LICENSE.txt.
import os.path
import pandas as pd
import pandas.util.testing as pdt
import pytest
from .. import cdap
from activitysim.core import simulate
@pytest.fixture(scope='module')
def data_dir():
return os.path.join(os.path.dirname(__file__), 'data')
@pytest.fixture... | bsd-3-clause |
0asa/scikit-learn | sklearn/linear_model/tests/test_sparse_coordinate_descent.py | 28 | 10014 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_true
from sklearn.utils.t... | bsd-3-clause |
gfyoung/pandas | pandas/tests/indexes/ranges/test_setops.py | 2 | 12685 | from datetime import datetime, timedelta
import numpy as np
import pytest
from pandas import Index, Int64Index, RangeIndex, UInt64Index
import pandas._testing as tm
class TestRangeIndexSetOps:
@pytest.mark.parametrize("klass", [RangeIndex, Int64Index, UInt64Index])
def test_intersection_mismatched_dtype(sel... | bsd-3-clause |
zrhans/python | exemplos/Examples.lnk/bokeh/plotting/file/glucose.py | 2 | 1520 | import pandas as pd
from bokeh.sampledata.glucose import data
from bokeh.plotting import *
output_file("glucose.html", title="glucose.py example")
TOOLS = "pan,wheel_zoom,box_zoom,reset,save"
p1 = figure(x_axis_type="datetime", tools=TOOLS)
p1.line(data.index, data['glucose'], color='red', legend='glucose')
p1.lin... | gpl-2.0 |
oesteban/mriqc | mriqc/classifier/sklearn/_validation.py | 1 | 7844 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: oesteban
# @Date: 2017-06-21 16:44:27
import warnings
import numbers
import time
import numpy as np
# import scipy.sparse as sp
from sklearn.base import is_classifier, clone
from sklearn.utils import indexable, check_random_state, safe_indexing
from sklearn... | bsd-3-clause |
Knuppknou/academia_ai | academia_ai/leafs/leafs.py | 1 | 1435 | import numpy as np
import matplotlib.pyplot as plt
import pickle
print("Reloaded leafs!")
class Leaf(object):
''' '''
def __init__(self, iid=-1, label=-1, matrix=np.zeros((1, 1)), labelstr=''):
self.image = matrix
if self.image.shape == (1, 1):
print('Error: no input matrix give... | mit |
chrisburr/scikit-learn | examples/tree/plot_tree_regression_multioutput.py | 22 | 1848 | """
===================================================================
Multi-output Decision Tree Regression
===================================================================
An example to illustrate multi-output regression with decision tree.
The :ref:`decision trees <tree>`
is used to predict simultaneously the ... | bsd-3-clause |
rajanshah/dx | dx/dx_models.py | 3 | 34610 | #
# DX Analytics
# Base Classes and Model Classes for Simulation
# dx_models.py
#
# DX Analytics is a financial analytics library, mainly for
# derviatives modeling and pricing by Monte Carlo simulation
#
# (c) Dr. Yves J. Hilpisch
# The Python Quants GmbH
#
# This program is free software: you can redistribute it and/... | agpl-3.0 |
samueljackson92/major-project | src/tests/test_utils.py | 1 | 1768 | import numpy as np
import os.path
import nose.tools
import tests
import pandas as pd
from skimage import filters, io
def assert_lists_equal(a, b):
"""Check if two lists are equal"""
nose.tools.assert_true(len(a) == len(b))
nose.tools.assert_true(sorted(a) == sorted(b))
def assert_data_frame_columns_mat... | mit |
Akshay0724/scikit-learn | sklearn/feature_selection/tests/test_base.py | 98 | 3681 | import numpy as np
from scipy import sparse as sp
from numpy.testing import assert_array_equal
from sklearn.base import BaseEstimator
from sklearn.feature_selection.base import SelectorMixin
from sklearn.utils import check_array
from sklearn.utils.testing import assert_raises, assert_equal
class StepSelector(Select... | bsd-3-clause |
sebchalmers/WTGen | SplineGen/SplineGen.py | 3 | 5106 | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 16 20:18:08 2012
@author: sebastien
Create a Cp/Ct table interpolation with sensitivity generation
"""
import numpy as np
from scipy import interpolate
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import scipy.io
#Some functions
def MakeGr... | apache-2.0 |
melqkiades/yelp | source/python/topicmodeling/context/context_utils.py | 1 | 18904 | from collections import Counter
import cPickle as pickle
import json
import math
import random
import itertools
import h5py
import networkx
import sklearn
from networkx.algorithms.approximation import dominating_set
from networkx.algorithms.approximation import vertex_cover
import nltk
from nltk.corpus import wordnet
... | lgpl-2.1 |
lucasbrunialti/biclustering-experiments | experiments/run_algo.py | 1 | 23647 |
import sys
import time
import h5py
import codecs
import subprocess
import numpy as np
import pandas as pd
import skfuzzy as fuzz
from argparse import ArgumentParser
# from fnmtf import fnmtf
from davies_bouldin import davies_bouldin_score, calculate_centroids_doc_mean
# from onmtf import matrix_factorization_clusteri... | bsd-2-clause |
gfyoung/pandas | pandas/tests/tslibs/test_liboffsets.py | 3 | 5095 | """
Tests for helper functions in the cython tslibs.offsets
"""
from datetime import datetime
import pytest
from pandas._libs.tslibs.ccalendar import get_firstbday, get_lastbday
import pandas._libs.tslibs.offsets as liboffsets
from pandas._libs.tslibs.offsets import roll_qtrday
from pandas import Timestamp
@pytest... | bsd-3-clause |
mojoboss/scikit-learn | examples/cluster/plot_birch_vs_minibatchkmeans.py | 333 | 3694 | """
=================================
Compare BIRCH and MiniBatchKMeans
=================================
This example compares the timing of Birch (with and without the global
clustering step) and MiniBatchKMeans on a synthetic dataset having
100,000 samples and 2 features generated using make_blobs.
If ``n_clusters... | bsd-3-clause |
KaelChen/numpy | numpy/lib/npyio.py | 42 | 71218 | from __future__ import division, absolute_import, print_function
import sys
import os
import re
import itertools
import warnings
import weakref
from operator import itemgetter
import numpy as np
from . import format
from ._datasource import DataSource
from numpy.core.multiarray import packbits, unpackbits
from ._ioto... | bsd-3-clause |
xwolf12/scikit-learn | examples/feature_selection/plot_feature_selection.py | 249 | 2827 | """
===============================
Univariate Feature Selection
===============================
An example showing univariate feature selection.
Noisy (non informative) features are added to the iris data and
univariate feature selection is applied. For each feature, we plot the
p-values for the univariate feature s... | bsd-3-clause |
xubenben/scikit-learn | sklearn/cluster/birch.py | 207 | 22706 | # Authors: Manoj Kumar <manojkumarsivaraj334@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Joel Nothman <joel.nothman@gmail.com>
# License: BSD 3 clause
from __future__ import division
import warnings
import numpy as np
from scipy import sparse
from math import sqrt
fro... | bsd-3-clause |
dsm054/pandas | pandas/tests/dtypes/test_common.py | 1 | 23699 | # -*- coding: utf-8 -*-
import pytest
import numpy as np
import pandas as pd
from pandas.core.dtypes.dtypes import (DatetimeTZDtype, PeriodDtype,
CategoricalDtype, IntervalDtype)
from pandas.core.sparse.api import SparseDtype
import pandas.core.dtypes.common as com
import panda... | bsd-3-clause |
brguez/TEIBA | src/python/genomic_distribution_cor.py | 1 | 4598 | #!/usr/bin/env python
#coding: utf-8
#### FUNCTIONS ####
def header(string):
"""
Display header
"""
timeInfo = time.strftime("%Y-%m-%d %H:%M")
print '\n', timeInfo, "****", string, "****"
def subHeader(string):
"""
Display subheader
"""
timeInfo = time.strftime("%Y-%m-%... | gpl-3.0 |
jseabold/scipy | scipy/stats/morestats.py | 6 | 87719 | # Author: Travis Oliphant, 2002
#
# Further updates and enhancements by many SciPy developers.
#
from __future__ import division, print_function, absolute_import
import math
import warnings
from collections import namedtuple
import numpy as np
from numpy import (isscalar, r_, log, sum, around, unique, asarray,
... | bsd-3-clause |
sosey/ginga | ginga/mplw/FigureCanvasQt.py | 1 | 2460 | #
# GingaCanvasQt.py -- classes for the display of FITS files in
# Matplotlib FigureCanvas
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
f... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.