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 |
|---|---|---|---|---|---|
sanketloke/scikit-learn | examples/decomposition/plot_faces_decomposition.py | 103 | 4394 | """
============================
Faces dataset decompositions
============================
This example applies to :ref:`olivetti_faces` different unsupervised
matrix decomposition (dimension reduction) methods from the module
:py:mod:`sklearn.decomposition` (see the documentation chapter
:ref:`decompositions`) .
"""... | bsd-3-clause |
devanshdalal/scikit-learn | examples/ensemble/plot_gradient_boosting_quantile.py | 392 | 2114 | """
=====================================================
Prediction Intervals for Gradient Boosting Regression
=====================================================
This example shows how quantile regression can be used
to create prediction intervals.
"""
import numpy as np
import matplotlib.pyplot as plt
from skle... | bsd-3-clause |
wwjiang007/flink | flink-python/pyflink/table/tests/test_pandas_udaf.py | 5 | 37026 | ################################################################################
# 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... | apache-2.0 |
wmvanvliet/mne-python | mne/viz/backends/_utils.py | 8 | 2928 | # -*- coding: utf-8 -*-
#
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Eric Larson <larson.eric.d@gmail.com>
# Joan Massich <mailsik@gmail.com>
# Guillaume Favelier <guillaume.favelier@gmail.com>
#
# License: Simplified BSD
from contextlib import contextmanager
import numpy ... | bsd-3-clause |
aabadie/scikit-learn | sklearn/linear_model/tests/test_theil_sen.py | 58 | 9948 | """
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 |
BhallaLab/moose | moose-examples/traub_2005/py/test_singlecomp.py | 2 | 7203 | # test_singlecomp.py ---
#
# Filename: test_singlecomp.py
# Description:
# Author: Subhasis Ray
# Maintainer:
# Created: Tue Jul 17 21:01:14 2012 (+0530)
# Version:
# Last-Updated: Sun Jun 25 15:37:21 2017 (-0400)
# By: subha
# Update #: 320
# URL:
# Keywords:
# Compatibility:
#
#
# Commentary:... | gpl-3.0 |
pompiduskus/scikit-learn | sklearn/linear_model/tests/test_randomized_l1.py | 214 | 4690 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD 3 clause
import numpy as np
from scipy import sparse
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.linear_model.randomized_l1 i... | bsd-3-clause |
ellisonbg/altair | altair/vegalite/v2/examples/bar_chart_with_highlight.py | 1 | 1033 | """
Bar Chart with Highlight
------------------------
This example shows a Bar chart that highlights values beyond a threshold.
"""
# category: bar charts
import altair as alt
import pandas as pd
data = pd.DataFrame({"Day": range(1, 16),
"Value": [54.8, 112.1, 63.6, 37.6, 79.7, 137.9, 120.1, 103.3... | bsd-3-clause |
scauglog/brain_record_toolbox | script_test_classifier.py | 1 | 1207 | import brain_state_calculate as bsc
import cpp_file_tools as cft
from matplotlib import pyplot as plt
import numpy as np
import Tkinter
import tkFileDialog
initdir="C:\\"
my_bsc = bsc.brain_state_calculate(32)
my_cft = cft.cpp_file_tools(32, 1, show=True)
my_bsc.init_networks_on_files(initdir, my_cft, train_mod_chan=... | mit |
Winand/pandas | pandas/core/reshape/util.py | 20 | 1915 | import numpy as np
from pandas.core.dtypes.common import is_list_like
from pandas.compat import reduce
from pandas.core.index import Index
from pandas.core import common as com
def match(needles, haystack):
haystack = Index(haystack)
needles = Index(needles)
return haystack.get_indexer(needles)
def ca... | bsd-3-clause |
asnorkin/sentiment_analysis | site/lib/python2.7/site-packages/sklearn/naive_bayes.py | 26 | 30641 | # -*- coding: utf-8 -*-
"""
The :mod:`sklearn.naive_bayes` module implements Naive Bayes algorithms. These
are supervised learning methods based on applying Bayes' theorem with strong
(naive) feature independence assumptions.
"""
# Author: Vincent Michel <vincent.michel@inria.fr>
# Minor fixes by Fabian Pedre... | mit |
jpallister/stm32f4-energy-monitor | pyenergy/src/pyenergy/interactive_graph.py | 1 | 16162 | import sys, os, random
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import matplotlib
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
# Matplotlib version change leads to name change
try:
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationTo... | gpl-3.0 |
csieg/ardupilot | libraries/AP_Math/tools/geodesic_grid/plot.py | 110 | 2876 | # Copyright (C) 2016 Intel Corporation. All rights reserved.
#
# This file 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, or
# (at your option) any later version.
#
# This fi... | gpl-3.0 |
qilicun/python | python3/matplotlib/tex_demo.py | 5 | 1061 | """
Demo of TeX rendering.
You can use TeX to render all of your matplotlib text if the rc
parameter text.usetex is set. This works currently on the agg and ps
backends, and requires that you have tex and the other dependencies
described at http://matplotlib.sf.net/matplotlib.texmanager.html
properly installed on you... | gpl-3.0 |
fivejjs/pybasicbayes | pybasicbayes/distributions/gaussian.py | 2 | 51874 | from __future__ import division
__all__ = \
['Gaussian', 'GaussianFixedMean', 'GaussianFixedCov', 'GaussianFixed',
'GaussianNonConj', 'DiagonalGaussian', 'DiagonalGaussianNonconjNIG',
'IsotropicGaussian', 'ScalarGaussianNIX', 'ScalarGaussianNonconjNIX',
'ScalarGaussianNonconjNIG', 'ScalarGaussianFixe... | mit |
brguez/TEIBA | src/python/germlineSrcElements_plotNbActiveElementsPerDonor.py | 1 | 3767 | #!/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 |
phoebe-project/phoebe2-docs | 2.1/examples/legacy_contact_binary.py | 1 | 3134 | #!/usr/bin/env python
# coding: utf-8
# Comparing Contacts Binaries in PHOEBE 2 vs PHOEBE Legacy
# ============================
#
# **NOTE**: PHOEBE 1.0 legacy is an alternate backend and is not installed with PHOEBE 2. In order to run this backend, you'll need to have [PHOEBE 1.0](https://phoebe-project.org/1.0) in... | gpl-3.0 |
mlucchini/keras-playground | networks/mnist-digit-recognition-perceptron-network.py | 1 | 1742 | from keras.callbacks import TensorBoard
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import Dropout
from keras.optimizers import SGD
from keras.utils import np_utils
import matplotlib.pyplot as plt
import numpy
numpy.random.seed(7)
def plot_imag... | gpl-3.0 |
marcocaccin/scikit-learn | sklearn/ensemble/partial_dependence.py | 251 | 15097 | """Partial dependence plots for tree ensembles. """
# Authors: Peter Prettenhofer
# License: BSD 3 clause
from itertools import count
import numbers
import numpy as np
from scipy.stats.mstats import mquantiles
from ..utils.extmath import cartesian
from ..externals.joblib import Parallel, delayed
from ..externals im... | bsd-3-clause |
0todd0000/spm1d | spm1d/_plot.py | 1 | 10320 |
'''
This module contains classes for low-level plotting.
Users should access plotting functions through spm1d.plot (not spm1d._plot).
'''
# Copyright (C) 2016 Todd Pataky
# updated (2016/10/01) todd
from copy import copy,deepcopy
import numpy as np
from scipy import ndimage
import matplotlib
from matplotlib impor... | gpl-3.0 |
ofgulban/segmentator | segmentator/gui_utils.py | 1 | 28321 | #!/usr/bin/env python
"""Functions covering the user interaction with the GUI."""
from __future__ import division, print_function
import os
import numpy as np
import matplotlib.pyplot as plt
import segmentator.config as cfg
from segmentator.utils import map_2D_hist_to_ima
from nibabel import save, Nifti1Image
from sci... | bsd-3-clause |
MikeDT/CNN_2_BBN | CNN_2_BBN_Optimiser.py | 1 | 5940 | from __future__ import print_function
from hyperopt import Trials, STATUS_OK, tpe
from keras.datasets import mnist
from keras.layers.core import Dense, Dropout, Activation,Flatten
from keras.models import Sequential
from keras.utils import np_utils
from Synthetic_Data_Creator import Synthetic_Data_Creator
from hyperas... | apache-2.0 |
MatthieuBizien/scikit-learn | examples/svm/plot_custom_kernel.py | 43 | 1546 | """
======================
SVM with custom kernel
======================
Simple usage of Support Vector Machines to classify a sample. It will
plot the decision surface and the support vectors.
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from sklearn import svm, datasets
# import some data... | bsd-3-clause |
gschivley/Index-variability | src/Analysis/capacity.py | 1 | 15174 | import pandas as pd
import os
import calendar
from joblib import Parallel, delayed
idx = pd.IndexSlice
def month_hours(year, month):
'Look up the number of hours in a given month'
# second value in tuple is number of days in a month
days = calendar.monthrange(year, month)[-1]
hours = days * 24
re... | bsd-3-clause |
dingocuster/scikit-learn | examples/linear_model/plot_sgd_comparison.py | 77 | 1820 | """
==================================
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 |
ajdawson/windspharm | examples/cdms/rws_example.py | 1 | 1972 | """Compute Rossby wave source from the long-term mean flow.
This example uses the cdms interface.
Additional requirements for this example:
* cdms2 (http://uvcdat.llnl.gov/)
* matplotlib (http://matplotlib.org/)
* cartopy (http://scitools.org.uk/cartopy/)
"""
import cartopy.crs as ccrs
import cdms2
import matplotli... | mit |
wmvanvliet/mne-python | mne/utils/mixin.py | 4 | 19575 | # -*- coding: utf-8 -*-
"""Some utility functions."""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
from collections import OrderedDict
from copy import deepcopy
import logging
import json
import numpy as np
from .check import _check_pandas_installed, _check_preload, _valida... | bsd-3-clause |
shurain/codesprint2013 | Basemodel.py | 1 | 10200 | # -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
import numpy as np
import pandas as pd
from IPython.core.display import HTML
import matplotlib as mtp
from pylab import *
from datetime import datetime, timedelta
from StringIO import StringIO
# <codecell>
parse = lambda x: datetime.strptime(x, '%Y%m%... | mit |
bmtgoncalves/TorinoCourse | Lecture IV/plot_geojson.py | 1 | 1061 | import matplotlib.pyplot as plt
import numpy as np
import json
import sys
data = json.load(open(sys.argv[1]))
def get_bbox(country):
maxLat = None
maxLon = None
minLat = None
minLon = None
for polygon in country["geometry"]["coordinates"]:
coords = np.array(polygon)[0]
curMaxLat = np.max(coords.T[1])
cur... | mit |
kaspar030/RIOT | tests/pkg_cmsis-nn/generate_image.py | 15 | 1140 | #!/usr/bin/env python3
"""Generate a binary file from a sample image of the CIFAR-10 dataset.
Pixel of the sample are stored as uint8, images have size 32x32x3.
"""
import os
import argparse
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.keras.datasets import cifar10
SCRIPT_DIR = os.path.dirnam... | lgpl-2.1 |
saiwing-yeung/scikit-learn | sklearn/utils/extmath.py | 16 | 26642 | """
Extended math utilities.
"""
# Authors: Gael Varoquaux
# Alexandre Gramfort
# Alexandre T. Passos
# Olivier Grisel
# Lars Buitinck
# Stefan van der Walt
# Kyle Kastner
# Giorgio Patrini
# License: BSD 3 clause
from __future__ import division
from funct... | bsd-3-clause |
M4573R/BuildingMachineLearningSystemsWithPython | ch05/utils.py | 24 | 7111 | # This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
import os
try:
import ujson as json # UltraJSON if available
except:
import json
from matplo... | mit |
DSLituiev/scikit-learn | examples/model_selection/plot_precision_recall.py | 74 | 6377 | """
================
Precision-Recall
================
Example of Precision-Recall metric to evaluate classifier output quality.
In information retrieval, precision is a measure of result relevancy, while
recall is a measure of how many truly relevant results are returned. A high
area under the curve represents both ... | bsd-3-clause |
jonyroda97/redbot-amigosprovaveis | lib/matplotlib/mlab.py | 2 | 122923 | """
Numerical python functions written for compatability with MATLAB
commands with the same names.
MATLAB compatible functions
---------------------------
:func:`cohere`
Coherence (normalized cross spectral density)
:func:`csd`
Cross spectral density using Welch's average periodogram
:func:`detrend`
Re... | gpl-3.0 |
ThomasMiconi/nupic.research | projects/sequence_learning/generate_plots.py | 6 | 2426 | import matplotlib.pyplot as plt
import multiprocessing
from optparse import OptionParser
import sequence_simulations
import sys
def fig6a(cliArgs, noises):
argsTpl = cliArgs + " --noise {}"
return [
sequence_simulations.parser.parse_args(argsTpl.format(noise).split(" "))[0]
for noise in noises
] + [
... | agpl-3.0 |
h2educ/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 |
IshankGulati/scikit-learn | examples/neighbors/plot_species_kde.py | 39 | 4039 | """
================================================
Kernel Density Estimate of Species Distributions
================================================
This shows an example of a neighbors-based query (in particular a kernel
density estimate) on geospatial data, using a Ball Tree built upon the
Haversine distance metric... | bsd-3-clause |
jszopi/repESP | repESP_old/graphs.py | 1 | 23402 | import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.backends.backend_pdf import PdfPages
import os
import numpy as np
from numpy.linalg import norm as vec_norm
import random
import math
import re
# This was necessary to prevent y-axis label from being cut off when plotting
# http://... | gpl-3.0 |
LSSTDESC/SLTimer | python/desc/sltimer/worker.py | 2 | 23802 | # ======================================================================
# License info here?
# ======================================================================
from __future__ import absolute_import
import os
import urllib
import subprocess
import pycs
import numpy as np
from .reading import *
from matplotlib im... | bsd-3-clause |
nanditav/15712-TensorFlow | tensorflow/contrib/learn/python/learn/tests/dataframe/tensorflow_dataframe_test.py | 24 | 13091 | # 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 |
vybstat/scikit-learn | examples/applications/svm_gui.py | 287 | 11161 | """
==========
Libsvm GUI
==========
A simple graphical frontend for Libsvm mainly intended for didactic
purposes. You can create data points by point and click and visualize
the decision region induced by different kernels and parameter settings.
To create positive examples click the left mouse button; to create
neg... | bsd-3-clause |
nebw/keras | examples/variational_autoencoder_deconv.py | 5 | 4206 | '''This script demonstrates how to build a variational autoencoder with Keras and deconvolution layers.
Reference: "Auto-Encoding Variational Bayes" https://arxiv.org/abs/1312.6114
'''
import numpy as np
import matplotlib.pyplot as plt
from keras.layers import Input, Dense, Lambda, Flatten, Reshape
from keras.layers ... | mit |
dsm054/pandas | pandas/tests/test_take.py | 1 | 16730 | # -*- coding: utf-8 -*-
import re
from datetime import datetime
import numpy as np
import pytest
from pandas.compat import long
import pandas.core.algorithms as algos
import pandas.util.testing as tm
from pandas._libs.tslib import iNaT
@pytest.fixture(params=[True, False])
def writeable(request):
return request.... | bsd-3-clause |
ryandougherty/mwa-capstone | MWA_Tools/build/matplotlib/lib/matplotlib/tests/test_mlab.py | 3 | 1722 | import numpy as np
import matplotlib.mlab as mlab
import tempfile
from nose.tools import raises
def test_colinear_pca():
a = mlab.PCA._get_colinear()
pca = mlab.PCA(a)
assert(np.allclose(pca.fracs[2:], 0.))
assert(np.allclose(pca.Y[:,2:], 0.))
def test_recarray_csv_roundtrip():
expected = np.reca... | gpl-2.0 |
warren-oneill/powerline | tests/test_product_conversion.py | 2 | 3427 | import pandas as pd
import numpy as np
from unittest import TestCase
from powerline.utils.hour_quarter_hour_converter import \
convert_between_h_and_qh
from powerline.exchanges.epex_exchange import EpexExchange
__author__ = "Max"
class TestProductConversion(TestCase):
"""
Testing the utility function ... | apache-2.0 |
mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/sklearn/datasets/samples_generator.py | 4 | 57684 | """
Generate samples of synthetic data sets.
"""
# Authors: B. Thirion, G. Varoquaux, A. Gramfort, V. Michel, O. Grisel,
# G. Louppe, J. Nothman
# License: BSD 3 clause
import numbers
import array
import numpy as np
from scipy import linalg
import scipy.sparse as sp
from ..preprocessing import MultiLabelBin... | mit |
waqasbhatti/astrobase | astrobase/lcproc/catalogs.py | 2 | 57723 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# catalogs.py - Waqas Bhatti (wbhatti@astro.princeton.edu) - Feb 2019
'''
This contains functions to generate light curve catalogs from collections of
light curves.
'''
#############
## LOGGING ##
#############
import logging
from astrobase import log_sub, log_fmt, lo... | mit |
rseubert/scikit-learn | benchmarks/bench_plot_lasso_path.py | 301 | 4003 | """Benchmarks of Lasso regularization path computation using Lars and CD
The input data is mostly low rank but is a fat infinite tail.
"""
from __future__ import print_function
from collections import defaultdict
import gc
import sys
from time import time
import numpy as np
from sklearn.linear_model import lars_pat... | bsd-3-clause |
DiamondLightSource/auto_tomo_calibration-experimental | old_code_scripts/measure_resolution/lmfit/model.py | 7 | 40402 | """
Concise nonlinear curve fitting.
"""
from __future__ import print_function
import warnings
import inspect
import operator
from copy import deepcopy
import numpy as np
from . import Parameters, Parameter, Minimizer
from .printfuncs import fit_report
from collections import MutableSet
try:
from collections impo... | apache-2.0 |
camallen/aggregation | experimental/penguins/clusterAnalysis/ibcc_priors.py | 2 | 2589 | #!/usr/bin/env python
__author__ = 'greghines'
import numpy as np
import matplotlib.pyplot as plt
import pymongo
import cPickle as pickle
import os
import math
import sys
if os.path.exists("/home/ggdhines"):
sys.path.append("/home/ggdhines/PycharmProjects/reduction/experimental/clusteringAlg")
else:
sys.path.a... | apache-2.0 |
crazyzlj/PyGeoC | setup.py | 1 | 5288 | """A setuptools based setup module for PyGeoC.
PyGeoC is short for "Python for GeoComputation"
Author: Liangjun Zhu
E-mail: zlj@lreis.ac.cn
Blog : zhulj.net
"""
# To use a consistent encoding
from codecs import open
from os import path
# Always prefer setuptools over distutils
from setuptools import setu... | mit |
MTG/sms-tools | lectures/08-Sound-transformations/plots-code/hps-morph.py | 2 | 2709 | # function for doing a morph between two sounds using the hpsModel
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import get_window
import sys, os
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/'))
sys.path.append(os.path.join(os.path.dirname(o... | agpl-3.0 |
kazemakase/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 |
jswoboda/GeoDataPython | GeoData/utilityfuncs.py | 1 | 25206 | #!/usr/bin/env python
"""
Note: "cartesian" column order is x,y,z in the Nx3 matrix
This module holds a number of functions that can be used to read data into
GeoData objects. All of the function s have the following outputs
(data,coordnames,dataloc,sensorloc,times)
Outputs
data - A dictionary with keys that are t... | mit |
michrawson/nyu_ml_lectures | notebooks/figures/plot_digits_datasets.py | 19 | 2750 | # Taken from example in scikit-learn examples
# Authors: Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Gael Varoquaux
# License: BSD 3 clause (C) INRIA 2011
import numpy as np
import matplotlib.pyplot as pl... | cc0-1.0 |
GuessWhoSamFoo/pandas | pandas/tests/indexes/multi/test_integrity.py | 1 | 9162 | # -*- coding: utf-8 -*-
import re
import numpy as np
import pytest
from pandas.compat import lrange, range
from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike
import pandas as pd
from pandas import IntervalIndex, MultiIndex, RangeIndex
import pandas.util.testing as tm
def test_labels_dtyp... | bsd-3-clause |
jzt5132/scikit-learn | examples/svm/plot_svm_nonlinear.py | 268 | 1091 | """
==============
Non-linear SVM
==============
Perform binary classification using non-linear SVC
with RBF kernel. The target to predict is a XOR of the
inputs.
The color map illustrates the decision function learned by the SVC.
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from sklearn imp... | bsd-3-clause |
wangjohn/wallace | wallace/predictive_models/gradient_boosting_regression.py | 1 | 1550 | from sklearn import ensemble
from wallace.predictive_models.sklearn_model import SklearnModel, TrainedSklearnModel
from wallace.parameters import ParametersGeneralValidityCheck
class GradientBoostingRegression(SklearnModel):
def train(self, dataset):
model = ensemble.GradientBoostingRegressor(learning_rate... | mit |
leesavide/pythonista-docs | Documentation/matplotlib/examples/misc/rec_groupby_demo.py | 9 | 2060 | from __future__ import print_function
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.cbook as cbook
datafile = cbook.get_sample_data('aapl.csv', asfileobj=False)
print('loading', datafile)
r = mlab.csv2rec(datafile)
r.sort()
def daily_return(prices):
'an array of daily returns from price arra... | apache-2.0 |
Keleir/glances | glances/outputs/glances_curses.py | 11 | 44601 | # -*- coding: utf-8 -*-
#
# This file is part of Glances.
#
# Copyright (C) 2015 Nicolargo <nicolas@nicolargo.com>
#
# Glances is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... | lgpl-3.0 |
CodeForPhilly/chime | tests/penn_chime/model/test_sir.py | 1 | 6343 | from datetime import date
import pytest
import pandas as pd
import numpy as np
from datetime import timedelta
from penn_chime.constants import EPSILON
from penn_chime.model.sir import (
sir,
sim_sir,
get_growth_rate,
Sir,
)
def test_sir():
"""
Someone who is good at testing, help
"""
... | mit |
jstoxrocky/statsmodels | statsmodels/tsa/arima_process.py | 26 | 30878 | '''ARMA process and estimation with scipy.signal.lfilter
2009-09-06: copied from try_signal.py
reparameterized same as signal.lfilter (positive coefficients)
Notes
-----
* pretty fast
* checked with Monte Carlo and cross comparison with statsmodels yule_walker
for AR numbers are close but not identical to yule... | bsd-3-clause |
plissonf/scikit-learn | examples/linear_model/plot_sgd_comparison.py | 77 | 1820 | """
==================================
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 |
echohenry2006/tvb-library | contrib/from_articles/region_deterministic_bnm_sj2d.py | 5 | 6136 | # -*- coding: utf-8 -*-
"""
What:
Reproduces Figures XX Sanz-Leon P., PhD Thesis
Needs:
A working installation of tvb
Run:
python region_deterministic_bnm_sjd2d.py -s True -f True
#Subsequent calls can be made with:
python region_deterministic_bnm_sj2d.py -f True
.. author:: Paula Sanz-Leo... | gpl-2.0 |
DrLuke/FEMM-bode | femm.py | 1 | 6403 | import subprocess
#import matplotlib as mpl
#import matplotlib.pyplot as plt
import numpy as np
import re
import math
from scipy.interpolate import griddata, LinearNDInterpolator
import os
class FEMMans:
def __init__(self, points, preamble):
self.points = points
self.preamble = preamble
sel... | mit |
openfisca/openfisca-qt | openfisca_qt/scripts/alexis/chunk.py | 1 | 1878 | # -*- coding:utf-8 -*-
#
# This file is part of OpenFisca.
# OpenFisca is a socio-fiscal microsimulation software
# Copyright © 2013 Alexis Eidelman, Clément Schaff, Mahdi Ben Jelloul
# Licensed under the terms of the GVPLv3 or later license
# (see openfisca/__init__.py for details)
# Script to compute the aggregates ... | agpl-3.0 |
shekkizh/TensorflowProjects | FaceDetection/FaceDetectionDataUtils.py | 1 | 4210 | __author__ = 'Charlie'
import pandas as pd
import numpy as np
import os, sys, inspect
from six.moves import cPickle as pickle
import scipy.misc as misc
IMAGE_SIZE = 96
NUM_LABELS = 30
VALIDATION_PERCENT = 0.1 # use 10 percent of training images for validation
IMAGE_LOCATION_NORM = IMAGE_SIZE / 2
np.random.seed(0)
... | mit |
X-DataInitiative/tick | tick/linear_model/tests/logistic_regression_test.py | 2 | 24388 | # License: BSD 3 clause
import itertools
import unittest
import numpy as np
from sklearn.metrics.ranking import roc_auc_score
from tick.base.inference import InferenceTest
from tick.linear_model import SimuLogReg, LogisticRegression
from tick.simulation import weights_sparse_gauss
from tick.preprocessing.features_bi... | bsd-3-clause |
pjryan126/solid-start-careers | store/api/zillow/venv/lib/python2.7/site-packages/pandas/tests/test_msgpack/test_read_size.py | 9 | 1867 | """Test Unpacker's read_array_header and read_map_header methods"""
from pandas.msgpack import packb, Unpacker, OutOfData
UnexpectedTypeException = ValueError
def test_read_array_header():
unpacker = Unpacker()
unpacker.feed(packb(['a', 'b', 'c']))
assert unpacker.read_array_header() == 3
assert unpac... | gpl-2.0 |
hoenirvili/distributions | distributions/binomial.py | 1 | 2925 | #!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import binom
from .distribution import Distribution
__all__ = ['Binomial']
class Binomial(Distribution):
"""
A random variable X that has a bernoulli distribution
represents one success in one yes/no trial, each of... | mit |
cosurgi/trunk | examples/test/psd.py | 10 | 1794 | # encoding: utf-8
#
# demonstrate how to generate sphere packing based on arbitrary PSD (particle size distribution)
# show the difference between size-based and mass-based (≡ volume-based in our case) PSD
#
import matplotlib; matplotlib.rc('axes',grid=True)
from yade import pack
import pylab
# PSD given as points of p... | gpl-2.0 |
rowanc1/Seismogram | syntheticSeismogram.py | 2 | 14041 | import numpy as np
import matplotlib.pyplot as plt
import scipy.io
def getPlotLog(d,log,dmax=200):
d = np.array(d, dtype=float)
log = np.array(log, dtype=float)
dplot = np.kron(d,np.ones(2))
logplot = np.kron(log,np.ones(2))
# dplot = dplot[1:]
dplot = np.append(dplot[1:],dmax)
ret... | mit |
toobaz/pandas | pandas/tests/indexing/test_floats.py | 1 | 30613 | import numpy as np
import pytest
from pandas import DataFrame, Float64Index, Index, Int64Index, RangeIndex, Series
import pandas.util.testing as tm
from pandas.util.testing import assert_almost_equal, assert_series_equal
class TestFloatIndexers:
def check(self, result, original, indexer, getitem):
"""
... | bsd-3-clause |
nmayorov/scikit-learn | sklearn/preprocessing/tests/test_label.py | 156 | 17626 | import numpy as np
from scipy.sparse import issparse
from scipy.sparse import coo_matrix
from scipy.sparse import csc_matrix
from scipy.sparse import csr_matrix
from scipy.sparse import dok_matrix
from scipy.sparse import lil_matrix
from sklearn.utils.multiclass import type_of_target
from sklearn.utils.testing impor... | bsd-3-clause |
wzbozon/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 |
treycausey/scikit-learn | examples/neighbors/plot_nearest_centroid.py | 8 | 1784 | """
===============================
Nearest Centroid Classification
===============================
Sample usage of Nearest Centroid classification.
It will plot the decision boundaries for each class.
"""
print(__doc__)
import numpy as np
import pylab as pl
from matplotlib.colors import ListedColormap
from sklearn i... | bsd-3-clause |
alvarofierroclavero/scikit-learn | sklearn/metrics/scorer.py | 211 | 13141 | """
The :mod:`sklearn.metrics.scorer` submodule implements a flexible
interface for model selection and evaluation using
arbitrary score functions.
A scorer object is a callable that can be passed to
:class:`sklearn.grid_search.GridSearchCV` or
:func:`sklearn.cross_validation.cross_val_score` as the ``scoring`` parame... | bsd-3-clause |
ioam/holoviews | holoviews/plotting/mpl/annotation.py | 2 | 7744 | from __future__ import absolute_import, division, unicode_literals
import param
import numpy as np
import matplotlib
from matplotlib import patches as patches
from ...core.util import match_spec, basestring
from ...core.options import abbreviated_exception
from .element import ElementPlot, ColorbarPlot
from .plot im... | bsd-3-clause |
meteorcloudy/tensorflow | tensorflow/contrib/learn/python/learn/estimators/kmeans_test.py | 39 | 20233 | # 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 |
carrillo/scikit-learn | examples/svm/plot_svm_regression.py | 249 | 1451 | """
===================================================================
Support Vector Regression (SVR) using linear and non-linear kernels
===================================================================
Toy example of 1D regression using linear, polynomial and RBF kernels.
"""
print(__doc__)
import numpy as np
... | bsd-3-clause |
toastedcornflakes/scikit-learn | examples/mixture/plot_gmm.py | 18 | 3038 | """
=================================
Gaussian Mixture Model Ellipsoids
=================================
Plot the confidence ellipsoids of a mixture of two Gaussians with EM
and variational Dirichlet process.
Both models have access to five components with which to fit the
data. Note that the EM model will necessari... | bsd-3-clause |
7630155/tushare | tushare/stock/shibor.py | 38 | 5010 | # -*- coding:utf-8 -*-
"""
上海银行间同业拆放利率(Shibor)数据接口
Created on 2014/07/31
@author: Jimmy Liu
@group : waditu
@contact: jimmysoa@sina.cn
"""
import pandas as pd
import numpy as np
from tushare.stock import cons as ct
from tushare.util import dateu as du
def shibor_data(year=None):
"""
获取上海银行间同业拆放利率(Shibor)
P... | bsd-3-clause |
georgetown-analytics/auto-sentiment | ingestion/database.py | 1 | 5186 | from pymongo import MongoClient
import pymongo
import pandas as pd
# This class creates an instance of our MongoDB
class twitterDB(object):
# Initiates the client to our database
def __init__(self):
self.client = MongoClient()
self.database = self.client.twitter_db
# Saves a list of eleme... | mit |
madjelan/CostSensitiveClassification | setup.py | 1 | 1561 | #!/usr/bin/env python
from setuptools import setup, find_packages
import re
for line in open('costcla/__init__.py'):
match = re.match("__version__ *= *'(.*)'", line)
if match:
__version__, = match.groups()
setup(name='costcla',
version=__version__,
description='costcla is a Python module ... | bsd-3-clause |
jdavidrcamacho/Tests_GP | MSc_results/speed_test5.py | 2 | 9388 | # -*- coding: utf-8 -*-
import Gedi as gedi
import george
import numpy as np#;np.random.seed(1234567)
import matplotlib.pylab as pl; pl.close('all')
from time import time,sleep
import scipy.optimize as op
import sys
##### INITIAL DATA ###########################################################
nrep = 10
pontos=[] ... | mit |
grlee77/scipy | scipy/spatial/tests/test__plotutils.py | 18 | 1943 | import pytest
from numpy.testing import assert_, assert_array_equal, suppress_warnings
try:
import matplotlib
matplotlib.rcParams['backend'] = 'Agg'
import matplotlib.pyplot as plt
has_matplotlib = True
except Exception:
has_matplotlib = False
from scipy.spatial import \
delaunay_plot_2d, voro... | bsd-3-clause |
rgerkin/upsit | bbdp/__init__.py | 1 | 6402 | import os
import sys
from datetime import datetime,timedelta
import numpy as np
import xlrd
filepath = os.path.abspath(__file__)
dirpath = filepath
for i in range(3):
dirpath = os.path.dirname(dirpath)
sys.path.append(dirpath)
from upsit import Subject,Question,Response,QuestionSet,ResponseSet,Test,plt
def lo... | gpl-2.0 |
jjx02230808/project0223 | sklearn/_build_utils/__init__.py | 21 | 1125 | """
Utilities useful during the build.
"""
# author: Andy Mueller, Gael Varoquaux
# license: BSD
from __future__ import division, print_function, absolute_import
HASH_FILE = 'cythonize.dat'
DEFAULT_ROOT = 'sklearn'
# WindowsError is not defined on unix systems
try:
WindowsError
except NameError:
WindowsError... | bsd-3-clause |
GeraldLoeffler/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/colors.py | 69 | 31676 | """
A module for converting numbers or color arguments to *RGB* or *RGBA*
*RGB* and *RGBA* are sequences of, respectively, 3 or 4 floats in the
range 0-1.
This module includes functions and classes for color specification
conversions, and for mapping numbers to colors in a 1-D array of
colors called a colormap. Color... | agpl-3.0 |
PrashntS/scikit-learn | sklearn/utils/multiclass.py | 45 | 12390 |
# Author: Arnaud Joly, Joel Nothman, Hamzeh Alsalhi
#
# License: BSD 3 clause
"""
Multi-class / multi-label utility function
==========================================
"""
from __future__ import division
from collections import Sequence
from itertools import chain
from scipy.sparse import issparse
from scipy.sparse.... | bsd-3-clause |
kylerbrown/scikit-learn | sklearn/covariance/tests/test_graph_lasso.py | 272 | 5245 | """ Test the graph_lasso module.
"""
import sys
import numpy as np
from scipy import linalg
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_array_less
from sklearn.covariance import (graph_lasso, GraphLasso, GraphLassoCV,
empirical_... | bsd-3-clause |
DSLituiev/scikit-learn | doc/tutorial/text_analytics/solutions/exercise_02_sentiment.py | 46 | 2798 | """Build a sentiment analysis / polarity model
Sentiment analysis can be casted as a binary text classification problem,
that is fitting a linear classifier on features extracted from the text
of the user messages so as to guess wether the opinion of the author is
positive or negative.
In this examples we will use a ... | bsd-3-clause |
466152112/scikit-learn | examples/applications/svm_gui.py | 287 | 11161 | """
==========
Libsvm GUI
==========
A simple graphical frontend for Libsvm mainly intended for didactic
purposes. You can create data points by point and click and visualize
the decision region induced by different kernels and parameter settings.
To create positive examples click the left mouse button; to create
neg... | bsd-3-clause |
liberatorqjw/scikit-learn | sklearn/__check_build/__init__.py | 30 | 1669 | """ Module to give helpful messages to the user that did not
compile the scikit properly.
"""
import os
INPLACE_MSG = """
It appears that you are importing a local scikit-learn source tree. For
this, you need to have an inplace install. Maybe you are in the source
directory and you need to try from another location.""... | bsd-3-clause |
marcsans/cnn-physics-perception | phy/lib/python2.7/site-packages/matplotlib/tri/triinterpolate.py | 8 | 66410 | """
Interpolation inside triangular grids.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from matplotlib.externals import six
from matplotlib.externals.six.moves import xrange
from matplotlib.tri import Triangulation
from matplotlib.tri.trifinder impo... | mit |
cbertinato/pandas | pandas/tests/generic/test_label_or_level_utils.py | 1 | 10041 | import pytest
from pandas.core.dtypes.missing import array_equivalent
import pandas as pd
# Fixtures
# ========
@pytest.fixture
def df():
"""DataFrame with columns 'L1', 'L2', and 'L3' """
return pd.DataFrame({'L1': [1, 2, 3],
'L2': [11, 12, 13],
'L3': ['A',... | bsd-3-clause |
lukashermann/pytorch-rl | core/env.py | 1 | 3187 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from copy import deepcopy
from gym.spaces.box import Box
import inspect
import cv2
from sklearn.utils.extmath import cartesian
from utils.helpers import Experience # NOTE: here sta... | mit |
datapythonista/pandas | pandas/tests/tslibs/test_conversion.py | 4 | 3986 | from datetime import datetime
import numpy as np
import pytest
from pytz import UTC
from pandas._libs.tslibs import (
OutOfBoundsTimedelta,
conversion,
iNaT,
timezones,
tzconversion,
)
from pandas import (
Timestamp,
date_range,
)
import pandas._testing as tm
def _compare_utc_to_local(t... | bsd-3-clause |
ornlneutronimaging/ResoFit | ResoFit/calibration.py | 1 | 31136 | import ImagingReso._utilities as reso_util
import matplotlib.pyplot as plt
from lmfit import Parameters
from lmfit import minimize
import pandas as pd
from itertools import cycle
import pprint
import ResoFit._utilities as fit_util
from ResoFit._gap_functions import y_gap_for_calibration
# from ResoFit._gap_functions i... | bsd-3-clause |
ephes/scikit-learn | doc/sphinxext/gen_rst.py | 142 | 40026 | """
Example generation for the scikit learn
Generate the rst files for the examples by iterating over the python
example files.
Files that generate images should start with 'plot'
"""
from __future__ import division, print_function
from time import time
import ast
import os
import re
import shutil
import traceback
i... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.