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
detrout/debian-statsmodels
statsmodels/sandbox/examples/example_crossval.py
33
2232
import numpy as np from statsmodels.sandbox.tools import cross_val if __name__ == '__main__': #A: josef-pktd import statsmodels.api as sm from statsmodels.api import OLS #from statsmodels.datasets.longley import load from statsmodels.datasets.stackloss import load from statsmodels.iolib.tab...
bsd-3-clause
bdh1011/wau
venv/lib/python2.7/site-packages/pandas/core/index.py
1
201512
# pylint: disable=E1101,E1103,W0232 import datetime import warnings import operator from functools import partial from pandas.compat import range, zip, lrange, lzip, u, reduce, filter, map from pandas import compat import numpy as np from sys import getsizeof import pandas.tslib as tslib import pandas.lib as lib impo...
mit
flightgong/scikit-learn
sklearn/utils/graph.py
50
6169
""" Graph utilities and algorithms Graphs are represented with their adjacency matrices, preferably using sparse matrices. """ # Authors: Aric Hagberg <hagberg@lanl.gov> # Gael Varoquaux <gael.varoquaux@normalesup.org> # Jake Vanderplas <vanderplas@astro.washington.edu> # License: BSD 3 clause impo...
bsd-3-clause
hamishcunningham/fishy-wifi
wegrow-web/wegrow_data_graphing/data_loader.py
1
4573
import os import datetime import json import pandas as pd from config import DATA_DIR, OUTPUT_DIR """Functions to easily return flat-file Elf data as pandas dataframes for visualisation. Plotting can be done with the `seaborn` package. Writing this has made me questioning why we're not using a data...
agpl-3.0
widdowquinn/Teaching-Dundee-BS32010
workshop_2/bs32010/ex06.py
2
8315
# ex08.py # # Functions and data useful in exercise 8 (finding RBBH) of # the BS32010 course at the University of Dundee from matplotlib.colors import LogNorm from Bio import SeqIO import matplotlib # to get version import matplotlib.pyplot as plt import pandas as pd import os # GLOBALS datadir = "rbbh_data/rbbh...
mit
harshaneelhg/scikit-learn
sklearn/neighbors/unsupervised.py
106
4461
"""Unsupervised nearest neighbors learner""" from .base import NeighborsBase from .base import KNeighborsMixin from .base import RadiusNeighborsMixin from .base import UnsupervisedMixin class NearestNeighbors(NeighborsBase, KNeighborsMixin, RadiusNeighborsMixin, UnsupervisedMixin): """Unsu...
bsd-3-clause
HoliestCow/ece692_deeplearning
project4/word_rnn.py
1
7885
import tensorflow as tf import numpy as np from tensorflow.contrib.rnn import LSTMCell, GRUCell import sys import time import gensim import string import re import collections import logging from matplotlib import pyplot as plt from itertools import islice def window(seq, n=2): "Returns a sliding window (of widt...
mit
McIntyre-Lab/mcscript
mclib_Python/plotting.py
4
1107
""" Various plotting function """ import numpy as np def blandAltman(s1, s2, ax=None): """ Generate a Bland-Altman plot. Arguments: :type s1: numpy.array :param s1: An array of sample1 data. :type s2: numpy.array :param s2: An array of sample2 data. :param ax: ...
gpl-3.0
jmontgom10/PRISM_pyPol
04_buildMasks.py
2
18023
# -*- coding: utf-8 -*- """ Launches a GUI mask builder for each file associated with the targets specidied by the 'targets' variable. When the script is launched, a three pane plot of the science images will be displayed. The center pane in this triptych is the active pane for which you are build a mask. The followi...
mit
tapomayukh/projects_in_python
classification/Classification_with_HMM/Single_Contact_Classification/Variable_Stiffness_Variable_Velocity/HMM/with 2s/hmm_crossvalidation_force_motion_10_states_scaled_wrt_all_data.py
1
39761
# Hidden Markov Model Implementation import pylab as pyl import numpy as np import matplotlib.pyplot as pp #from enthought.mayavi import mlab import scipy as scp import scipy.ndimage as ni import roslib; roslib.load_manifest('sandbox_tapo_darpa_m3') import rospy #import hrl_lib.mayavi2_util as mu import hrl_lib.viz ...
mit
zihua/scikit-learn
sklearn/neighbors/tests/test_ball_tree.py
159
10196
import pickle import numpy as np from numpy.testing import assert_array_almost_equal from sklearn.neighbors.ball_tree import (BallTree, NeighborsHeap, simultaneous_sort, kernel_norm, nodeheap_sort, DTYPE, ITYPE) from sklearn.neighbors.dis...
bsd-3-clause
Weihonghao/ECM
Vpy34/lib/python3.5/site-packages/pandas/tests/plotting/test_misc.py
6
13131
# coding: utf-8 """ Test cases for misc plot functions """ import pytest from pandas import Series, DataFrame from pandas.compat import lmap import pandas.util.testing as tm from pandas.util.testing import slow import numpy as np from numpy import random from numpy.random import randn import pandas.plotting as plo...
agpl-3.0
kastnerkyle/crikey
chirp_tests/frequency_modulation_rnn.py
1
6631
# Author: Kyle Kastner # License: BSD 3-clause # THEANO_FLAGS="optimizer=None,compute_test_value=raise" python tanh_rnn.py import numpy as np import theano import theano.tensor as T from scipy import linalg class sgd(object): # Only here for API conformity with other optimizers def __init__(self, params): ...
bsd-3-clause
codein/poc
github_poller.py
1
2466
import os import requests import json import urllib from urllib import urlencode import pandas as pd import argparse import numpy as np import datetime import settings import utils base_url = 'https://api.github.com' issue_attributes = ['title', 'html_url'] def extract_issue_attributes(raw_issue): try: i...
mit
jmargeta/scikit-learn
benchmarks/bench_plot_parallel_pairwise.py
10
1181
# Author: Mathieu Blondel <mathieu@mblondel.org> # License: BSD Style. import time import pylab as pl from sklearn.utils import check_random_state from sklearn.metrics.pairwise import pairwise_distances from sklearn.metrics.pairwise import pairwise_kernels def plot(func): random_state = check_random_state(0) ...
bsd-3-clause
seckcoder/lang-learn
python/sklearn/examples/linear_model/plot_polynomial_interpolation.py
7
1647
#!/usr/bin/env python """ ======================== Polynomial interpolation ======================== This example demonstrates how to approximate a function with a polynomial of degree n_degree by using ridge regression. Concretely, from n_samples 1d points, it suffices to build the Vandermonde matrix, which is n_samp...
unlicense
jhanley634/testing-tools
problem/conda_env_yml/env_report.py
1
2585
#! /usr/bin/env python # Copyright 2019 John Hanley. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, me...
mit
PyPSA/PyPSA
examples/opf-storage-hvdc/export_opf-storage_network.py
1
5451
#This script builds a network manually using network.add, so that it #has two 3-bus disconnected AC networks, connected by HVDC #links. Storage and generation (wind and gas) is then optimised. #The network is then written as CSV files to csv_folder_name. import pypsa import datetime import pandas as pd import nump...
gpl-3.0
tfiedor/perun
perun/fuzz/interpret.py
1
7884
""" Module contains a set of functions for fuzzing results interpretation.""" import demandimport import os.path as path import difflib import scipy.stats.mstats as stats with demandimport.enabled(): import matplotlib.pyplot as plt import perun.utils.streams as streams import perun.utils.log as log import perun.f...
gpl-3.0
hsiaoyi0504/scikit-learn
examples/linear_model/plot_lasso_model_selection.py
311
5431
""" =================================================== Lasso model selection: Cross-Validation / AIC / BIC =================================================== Use the Akaike information criterion (AIC), the Bayes Information criterion (BIC) and cross-validation to select an optimal value of the regularization paramet...
bsd-3-clause
WojciechMigda/TCO-PCFStupskiPrize1
src/lbp_tpl_features.py
1
10225
#!/opt/anaconda2/bin/python # -*- coding: utf-8 -*- """ ################################################################################ # # Copyright (c) 2015 Wojciech Migda # All rights reserved # Distributed under the terms of the MIT license # ####################################################################...
mit
gbrammer/pygrism
hudf.py
2
227635
import os import glob import numpy as np import matplotlib.pyplot as plt #import pyfits import astropy.io.fits as pyfits import threedhst import threedhst.catIO as catIO import threedhst.eazyPy as eazy #import threedhst.dq import unicorn #### nJy bouwens = {'F435W':-1.7, 'F606W':-1.1, 'F775W':-1.4, 'F814W':-3.3, 'F...
mit
jni/skan
skan/csr.py
1
38144
import numpy as np import pandas as pd from scipy import sparse, ndimage as ndi from scipy.sparse import csgraph from scipy import spatial import numba from .nputil import raveled_steps_to_neighbors ## NBGraph and Numba-based implementation csr_spec = [ ('indptr', numba.int32[:]), ('indices', numba.int32[:]...
bsd-3-clause
wrichert/BuildingMachineLearningSystemsWithPython
ch05/PosTagFreqVectorizer.py
27
9486
# 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 re from operator import itemgetter from collections import Mapping import scipy.sparse as sp f...
mit
trankmichael/scikit-learn
sklearn/manifold/tests/test_locally_linear.py
232
4761
from itertools import product from nose.tools import assert_true import numpy as np from numpy.testing import assert_almost_equal, assert_array_almost_equal from scipy import linalg from sklearn import neighbors, manifold from sklearn.manifold.locally_linear import barycenter_kneighbors_graph from sklearn.utils.testi...
bsd-3-clause
trichter/yam
yam/tests/test_correlate.py
1
16313
# Copyright 2017-2019 Tom Eulenfeld, MIT license import unittest import sys import numpy as np from obspy import read, read_inventory, UTCDateTime as UTC from obspy.signal.cross_correlation import correlate, xcorr_max from scipy.signal import periodogram from scipy.fftpack import next_fast_len from yam.correlate impo...
mit
michigraber/scikit-learn
sklearn/datasets/tests/test_mldata.py
384
5221
"""Test functionality of mldata fetching utilities.""" import os import shutil import tempfile import scipy as sp from sklearn import datasets from sklearn.datasets import mldata_filename, fetch_mldata from sklearn.utils.testing import assert_in from sklearn.utils.testing import assert_not_in from sklearn.utils.test...
bsd-3-clause
nicolaoun/NS3-AM-Proto-Simulation
src/flow-monitor/examples/wifi-olsr-flowmon.py
59
7427
# -*- Mode: Python; -*- # Copyright (c) 2009 INESC Porto # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, #...
gpl-2.0
barbagroup/cuIBM
examples/lidDrivenCavity/Re1000/scripts/plotCenterlineVelocities.py
1
2897
""" Plots the velocities along the centerlines of the 2D cavity at Reynolds number 1000 and compares with the numerical data reported in Ghia et al. (1982). _References:_ * Ghia, U. K. N. G., Ghia, K. N., & Shin, C. T. (1982). High-Re solutions for incompressible flow using the Navier-Stokes equations and a multig...
mit
PythonCharmers/bokeh
bokeh/charts/builder/scatter_builder.py
43
7792
"""This is the Bokeh charts interface. It gives you a high level API to build complex plot is a simple way. This is the Scatter class which lets you build your Scatter charts just passing the arguments to the Chart class and calling the proper functions. """ #-----------------------------------------------------------...
bsd-3-clause
kaichogami/scikit-learn
sklearn/neighbors/tests/test_approximate.py
55
19053
""" Testing for the approximate neighbor search using Locality Sensitive Hashing Forest module (sklearn.neighbors.LSHForest). """ # Author: Maheshakya Wijewardena, Joel Nothman import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_a...
bsd-3-clause
joelgrus/data-science-from-scratch
first-edition/code/linear_algebra.py
12
3701
# -*- coding: iso-8859-15 -*- from __future__ import division # want 3 / 2 == 1.5 import re, math, random # regexes, math functions, random numbers import matplotlib.pyplot as plt # pyplot from collections import defaultdict, Counter from functools import partial # # functions for working with vectors # def vector_...
mit
18padx08/PPTex
PPTexEnv_x86_64/lib/python2.7/site-packages/matplotlib/tests/test_compare_images.py
15
3854
from __future__ import (absolute_import, division, print_function, unicode_literals) import six import os import shutil from nose.tools import assert_equal, assert_not_equal, assert_almost_equal from matplotlib.testing.compare import compare_images from matplotlib.testing.decorators import _...
mit
kelle/astropy
astropy/nddata/utils.py
3
32776
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module includes helper functions for array operations. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from copy import deepcopy import numpy as np from .decorators import support_...
bsd-3-clause
mhue/scikit-learn
examples/decomposition/plot_incremental_pca.py
244
1878
""" =============== Incremental PCA =============== Incremental principal component analysis (IPCA) is typically used as a replacement for principal component analysis (PCA) when the dataset to be decomposed is too large to fit in memory. IPCA builds a low-rank approximation for the input data using an amount of memo...
bsd-3-clause
rubikloud/scikit-learn
sklearn/neighbors/nearest_centroid.py
38
7356
# -*- coding: utf-8 -*- """ Nearest Centroid Classification """ # Author: Robert Layton <robertlayton@gmail.com> # Olivier Grisel <olivier.grisel@ensta.org> # # License: BSD 3 clause import warnings import numpy as np from scipy import sparse as sp from ..base import BaseEstimator, ClassifierMixin from ..met...
bsd-3-clause
pvlib/pvlib-python
pvlib/tests/iotools/test_crn.py
2
3259
import pandas as pd import numpy as np from numpy import dtype, nan import pytest from pvlib.iotools import crn from ..conftest import DATA_DIR, assert_frame_equal @pytest.fixture def columns(): return [ 'WBANNO', 'UTC_DATE', 'UTC_TIME', 'LST_DATE', 'LST_TIME', 'CRX_VN', 'longitude', 'latitude', '...
bsd-3-clause
kenshay/ImageScripter
ProgramData/SystemFiles/Python/Lib/site-packages/numpydoc/plot_directive.py
89
20530
""" A special directive for generating a matplotlib plot. .. warning:: This is a hacked version of plot_directive.py from Matplotlib. It's very much subject to change! Usage ----- Can be used like this:: .. plot:: examples/example.py .. plot:: import matplotlib.pyplot as plt plt.plot...
gpl-3.0
hsiaoyi0504/scikit-learn
sklearn/linear_model/tests/test_least_angle.py
57
16523
from nose.tools import assert_equal import numpy as np from scipy import linalg from sklearn.cross_validation import train_test_split from sklearn.externals import joblib from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_...
bsd-3-clause
hainm/scipy
scipy/stats/_multivariate.py
35
69253
# # Author: Joris Vankerschaver 2013 # from __future__ import division, print_function, absolute_import import numpy as np import scipy.linalg from scipy.misc import doccer from scipy.special import gammaln, psi, multigammaln from scipy._lib._util import check_random_state __all__ = ['multivariate_normal', 'dirichle...
bsd-3-clause
MartinDelzant/scikit-learn
examples/cross_decomposition/plot_compare_cross_decomposition.py
128
4761
""" =================================== Compare cross decomposition methods =================================== Simple usage of various cross decomposition algorithms: - PLSCanonical - PLSRegression, with multivariate response, a.k.a. PLS2 - PLSRegression, with univariate response, a.k.a. PLS1 - CCA Given 2 multivari...
bsd-3-clause
synergetics/nest
pynest/examples/HillTononi/ht_poisson.py
4
3406
# -*- coding: utf-8 -*- # # ht_poisson.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, or ...
gpl-2.0
rajegannathan/grasp-lift-eeg-cat-dog-solution-updated
python-packages/pyRiemann-0.2.2/build/lib.linux-x86_64-2.7/pyriemann/clustering.py
2
5060
import numpy from sklearn.base import BaseEstimator, ClassifierMixin, TransformerMixin, ClusterMixin from sklearn.cluster.k_means_ import _init_centroids from sklearn.externals.joblib import Parallel from sklearn.externals.joblib import delayed from .utils.mean import mean_covariance from .utils.distance import distan...
bsd-3-clause
abhishekgahlot/scikit-learn
examples/model_selection/grid_search_text_feature_extraction.py
253
4158
""" ========================================================== Sample pipeline for text feature extraction and evaluation ========================================================== The dataset used in this example is the 20 newsgroups dataset which will be automatically downloaded and then cached and reused for the do...
bsd-3-clause
StevenLOL/aicyber_semeval_2016_ivector
System_2/0042_test_ivector_SemEval2016.py
1
1492
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis from sklearn.ensemble import BaggingClassifier, RandomForestClassifier from sklearn.linear_model import SGDClassifier from sklearn.preprocessing import StandardScaler, RobustScaler from sklearn.metrics import classification_report, confusion_matrix fr...
gpl-3.0
Hiyorimi/scikit-image
doc/examples/segmentation/plot_peak_local_max.py
9
1460
""" ==================== Finding local maxima ==================== The ``peak_local_max`` function returns the coordinates of local peaks (maxima) in an image. A maximum filter is used for finding local maxima. This operation dilates the original image and merges neighboring local maxima closer than the size of the di...
bsd-3-clause
loli/sklearn-ensembletrees
sklearn/lda.py
4
9599
""" The :mod:`sklearn.lda` module implements Linear Discriminant Analysis (LDA). """ from __future__ import print_function # Authors: Matthieu Perrot # Mathieu Blondel import warnings import numpy as np from scipy import linalg from .base import BaseEstimator, ClassifierMixin, TransformerMixin from .utils.e...
bsd-3-clause
michalkurka/h2o-3
h2o-py/h2o/model/dim_reduction.py
2
4901
# -*- encoding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals # noinspection PyUnresolvedReferences from h2o.utils.compatibility import * # NOQA import h2o from h2o.utils.ext_dependencies import get_matplotlib_pyplot from h2o.utils.shared_utils import can_use_pandas from...
apache-2.0
pv/scikit-learn
examples/text/document_classification_20newsgroups.py
222
10500
""" ====================================================== Classification of text documents using sparse features ====================================================== This is an example showing how scikit-learn can be used to classify documents by topics using a bag-of-words approach. This example uses a scipy.spars...
bsd-3-clause
treycausey/scikit-learn
sklearn/covariance/tests/test_covariance.py
28
10115
# 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
theakholic/ThinkStats2
code/hypothesis.py
75
10162
"""This file contains code used in "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, division import nsfg import nsfg2 import first import thinkstats2 import thinkplot ...
gpl-3.0
rs2/pandas
pandas/tests/series/test_block_internals.py
2
1418
import pandas as pd # Segregated collection of methods that require the BlockManager internal data # structure class TestSeriesBlockInternals: def test_setitem_invalidates_datetime_index_freq(self): # GH#24096 altering a datetime64tz Series inplace invalidates the # `freq` attribute on the under...
bsd-3-clause
nwillemse/misc-scripts
ib-downloader/ib-downloader1.py
1
6580
#!/usr/bin/env python2 """ ib-downloader.py """ import click import time import pandas as pd from datetime import datetime from ib.ext.Contract import Contract from ib.opt import Connection class Downloader: def __init__( self, tickers, barsize, start_date, end_date, ib_client_id, ib_port ): ...
mit
edonyM/emthesis
code/ransac.py
1
4301
#!/usr/bin/env python3 # -*- coding: utf-8 -*- r""" # .---. .----------- # / \ __ / ------ # / / \( )/ ----- (`-') _ _(`-') <-. (`-')_ # ////// '\/ ` --- ( OO).-/( (OO ).-> .-> \( OO) ) .-> # //// / // : : --- (,------...
mit
ProjectsUCSC/NLP
User Modelling/rnn.py
1
25404
from lib import * #from keras.layers.merge import Concatenate from keras.layers import Merge import copy from collections import Counter from sklearn.metrics import confusion_matrix from sklearn.metrics import f1_score import math word2topic = pickle.load(open("word2topic", "r")) embedding = pickle.load(open("word2top...
mit
ammarkhann/FinalSeniorCode
lib/python2.7/site-packages/mpl_toolkits/exceltools.py
10
3958
""" Some io tools for excel -- requires xlwt Example usage: import matplotlib.mlab as mlab import mpl_toolkits.exceltools as exceltools r = mlab.csv2rec('somefile.csv', checkrows=0) formatd = dict( weight = mlab.FormatFloat(2), change = mlab.FormatPercent(2), cost = mlab.Fo...
mit
xiwei-zhang/vigra
vigranumpy/examples/non_local_mean_2d_color.py
10
1407
import vigra from vigra import numpy from matplotlib import pylab from time import time import multiprocessing path = "69015.jpg" #path = "12074.jpg" path = "100075.jpg" path = "12003.jpg" data = vigra.impex.readImage(path).astype(numpy.float32) cpus = multiprocessing.cpu_count() print "nCpus",cpus t0 =time() #fo...
mit
tkaitchuck/nupic
external/linux64/lib/python2.6/site-packages/matplotlib/delaunay/testfuncs.py
72
20890
"""Some test functions for bivariate interpolation. Most of these have been yoinked from ACM TOMS 792. http://netlib.org/toms/792 """ import numpy as np from triangulate import Triangulation class TestData(dict): def __init__(self, *args, **kwds): dict.__init__(self, *args, **kwds) self.__dict__ ...
gpl-3.0
ctada/napCAD
testOutputs/gui_test.py
1
6294
""" OpenCV portions copied from http://kieleth.blogspot.com/2014/05/webcam-with-opencv-and-tkinter.html """ import Tkinter as tk import tkFileDialog, Tkconstants, tkMessageBox import cv2 import numpy as np from PIL import Image, ImageTk # sudo pip install Pillow, sudo apt-get install python-imaging-tk import stl_test...
mit
kashif/scikit-learn
sklearn/linear_model/logistic.py
9
67760
""" Logistic Regression """ # Author: Gael Varoquaux <gael.varoquaux@normalesup.org> # Fabian Pedregosa <f@bianp.net> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Manoj Kumar <manojkumarsivaraj334@gmail.com> # Lars Buitinck # Simon Wu <s8wu@uwaterloo.ca> im...
bsd-3-clause
hparik11/Deep-Learning-Nanodegree-Foundation-Repository
weight-initialization/helper.py
153
3649
import numpy as np import matplotlib.pyplot as plt import tensorflow as tf def hist_dist(title, distribution_tensor, hist_range=(-4, 4)): """ Display histogram of a TF distribution """ with tf.Session() as sess: values = sess.run(distribution_tensor) plt.title(title) plt.hist(values, ...
mit
YuepengGuo/zipline
zipline/examples/buyapple.py
11
2079
#!/usr/bin/env python # # 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 ...
apache-2.0
ctherien/pysptools
pysptools/skl/base.py
1
4627
# #------------------------------------------------------------------------------ # Copyright (c) 2013-2017, Christian Therien # # 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://ww...
apache-2.0
DailyActie/Surrogate-Model
01-codes/scikit-learn-master/sklearn/utils/tests/test_sparsefuncs.py
1
17389
import numpy as np import scipy.sparse as sp from numpy.testing import (assert_array_almost_equal, assert_array_equal, assert_equal) from scipy import linalg from sklearn.datasets import make_classification from sklearn.utils.sparsefuncs import (mean_variance_axis, ...
mit
massmutual/scikit-learn
sklearn/manifold/tests/test_locally_linear.py
232
4761
from itertools import product from nose.tools import assert_true import numpy as np from numpy.testing import assert_almost_equal, assert_array_almost_equal from scipy import linalg from sklearn import neighbors, manifold from sklearn.manifold.locally_linear import barycenter_kneighbors_graph from sklearn.utils.testi...
bsd-3-clause
loretoparisi/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/pylab.py
70
10245
""" This is a procedural interface to the matplotlib object-oriented plotting library. The following plotting commands are provided; the majority have Matlab(TM) analogs and similar argument. _Plotting commands acorr - plot the autocorrelation function annotate - annotate something in the figure arrow ...
agpl-3.0
jyeatman/dipy
tools/make_examples.py
6
4149
#!/usr/bin/env python """Run the py->rst conversion and run all examples. Steps are: analyze example index file for example py filenames check for any filenames in example directory not included do py to rst conversion, writing into build directory run """ #---------------------------------------------...
bsd-3-clause
davidtwomey/greengraphs_cw
greengraph/command.py
1
1207
from matplotlib import pyplot as plt from greengraph import Greengraph from argparse import ArgumentParser parser = ArgumentParser(description = "Evaluate green pixels between two locations") parser.add_argument('--from', '-f', help = 'Start location, default: London', dest='startLoc', default='London') parser.add_...
mit
jzt5132/scikit-learn
examples/ensemble/plot_ensemble_oob.py
259
3265
""" ============================= OOB Errors for Random Forests ============================= The ``RandomForestClassifier`` is trained using *bootstrap aggregation*, where each new tree is fit from a bootstrap sample of the training observations :math:`z_i = (x_i, y_i)`. The *out-of-bag* (OOB) error is the average er...
bsd-3-clause
dridk/ion-wisecondor
wisecondor/test.py
1
16686
############################################################################## # # # Test a maternal DNA sample for fetal Copy Number Aberrations. # # Copyright(C) 2013 TU Delft & VU University Medical Center Amsterdam # # ...
gpl-3.0
clemkoa/scikit-learn
examples/text/document_clustering.py
21
8531
""" ======================================= Clustering text documents using k-means ======================================= This is an example showing how the scikit-learn can be used to cluster documents by topics using a bag-of-words approach. This example uses a scipy.sparse matrix to store the features instead of ...
bsd-3-clause
NunoEdgarGub1/scikit-learn
sklearn/utils/tests/test_class_weight.py
140
11909
import numpy as np from sklearn.linear_model import LogisticRegression from sklearn.datasets import make_blobs from sklearn.utils.class_weight import compute_class_weight from sklearn.utils.class_weight import compute_sample_weight from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testin...
bsd-3-clause
sargas/scipy
scipy/signal/ltisys.py
1
29747
""" ltisys -- a collection of classes and functions for modeling linear time invariant systems. """ from __future__ import division, print_function, absolute_import # # Author: Travis Oliphant 2001 # # Feb 2010: Warren Weckesser # Rewrote lsim2 and added impulse2. # from .filter_design import tf2zpk, zpk2tf, normal...
bsd-3-clause
astroML/sklearn_tutorial
doc/skeletons/exercise_01.py
4
7513
""" Astronomy Tutorial: exercise 1 Classification of photometric sources usage: python exercise_01.py datadir - datadir is $TUTORIAL_DIR/data/sdss_colors This directory should contain the files: - sdssdr6_colors_class_train.npy - sdssdr6_colors_class.200000.npy Description: In the tutorial, we u...
bsd-3-clause
lukovkin/ufcnn-keras
models/a3c/Trading.py
1
9754
import json import numpy as np np.set_printoptions(threshold=np.inf) import random from constants import TRADING_FEE from constants import SHOW_TRADES import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt class Trade: ''' Encapsulate a trade Statistics can be calculated from a list of ...
mit
to266/hyperspy
hyperspy/drawing/_markers/horizontal_line_segment.py
1
3267
# -*- coding: utf-8 -*- # Copyright 2007-2016 The HyperSpy developers # # This file is part of HyperSpy. # # HyperSpy 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...
gpl-3.0
mvernacc/proptools
docs/source/examples/plots/exp_ratio_cf.py
1
1237
"""Effect of expansion ratio on thrust coefficient.""" import numpy as np from matplotlib import pyplot as plt from proptools import nozzle p_c = 10e6 # Chamber pressure [units: pascal] p_a = 100e3 # Ambient pressure [units: pascal] gamma = 1.2 # Exhaust heat capacity ratio [units: dimensionless] p_e = np.lin...
mit
AlexanderFabisch/scikit-learn
sklearn/linear_model/coordinate_descent.py
8
76416
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Olivier Grisel <olivier.grisel@ensta.org> # Gael Varoquaux <gael.varoquaux@inria.fr> # # License: BSD 3 clause import sys import warnings from abc import ABCMeta, abstractmethod import n...
bsd-3-clause
ElDeveloper/scikit-learn
examples/ensemble/plot_forest_importances_faces.py
403
1519
""" ================================================= Pixel importances with a parallel forest of trees ================================================= This example shows the use of forests of trees to evaluate the importance of the pixels in an image classification task (faces). The hotter the pixel, the more impor...
bsd-3-clause
hochthom/kaggle-taxi-ii
src/blend_submissions.py
2
1148
import numpy as np import pandas as pd import cPickle as pickle print('reading general model predictions ...') df = pd.read_csv('../data/test_pp_RND.csv') submissions = ['my_submission_N1.csv','my_submission_N2.csv', 'my_submission_N3.csv','my_submission_RND.csv'] idx = np.argsort(df['...
mit
jigargandhi/UdemyMachineLearning
Machine Learning A-Z Template Folder/Part 3 - Classification/Section 19 - Decision Tree Classification/j_decision_tree_classification.py
1
2750
# Classification template # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('Social_Network_Ads.csv') X = dataset.iloc[:, [2, 3]].values y = dataset.iloc[:, 4].values # Splitting the dataset into the Training set and Test se...
mit
3DGenomes/tadbit
test/test.py
2
1393
""" 25 Oct 2012 manual test """ from pytadbit import tadbit, batch_tadbit from sys import argv from matplotlib import pyplot as plt from numpy import log2, matrix def get_matrix(f_name): nums = [] for line in open(f_name): values = line.split() try: nums.append([float(v) for v in...
gpl-3.0
OwaJawa/kaggle-galaxies
predict_augmented_npy_maxout2048_extradense_pysexgen1_dup.py
7
9736
""" Load an analysis file and redo the predictions on the validation set / test set, this time with augmented data and averaging. Store them as numpy files. """ import numpy as np # import pandas as pd import theano import theano.tensor as T import layers import cc_layers import custom import load_data import realtime...
bsd-3-clause
fermiPy/fermipy
fermipy/jobs/target_collect.py
1
12235
#!/usr/bin/env python # Licensed under a 3-clause BSD style license - see LICENSE.rst """ Collect information for simulated realizations of an analysis """ from __future__ import absolute_import, division, print_function import os import sys import yaml import numpy as np from astropy.table import Table, Column, vs...
bsd-3-clause
victor-prado/broker-manager
environment/lib/python3.5/site-packages/pandas/stats/ols.py
7
40448
""" Ordinary least squares regression """ # pylint: disable-msg=W0201 # flake8: noqa from pandas.compat import zip, range, StringIO from itertools import starmap from pandas import compat import numpy as np from pandas.core.api import DataFrame, Series, isnull from pandas.core.base import StringMixin from pandas.ty...
mit
yask123/scikit-learn
sklearn/preprocessing/tests/test_function_transformer.py
176
2169
from nose.tools import assert_equal import numpy as np from sklearn.preprocessing import FunctionTransformer def _make_func(args_store, kwargs_store, func=lambda X, *a, **k: X): def _func(X, *args, **kwargs): args_store.append(X) args_store.extend(args) kwargs_store.update(kwargs) ...
bsd-3-clause
detrout/debian-statsmodels
statsmodels/sandbox/examples/example_gam.py
33
2343
'''original example for checking how far GAM works Note: uncomment plt.show() to display graphs ''' example = 2 # 1,2 or 3 import numpy as np import numpy.random as R import matplotlib.pyplot as plt from statsmodels.sandbox.gam import AdditiveModel from statsmodels.sandbox.gam import Model as GAM #? from statsmode...
bsd-3-clause
markelg/xray
xray/core/coordinates.py
5
7037
from collections import Mapping from contextlib import contextmanager import pandas as pd from .pycompat import iteritems, basestring, OrderedDict from . import formatting from . import utils def _coord_merge_finalize(target, other, target_conflicts, other_conflicts, promote_dims={}): f...
apache-2.0
Pranav-Rastogi/barbell-lift
barbell_lift.py
1
1832
import pandas as pd from sklearn import tree from sklearn import preprocessing from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import cross_val_score, train_test_split ''' Convert the csv file to a pandas DataFrame. The read_csv function might give a DtypeWarning due to the l...
mit
q1ang/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
LohithBlaze/scikit-learn
sklearn/ensemble/tests/test_gradient_boosting_loss_functions.py
221
5517
""" Testing for the gradient boosting loss functions and initial estimators. """ import numpy as np from numpy.testing import assert_array_equal from numpy.testing import assert_almost_equal from numpy.testing import assert_equal from nose.tools import assert_raises from sklearn.utils import check_random_state from ...
bsd-3-clause
shahankhatch/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
IndraVikas/scikit-learn
examples/plot_digits_pipe.py
250
1809
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Pipelining: chaining a PCA and a logistic regression ========================================================= The PCA does an unsupervised dimensionality reduction, while the logistic regression does the predictio...
bsd-3-clause
dimm0/tacc_stats
tacc_stats/site/machine/views.py
1
15509
from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render_to_response, render from django.views.generic import DetailView, ListView from django.db.models import Q from django.core.cache import cache import os,sys,pwd import cPickle as pickle import operator from tacc_stats.analy...
lgpl-2.1
rahuldhote/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
anirudhjayaraman/scikit-learn
sklearn/tests/test_naive_bayes.py
70
17509
import pickle from io import BytesIO import numpy as np import scipy.sparse from sklearn.datasets import load_digits, load_iris from sklearn.cross_validation import cross_val_score, train_test_split from sklearn.externals.six.moves import zip from sklearn.utils.testing import assert_almost_equal from sklearn.utils.te...
bsd-3-clause
bmcage/stickproject
stick/yarn2d/distribution_method.py
1
11829
# # Copyright (C) 2010 B. Malengier # Copyright (C) 2010 P.Li # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Th...
gpl-2.0
daodaoliang/neural-network-animation
matplotlib/backends/backend_wx.py
10
65412
""" A wxPython backend for matplotlib, based (very heavily) on backend_template.py and backend_gtk.py Author: Jeremy O'Donoghue (jeremy@o-donoghue.com) Derived from original copyright work by John Hunter (jdhunter@ace.bsd.uchicago.edu) Copyright (C) Jeremy O'Donoghue & John Hunter, 2003-4 License: This work ...
mit
ProkopHapala/SimpleSimulationEngine
cpp/sketches_SDL/Molecular/python/eFF_KineticAndOverlap.py
1
4811
#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt import scipy.special as spc ''' To evaluate Change of Kinetic energy due to orthogonalization (Deltat E_kin ) which is Valence-Bond model for Pauli repulsion see: [1] eq.4 in http://aip.scitation.org/doi/10.1063/1.3272671 Jaramillo-Bo...
mit
OshynSong/scikit-learn
sklearn/externals/joblib/parallel.py
79
35628
""" 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