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 |
|---|---|---|---|---|---|
cwu2011/scikit-learn | examples/applications/plot_species_distribution_modeling.py | 254 | 7434 | """
=============================
Species distribution modeling
=============================
Modeling species' geographic distributions is an important
problem in conservation biology. In this example we
model the geographic distribution of two south american
mammals given past observations and 14 environmental
varia... | bsd-3-clause |
AustralianSynchrotron/sinspect | setup.py | 1 | 5354 | # This file based on the example by Thomas Lecocq at
# http://www.geophysique.be/2011/08/01/pack-an-enthought-traits-app-inside-a-exe-using-py2exe-ets-4-0-edit/
# retrieved 2013-04-05
# Quoting the blog entry:
#
# then, to launch the packing, just do:
# $ python setup.py py2exe
#
# The build and packing process... | bsd-3-clause |
fdft/wordCloudArt | examples/colored.py | 10 | 1555 | #!/usr/bin/env python2
"""
Image-colored wordcloud
========================
You can color a word-cloud by using an image-based coloring strategy implemented in
ImageColorGenerator. It uses the average color of the region occupied by the word
in a source image. You can combine this with masking - pure-white will be inte... | mit |
hmendozap/auto-sklearn | test/test_pipeline/components/data_preprocessing/test_one_hot_encoding.py | 1 | 4903 | import os
import unittest
import numpy as np
from scipy import sparse
from autosklearn.pipeline.components.data_preprocessing.one_hot_encoding import OneHotEncoder
from autosklearn.pipeline.util import _test_preprocessing
class OneHotEncoderTest(unittest.TestCase):
def setUp(self):
self.categorical = [T... | bsd-3-clause |
hugobowne/scikit-learn | examples/ensemble/plot_forest_iris.py | 335 | 6271 | """
====================================================================
Plot the decision surfaces of ensembles of trees on the iris dataset
====================================================================
Plot the decision surfaces of forests of randomized trees trained on pairs of
features of the iris dataset.
... | bsd-3-clause |
hfp/tensorflow-xsmm | 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 |
jm-begon/scikit-learn | sklearn/linear_model/tests/test_theil_sen.py | 234 | 9928 | """
Testing for Theil-Sen module (sklearn.linear_model.theil_sen)
"""
# Author: Florian Wilhelm <florian.wilhelm@gmail.com>
# License: BSD 3 clause
from __future__ import division, print_function, absolute_import
import os
import sys
from contextlib import contextmanager
import numpy as np
from numpy.testing import ... | bsd-3-clause |
aabadie/scikit-learn | sklearn/preprocessing/tests/test_data.py | 6 | 62084 |
# Authors:
#
# Giorgio Patrini
#
# License: BSD 3 clause
import warnings
import numpy as np
import numpy.linalg as la
from scipy import sparse
from distutils.version import LooseVersion
from sklearn.utils import gen_batches
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing im... | bsd-3-clause |
rishikksh20/scikit-learn | sklearn/pipeline.py | 13 | 30670 | """
The :mod:`sklearn.pipeline` module implements utilities to build a composite
estimator, as a chain of transforms and estimators.
"""
# Author: Edouard Duchesnay
# Gael Varoquaux
# Virgile Fritsch
# Alexandre Gramfort
# Lars Buitinck
# License: BSD
from collections import defaultdict... | bsd-3-clause |
NumCosmo/NumCosmo | examples/pydata_simple/example_mc.py | 1 | 3171 | #!/usr/bin/env python
import sys
import math
import numpy as np
import matplotlib.pyplot as plt
import os.path
try:
import gi
gi.require_version('NumCosmo', '1.0')
gi.require_version('NumCosmoMath', '1.0')
except:
pass
from gi.repository import GObject
from gi.repository import NumCosmo as Nc
from gi.reposit... | gpl-3.0 |
fraricci/pymatgen | pymatgen/io/lammps/tests/test_outputs.py | 4 | 6962 | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import unittest
import os
import json
import numpy as np
import pandas as pd
from pymatgen.io.lammps.outputs import LammpsDump, parse_lammps_dumps, \
parse_lammps_log
test_dir = os.path.join(os.path.dirna... | mit |
fzalkow/scikit-learn | sklearn/externals/joblib/parallel.py | 86 | 35087 | """
Helpers for embarrassingly parallel code.
"""
# Author: Gael Varoquaux < gael dot varoquaux at normalesup dot org >
# Copyright: 2010, Gael Varoquaux
# License: BSD 3 clause
from __future__ import division
import os
import sys
import gc
import warnings
from math import sqrt
import functools
import time
import thr... | bsd-3-clause |
shenzebang/scikit-learn | examples/svm/plot_svm_scale_c.py | 223 | 5375 | """
==============================================
Scaling the regularization parameter for SVCs
==============================================
The following example illustrates the effect of scaling the
regularization parameter when using :ref:`svm` for
:ref:`classification <svm_classification>`.
For SVC classificati... | bsd-3-clause |
anirudhjayaraman/scikit-learn | sklearn/externals/joblib/__init__.py | 72 | 4795 | """ Joblib is a set of tools to provide **lightweight pipelining in
Python**. In particular, joblib offers:
1. transparent disk-caching of the output values and lazy re-evaluation
(memoize pattern)
2. easy simple parallel computing
3. logging and tracing of the execution
Joblib is optimized to be **fast*... | bsd-3-clause |
IndraVikas/scikit-learn | examples/linear_model/plot_theilsen.py | 232 | 3615 | """
====================
Theil-Sen Regression
====================
Computes a Theil-Sen Regression on a synthetic dataset.
See :ref:`theil_sen_regression` for more information on the regressor.
Compared to the OLS (ordinary least squares) estimator, the Theil-Sen
estimator is robust against outliers. It has a breakd... | bsd-3-clause |
andrewnc/scikit-learn | examples/applications/topics_extraction_with_nmf_lda.py | 133 | 3517 | """
========================================================================================
Topics extraction with Non-Negative Matrix Factorization And Latent Dirichlet Allocation
========================================================================================
This is an example of applying Non Negative Matr... | bsd-3-clause |
CanisMajoris/ThinkStats2 | code/brfss.py | 69 | 4708 | """This file contains code for use with "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2010 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function
import math
import sys
import pandas
import numpy as np
import thinkstats2
impo... | gpl-3.0 |
Srisai85/scikit-learn | benchmarks/bench_glmnet.py | 297 | 3848 | """
To run this, you'll need to have installed.
* glmnet-python
* scikit-learn (of course)
Does two benchmarks
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... | bsd-3-clause |
ARM-software/lisa | lisa/analysis/base.py | 2 | 28654 | # SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2015, ARM Limited and contributors.
#
# 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
#
# ... | apache-2.0 |
karstenw/nodebox-pyobjc | examples/Extended Application/matplotlib/examples/user_interfaces/embedding_in_gtk2_sgskip.py | 1 | 1492 | """
=================
Embedding In GTK2
=================
show how to add a matplotlib FigureCanvasGTK or FigureCanvasGTKAgg widget and
a toolbar to a gtk.Window
"""
import gtk
from matplotlib.figure import Figure
from numpy import arange, sin, pi
# uncomment to select /GTK/GTKAgg/GTKCairo
#from matplotlib.backends.... | mit |
CallaJun/hackprince | indico/matplotlib/backend_bases.py | 10 | 106046 | """
Abstract base classes define the primitives that renderers and
graphics contexts must implement to serve as a matplotlib backend
:class:`RendererBase`
An abstract base class to handle drawing/rendering operations.
:class:`FigureCanvasBase`
The abstraction layer that separates the
:class:`matplotlib.fi... | lgpl-3.0 |
vshtanko/scikit-learn | examples/linear_model/plot_robust_fit.py | 238 | 2414 | """
Robust linear estimator fitting
===============================
Here a sine function is fit with a polynomial of order 3, for values
close to zero.
Robust fitting is demoed in different situations:
- No measurement errors, only modelling errors (fitting a sine with a
polynomial)
- Measurement errors in X
- M... | bsd-3-clause |
massmutual/scikit-learn | sklearn/cluster/tests/test_mean_shift.py | 150 | 3651 | """
Testing for mean shift clustering methods
"""
import numpy as np
import warnings
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import asser... | bsd-3-clause |
dwaithe/ONBI_image_analysis | day2_colocalisation/tifffile.py | 3 | 172981 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# tifffile.py
# Copyright (c) 2008-2014, Christoph Gohlke
# Copyright (c) 2008-2014, The Regents of the University of California
# Produced at the Laboratory for Fluorescence Dynamics
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or wit... | gpl-2.0 |
ruymanengithub/vison | vison/analysis/Guyonnet15.py | 1 | 32591 | # -*- coding: utf-8 -*-
"""
Library with functions that implement the algorithms described in Guyonnet+15.
"Evidence for self-interaction of charge distribution in CCDs"
Guyonnet, Astier, Antilogus, Regnault and Doherty 2015
Notes:
- I renamed "x" (pixel boundary index) to "b", to avoid confusion with
cartesian "... | gpl-3.0 |
lmallin/coverage_test | python_venv/lib/python2.7/site-packages/pandas/tests/frame/test_to_csv.py | 7 | 44295 | # -*- coding: utf-8 -*-
from __future__ import print_function
import csv
import pytest
from numpy import nan
import numpy as np
from pandas.compat import (lmap, range, lrange, StringIO, u)
from pandas.errors import ParserError
from pandas import (DataFrame, Index, Series, MultiIndex, Timestamp,
... | mit |
smblance/ggplot | ggplot/tests/test_element_text.py | 12 | 1362 | from nose.tools import assert_equal, assert_true
from ggplot.tests import image_comparison, cleanup
from ggplot import *
from numpy import linspace
from pandas import DataFrame
df = DataFrame({"blahblahblah": linspace(999, 1111, 9),
"yadayadayada": linspace(999, 1111, 9)})
simple_gg = ggplot(aes(x="b... | bsd-2-clause |
anilmuthineni/tensorflow | tensorflow/examples/tutorials/input_fn/boston.py | 12 | 2597 | # 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 |
yyjiang/scikit-learn | sklearn/neighbors/base.py | 115 | 29783 | """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 |
dvro/brew | brew/selection/dynamic/knora.py | 3 | 8361 | # -*- coding: utf-8 -*-
import numpy as np
from .base import DCS
from brew.base import Ensemble
# do not use this class directly, call it's subclasses instead (e.g. KNORA_E)
class KNORA(DCS):
def _get_best_classifiers(self, ensemble, neighbors_X, neighbors_y, x):
ensemble_out = ensemble.output(neighbo... | mit |
timmyshen/kaggle-titanic | myfirstforest.py | 26 | 4081 | """ Writing my first randomforest code.
Author : AstroDave
Date : 23rd September 2012
Revised: 15 April 2014
please see packages.python.org/milk/randomforests.html for more
"""
import pandas as pd
import numpy as np
import csv as csv
from sklearn.ensemble import RandomForestClassifier
# Data cleanup
# TRAIN DATA
tra... | mit |
subhadram/insilico | examples/NeuronSAHPVGCCNetwork/peak3.py | 1 | 1562 | from pylab import *
import numpy as np
from matplotlib import pyplot
# Get peak of data and store it in file
#data = genfromtxt('/media/subhadra/b8f700e2-a56b-4e3c-ba5d-d4a7ab6f5d56/centos6.3/arun/Subhadra/our.dat')
#data1 = genfromtxt('/media/subhadra/b8f700e2-a56b-4e3c-ba5d-d4a7ab6f5d56/centos6.3/arun/Subhadra/cw.d... | gpl-3.0 |
MichaelJVLeach/DotaCaptain | k_nearest_neighbors/test.py | 4 | 2340 | import numpy as np
import pickle
from progressbar import ProgressBar, Bar, Percentage, FormatLabel, ETA
from sklearn.metrics import precision_recall_fscore_support
NUM_HEROES = 108
NUM_FEATURES = NUM_HEROES*2
# Import the test x matrix and Y vector
preprocessed = np.load('test_5669.npz')
X = preprocessed['X']
Y = pre... | mit |
mikecroucher/GPy | GPy/plotting/matplot_dep/img_plots.py | 15 | 2159 | # Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
"""
The module contains the tools for ploting 2D image visualizations
"""
import numpy as np
from matplotlib.cm import jet
width_max = 15
height_max = 12
def _calculateFigureSize(x_size, y_size, fig_ncols... | bsd-3-clause |
cauchycui/scikit-learn | examples/neighbors/plot_kde_1d.py | 347 | 5100 | """
===================================
Simple 1D Kernel Density Estimation
===================================
This example uses the :class:`sklearn.neighbors.KernelDensity` class to
demonstrate the principles of Kernel Density Estimation in one dimension.
The first plot shows one of the problems with using histogram... | bsd-3-clause |
Crimson-Star-Software/data-combine | datacombine/datacombine/hrminer.py | 1 | 9120 | #!/usr/bin/env python
import json
import logging
import os
import re
import sys
from IPython import embed
import pandas as pd
import numpy as np
tagre = re.compile("Tags:\s+\n(\s+-\s+[0-9A-Za-z\s]+\n)+", re.MULTILINE)
idre = re.compile("- ID: ([0-9]+)", re.MULTILINE)
namere = re.compile(" Name: ([\s\w\&\.\-\\\/\(\)\'... | mit |
kohpangwei/influence-release | influence/all_CNN_c.py | 1 | 5279 | from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import abc
import sys
import numpy as np
import pandas as pd
from sklearn import linear_model, preprocessing, cluster
import matplotlib.pyplot as plt
import seaborn as... | mit |
fredhusser/scikit-learn | examples/plot_multilabel.py | 236 | 4157 | # Authors: Vlad Niculae, Mathieu Blondel
# License: BSD 3 clause
"""
=========================
Multilabel classification
=========================
This example simulates a multi-label document classification problem. The
dataset is generated randomly based on the following process:
- pick the number of labels: n ... | bsd-3-clause |
ishank08/scikit-learn | sklearn/manifold/tests/test_mds.py | 99 | 1873 | import numpy as np
from numpy.testing import assert_array_almost_equal
from sklearn.manifold import mds
from sklearn.utils.testing import assert_raises
def test_smacof():
# test metric smacof using the data of "Modern Multidimensional Scaling",
# Borg & Groenen, p 154
sim = np.array([[0, 5, 3, 4],
... | bsd-3-clause |
gviejo/ThalamusPhysio | python/main_pop_corr_NOHD.py | 1 | 6497 | import numpy as np
import pandas as pd
# from matplotlib.pyplot import plot,show,draw
import scipy.io
from functions import *
import _pickle as cPickle
import time
import os, sys
import ipyparallel
import neuroseries as nts
import scipy.stats
from pylab import *
from multiprocessing import Pool
data_directory = '/mnt/... | gpl-3.0 |
Srisai85/scipy | scipy/special/c_misc/struve_convergence.py | 76 | 3725 | """
Convergence regions of the expansions used in ``struve.c``
Note that for v >> z both functions tend rapidly to 0,
and for v << -z, they tend to infinity.
The floating-point functions over/underflow in the lower left and right
corners of the figure.
Figure legend
=============
Red region
Power series is clo... | bsd-3-clause |
elijahc/ml_v1 | rnn/neon/examples/timeseries_lstm.py | 1 | 15441 | #!/usr/bin/env python
# ----------------------------------------------------------------------------
# Copyright 2015-2016 Nervana Systems 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
#... | mit |
felipebetancur/scipy | scipy/interpolate/ndgriddata.py | 45 | 7161 | """
Convenience interface to N-D interpolation
.. versionadded:: 0.9
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from .interpnd import LinearNDInterpolator, NDInterpolatorBase, \
CloughTocher2DInterpolator, _ndim_coords_from_arrays
from scipy.spatial import cKDTree
_... | bsd-3-clause |
maheshakya/scikit-learn | examples/covariance/plot_outlier_detection.py | 235 | 3891 | """
==========================================
Outlier detection with several methods.
==========================================
When the amount of contamination is known, this example illustrates two
different ways of performing :ref:`outlier_detection`:
- based on a robust estimator of covariance, which is assumin... | bsd-3-clause |
memo/tensorflow | tensorflow/contrib/learn/python/learn/estimators/kmeans.py | 34 | 10130 | # 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 |
Edu-Glez/Bank_sentiment_analysis | env/lib/python3.6/site-packages/numpy/lib/polynomial.py | 32 | 37972 | """
Functions to operate on polynomials.
"""
from __future__ import division, absolute_import, print_function
__all__ = ['poly', 'roots', 'polyint', 'polyder', 'polyadd',
'polysub', 'polymul', 'polydiv', 'polyval', 'poly1d',
'polyfit', 'RankWarning']
import re
import warnings
import numpy.core.... | apache-2.0 |
PDFangeltop1/cs224d | assignment2/assignment2/rnnlmWithWParameter/rnnlmWithoutW.py | 1 | 12093 | from numpy import *
import numpy as np
import itertools
import time
import sys
import cPickle as pickle
# Import NN utils
from nn.base import NNBase
from nn.math import softmax, sigmoid, sigmoidGrad,make_onehot
from nn.math import MultinomialSampler, multinomial_sample
from misc import random_weight_matrix
class RNNL... | mit |
IGITUGraz/spore-nest-module | examples/center_out_showcase/python/snn_utils/plotter/backends/mpl.py | 3 | 1721 | import logging
import matplotlib.pyplot as plt
import snn_utils.plotter as plotter
logger = logging.getLogger(__name__)
def configure_matplotlib():
plt.ion() # interactive mode
plt.rcParams['figure.facecolor'] = 'white'
plt.rcParams['axes.facecolor'] = 'white'
plt.switch_backend('TkAgg')
class M... | gpl-2.0 |
icdishb/scikit-learn | examples/linear_model/plot_bayesian_ridge.py | 248 | 2588 | """
=========================
Bayesian Ridge Regression
=========================
Computes a Bayesian Ridge Regression on a synthetic dataset.
See :ref:`bayesian_ridge_regression` for more information on the regressor.
Compared to the OLS (ordinary least squares) estimator, the coefficient
weights are slightly shift... | bsd-3-clause |
YinongLong/scikit-learn | sklearn/gaussian_process/tests/test_gpc.py | 11 | 6079 | """Testing for Gaussian process classification """
# Author: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
# License: BSD 3 clause
import numpy as np
from scipy.optimize import approx_fprime
from sklearn.gaussian_process import GaussianProcessClassifier
from sklearn.gaussian_process.kernels import RBF, Constant... | bsd-3-clause |
swaroophangal/simulink2mavlink | mavlink/pymavlink/tools/mavgpslag.py | 43 | 3446 | #!/usr/bin/env python
'''
calculate GPS lag from DF log
'''
import sys, time, os
from argparse import ArgumentParser
parser = ArgumentParser(description=__doc__)
parser.add_argument("--plot", action='store_true', default=False, help="plot errors")
parser.add_argument("--minspeed", type=float, default=6, help="minimu... | gpl-2.0 |
wschenck/nest-simulator | pynest/examples/spatial/grid_iaf_irr.py | 20 | 1453 | # -*- coding: utf-8 -*-
#
# grid_iaf_irr.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, o... | gpl-2.0 |
JPFrancoia/scikit-learn | sklearn/neural_network/tests/test_mlp.py | 15 | 21005 | """
Testing for Multi-layer Perceptron module (sklearn.neural_network)
"""
# Author: Issam H. Laradji
# License: BSD 3 clause
import sys
import warnings
import numpy as np
from numpy.testing import assert_almost_equal, assert_array_equal
from sklearn.datasets import load_digits, load_boston
from sklearn.datasets i... | bsd-3-clause |
grevutiu-gabriel/sympy | sympy/interactive/session.py | 43 | 15119 | """Tools for setting up interactive sessions. """
from __future__ import print_function, division
from distutils.version import LooseVersion as V
from sympy.core.compatibility import range
from sympy.external import import_module
from sympy.interactive.printing import init_printing
preexec_source = """\
from __futu... | bsd-3-clause |
idlead/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 |
andrewfullard/python-meet | assignment3_afullard.py | 1 | 4008 | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 28 13:58:21 2013
@author: Andrew
"""
import numpy as np
import matplotlib.pyplot as plt
import scipy.interpolate as interpolate
alpha = 500
sigma = 100
# Step 1
# Finite difference vectors
def finiteDifference(N, dx):
A = 1./(np.ones(N + 2)*dx*dx... | mit |
arbuz001/sms-tools | lectures/04-STFT/plots-code/windows-2.py | 24 | 1026 | import matplotlib.pyplot as plt
import numpy as np
import time, os, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/'))
import dftModel as DF
import utilFunctions as UF
import math
(fs, x) = UF.wavread('../../../sounds/violin-B3.wav')
N = 1024
pin = 5000
w = np... | agpl-3.0 |
jlegendary/scikit-learn | sklearn/manifold/tests/test_mds.py | 324 | 1862 | import numpy as np
from numpy.testing import assert_array_almost_equal
from nose.tools import assert_raises
from sklearn.manifold import mds
def test_smacof():
# test metric smacof using the data of "Modern Multidimensional Scaling",
# Borg & Groenen, p 154
sim = np.array([[0, 5, 3, 4],
... | bsd-3-clause |
ch3ll0v3k/scikit-learn | sklearn/ensemble/tests/test_gradient_boosting.py | 127 | 37672 | """
Testing for the gradient boosting module (sklearn.ensemble.gradient_boosting).
"""
import warnings
import numpy as np
from sklearn import datasets
from sklearn.base import clone
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.ensemble.grad... | bsd-3-clause |
jviada/QuantEcon.py | examples/ar1_cycles.py | 7 | 1095 | """
Helps to illustrate the spectral density for AR(1) X' = phi X + epsilon
"""
import numpy as np
import matplotlib.pyplot as plt
phi = -0.8
times = list(range(16))
y1 = [phi**k / (1 - phi**2) for k in times]
y2 = [np.cos(np.pi * k) for k in times]
y3 = [a * b for a, b in zip(y1, y2)]
num_rows, num_cols = 3, 1
fig, ... | bsd-3-clause |
benhamner/nips-2015-papers | src/download_papers.py | 1 | 2740 | from bs4 import BeautifulSoup
import json
import os
import pandas as pd
import re
import requests
import subprocess
base_url = "http://papers.nips.cc"
index_url = "http://papers.nips.cc/book/advances-in-neural-information-processing-systems-29-2016"
r = requests.get(index_url)
soup = BeautifulSoup(r.content, "lxml"... | mit |
kalleknast/head-tracker | ht_helper.py | 1 | 21594 | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 18 18:46:36 2016
@author: hjalmar
"""
import numpy as np
import sys
from video_tools import VideoReader
from scipy.interpolate import UnivariateSpline
from scipy.ndimage.filters import gaussian_filter1d
from sklearn.metrics import roc_auc_score, matthews_corrcoef, brier_s... | apache-2.0 |
jpautom/scikit-learn | sklearn/metrics/__init__.py | 214 | 3440 | """
The :mod:`sklearn.metrics` module includes score functions, performance metrics
and pairwise metrics and distance computations.
"""
from .ranking import auc
from .ranking import average_precision_score
from .ranking import coverage_error
from .ranking import label_ranking_average_precision_score
from .ranking imp... | bsd-3-clause |
zrhans/pythonanywhere | .virtualenvs/django19/lib/python3.4/site-packages/matplotlib/text.py | 4 | 79856 | """
Classes for including text in a figure.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from matplotlib.externals import six
from matplotlib.externals.six.moves import zip
import math
import warnings
import contextlib
import numpy as np
from matp... | apache-2.0 |
lizhedm/password-blur | data_analysis/online_survey/results_survey_analysis.py | 1 | 4359 | # function to calculate levenshtein distance
def levenshtein(s, t):
''' From Wikipedia article; Iterative with two matrix rows. '''
if s == t: return 0
elif len(s) == 0: return len(t)
elif len(t) == 0: return len(s)
v0 = [None] * (len(t) + 1)
v1 = [None] * (len(t) + 1)
... | mit |
peterwilletts24/Python-Scripts | plot_scripts/EMBRACE/heat_flux/plot_from_pp_3217_diff_8km.py | 2 | 5618 | """
Load pp, plot and save
"""
import os, sys
import matplotlib
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from matplotlib import rc
from matplotlib.font_manager import FontProperties
from matplotlib import rcParams
from mpl_toolkits.basemap import Basemap
rc('font', family = '... | mit |
tpltnt/SimpleCV | SimpleCV/ImageClass.py | 1 | 517130 | from __future__ import print_function
from __future__ import absolute_import
# Load required libraries
from SimpleCV.base import *
from SimpleCV.Color import *
from SimpleCV.LineScan import *
from numpy import int32
from numpy import uint8
import cv2
from .EXIF import *
if not init_options_handler.headless:
impor... | bsd-3-clause |
l3enny/lasana | main.py | 1 | 4185 | """
Simple frontend to the Laser Absorption Spectroscopy ANalysis package.
Makes use of the modules 'parse.py', and 'analyze.py'.
Submodules notwithstanding.
"""
# Standard
from os import path, makedirs
# Part of package
import analyze
from atoms import He
import gui
import models
import parse
import preprocess
impo... | mit |
icdishb/scikit-learn | sklearn/svm/tests/test_sparse.py | 15 | 12169 | from nose.tools import assert_raises, assert_true, assert_false
import numpy as np
from scipy import sparse
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_equal)
from sklearn import datasets, svm, linear_model, base
from sklearn.datasets import make_classif... | bsd-3-clause |
koverholt/ibis | ibis/tasks.py | 9 | 7815 | # Copyright 2014 Cloudera Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | apache-2.0 |
bhargav/scikit-learn | examples/model_selection/plot_underfitting_overfitting.py | 53 | 2668 | """
============================
Underfitting vs. Overfitting
============================
This example demonstrates the problems of underfitting and overfitting and
how we can use linear regression with polynomial features to approximate
nonlinear functions. The plot shows the function that we want to approximate,
wh... | bsd-3-clause |
clan2000/data-science-from-scratch | code/ch18_neural_networks.py | 3 | 6852 | # -*- coding: utf-8 -*-
from __future__ import division
from collections import Counter
from functools import partial
import math, random
import matplotlib
import matplotlib.pyplot as plt
from ch04_linear_algebra import dot
# 18.1. 퍼셉트론
def step_function(x):
return 1 if x >= 0 else 0
def perceptron_output(w... | unlicense |
Haunter17/MIR_SU17 | exp2/exp2i.py | 1 | 4340 | import numpy as np
import tensorflow as tf
import h5py
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import sys
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial)
def bias_variable(shape):
initial = tf.constant(0.1, sha... | mit |
kimlaborg/NGSKit | ngskit/utils/fasta_tools.py | 1 | 3367 | """Fasta Tools
"""
import pandas as pd
def write_fasta_sequence(sequence_data, file_output, write_mode='a'):
"""Add sequences to a file, in Fasta Format.
Parameters
----------
sequence_data : str
Sequence to add to the fasta file. if only the sequence is provided,
assume the header is not... | mit |
ChinaQuants/zipline | tests/test_algorithm.py | 1 | 65834 | #
# 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 |
hansbrenna/NetCDF_postprocessor | total_gases_double.py | 1 | 6409 | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 24 13:35:44 2016
@author: hanbre
"""
from __future__ import print_function
import sys
import numpy as np
import pandas as pd
import xray
import matplotlib.pyplot as plt
import seaborn as sns
import HB_module.outsourced
import HB_module.timing
import HB_module.colordefs
c... | gpl-3.0 |
chrisburr/scikit-learn | sklearn/neural_network/rbm.py | 46 | 12303 | """Restricted Boltzmann Machine
"""
# Authors: Yann N. Dauphin <dauphiya@iro.umontreal.ca>
# Vlad Niculae
# Gabriel Synnaeve
# Lars Buitinck
# License: BSD 3 clause
import time
import numpy as np
import scipy.sparse as sp
from ..base import BaseEstimator
from ..base import TransformerMixi... | bsd-3-clause |
karthikdevel/fit | gui/wxpython/fittopframe.py | 1 | 16224 | import wx
import os
import threading
import pandas as pd
import numpy as np
import Queue
from fitplotter import FitPlotter
from parser.topparser import TopDirParser
from fitlistbox import FitListBox
class FitTopFrame(wx.Frame):
def __init__(self, parent, id, parsedir, start_date, end_date, title):
wx.Fr... | mit |
gallir/influxdb-python | influxdb/_dataframe_client.py | 5 | 5849 | # -*- coding: utf-8 -*-
"""
DataFrame client for InfluxDB
"""
import math
import pandas as pd
from .client import InfluxDBClient
def _pandas_time_unit(time_precision):
unit = time_precision
if time_precision == 'm':
unit = 'ms'
elif time_precision == 'u':
unit = 'us'
elif time_precis... | mit |
dsquareindia/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 |
simonm3/xdrive | xdrive/aws.py | 1 | 3645 | # -*- coding: utf-8 -*-
"""
manage aws resources
manage tags
list resources used
NOTE: This is a set of functions not a class
"""
import logging as log
import pandas as pd
import boto3
import fabric.api as fab
from time import sleep
import pyperclip
### connection #########################################... | gpl-3.0 |
kklmn/xrt | examples/withRaycing/01_SynchrotronSources/MAX-IV-IDs-Flux.py | 1 | 7358 | # -*- coding: utf-8 -*-
import os, sys; sys.path.append(os.path.join('..', '..', '..')) # analysis:ignore
#import matplotlib as mpl
import copy
import numpy as np
import matplotlib.pyplot as plt
try:
import xlwt
except ImportError:
xlwt = None
import xrt.backends.raycing.sources as rs
from xrt.backends.rayci... | mit |
clan2000/data-science-from-scratch | code-python3/linear_algebra.py | 12 | 3566 | # -*- coding: iso-8859-15 -*-
import re, math, random # regexes, math functions, random numbers
import matplotlib.pyplot as plt # pyplot
from collections import defaultdict, Counter
from functools import partial, reduce
#
# functions for working with vectors
#
def vector_add(v, w):
"""adds two vectors componentw... | unlicense |
trankmichael/scikit-learn | sklearn/utils/tests/test_shortest_path.py | 88 | 2828 | from collections import defaultdict
import numpy as np
from numpy.testing import assert_array_almost_equal
from sklearn.utils.graph import (graph_shortest_path,
single_source_shortest_path_length)
def floyd_warshall_slow(graph, directed=False):
N = graph.shape[0]
#set nonzer... | bsd-3-clause |
tgbugs/pyontutils | ilxutils/ilxutils/ilx2pd.py | 1 | 2415 | from collections import defaultdict
from ilxutils.interlex_sql import IlxSql
from ilxutils.mydifflib import ratio
from ilxutils.tools import open_pickle, create_pickle
import os
import pandas as pd
from pathlib import Path
from sys import exit
sql = IlxSql(db_url=os.environ.get('SCICRUNCH_DB_URL_PRODUCTION'))
data = ... | mit |
pactools/pactools | pactools/utils/spectrum.py | 1 | 17422 | import numpy as np
import scipy as sp
from scipy.linalg import hankel
from scipy.signal import hilbert
import matplotlib.pyplot as plt
from .maths import square, is_power2, prime_factors, compute_n_fft, next_power2
from .viz import compute_vmin_vmax
class Spectrum(object):
"""Spectral estimator following Welch's... | bsd-3-clause |
obarquero/intro_machine_learning_udacity | Projects/ud120-projects-master/choose_your_own/your_algorithm.py | 7 | 1400 | #!/usr/bin/python
import matplotlib.pyplot as plt
from prep_terrain_data import makeTerrainData
from class_vis import prettyPicture
features_train, labels_train, features_test, labels_test = makeTerrainData()
### the training data (features_train, labels_train) have both "fast" and "slow"
### points mixed together-... | gpl-2.0 |
JPFrancoia/scikit-learn | sklearn/datasets/base.py | 8 | 26095 | """
Base IO code for all datasets
"""
# Copyright (c) 2007 David Cournapeau <cournape@gmail.com>
# 2010 Fabian Pedregosa <fabian.pedregosa@inria.fr>
# 2010 Olivier Grisel <olivier.grisel@ensta.org>
# License: BSD 3 clause
import os
import csv
import sys
import shutil
from os import environ... | bsd-3-clause |
gdl-civestav-localization/cinvestav_location_fingerprinting | datasets/Simulation/__init__.py | 1 | 3912 | import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import coverage
def plot(rssi_map, cover, best, figsize=(10, 8)):
fig, ax = cover.L.showG('s', figsize=figsize)
# plot the grid
for k in cover.dap:
p = cover.dap[k]['p']
ax.plot(p[0], p[1], 'or')
# rs... | gpl-3.0 |
geodynamics/burnman | misc/benchmarks/DKS_mixing.py | 2 | 3783 | from __future__ import absolute_import
from __future__ import print_function
import os.path
import sys
sys.path.insert(1, os.path.abspath('../..'))
import burnman
from burnman.minerals import \
DKS_2013_liquids, \
DKS_2013_solids, \
SLB_2011
from burnman import constants
import numpy as np
import matplotl... | gpl-2.0 |
potash/drain | drain/exploration.py | 1 | 10781 | from tempfile import NamedTemporaryFile
from pprint import pformat
from itertools import product
from sklearn import tree
import pandas as pd
from collections import Counter
from six import StringIO
from drain import util, step
def explore(steps, reload=False):
return StepFrame(index=step.load(steps, reload=rel... | mit |
Sentient07/scikit-learn | examples/gaussian_process/plot_gpc_iris.py | 100 | 2269 | """
=====================================================
Gaussian process classification (GPC) on iris dataset
=====================================================
This example illustrates the predicted probability of GPC for an isotropic
and anisotropic RBF kernel on a two-dimensional version for the iris-dataset.
... | bsd-3-clause |
nmayorov/scikit-learn | sklearn/feature_extraction/dict_vectorizer.py | 234 | 12267 | # Authors: Lars Buitinck
# Dan Blanchard <dblanchard@ets.org>
# License: BSD 3 clause
from array import array
from collections import Mapping
from operator import itemgetter
import numpy as np
import scipy.sparse as sp
from ..base import BaseEstimator, TransformerMixin
from ..externals import six
from ..ext... | bsd-3-clause |
rvalyi/OpenUpgrade | addons/resource/faces/timescale.py | 170 | 3902 | ############################################################################
# Copyright (C) 2005 by Reithinger GmbH
# mreithinger@web.de
#
# This file is part of faces.
#
# faces is free software; you can redistribute it and/or modify
# ... | agpl-3.0 |
vidartf/hyperspy | hyperspy/docstrings/plot.py | 1 | 4560 | # -*- coding: utf-8 -*-
"""Common docstring snippets for plot.
"""
BASE_PLOT_DOCSTRING = \
"""Plot the signal at the current coordinates.
For multidimensional datasets an optional figure,
the "navigator", with a cursor to navigate that data is
raised. In any case it is possible to navigat... | gpl-3.0 |
drmaize/ThermoAlign | TA_codes/vcf_conversion.py | 1 | 2180 | ### vcf_conversion: converts a vcf file to ThermoAlign input format
### Version 1.0.0: 06/28/2016
### Authors: Felix Francis (felixfrancier@gmail.com); Randall J. Wisser (rjw@udel.edu)
### Requirements
### vcf files should follow the format described here: https://samtools.github.io/hts-specs/VCFv4.2.pdf
### all vcf ... | gpl-3.0 |
Diyago/Machine-Learning-scripts | DEEP LEARNING/Kaggle Avito Demand Prediction Challenge/image feat. extraction/avito_deepIQA/deepIQA/evaluate.py | 1 | 3181 | #!/usr/bin/python2
import argparse
import os
import cv2
import numpy as np
import pandas as pd
import six
from chainer import cuda
from chainer import serializers
from sklearn.feature_extraction.image import extract_patches
from tqdm import tqdm
from deepIQA.fr_model import FRModel
from deepIQA.nr_model import Model
... | apache-2.0 |
boyleworkflow/boyle | notes/internal-python-dsl/variant9.py | 1 | 2765 | # VARIANT 9
# a.k.a "the implicit variant"
# a.k.a "stop naming files"
import boyle
from glob import glob
import os
# list_col_values could be written in two ways.
# Either something like this:
@out('col_values.json')
@inp('table.csv')
def list_col_values(colname):
return Python(script=f'''
import pan... | lgpl-3.0 |
juhi24/baecc | baecc/instruments/pip_particles.py | 1 | 1334 | # coding: utf-8
import numpy as np
import pandas as pd
import datetime
from baecc import instruments
class PipParticles(instruments.InstrumentData):
"""PIP particle tables"""
def __init__(self, filenames=None, dt_start=None, dt_end=None, **kwargs):
InstrumentData.__init__(self, filenames, **kwargs)
... | gpl-3.0 |
4thgen/DCGAN-CIFAR10 | GAN.py | 1 | 16804 | #-*- coding: utf-8 -*-
from __future__ import division
import os
import time
import tensorflow as tf
import numpy as np
from ops import *
from utils import *
#from datetime import datetime
#import matplotlib.pyplot as plt
class GAN(object):
def __init__(self, sess, epoch, batch_size, dataset_name, checkpoint_di... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.