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
mkukielka/oddt
oddt/scoring/__init__.py
1
15324
from os.path import dirname, join as path_join import gzip from itertools import chain from functools import partial import six from six.moves import cPickle as pickle import numpy as np from scipy.sparse import vstack as sparse_vstack import pandas as pd from joblib import Parallel, delayed from sklearn.model_selec...
bsd-3-clause
mrshu/scikit-learn
sklearn/linear_model/tests/test_bayes.py
8
1627
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # # License: BSD Style. import numpy as np from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import SkipTest from sklearn.linear_model.bayes import BayesianRidge, ARDRegressi...
bsd-3-clause
njuwangchen/TravelRec
backend/hack.py
1
15425
# coding: utf-8 # In[1]: import requests, json from math import radians, cos, sin, asin, sqrt from datetime import datetime import random import time import cPickle as pickle # import xgboost as xgb # import pandas as pd # In[2]: # REQUEST POINT OF INTEREST def requestPoints(city_name): search_type = "points-...
apache-2.0
Chemcy/vnpy
vn.trader/ctaStrategy/strategy/strategyDualThrust.py
4
9481
# encoding: UTF-8 """ DualThrust交易策略 """ from datetime import time from ctaBase import * from ctaTemplate import CtaTemplate ######################################################################## class DualThrustStrategy(CtaTemplate): """DualThrust交易策略""" className = 'DualThrustStrategy' author = u'用...
mit
3manuek/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
mne-tools/mne-tools.github.io
0.14/_downloads/plot_visualize_epochs.py
3
4239
""" .. _tut_viz_epochs: Visualize Epochs data ===================== """ import os.path as op import mne data_path = op.join(mne.datasets.sample.data_path(), 'MEG', 'sample') raw = mne.io.read_raw_fif(op.join(data_path, 'sample_audvis_raw.fif')) raw.set_eeg_reference() # set EEG average reference event_id = {'audit...
bsd-3-clause
treycausey/scikit-learn
sklearn/covariance/tests/test_robust_covariance.py
31
3340
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Gael Varoquaux <gael.varoquaux@normalesup.org> # Virgile Fritsch <virgile.fritsch@inria.fr> # # License: BSD 3 clause import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_alm...
bsd-3-clause
trankmichael/scipy
scipy/spatial/_plotutils.py
53
4034
from __future__ import division, print_function, absolute_import import numpy as np from scipy._lib.decorator import decorator as _decorator __all__ = ['delaunay_plot_2d', 'convex_hull_plot_2d', 'voronoi_plot_2d'] @_decorator def _held_figure(func, obj, ax=None, **kw): import matplotlib.pyplot as plt if ax...
bsd-3-clause
astrofrog/glue-3d-viewer
glue_vispy_viewers/common/vispy_widget.py
2
6339
from __future__ import absolute_import, division, print_function import sys import numpy as np from ..extern.vispy import scene from .axes import AxesVisual3D from ..utils import NestedSTTransform from matplotlib.colors import ColorConverter from glue.config import settings rgb = ColorConverter().to_rgb LIMITS_P...
bsd-2-clause
dialounke/pylayers
pylayers/simul/link.py
1
74985
# # -*- coding: utf-8 -*- # from __future__ import print_function r""" .. currentmodule:: pylayers.simul.link .. autosummary:: :members: """ try: from tvtk.api import tvtk from mayavi.sources.vtk_data_source import VTKDataSource from mayavi import mlab except: print('Layout:Mayavi is not instal...
mit
dllsf/odootest
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
shicai/cuda-convnet2
convdata.py
174
14675
# Copyright 2014 Google Inc. 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 applicable law or...
apache-2.0
Evidlo/imgurt
setup.py
2
1130
from setuptools import setup from redrum import version import os import shutil module_path = os.path.dirname(os.path.realpath(__file__)) + '/redrum' config_file = os.path.expanduser('~/.config/redrum.ini') shutil.copyfile(module_path + '/redrum.ini', config_file) setup( name='redrum', version=version.__vers...
mit
xuanyuanking/spark
python/docs/source/conf.py
12
13269
# -*- coding: utf-8 -*- # # pyspark documentation build configuration file, created by # sphinx-quickstart on Thu Aug 28 15:17:47 2014. # # 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. # # A...
apache-2.0
marionleborgne/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/font_manager.py
69
42655
""" A module for finding, managing, and using fonts across platforms. This module provides a single :class:`FontManager` instance that can be shared across backends and platforms. The :func:`findfont` function returns the best TrueType (TTF) font file in the local or system font path that matches the specified :class...
agpl-3.0
jmetzen/scikit-learn
sklearn/feature_extraction/text.py
7
50272
# -*- coding: utf-8 -*- # Authors: Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Lars Buitinck <L.J.Buitinck@uva.nl> # Robert Layton <robertlayton@gmail.com> # Jochen Wersdörfer <jochen@wersdoerfer.de> # Roman Sinayev <roman.sinayev@gma...
bsd-3-clause
grollins/calm
examples/denoising/denoise_traces.py
1
5410
# standard library imports from os import mkdir from os.path import join, exists, basename from glob import glob from collections import defaultdict, Counter # non-standard library imports from numpy import array, float64 from pandas import DataFrame, Series # local imports from plot_fcn import plot_traces # calm im...
bsd-2-clause
simonsfoundation/CaImAn
use_cases/NWB/demo_pipeline_NWB.py
2
11632
#!/usr/bin/env python """ This script follows closely the demo_pipeline.py script but uses the Neurodata Without Borders (NWB) file format for loading the input and saving the output. It is meant as an example on how to use NWB files with CaImAn. authors: @agiovann and @epnev """ import cv2 import glob import logging...
gpl-2.0
jlegendary/opencog
scripts/make_benchmark_graphs.py
56
3139
#!/usr/bin/env python # Requires matplotlib for graphing # reads *_benchmark.csv files as output by atomspace_bm and turns them into # graphs. import csv import numpy as np import matplotlib.colors as colors #import matplotlib.finance as finance import matplotlib.dates as mdates import matplotlib.ticker as mticker i...
agpl-3.0
public-ink/public-ink
server/appengine/lib/matplotlib/patches.py
4
151301
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) import six from six.moves import map, zip import warnings import math import matplotlib as mpl import numpy as np import matplotlib.cbook as cbook import matplotlib.artist as artist f...
gpl-3.0
SanPen/GridCal
src/GridCal/Gui/GridEditorWidget/generator_graphics.py
1
7722
# This file is part of GridCal. # # GridCal 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. # # GridCal is distributed in the hope that...
gpl-3.0
zehpunktbarron/iOSMAnalyzer
scripts/c6_shop.py
1
3201
# -*- coding: utf-8 -*- #!/usr/bin/python2.7 #description :This file creates a plot: Calculates the development of all objects with a "shop"-tag #author :Christopher Barron @ http://giscience.uni-hd.de/ #date :19.01.2013 #version :0.1 #usage :python pyscript.py #=============...
gpl-3.0
ominux/scikit-learn
examples/neighbors/plot_regression.py
1
1368
""" ============================ Nearest Neighbors regression ============================ Demonstrate the resolution of a regression problem using a k-Nearest Neighbor and the interpolation of the target using both barycenter and constant weights. """ print __doc__ # Author: Alexandre Gramfort <alexandre.gramfort@i...
bsd-3-clause
jseabold/scikit-learn
sklearn/utils/validation.py
16
26075
"""Utilities for input validation""" # Authors: Olivier Grisel # Gael Varoquaux # Andreas Mueller # Lars Buitinck # Alexandre Gramfort # Nicolas Tresegnie # License: BSD 3 clause import warnings import numbers import numpy as np import scipy.sparse as sp from ..externals i...
bsd-3-clause
zihua/scikit-learn
sklearn/model_selection/_split.py
7
61646
""" The :mod:`sklearn.model_selection._split` module includes classes and functions to split the data based on a preset strategy. """ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>, # Gael Varoquaux <gael.varoquaux@normalesup.org>, # Olivier Grisel <olivier.grisel@ensta.org> # Ragha...
bsd-3-clause
richstoner/proletariat
ipython_profile/profile_girderconfig/ipython_notebook_config.py
1
24158
# Configuration file for ipython-notebook. c = get_config() #------------------------------------------------------------------------------ # NotebookApp configuration #------------------------------------------------------------------------------ # NotebookApp will inherit config from: BaseIPythonApplication, Appli...
apache-2.0
aflaxman/scikit-learn
examples/cluster/plot_mini_batch_kmeans.py
53
4096
""" ==================================================================== Comparison of the K-Means and MiniBatchKMeans clustering algorithms ==================================================================== We want to compare the performance of the MiniBatchKMeans and KMeans: the MiniBatchKMeans is faster, but give...
bsd-3-clause
jaeilepp/mne-python
examples/time_frequency/plot_time_frequency_simulated.py
1
8415
""" ====================================================================== Time-frequency on simulated data (Multitaper vs. Morlet vs. Stockwell) ====================================================================== This example demonstrates the different time-frequency estimation methods on simulated data. It shows ...
bsd-3-clause
totalgood/nlpia
src/nlpia/book/examples/ch04_catdog_lsa_3x6x16.py
1
16654
from nlpia.data.loaders import get_data from nltk.tokenize import casual_tokenize import pandas as pd import numpy as np import os from sklearn.feature_extraction.text import TfidfVectorizer # from nltk.stem import PorterStemmer from sklearn.decomposition import PCA from nlpia.constants import DATA_PATH NUM_TOPICS = ...
mit
seckcoder/lang-learn
python/sklearn/examples/linear_model/plot_logistic_l1_l2_sparsity.py
2
2566
""" ============================================== 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...
unlicense
0asa/scikit-learn
examples/text/mlcomp_sparse_document_classification.py
292
4498
""" ======================================================== Classification of text documents: using a MLComp dataset ======================================================== This is an example showing how the scikit-learn can be used to classify documents by topics using a bag-of-words approach. This example uses a s...
bsd-3-clause
wk8910/bio_tools
01.dadi_fsc/02.two_pop_model/10.changePop2First/01.model.py
1
2358
#! /usr/bin/env python import os,sys,re # import matplotlib # matplotlib.use('Agg') import numpy import sys from numpy import array # import pylab import dadi import custom_model spectrum_file = sys.argv[1] data = dadi.Spectrum.from_file(spectrum_file) data = data.fold() ns = data.sample_sizes pts_l = [40,50,60] # n...
mpl-2.0
danielru/pySDC
playgrounds/deprecated/acoustic_2d_imex/HookClass.py
1
1847
from __future__ import division from pySDC.core.Hooks import hooks from pySDC.core.Stats import stats import matplotlib.pyplot as plt import numpy as np from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatte...
bsd-2-clause
KTH-dESA/PyOnSSET
onsset/onsset.py
1
198624
# Author: KTH dESA Last modified by Andreas Sahlberg # Date: 05 June 2019 # Python version: 3.5 import os import logging import pandas as pd from math import ceil, pi, exp, log, sqrt, radians, cos, sin, asin # from pyproj import Proj import numpy as np from collections import defaultdict # from IPython.display import...
mit
saleemayman/scalapack_svd
smuc/postprocess/plotCase3Results.py
1
2323
import glob, os, sys import numpy as np from random import* import matplotlib.pyplot as plt import matplotlib.cm as cmx import matplotlib.colors as colors def get_rand_color(val): h,s,v = random()*6, 0.5, 243.2 colors = [] for i in range(val): h += 3.75#3.708 tmp = ((v, v-v*s*abs(1-h%2), v-...
apache-2.0
K-Phoen/runner
runner/fusion.py
1
1312
#!/usr/bin/env python import pandas, time, math class Fusion: def merge_activities(self, main_activity, cardio_activity): complete_cardio = self._interpolate_cardio(main_activity, cardio_activity) # and merge it back into the main activity for trackpoint in main_activity.trackpoints: ...
mit
mihalybaci/keras
mnist_deep_tutorial.py
1
4145
# -*- coding: utf-8 -*- """ Created on Wed Jun 28 21:47:59 2017 @author: michael """ # # Begin code from TensorFlow Deep MNIST Tutorial # import pandas as pd import numpy as np import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data #import data mnist = input_data.read_data_sets('MNIST_d...
gpl-3.0
jmccormac/pySceneNetRGBD
calculate_optical_flow.py
1
10949
from PIL import Image import math import matplotlib import numpy as np import os import pathlib import random import scenenet_pb2 as sn import sys import scipy.misc def normalize(v): return v/np.linalg.norm(v) def load_depth_map_in_m(file_name): image = Image.open(file_name) pixel = np.array(image) re...
gpl-3.0
RayMick/scikit-learn
sklearn/cross_decomposition/pls_.py
187
28507
""" The :mod:`sklearn.pls` module implements Partial Least Squares (PLS). """ # Author: Edouard Duchesnay <edouard.duchesnay@cea.fr> # License: BSD 3 clause from ..base import BaseEstimator, RegressorMixin, TransformerMixin from ..utils import check_array, check_consistent_length from ..externals import six import w...
bsd-3-clause
JohanComparat/pySU
spm/bin_SMF/create_table_completeness.py
1
9615
import astropy.io.fits as fits import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as p import numpy as n import os import sys from scipy.stats import scoreatpercentile as sc survey = sys.argv[1] z_min, z_max = 0., 1.6 imfs = ["Chabrier_ELODIE_", "Chabrier_MILES_", "Chabrier_STELIB_", "Kroupa_ELODIE_", ...
cc0-1.0
mjgrav2001/scikit-learn
examples/neighbors/plot_approximate_nearest_neighbors_scalability.py
225
5719
""" ============================================ Scalability of Approximate Nearest Neighbors ============================================ This example studies the scalability profile of approximate 10-neighbors queries using the LSHForest with ``n_estimators=20`` and ``n_candidates=200`` when varying the number of sa...
bsd-3-clause
UASLab/ImageAnalysis
scripts/99-plot-matches.py
1
3445
#!/usr/bin/env python3 # do pairwise triangulation to estimate local surface height, but try # to also build up a tracking structure so we could use and refine # this as we proceed through the matching process. import argparse from matplotlib import pyplot as plt from matplotlib import collections as mc import numpy ...
mit
nrweir/pyto_segmenter
PytoSegment.py
1
2847
'''Classes for merging segmented cells with subcellular structures''' import pandas as pd import pickle class PytoSegmentObj: '''A metaclass to merge together a CellSegmentObj with child objects segmented in other channels. ''' def __init__(self, cell_obj, daughter_objs = {}): '''Generate a P...
gpl-3.0
xubenben/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
Neurita/bamboo
setup.py
1
2824
#!/usr/bin/env python """ Bamboo ----- bambo is a set of tools for pandas DataFrames. """ from __future__ import print_function import os.path as op import io import sys from setuptools import Command, setup, find_packages from setuptools.command.test import test as TestCommand from pip.req import parse_requirement...
bsd-3-clause
maksyuki/vim
python/numerical_calculation.py
2
6539
#!/usr/bin/python #filename :numerical_calculation.py #author :Yuchi Miao #created time :2016/4/18 19:44:10 #last modified :2016/9/22 11:28:18 #python_version :2.7.6 #version :1.0 #description :use the numerical integration method(Runge_Kutta Method) to # solve the first order...
gpl-3.0
mikelum/pyspeckit
pyspeckit/spectrum/plotters.py
1
31130
""" ======= Plotter ======= .. moduleauthor:: Adam Ginsburg <adam.g.ginsburg@gmail.com> """ from __future__ import print_function import matplotlib import matplotlib.pyplot import matplotlib.figure import numpy as np import astropy.units as u import copy import inspect try: from matplotlib.cbook import BoundMetho...
mit
sanginnwoo/longtailedtit
doc/tests/radialinjection.py
5
4190
#!/usr/bin/env python import matplotlib.pyplot as plt import numpy as np # # The two phase radial injection problem has a similarity solution (r^2/t) # # Read MOOSE simulation data for constant time (tdata) and constant # radial distance (rdata) tdata = np.genfromtxt('../../tests/dirackernels/theis3_line_0016.csv', d...
lgpl-2.1
nomadcube/scikit-learn
sklearn/tree/tests/test_export.py
76
9318
""" Testing for export functions of decision trees (sklearn.tree.export). """ from numpy.testing import assert_equal from nose.tools import assert_raises from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor from sklearn.tree import export_graphviz from sklearn.externals.six import StringIO # toy sa...
bsd-3-clause
russel1237/scikit-learn
doc/tutorial/text_analytics/skeletons/exercise_01_language_train_model.py
254
2005
"""Build a language detector model The goal of this exercise is to train a linear classifier on text features that represent sequences of up to 3 consecutive characters so as to be recognize natural languages by using the frequencies of short character sequences as 'fingerprints'. """ # Author: Olivier Grisel <olivie...
bsd-3-clause
navjeet0211/phd
misc/rama-regions-on-plot.py
1
1599
import numpy as np import matplotlib.pyplot as plt #f = np.loadtxt('rama-bg.dat') f = np.array([[-156.5, -70.4, -54.7, -54.7, -136.9, -136.9, -156.5, -156.5, -180. , -140.8, -86. , -74.3, -74.3, -44.3, -44.3, -46.9, -180. , -180. , -164.3, -133. , -109.4, -106.9, -44.3, -44.3, ...
gpl-2.0
ky822/scikit-learn
examples/linear_model/plot_ard.py
248
2622
""" ================================================== Automatic Relevance Determination Regression (ARD) ================================================== Fit regression model with Bayesian Ridge Regression. See :ref:`bayesian_ridge_regression` for more information on the regressor. Compared to the OLS (ordinary l...
bsd-3-clause
mcallaghan/tmv
BasicBrowser/tmv_app/management/commands/compare_topics.py
1
2280
from django.core.management.base import BaseCommand, CommandError from tmv_app.models import * import numpy as np from sklearn.decomposition import NMF from scipy.sparse import csr_matrix, find from functools import partial from multiprocess import Pool from utils.db import * from utils.utils import * from scoping.mode...
gpl-3.0
beepee14/scikit-learn
sklearn/feature_extraction/tests/test_text.py
41
35602
from __future__ import unicode_literals import warnings from sklearn.feature_extraction.text import strip_tags from sklearn.feature_extraction.text import strip_accents_unicode from sklearn.feature_extraction.text import strip_accents_ascii from sklearn.feature_extraction.text import HashingVectorizer from sklearn.fe...
bsd-3-clause
miloharper/neural-network-animation
matplotlib/docstring.py
23
3995
from __future__ import (absolute_import, division, print_function, unicode_literals) import six from matplotlib import cbook import sys import types class Substitution(object): """ A decorator to take a function's docstring and perform string substitution on it. This decorat...
mit
boomsbloom/dtm-fmri
DTM/for_gensim/lib/python2.7/site-packages/matplotlib/axes/_axes.py
1
275832
from __future__ import (absolute_import, division, print_function, unicode_literals) from matplotlib.externals import six from matplotlib.externals.six.moves import reduce, xrange, zip, zip_longest import math import warnings import numpy as np from numpy import ma import matplotlib from mat...
mit
agrawalabhishek/NAOS
python/plotSpringMass.py
1
3901
''' Copyright (c) 2016 Abhishek Agrawal (abhishek.agrawal@protonmail.com) Distributed under the MIT License. See accompanying file LICENSE.md or copy at http://opensource.org/licenses/MIT ''' # Set up modules and packages # I/O import csv from pprint import pprint # Numerical import numpy as np import pandas as pd fr...
mit
aleaf/pest_tools
pest_tools/load_jco.py
2
2515
import numpy as np import pandas as pd import struct def load_jco(file_name, return_par = True, return_obs = True): '''Read PEST Jacobian matrix file (binary) into Pandas data frame Parameters ---------- file_name : string File name for .jco (binary) produced by PEST return_par : {Tru...
mit
CVML/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/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
joostvanzwieten/nutils
examples/laplace.py
1
7208
#! /usr/bin/env python3 # # In this script we solve the Laplace equation :math:`u_{,kk} = 0` on a unit # square domain :math:`Ω` with boundary :math:`Γ`, subject to boundary # conditions: # # .. math:: u &= 0 && Γ_{\rm left} # # ∂_n u &= 0 && Γ_{\rm bottom} # # ∂_n u ...
mit
abimannans/scikit-learn
sklearn/tests/test_qda.py
155
3481
import numpy as np from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_raises from sklearn.utils.testing import ignore_war...
bsd-3-clause
jakob223/ipython_sound_animator
sound_animator.py
1
3042
from matplotlib import animation from ipywidgets import HTML import IPython.display as ipd import random from tempfile import NamedTemporaryFile import math import matplotlib.pyplot as plt VIDEO_TAG = """<video controls id="video_{1}"> <source src="data:video/x-m4v;base64,{0}" type="video/mp4"> Your browser does not ...
mit
precice/elastictube1d
postproc/plot-fluid.py
1
1894
#!/usr/bin/python import vtk import numpy as np import os import sys import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D T = 100 # number of timesteps performed arrayname = sys.argv[1] # Which dataset should be plotted? data_path = sys.argv[2] # Where is the data? file_name_generator = lambda...
gpl-3.0
billy-inn/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
semio/zipline
zipline/examples/pairtrade.py
16
5197
#!/usr/bin/env python # # Copyright 2013 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 ...
apache-2.0
ilo10/scikit-learn
examples/decomposition/plot_pca_vs_fa_model_selection.py
78
4510
#!/usr/bin/python # -*- coding: utf-8 -*- """ =============================================================== Model selection with Probabilistic PCA and Factor Analysis (FA) =============================================================== Probabilistic PCA and Factor Analysis are probabilistic models. The consequence ...
bsd-3-clause
jm-begon/scikit-learn
examples/linear_model/plot_iris_logistic.py
283
1678
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Logistic Regression 3-class Classifier ========================================================= Show below is a logistic-regression classifiers decision boundaries on the `iris <http://en.wikipedia.org/wiki/Iris_f...
bsd-3-clause
averagehat/bio_pieces
tests/test_amos2fastq.py
2
4832
try: import unittest2 as unittest except ImportError: import unittest from operator import itemgetter from pandas.util.testing import assert_frame_equal import pandas as pd import mock from bio_pieces import amos2fastq_main from bio_pieces import amos2fastq as a2f import os import random from functools impor...
gpl-2.0
MichielCottaar/pymc3
pymc3/tests/test_plots.py
13
1721
import matplotlib matplotlib.use('Agg', warn=False) import numpy as np from .checks import close_to import pymc3.plots from pymc3.plots import * from pymc3 import Slice, Metropolis, find_hessian, sample def test_plots(): # Test single trace from pymc3.examples import arbitrary_stochastic as asmod with...
apache-2.0
rosswhitfield/javelin
javelin/io.py
1
9604
""" == io == """ def read_mantid_MDHisto(filename): """Read the saved MDHisto from from Mantid and returns an xarray.DataArray object""" import h5py import numpy as np import xarray as xr from javelin.unitcell import UnitCell with h5py.File(filename, "r") as f: if ('SaveMDVersion' not ...
mit
yask123/scikit-learn
benchmarks/bench_tree.py
297
3617
""" To run this, you'll need to have installed. * scikit-learn Does two benchmarks First, we fix a training set, increase the number of samples to classify and plot number of classified samples as a function of time. In the second benchmark, we increase the number of dimensions of the training set, classify a sam...
bsd-3-clause
architecture-building-systems/CEAforArcGIS
cea/utilities/doc_schemas.py
1
9354
""" Create a schemas.yml-compatible entry given a locator method by reading the file from the current scenario. NOTE: This is meant to help _write_ the schemas.yml file, not to CREATE it - you'll have to edit constraints and types by hand too! """ import os import yaml import json import pandas as pd from p...
mit
IshankGulati/scikit-learn
sklearn/utils/setup.py
77
2993
import os from os.path import join from sklearn._build_utils import get_blas_info def configuration(parent_package='', top_path=None): import numpy from numpy.distutils.misc_util import Configuration config = Configuration('utils', parent_package, top_path) config.add_subpackage('sparsetools') ...
bsd-3-clause
meduz/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
trungnt13/scikit-learn
sklearn/metrics/tests/test_regression.py
272
6066
from __future__ import division, print_function import numpy as np from itertools import product from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils....
bsd-3-clause
numenta/htmresearch
htmresearch/frameworks/poirazi_neuron_model/neuron_model.py
2
11852
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2017, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This progra...
agpl-3.0
cbrunet/fibermodes
scripts/tof/tofanalyse.py
2
1186
import pickle import numpy from matplotlib import pyplot from tofcommon import r1, r2, diam, RCF, X def errng(ng, target): if len(ng) < len(target) + 1: return float("nan") ng.sort() e1 = (ng[2] - ng[1] - target[1] + target[0])**2 e2 = (ng[3] - ng[2] - target[2] + target[1])**2 if len(t...
gpl-3.0
QuantEcon/QuantEcon.notebooks
dependencies/lq_markov.py
1
8130
""" Author: Sebastian Graves Provides a class called LQ_Markov for analyzing Markov jump LQ problems. Provides a function to map first type of Barro model into LQ Markov problem. Provides a function to map second type of Barro model (with restructuring) into LQ Markov problem. """ import numpy as np from collection...
bsd-3-clause
NINAnor/sentinel4nature
Tree canopy cover/regression/GBRT_Dovre1_manual_FCLS.py
1
8831
# GBRT for Dovre1 case study site # Training data: manually digitized training areas, including water pixels # Predictors: results of FCLS spectral unmixing # Authors: Stefan Blumentrath import numpy as np import matplotlib.pyplot as plt from sklearn import ensemble from sklearn import datasets from sklearn.utils imp...
gpl-2.0
AlexanderFabisch/scikit-learn
doc/sphinxext/gen_rst.py
106
40198
""" 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
brupoon/nextTwilight
iso_theoretical.py
1
1193
# -*- coding: utf-8 -*- """ Created on Tue Apr 22 09:23:19 2014 @author: B Poon (demure) """ import numpy as np from matplotlib import pyplot as plt #from math import log10 #definitions first = r"C:\pyf\ast\iso100Mfixed.txt" second = r"C:\pyf\ast\iso1G.txt" third = r"C:\pyf\ast\iso10G.txt" def iso_theo(filepath, col...
mit
shirishr/My-Progress-at-Machine-Learning
Udacity_Machine_Learning/customer_segments/visuals.py
21
6047
########################################### # Suppress matplotlib user warnings # Necessary for newer version of matplotlib import warnings warnings.filterwarnings("ignore", category = UserWarning, module = "matplotlib") # # Display inline matplotlib plots with IPython from IPython import get_ipython get_ipython().run_...
mit
cpcloud/arrow
python/pyarrow/tests/test_parquet.py
1
68774
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
apache-2.0
piyush0609/scipy
scipy/stats/stats.py
1
161773
# Copyright (c) Gary Strangman. All rights reserved # # Disclaimer # # This software is provided "as-is". There are no expressed or implied # warranties of any kind, including, but not limited to, the warranties # of merchantability and fitness for a given application. In no event # shall Gary Strangman be liable fo...
bsd-3-clause
ggodreau/c3t2
concatenate.py
1
2987
#!/usr/bin/python """ To use, please type in: python concatenate.py The script will only look at files that are within folders that are one level below the directory supplied to the script. For example, if no argument is given to the script, script will parse all folders within the current working directory as ...
mit
IshankGulati/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
elkingtonmcb/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
tawsifkhan/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
mrshu/scikit-learn
sklearn/datasets/tests/test_20news.py
11
2398
"""Test the 20news downloader, if the data is available.""" import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import SkipTest from sklearn import datasets def test_20news(): try: data = dat...
bsd-3-clause
larsmans/scikit-learn
examples/linear_model/plot_multi_task_lasso_support.py
249
2211
#!/usr/bin/env python """ ============================================= Joint feature selection with multi-task Lasso ============================================= The multi-task lasso allows to fit multiple regression problems jointly enforcing the selected features to be the same across tasks. This example simulates...
bsd-3-clause
davidgbe/scikit-learn
sklearn/linear_model/tests/test_ridge.py
130
22974
import numpy as np import scipy.sparse as sp from scipy import linalg from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_a...
bsd-3-clause
aminert/scikit-learn
sklearn/datasets/tests/test_lfw.py
230
7880
"""This test for the LFW require medium-size data dowloading and processing If the data has not been already downloaded by running the examples, the tests won't run (skipped). If the test are run, the first execution will be long (typically a bit more than a couple of minutes) but as the dataset loader is leveraging ...
bsd-3-clause
cdegroc/scikit-learn
sklearn/gaussian_process/gaussian_process.py
1
32730
#!/usr/bin/python # -*- coding: utf-8 -*- # Author: Vincent Dubourg <vincent.dubourg@gmail.com> # (mostly translation, see implementation details) # License: BSD style import numpy as np from scipy import linalg, optimize, rand from ..base import BaseEstimator, RegressorMixin from ..metrics.pairwise import m...
bsd-3-clause
joelgrus/data-science-from-scratch
scratch/logistic_regression.py
3
7642
tuples = [(0.7,48000,1),(1.9,48000,0),(2.5,60000,1),(4.2,63000,0),(6,76000,0),(6.5,69000,0),(7.5,76000,0),(8.1,88000,0),(8.7,83000,1),(10,83000,1),(0.8,43000,0),(1.8,60000,0),(10,79000,1),(6.1,76000,0),(1.4,50000,0),(9.1,92000,0),(5.8,75000,0),(5.2,69000,0),(1,56000,0),(6,67000,0),(4.9,74000,0),(6.4,63000,1),(6.2,8200...
mit
tawsifkhan/scikit-learn
benchmarks/bench_plot_neighbors.py
287
6433
""" Plot the scaling of the nearest neighbors algorithms with k, D, and N """ from time import time import numpy as np import pylab as pl from matplotlib import ticker from sklearn import neighbors, datasets def get_data(N, D, dataset='dense'): if dataset == 'dense': np.random.seed(0) return np....
bsd-3-clause
asteca/ASteCA
packages/out/mp_centers.py
1
3202
import numpy as np import matplotlib.pyplot as plt import matplotlib.offsetbox as offsetbox def pl_full_frame( N, gs, fig, x_name, y_name, coord, x_min, x_max, y_min, y_max, asp_ratio, x, y, st_sizes_arr, mag_range, main_mag): """ x,y finding chart of stars in frame within 'mag_range' """ ...
gpl-3.0
alexsavio/scikit-learn
sklearn/cluster/setup.py
24
1690
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD 3 clause import os from os.path import join import numpy from sklearn._build_utils import get_blas_info def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration cblas_libs, blas_info = ...
bsd-3-clause
jorik041/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
vsmolyakov/kaggle
toxic/toxic_kernel2.py
1
8062
import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import os import re import csv import math import codecs import keras from keras import optimizers from keras import backend as K from keras import regularizers from keras.models import Sequential from keras.layers import Den...
mit