repo_name stringlengths 7 79 | path stringlengths 4 179 | copies stringlengths 1 3 | size stringlengths 4 6 | content stringlengths 959 798k | license stringclasses 15
values |
|---|---|---|---|---|---|
xubenben/scikit-learn | sklearn/cluster/tests/test_mean_shift.py | 150 | 3651 | """
Testing for mean shift clustering methods
"""
import numpy as np
import warnings
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import asser... | bsd-3-clause |
nguyentu1602/statsmodels | examples/run_all.py | 34 | 1740 | """run all examples to make sure we don't get an exception
Note:
If an example contaings plt.show(), then all plot windows have to be closed
manually, at least in my setup.
uncomment plt.show() to show all plot windows
"""
from __future__ import print_function
from statsmodels.compat import input
stop_on_error = Tru... | bsd-3-clause |
reichelu/copasul | src/copasul_plot.py | 1 | 30100 |
# author: Uwe Reichel, Budapest, 2016
import mylib as myl
import matplotlib as mpl
import matplotlib.pyplot as plt
import re
import sys
import numpy as np
import math
import copy as cp
# browsing through copa
# calling plot_main for selected feature sets
# do clst first (single plot)
def plot_browse(copa):
... | mit |
pratapvardhan/scikit-learn | sklearn/preprocessing/data.py | 5 | 68513 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Eric Martin <eric@ericmart.in>
# Giorgio Patrini <giorgio.patrini@anu.edu.au>
# Lic... | bsd-3-clause |
roxyboy/scikit-learn | sklearn/linear_model/coordinate_descent.py | 12 | 75078 | # 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 |
vinodkc/spark | python/pyspark/pandas/strings.py | 14 | 71898 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | apache-2.0 |
DotStar-Game-of-Stocks/Website-Backend | generateHistogramData.py | 1 | 2530 | # -*- coding: utf-8 -*-
# generateHistogramData.py
"""
Version: 03.18.2015
A function that returns data to plot a smooth histogram of the stock price for
the previous year. Provided with sample plotting code.
@author: Luke_Wortsmann
"""
import datetime as dt
import numpy as np
from yahoo_finance import Share
from s... | mit |
fdft/ml | ch02/heldout.py | 24 | 1377 | # 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
# This script demonstrates the difference between the training accuracy and
# testing (held-out) accura... | mit |
JeanKossaifi/scikit-learn | sklearn/utils/testing.py | 71 | 26178 | """Testing utilities."""
# Copyright (c) 2011, 2012
# Authors: Pietro Berkes,
# Andreas Muller
# Mathieu Blondel
# Olivier Grisel
# Arnaud Joly
# Denis Engemann
# License: BSD 3 clause
import os
import inspect
import pkgutil
import warnings
import sys
import re
import platf... | bsd-3-clause |
mattilyra/scikit-learn | sklearn/exceptions.py | 35 | 4329 | """
The :mod:`sklearn.exceptions` module includes all custom warnings and error
classes used across scikit-learn.
"""
__all__ = ['NotFittedError',
'ChangedBehaviorWarning',
'ConvergenceWarning',
'DataConversionWarning',
'DataDimensionalityWarning',
'EfficiencyWarn... | bsd-3-clause |
ahaldane/numpy | numpy/doc/structured_arrays.py | 5 | 26509 | """
=================
Structured Arrays
=================
Introduction
============
Structured arrays are ndarrays whose datatype is a composition of simpler
datatypes organized as a sequence of named :term:`fields <field>`. For example,
::
>>> x = np.array([('Rex', 9, 81.0), ('Fido', 3, 27.0)],
... d... | bsd-3-clause |
dsullivan7/scikit-learn | examples/cluster/plot_feature_agglomeration_vs_univariate_selection.py | 218 | 3893 | """
==============================================
Feature agglomeration vs. univariate selection
==============================================
This example compares 2 dimensionality reduction strategies:
- univariate feature selection with Anova
- feature agglomeration with Ward hierarchical clustering
Both metho... | bsd-3-clause |
rexshihaoren/scikit-learn | sklearn/utils/tests/test_fixes.py | 281 | 1829 | # Authors: Gael Varoquaux <gael.varoquaux@normalesup.org>
# Justin Vincent
# Lars Buitinck
# License: BSD 3 clause
import numpy as np
from nose.tools import assert_equal
from nose.tools import assert_false
from nose.tools import assert_true
from numpy.testing import (assert_almost_equal,
... | bsd-3-clause |
SPP1665DataAnalysisCourse/elephant | elephant/sta.py | 1 | 19728 | # -*- coding: utf-8 -*-
'''
Module: jelephant.analysis.sta
Contains functions to calculate spike-triggered averages of AnalogSignals.
'''
import numpy as np
import scipy.signal
import quantities as pq
from neo.core import AnalogSignal, AnalogSignalArray
if __name__ == '__main__':
pass
#=====================... | bsd-3-clause |
easonlv/BDA_py_demos | demos_ch4/demo4_1.py | 19 | 5306 | """Bayesian Data Analysis, 3rd ed
Chapter 4, demo 1
Normal approximaton for Bioassay model.
"""
from __future__ import division
import numpy as np
from scipy import optimize, stats
import matplotlib.pyplot as plt
# Edit default plot settings (colours from colorbrewer2.org)
plt.rc('font', size=14)
plt.rc('lines', c... | gpl-3.0 |
yongfuyang/vnpy | vn.trader/ctaAlgo/StrategyRangeBreak.py | 2 | 11558 | # encoding: UTF-8
"""
一个ATR-RSI指标结合的交易策略,适合用在股指的1分钟和5分钟线上。
注意事项:
1. 作者不对交易盈利做任何保证,策略代码仅供参考
2. 本策略需要用到talib,没有安装的用户请先参考www.vnpy.org上的教程安装
3. 将IF0000_1min.csv用ctaHistoryData.py导入MongoDB后,直接运行本文件即可回测策略
"""
from ctaBase import *
from ctaTemplate import CtaTemplate
import talib
import numpy as np
#####################... | mit |
jonathansick/m31hst | m31hst/phatast.py | 1 | 7898 | #!/usr/bin/env python
# encoding: utf-8
"""
PHAT v2 artificial star tests.
2015-03-31 - Created by Jonathan Sick
"""
import numpy as np
from sklearn.cluster import KMeans
from astropy.table import Table
from astroML.stats import binned_statistic_2d
from m31hst.paths import phat_v2_ast_path
def load_phat_ast_table()... | bsd-3-clause |
nhuntwalker/astroML | book_figures/chapter4/fig_bootstrap_gaussian.py | 4 | 2843 | r"""
Bootstrap Calculations of Error on Mean
---------------------------------------
Figure 4.3.
The bootstrap uncertainty estimates for the sample standard deviation
:math:`\sigma` (dashed line; see eq. 3.32) and :math:`\sigma_G` (solid line;
see eq. 3.36). The sample consists of N = 1000 values drawn from a Gaussian... | bsd-2-clause |
aetilley/scikit-learn | examples/classification/plot_digits_classification.py | 289 | 2397 | """
================================
Recognizing hand-written digits
================================
An example showing how the scikit-learn can be used to recognize images of
hand-written digits.
This example is commented in the
:ref:`tutorial section of the user manual <introduction>`.
"""
print(__doc__)
# Autho... | bsd-3-clause |
bgris/ODL_bgris | lib/python3.5/site-packages/odl/space/pspace.py | 1 | 46185 | # Copyright 2014-2016 The ODL development group
#
# This file is part of ODL.
#
# ODL 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.
... | gpl-3.0 |
nce/sedater | docs/conf.py | 1 | 11534 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# sedater documentation build configuration file, created by
# sphinx-quickstart on Fri Nov 6 18:16:57 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# au... | mit |
zblz/naima | src/naima/tests/test_saveread.py | 1 | 3719 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import astropy.units as u
import numpy as np
from astropy.io import ascii
from astropy.tests.helper import pytest
from astropy.utils.data import get_pkg_data_filename
from ..analysis import read_run, save_run
from ..core import run_sampler, uni... | bsd-3-clause |
Erotemic/ibeis | dev/_scripts/fix_common_issues.py | 2 | 1048 | # -*- coding: utf-8 -*-
import sys
# FIXME: setup for more than just win32
WIN32 = sys.platform.startswith('win32')
def get_install_cmd(modname):
if WIN32:
install_cmd = ('_scripts\win32bootstrap.py --run --dl ' + modname)
else:
install_cmd = 'sudo pip install ' + modname
return install_c... | apache-2.0 |
tiw51/DeepPurple | Stock_Programs/findStockTrends.py | 1 | 3781 | #this will preform sum basic statistical analysis of data as specified as user input
#this should give a starting date
import datetime as dt
import numpy
#this allows us to make plots
import matplotlib.pyplot as plt
from matplotlib.finance import candlestick_ohlc
import matplotlib.dates as mdates
#makes the... | apache-2.0 |
dnolivieri/RFVextract | rfVextract/VsRFtrain03.py | 1 | 14112 | #!/usr/bin/env python
"""
dnolivieri: (started: 23 september 2014)
- doing multiple binary trainings.
"""
import pylab as pl
import numpy as np
import sys
import matplotlib.pyplot as plt
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.cross_val... | bsd-3-clause |
vossman/ctfeval | appionlib/apCtf/ctfdisplay.py | 1 | 43159 | #!/usr/bin/env python
import os
import sys
import math
import numpy
import time
import random
from pyami import imagefun
from pyami import ellipse
from pyami import mrc
from appionlib import apDisplay
#from appionlib import lowess
from appionlib.apImage import imagefile
from appionlib.apImage import imagefilter
from a... | apache-2.0 |
detrout/debian-statsmodels | statsmodels/examples/tut_ols_rlm_short.py | 34 | 1649 | '''Examples: comparing OLS and RLM
robust estimators and outliers
RLM is less influenced by outliers than OLS and has estimated slope
closer to true slope and not tilted like OLS.
Note: uncomment plt.show() to display graphs
'''
from __future__ import print_function
import numpy as np
#from scipy import stats
impor... | bsd-3-clause |
manashmndl/scikit-learn | benchmarks/bench_random_projections.py | 397 | 8900 | """
===========================
Random projection benchmark
===========================
Benchmarks for random projections.
"""
from __future__ import division
from __future__ import print_function
import gc
import sys
import optparse
from datetime import datetime
import collections
import numpy as np
import scipy.s... | bsd-3-clause |
lcharleux/numerical_analysis | doc/Traitement_images/Example_code/europe_comptage.py | 1 | 1998 | #----------------------------------------------------
# Comptage des iles et continents
#----------------------------------------------------
# PACKAGES
from PIL import Image # On charge Python Image Library
import numpy as np # On charge Numpy
from matplotlib import pyplot as plt # On charge pyplot (un sous modu... | gpl-2.0 |
TomAugspurger/pandas | pandas/tests/indexes/datetimes/test_date_range.py | 2 | 36774 | """
test date_range, bdate_range construction from the convenience range functions
"""
from datetime import datetime, time, timedelta
import numpy as np
import pytest
import pytz
from pytz import timezone
from pandas._libs.tslibs import timezones
from pandas._libs.tslibs.offsets import BDay, CDay, DateOffset, MonthE... | bsd-3-clause |
TinyOS-Camp/DDEA-DEV | Archive/[14_09_12] DDEA_example_code/df_data_analysis_ver6.py | 3 | 101804 | # coding: utf-8
"""
======================================================================
Learning and Visualizing the BMS sensor-time-weather data structure
======================================================================
This example employs several unsupervised learning techniques to extract
the energy data... | gpl-2.0 |
muxiaobai/CourseExercises | python/kaggle/competition/Digit-Recognizer/use-sklearn_knn_svm_NB.py | 1 | 4137 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 16 21:59:00 2014
@author: wepon
@blog:http://blog.csdn.net/u012162613
"""
from numpy import *
import csv
def toInt(array):
array=mat(array)
m,n=shape(array)
newArray=zeros((m,n))
for i in xrange(m):
for j in xrange(n):
... | gpl-2.0 |
henrykironde/scikit-learn | examples/cluster/plot_kmeans_silhouette_analysis.py | 242 | 5885 | """
===============================================================================
Selecting the number of clusters with silhouette analysis on KMeans clustering
===============================================================================
Silhouette analysis can be used to study the separation distance between the... | bsd-3-clause |
mtb-za/fatiando | fatiando/gravmag/__init__.py | 1 | 2110 | """
Gravity and magnetics forward modeling, inversion, transformations and
utilities.
Forward modeling
----------------
The forward modeling modules provide ways to calculate the gravitational and
magnetic field of various types of geometric objects:
* :mod:`~fatiando.gravmag.prism`: 3D right rectangular prisms
* :m... | bsd-3-clause |
BorisJeremic/Real-ESSI-Examples | dynamic_test/Newmark/gamma0.5/post.py | 9 | 2369 | #!/usr/bin/python
#Standard python libs
import sys
import os
# import datetime
import numpy as np
import h5py
import matplotlib.pyplot as plt
from math import *
#Libs related to scipy and matplotlib
from scipy import *
from scipy.fftpack import fft
from scipy.fftpack.helper import fftfreq
sys.path.append("./" )
# tim... | cc0-1.0 |
thientu/scikit-learn | sklearn/utils/tests/test_sparsefuncs.py | 157 | 13799 | import numpy as np
import scipy.sparse as sp
from scipy import linalg
from numpy.testing import assert_array_almost_equal, assert_array_equal
from sklearn.datasets import make_classification
from sklearn.utils.sparsefuncs import (mean_variance_axis,
inplace_column_scale,
... | bsd-3-clause |
larsmans/scikit-learn | sklearn/metrics/cluster/tests/test_unsupervised.py | 26 | 2870 | import numpy as np
from scipy.sparse import csr_matrix
from .... import datasets
from ..unsupervised import silhouette_score
from ... import pairwise_distances
from sklearn.utils.testing import assert_false, assert_almost_equal
from sklearn.utils.testing import assert_raises_regexp
def test_silhouette():
"""Test... | bsd-3-clause |
rgommers/statsmodels | statsmodels/regression/mixed_linear_model.py | 1 | 63016 | """
Linear mixed effects models for Statsmodels
The data are partitioned into disjoint groups. The probability model
for group i is:
Y = X*beta + Z*gamma + epsilon
where
* n_i is the number of observations in group i
* Y is a n_i dimensional response vector
* X is a n_i x k_fe dimensional matrix of fixed effects
... | bsd-3-clause |
Moriadry/tensorflow | tensorflow/python/estimator/inputs/inputs.py | 94 | 1290 | # Copyright 2017 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 |
RachitKansal/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 |
94KeyboardsSmashed/SLI2017_Hurgus_Madison | Python_Data_Analysis/Accelerometer_Data_Synthesis_Graph.py | 1 | 6559 | <<<<<<< HEAD
# -*- coding: utf-8 -*-
"""
Created on Tue May 9 12:13:27 2017
@author: Hyun-seok
"""
import numpy as np
import math
import matplotlib.pyplot as plt
def mag(x):
#Calculates Magnitude (sqrt(x^2+y^2+z^2))
#Takes list of tuples (x, y, z)
return math.sqrt(sum(float(i)**2 for i in x)... | mit |
khkaminska/scikit-learn | examples/cluster/plot_ward_structured_vs_unstructured.py | 320 | 3369 | """
===========================================================
Hierarchical clustering: structured vs unstructured ward
===========================================================
Example builds a swiss roll dataset and runs
hierarchical clustering on their position.
For more information, see :ref:`hierarchical_clus... | bsd-3-clause |
pthaike/SFrame | oss_src/unity/python/sframe/data_structures/sgraph.py | 9 | 58636 | """
.. warning:: This product is currently in a beta release. The API reference is
subject to change.
This package defines the GraphLab Create SGraph, Vertex, and Edge objects. The SGraph
is a directed graph, consisting of a set of Vertex objects and Edges that
connect pairs of Vertices. The methods in this module are... | bsd-3-clause |
kpespinosa/BuildingMachineLearningSystemsWithPython | ch06/04_sent.py | 22 | 10125 | # 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
#
# This script trains tries to tweak hyperparameters to improve P/R AUC
#
import time
start_time = ti... | mit |
initNirvana/Easyphotos | env/lib/python3.4/site-packages/IPython/parallel/tests/test_view.py | 5 | 28733 | # -*- coding: utf-8 -*-
"""test View objects"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import base64
import sys
import platform
import time
from collections import namedtuple
from tempfile import NamedTemporaryFile
import zmq
from nose.plugins.attrib impo... | mit |
maciekcc/tensorflow | tensorflow/examples/learn/text_classification.py | 12 | 6651 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | apache-2.0 |
ishanic/scikit-learn | benchmarks/bench_mnist.py | 154 | 6006 | """
=======================
MNIST dataset benchmark
=======================
Benchmark on the MNIST dataset. The dataset comprises 70,000 samples
and 784 features. Here, we consider the task of predicting
10 classes - digits from 0 to 9 from their raw images. By contrast to the
covertype dataset, the feature space is... | bsd-3-clause |
jlegendary/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 |
SlipknotTN/udacity-deeplearning-nanodegree | image-classification/helper.py | 155 | 5631 | import pickle
import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import LabelBinarizer
def _load_label_names():
"""
Load the label names from file
"""
return ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck']
def load_cfar10_batch(ci... | mit |
chrisburr/scikit-learn | sklearn/base.py | 22 | 18131 | """Base classes for all estimators."""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD 3 clause
import copy
import warnings
import numpy as np
from scipy import sparse
from .externals import six
from .utils.fixes import signature
from .utils.deprecation import deprecated
from .exceptions impor... | bsd-3-clause |
astocko/statsmodels | statsmodels/tsa/statespace/tests/test_representation.py | 6 | 19651 | """
Tests for representation module
Author: Chad Fulton
License: Simplified-BSD
References
----------
Kim, Chang-Jin, and Charles R. Nelson. 1999.
"State-Space Models with Regime Switching:
Classical and Gibbs-Sampling Approaches with Applications".
MIT Press Books. The MIT Press.
"""
from __future__ import division... | bsd-3-clause |
PrashntS/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 |
Haunter17/MIR_SU17 | exp4/exp4_rnn.py | 1 | 6465 | '''
A Recurrent Neural Network (LSTM) implementation example using TensorFlow library.
This example is using the MNIST database of handwritten digits (http://yann.lecun.com/exdb/mnist/)
Long Short Term Memory paper: http://deeplearning.cs.cmu.edu/pdfs/Hochreiter97_lstm.pdf
Author: Aymeric Damien
Project: https://github... | mit |
google/makani | analysis/force_balance_loop/power_calcs/kite_loop.py | 1 | 70138 | # Copyright 2020 Makani Technologies LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | apache-2.0 |
AIML/scikit-learn | sklearn/datasets/svmlight_format.py | 114 | 15826 | """This module implements a loader and dumper for the svmlight format
This format is a text-based format, with one sample per line. It does
not store zero valued features hence is suitable for sparse dataset.
The first element of each line can be used to store a target variable to
predict.
This format is used as the... | bsd-3-clause |
florian-f/sklearn | sklearn/cluster/tests/test_spectral.py | 2 | 7966 | """Testing for Spectral Clustering methods"""
from sklearn.externals.six.moves import cPickle
dumps, loads = cPickle.dumps, cPickle.loads
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 a... | bsd-3-clause |
c-benko/HHG_phasematching_fsEC | test/testrun.py | 1 | 1170 | # testrun.py
import sys, os
here = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.normpath(os.path.join(here, '../src')))
from phasematching import *
import matplotlib.pyplot as plt
from pylab import *
sim = phase_matching('Ar', 100, 88 , 45e-15, 40e-6, 1070e-9, 1, 20e-3, 300, 0, .015, 0, 'o... | mit |
nrego/westpa | lib/examples/stringmethodexamples/examples/plotmueller.py | 1 | 1470 | import numpy as np
import matplotlib as mpl
from matplotlib import pyplot as plt
import h5py
from IPython import embed
from fasthist import normhistnd
def mueller(x, y):
aa = [-1, -1, -6.5, 0.7]
bb = [0, 0, 11, 0.6]
cc = [-10, -10, -6.5, 0.7]
AA = [-200, -100, -170, 15]
XX = [1, 0, -0.5, -1]
... | gpl-3.0 |
datachand/h2o-3 | h2o-py/tests/testdir_golden/pyunit_svd_1_golden.py | 5 | 2184 | import sys
sys.path.insert(1, "../../")
import h2o, tests
def svd_1_golden():
print "Importing USArrests.csv data..."
arrestsH2O = h2o.upload_file(h2o.locate("smalldata/pca_test/USArrests.csv"))
print "Compare with SVD"
fitH2O = h2o.svd(x=arrestsH2O[0:4], nv=4, transform="NONE", max_iterations=... | apache-2.0 |
yunfeilu/scikit-learn | sklearn/metrics/cluster/tests/test_bicluster.py | 394 | 1770 | """Testing for bicluster metrics module"""
import numpy as np
from sklearn.utils.testing import assert_equal, assert_almost_equal
from sklearn.metrics.cluster.bicluster import _jaccard
from sklearn.metrics import consensus_score
def test_jaccard():
a1 = np.array([True, True, False, False])
a2 = np.array([T... | bsd-3-clause |
xiangdal/TrajectoryNet | load_data.py | 1 | 1386 | import cPickle, gzip, numpy
import theano
import theano.tensor as T
from theano.tensor.shared_randomstreams import RandomStreams
from logistic_sgd import LogisticRegression
# For ploting
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
from itertools import compress
from numpy impor... | apache-2.0 |
surligas/gnuradio | gr-filter/examples/synth_filter.py | 58 | 2552 | #!/usr/bin/env python
#
# Copyright 2010,2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your ... | gpl-3.0 |
nvoron23/statsmodels | statsmodels/tsa/vector_ar/tests/test_var.py | 23 | 18346 | """
Test VAR Model
"""
from __future__ import print_function
# pylint: disable=W0612,W0231
from statsmodels.compat.python import (iteritems, StringIO, lrange, BytesIO,
range)
from nose.tools import assert_raises
import nose
import os
import sys
import numpy as np
import statsmod... | bsd-3-clause |
rosenbrockc/acorn | tests/test_0sklearn.py | 1 | 5013 | """Tests the decoration and logging of the sklearn package by running some
common code lines and checking that the logged entries make sense. Also, checks
the analysis functions for the fit and predict methods to make sure they are
working.
"""
import pytest
import six
@pytest.fixture(scope="module", autouse=True)
def... | mit |
neuropoly/spinalcordtoolbox | testing/test_sct_dmri_moco.py | 1 | 3176 | #!/usr/bin/env python
#########################################################################################
#
# Test function for sct_dmri_moco
#
# ---------------------------------------------------------------------------------------
# Copyright (c) 2017 Polytechnique Montreal <www.neuro.polymtl.ca>
# Author: Jul... | mit |
MathieuLeocmach/colloids | python/colloids/ddm.py | 1 | 3933 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2015 Mathieu Leocmach
#
# This file is part of Colloids.
#
# Colloids 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 ... | gpl-3.0 |
wangkua1/sportvu | sportvu/train-seq2seq.py | 1 | 10913 | """train-seq2seq.py
Usage:
train-seq2seq.py <fold_index> <f_data_config> <f_model_config>
train-seq2seq.py --test <fold_index> <f_data_config> <f_model_config>
Arguments:
<f_data_config> example ''data/config/train_rev0.yaml''
<f_model_config> example 'model/config/conv2d-3layers.yaml'
Example:
... | mit |
DCSaunders/tensorflow | tensorflow/examples/learn/iris_custom_model.py | 13 | 2641 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | apache-2.0 |
ctogle/dilapidator | test/geometry/tform_tests.py | 1 | 1264 | from dilap.geometry.vec3 import vec3
from dilap.geometry.quat import quat
from dilap.geometry.tform import tform
import dilap.geometry.tools as dpr
import matplotlib.pyplot as plt
import unittest,numpy,math
import pdb
#python3 -m unittest discover -v ./ "*tests.py"
class test_tform(unittest.TestCase):
def s... | mit |
redhat-openstack/rdo-infra | ci-scripts/infra-setup/roles/rrcockpit/files/telegraf/openstack_infra_status.py | 2 | 1592 | #!/usr/bin/env python
import re
from datetime import datetime
import influxdb_utils
import pandas as pd
import requests
from bs4 import BeautifulSoup
infra_status_regexp = re.compile(
'^ *([0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}) *UTC *(.+)$')
infra_status_url = 'https://wiki.openstack.org/wiki/Inf... | apache-2.0 |
ElvisLouis/code | work/ML/tensorflow/separa/lda_rf.py | 1 | 1969 | from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.ensemble import RandomForestClassifier
import tool as tool
import numpy as np
SIZE = 828
IMAGE_SIZE = 224
NUM_CHANNEL = 1
LABEL = 6
BASE_DIVIDE = 128
ACCELERATION_FACTOR = 256
FEATURE = 42
FILENAME = "/home/elvis/work/ML/tensorflow/separ... | gpl-2.0 |
toastedcornflakes/scikit-learn | examples/neural_networks/plot_mlp_alpha.py | 58 | 4088 | """
================================================
Varying regularization in Multi-layer Perceptron
================================================
A comparison of different values for regularization parameter 'alpha' on
synthetic datasets. The plot shows that different alphas yield different
decision functions.
A... | bsd-3-clause |
phockett/ePSproc | epsproc/sphCalc.py | 1 | 27587 | # -*- coding: utf-8 -*-
"""
ePSproc spherical function calculations.
Collection of functions for calculating Spherical Tensors: Ylm, wignerD etc.
For spherical harmonics, currently using scipy.special.sph_harm
For other functions, using Moble's spherical_functions package
https://github.com/moble/spherical_functions... | gpl-3.0 |
wathen/PhD | MHD/FEniCS/MHD/CG/PicardIter_Direct/DecoupleTest/MHDnewcastle.py | 1 | 11326 | #!/usr/bin/python
# interpolate scalar gradient onto nedelec space
from dolfin import *
import petsc4py
import sys
petsc4py.init(sys.argv)
from petsc4py import PETSc
Print = PETSc.Sys.Print
# from MatrixOperations import *
import numpy as np
import matplotlib.pylab as plt
import PETScIO as IO
import common
import s... | mit |
manazhao/tf_recsys | tensorflow/contrib/learn/python/learn/learn_io/__init__.py | 79 | 2464 | # 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 |
brodoll/sms-tools | lectures/03-Fourier-properties/plots-code/symmetry-real-even.py | 26 | 1150 | import matplotlib.pyplot as plt
import numpy as np
import sys
import math
from scipy.signal import triang
from scipy.fftpack import fft, fftshift
M = 127
N = 128
hM1 = int(math.floor((M+1)/2))
hM2 = int(math.floor(M/2))
x = triang(M)
fftbuffer = np.zeros(N)
fftbuffer[:hM1] = x[hM2:]
fftbuffer[N-hM2:] = x[:hM2]
X =... | agpl-3.0 |
nomed/cashup | cashup/controllers/root.py | 1 | 116017 | # -*- coding: utf-8 -*-
"""Main Controller"""
import uuid
from datetime import datetime
from tg import TGController
from tg import tmpl_context
from tg import request, response
from tg import expose, flash, require, url, lurl, request, redirect, validate, predicates, override_template
from tg.i18n import ugettext as _,... | mit |
samfu1994/cs838webpage | stage5/src/boxplot_demo.py | 1 | 4501 | """
Thanks Josh Hemann for the example
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon
# Generate some data from five different probability distributions,
# each with different characteristics. We want to play with how an IID
# bootstrap resample of the data preserves th... | mit |
xyguo/scikit-learn | sklearn/linear_model/tests/test_bayes.py | 299 | 1770 | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
#
# License: BSD 3 clause
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, ARDRegres... | bsd-3-clause |
nesterione/scikit-learn | examples/cluster/plot_birch_vs_minibatchkmeans.py | 333 | 3694 | """
=================================
Compare BIRCH and MiniBatchKMeans
=================================
This example compares the timing of Birch (with and without the global
clustering step) and MiniBatchKMeans on a synthetic dataset having
100,000 samples and 2 features generated using make_blobs.
If ``n_clusters... | bsd-3-clause |
largelymfs/w2vtools | build/scipy/scipy/interpolate/fitpack2.py | 5 | 55068 | """
fitpack --- curve and surface fitting with splines
fitpack is based on a collection of Fortran routines DIERCKX
by P. Dierckx (see http://www.netlib.org/dierckx/) transformed
to double routines by Pearu Peterson.
"""
# Created by Pearu Peterson, June,August 2003
from __future__ import division, print_function, abs... | mit |
operalib/operalib | operalib/metrics.py | 2 | 1391 | """
:mod:`operalib.metrics` define upplementary metrics not
available in scikit-learn
"""
# Author: Romain Brault <romain.brault@telecom-paristech.fr> with help from
# the scikit-learn community.
# License: MIT
from numpy import log, pi, sqrt, exp, cos
from sklearn.metrics.pairwise import check_pairwise_array... | bsd-3-clause |
lzamparo/SdA_reduce | plot_scripts/validation_set_NOP10_ggplot_densities.py | 1 | 4334 | # coding: utf-8
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pylab as pylab
import matplotlib.pyplot as plt
from scipy.stats import gaussian_kde
from common_density_plot_utils import *
#################### The script part to generate the plots, and find the limits ####################
i... | bsd-3-clause |
studywolf/blog | train_AHF/plot_error.py | 1 | 4956 | '''
Copyright (C) 2016 Travis DeWolf
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 3 of the License, or
(at your option) any later version.
This program is distributed in the hope t... | gpl-3.0 |
alshedivat/tensorflow | tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined_test.py | 30 | 70017 | # 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 |
mehdidc/scikit-learn | sklearn/tests/test_calibration.py | 2 | 11711 | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# License: BSD 3 clause
import numpy as np
from scipy import sparse
from sklearn.utils.testing import (assert_array_almost_equal, assert_equal,
assert_greater, assert_almost_equal,
... | bsd-3-clause |
enram/infrastructure | file_transfer/ad_hoc_management/bash_file_info.py | 2 | 1281 | #
# S. Van Hoey
#
# ENRAM meeting 2017-01
#
import sys
import argparse
import h5py
import pandas as pd
def main(argv=None):
parser = argparse.ArgumentParser()
parser.add_argument('filename', type=str,
help='filename of hdf5 file to check')
args = parser.parse_args()
filena... | mit |
pnedunuri/scikit-learn | examples/linear_model/plot_sgd_iris.py | 286 | 2202 | """
========================================
Plot multi-class SGD on the iris dataset
========================================
Plot decision surface of multi-class SGD on iris dataset.
The hyperplanes corresponding to the three one-versus-all (OVA) classifiers
are represented by the dashed lines.
"""
print(__doc__)
... | bsd-3-clause |
koroder/Chord-DHT-simulation | plots/examples/plengthvsnodes.py | 1 | 1507 | #import everything from matplotlib (numpy is accessible via 'np' alias)
from pylab import *
# Create a new figure of size 8x6 points, using 80 dots per inch
figure(figsize=(8,6), dpi=80)
# Create a new subplot from a grid of 1x1
ax = subplot(1,1,1)
#X = [10,20,40,80,160,320,640,1280,2560,5120,10240]
X = [100,1000,50... | mit |
JohannesBuchner/PyMirage | pymirage/filter.py | 1 | 2678 | import numpy
from numpy import linspace, arange, log, zeros, cos, transpose, pi, logical_and, log10
import scipy.sparse
import tempfile
def gen_mfcc_filters(samplingrate, winsize, numfilters, nummfccs):
# Precompute the MFCC filterweights and DCT.
# Adopted from Malcolm Slaneys mfcc.m, August 1993
# Mirage uses fil... | gpl-2.0 |
qifeigit/scikit-learn | examples/classification/plot_classifier_comparison.py | 181 | 4699 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=====================
Classifier comparison
=====================
A comparison of a several classifiers in scikit-learn on synthetic datasets.
The point of this example is to illustrate the nature of decision boundaries
of different classifiers.
This should be taken with ... | bsd-3-clause |
aabadie/scikit-learn | sklearn/tests/test_isotonic.py | 34 | 14159 | import warnings
import numpy as np
import pickle
import copy
from sklearn.isotonic import (check_increasing, isotonic_regression,
IsotonicRegression)
from sklearn.utils.testing import (assert_raises, assert_array_equal,
assert_true, assert_false, assert... | bsd-3-clause |
niamoto/niamoto-core | niamoto/data_providers/sql_provider/sql_plot_provider.py | 2 | 2033 | # coding: utf-8
import sqlalchemy as sa
import pandas as pd
from niamoto.data_providers.base_plot_provider import BasePlotProvider
from niamoto.exceptions import MalformedDataSourceError
class SQLPlotProvider(BasePlotProvider):
"""
SQL plot provider. Instantiated with a sql query, that must return
must ... | gpl-3.0 |
alexvmarch/atomic | exatomic/nwchem/inputs.py | 3 | 9184 | # -*- coding: utf-8 -*-
# Copyright (c) 2015-2018, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
"""
Input Generator and Parser
#############################
Every attempt is made to follow the Documentation on the
NWChem `website`_ with a general theme of the input Generator
ac... | apache-2.0 |
ExaScience/smurff | data/synthetic/make.py | 1 | 8259 | #!/usr/bin/env python
import numpy as np
from scipy import sparse
import scipy.io as sio
import argparse
import os
import itertools
import smurff.matrix_io as mio
from sklearn import preprocessing
#parser = argparse.ArgumentParser(description='SMURFF tests')
#parser.add_argument('--envdir', metavar='DIR', dest='envd... | mit |
PrashntS/scikit-learn | examples/calibration/plot_calibration.py | 225 | 4795 | """
======================================
Probability calibration of classifiers
======================================
When performing classification you often want to predict not only
the class label, but also the associated probability. This probability
gives you some kind of confidence on the prediction. However,... | bsd-3-clause |
joshuagryphon/minihmm | docs/source/conf.py | 1 | 10964 | # -*- coding: utf-8 -*-
#
# minihmm documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 5 00:24:09 2015.
#
import sys
import os
import minihmm
import mock
# Manual mocking
class SetMock():
def __contains__(self, val):
return True
class DocMock(mock.MagicMock):
"""Pro... | bsd-3-clause |
tmrowco/electricitymap | parsers/CA_AB.py | 1 | 6277 | #!/usr/bin/env python3
import arrow
from bs4 import BeautifulSoup
import datetime
import re
import requests
import pandas as pd
from pytz import timezone
ab_timezone = 'Canada/Mountain'
def convert_time_str(ts):
"""Takes a time string and converts into an aware datetime object."""
dt_naive = datetime.datet... | gpl-3.0 |
jh23453/privacyidea | privacyidea/lib/stats.py | 3 | 5545 | # -*- coding: utf-8 -*-
#
# 2015-07-16 Initial writeup
# (c) Cornelius Kölbel
# License: AGPLv3
# contact: http://www.privacyidea.org
#
# This code is free software; you can redistribute it and/or
# modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
# License as published by the Free Software Foun... | agpl-3.0 |
eramirem/astroML | book_figures/chapter3/fig_transform_distribution.py | 3 | 2529 | r"""
Transformation of Distribution
------------------------------
Figure 3.4.
An example of transforming a uniform distribution. In the left panel, x
is sampled from a uniform distribution of unit width centered on x = 0.5
(:math:`\mu` = 0 and W = 1; see Section 3.3.1). In the right panel,
the distribution is transfo... | bsd-2-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.