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
davidwaroquiers/pymatgen
pymatgen/io/lammps/tests/test_inputs.py
5
4354
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. import filecmp import os import re import shutil import unittest import pandas as pd from pymatgen.core.lattice import Lattice from pymatgen.core.structure import Structure from pymatgen.io.lammps.data import ...
mit
JeanKossaifi/scikit-learn
benchmarks/bench_multilabel_metrics.py
276
7138
#!/usr/bin/env python """ A comparison of multilabel target formats and metrics over them """ from __future__ import division from __future__ import print_function from timeit import timeit from functools import partial import itertools import argparse import sys import matplotlib.pyplot as plt import scipy.sparse as...
bsd-3-clause
klocey/hydrobide
tools/SADfits/SAD-Models.py
9
12909
from __future__ import division import os, collections, math from scipy import stats, optimize import statsmodels.formula.api as smf import statsmodels.api as sm from scipy.stats import nbinom import numpy as np import pandas as pd from macroeco_distributions import pln, pln_solver, negbin_solver, trunc_geom from scipy...
mit
haaspt/panopti
scraper.py
1
5320
from __future__ import print_function import time import praw import pandas as pd import numpy as np def get_new_authors(reddit_post_generator, author_series=None): """Takes a reddit post generator object and an optional pandas series. Iterates through the generator and adds praw user objects to the series ...
mit
maheshakya/scikit-learn
sklearn/utils/tests/test_utils.py
23
6045
import warnings import numpy as np import scipy.sparse as sp from scipy.linalg import pinv2 from sklearn.utils.testing import (assert_equal, assert_raises, assert_true, assert_almost_equal, assert_array_equal, SkipTest) from sklearn.utils import c...
bsd-3-clause
sargas/scipy
scipy/signal/spectral.py
3
13369
"""Tools for spectral analysis. """ from __future__ import division, print_function, absolute_import import numpy as np from scipy import fftpack from . import signaltools from .windows import get_window from ._spectral import lombscargle import warnings from scipy.lib.six import string_types __all__ = ['periodogra...
bsd-3-clause
andaag/scikit-learn
sklearn/neighbors/tests/test_nearest_centroid.py
305
4121
""" Testing for the nearest centroid module. """ import numpy as np from scipy import sparse as sp from numpy.testing import assert_array_equal from numpy.testing import assert_equal from sklearn.neighbors import NearestCentroid from sklearn import datasets from sklearn.metrics.pairwise import pairwise_distances # t...
bsd-3-clause
ch3ll0v3k/scikit-learn
sklearn/utils/arpack.py
265
64837
""" This contains a copy of the future version of scipy.sparse.linalg.eigen.arpack.eigsh It's an upgraded wrapper of the ARPACK library which allows the use of shift-invert mode for symmetric matrices. Find a few eigenvectors and eigenvalues of a matrix. Uses ARPACK: http://www.caam.rice.edu/software/ARPACK/ """ #...
bsd-3-clause
mayblue9/scikit-learn
sklearn/linear_model/tests/test_sgd.py
68
43439
import pickle import unittest import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_greater from sklearn.utils.testing ...
bsd-3-clause
gaomeng1900/SQIP-py
sqip/api/api.py
1
11570
#!/usr/bin/env python #-*-coding:utf-8-*- # # @author Meng G. # 2016-03-28 restructed import sys reload(sys) sys.setdefaultencoding("utf-8") from sqip.config import * from sqip.libs import * # @TODO # 为什么没有后三行就一直提示 # 'module' object has no attribute 'stu' import models from models import project, meta from sqip.b...
cc0-1.0
untom/scikit-learn
examples/bicluster/bicluster_newsgroups.py
162
7103
""" ================================================================ Biclustering documents with the Spectral Co-clustering algorithm ================================================================ This example demonstrates the Spectral Co-clustering algorithm on the twenty newsgroups dataset. The 'comp.os.ms-windows...
bsd-3-clause
louisLouL/pair_trading
capstone_env/lib/python3.6/site-packages/matplotlib/backends/backend_gtkagg.py
2
3347
""" Render to gtk from agg """ from __future__ import (absolute_import, division, print_function, unicode_literals) import six import os import matplotlib from matplotlib.figure import Figure from matplotlib.backends.backend_agg import FigureCanvasAgg from matplotlib.backends.backend_gtk impo...
mit
WafaaT/spark-tk
regression-tests/sparktkregtests/testcases/scoretests/scoring_pipeline_test.py
9
2856
# vim: set encoding=utf-8 # Copyright (c) 2016 Intel Corporation  # # 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 require...
apache-2.0
bhargav/scikit-learn
sklearn/metrics/cluster/tests/test_unsupervised.py
26
3305
import numpy as np from scipy.sparse import csr_matrix from sklearn import datasets from sklearn.metrics.cluster.unsupervised import silhouette_score from sklearn.metrics import pairwise_distances from sklearn.utils.testing import assert_false from sklearn.utils.testing import assert_almost_equal from sklearn.utils.te...
bsd-3-clause
khkaminska/scikit-learn
sklearn/tests/test_calibration.py
213
12219
# 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
sunopy/amaterasu
python/import_data.py
1
1650
from __future__ import division import numpy import matplotlib.pyplot as plt ace = numpy.genfromtxt('../data/data.csv', dtype=None,names = ['year', 'day', 'hr', 'min', 'sec', 'fp_year', 'fp_day', 'ACEepoch', 'proton_density', 'proton_temp', 'He4toprotons', 'proton_speed', 'x_dot_RTN', 'y_dot_RTN', 'z_dot_RTN', 'x_dot_...
apache-2.0
JasonKessler/scattertext
demo_sklearn.py
1
2580
from lightning.classification import CDClassifier from sklearn.datasets import fetch_20newsgroups from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer from sklearn.metrics import f1_score import scattertext as st newsgroups_train = fetch_20newsgroups(subset='train', remove=('headers', 'footers'...
apache-2.0
ningchi/scikit-learn
sklearn/utils/arpack.py
265
64837
""" This contains a copy of the future version of scipy.sparse.linalg.eigen.arpack.eigsh It's an upgraded wrapper of the ARPACK library which allows the use of shift-invert mode for symmetric matrices. Find a few eigenvectors and eigenvalues of a matrix. Uses ARPACK: http://www.caam.rice.edu/software/ARPACK/ """ #...
bsd-3-clause
blab/nextstrain-augur
base/fitness_predictors.py
1
19731
import Bio import time import numpy as np import pandas as pd from scipy.stats import linregress import sys try: import itertools.izip as zip except ImportError: pass from .scores import calculate_LBI, select_nodes_in_season from .titer_model import SubstitutionModel, TiterCollection, TreeModel # all fitness...
agpl-3.0
plotly/plotly.py
packages/python/plotly/plotly/graph_objs/_scatterternary.py
1
86927
from plotly.basedatatypes import BaseTraceType as _BaseTraceType import copy as _copy class Scatterternary(_BaseTraceType): # class properties # -------------------- _parent_path_str = "" _path_str = "scatterternary" _valid_props = { "a", "asrc", "b", "bsrc", ...
mit
natasasdj/OpenWPM
analysis_parallel/01b_responseDomains_sqlite.py
1
1463
import sys import sqlite3 import os import pandas as pd from urlparse import urlparse from timeit import default_timer as timer data_dir = sys.argv[1] db = os.path.join(data_dir,'crawl-data.sqlite') print db conn = sqlite3.connect(db) res_dir = sys.argv[2] db = os.path.join(res_dir,'domains.sqlite') print db conn1 ...
gpl-3.0
mmoiozo/IROS
sw/misc/attitude_reference/test_att_ref.py
49
3485
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2014 Antoine Drouin # # This file is part of paparazzi. # # paparazzi 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, or (at y...
gpl-2.0
woozzu/pylearn2
pylearn2/train_extensions/roc_auc.py
30
4854
""" TrainExtension subclass for calculating ROC AUC scores on monitoring dataset(s), reported via monitor channels. """ __author__ = "Steven Kearnes" __copyright__ = "Copyright 2014, Stanford University" __license__ = "3-clause BSD" import numpy as np try: from sklearn.metrics import roc_auc_score except ImportEr...
bsd-3-clause
ahnitz/pycbc
setup.py
1
11507
#!/usr/bin/env python # Copyright (C) 2012 Alex Nitz, Duncan Brown, Andrew Miller, Josh Willis # # 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 # op...
gpl-3.0
ltiao/scikit-learn
sklearn/cluster/bicluster.py
211
19443
"""Spectral biclustering algorithms. Authors : Kemal Eren License: BSD 3 clause """ from abc import ABCMeta, abstractmethod import numpy as np from scipy.sparse import dia_matrix from scipy.sparse import issparse from . import KMeans, MiniBatchKMeans from ..base import BaseEstimator, BiclusterMixin from ..external...
bsd-3-clause
hsk81/calaganne
2016-03-01/The Probability of Co-Prime Integers/plot.py
1
1128
#!/usr/bin/env python ############################################################################### import numpy as np from math import gcd from matplotlib import pyplot as pp ############################################################################### def NEXT(n): return np.random.random_integers(2**n) def CO...
isc
mlperf/training_results_v0.6
Fujitsu/benchmarks/resnet/implementations/mxnet/example/rcnn/symdata/loader.py
11
8759
# 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
Crobisaur/KMeans_MNIST
CpE520_HW5.py
1
2749
print(__doc__) from time import time import numpy as np import matplotlib.pyplot as plt import h5py from sklearn import metrics from sklearn.cluster import KMeans from sklearn.datasets import load_digits from sklearn import decomposition from sklearn.preprocessing import scale from skimage.transform import rescale i...
mit
Arn-O/kadenze-deep-creative-apps
session-3/libs/gif.py
4
1797
"""Utility for creating a GIF. Creative Applications of Deep Learning w/ Tensorflow. Kadenze, Inc. Copyright Parag K. Mital, June 2016. """ import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation def build_gif(imgs, interval=0.1, dpi=72, save_gif=True, saveto='animat...
apache-2.0
wiki2014/Learning-Summary
alps/cts/apps/CameraITS/tests/scene1/test_param_shading_mode.py
1
4654
# Copyright 2015 The Android Open Source Project # # 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 a...
gpl-3.0
schets/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
kylerbrown/scikit-learn
examples/applications/plot_out_of_core_classification.py
255
13919
""" ====================================================== Out-of-core classification of text documents ====================================================== This is an example showing how scikit-learn can be used for classification using an out-of-core approach: learning from data that doesn't fit into main memory. ...
bsd-3-clause
asnorkin/sentiment_analysis
site/lib/python2.7/site-packages/sklearn/tests/test_multioutput.py
39
6609
import numpy as np import scipy.sparse as sp from sklearn.utils import shuffle from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_raises_regex from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing impor...
mit
changsiyao/mousestyles
mousestyles/path_diversity/tests/test_dist_speed.py
3
1642
from __future__ import (absolute_import, division, print_function, unicode_literals) import pandas as pd import pytest from mousestyles import data from mousestyles import path_diversity def test_dist_speed_input(): movement = data.load_movement(0, 0, 0) # Check if function raises t...
bsd-2-clause
tobegit3hub/deep_cnn
java_predict_client/src/main/proto/tensorflow/contrib/learn/python/learn/learn_io/data_feeder_test.py
24
8691
# 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
jnez71/demos
geometry/quaternion_exponential.py
1
3360
#!/usr/bin/env python3 """ Computational demo of the exponential map for the quaternion representation of SO3. Quaternions here are stored as arrays [w, i, j, k]. (NOT the ROS TF convention). """ import numpy as np from matplotlib import pyplot from mpl_toolkits.mplot3d import Axes3D npl = np.linalg PI = np.pi #####...
mit
francesco-mannella/dmp-esn
DMP/stulp/src/functionapproximators/tests/testFunctionApproximatorTraining.py
2
2473
from mpl_toolkits.mplot3d.axes3d import Axes3D import numpy import matplotlib.pyplot as plt import os, sys, subprocess lib_path = os.path.abspath('../plotting') sys.path.append(lib_path) from plotData impo...
gpl-2.0
tom-f-oconnell/multi_tracker
nodes/delta_video_simplebuffer.py
1
25393
#!/usr/bin/env python from __future__ import division import copy import threading from subprocess import Popen import time import os import sys import numpy as np import cv2 from cv_bridge import CvBridge, CvBridgeError import matplotlib.pyplot as plt import rospy import rosparam from sensor_msgs.msg import Image f...
mit
zehpunktbarron/iOSMAnalyzer
scripts/c2_actuality_point.py
1
5651
# -*- coding: utf-8 -*- #!/usr/bin/python2.7 #description :This file creates a plot: Calculate the actuality of all points #author :Christopher Barron @ http://giscience.uni-hd.de/ #date :19.01.2013 #version :0.1 #usage :python pyscript.py #====================================...
gpl-3.0
terkkila/scikit-learn
examples/linear_model/plot_sparse_recovery.py
243
7461
""" ============================================================ Sparse recovery: feature selection for sparse linear models ============================================================ Given a small number of observations, we want to recover which features of X are relevant to explain y. For this :ref:`sparse linear ...
bsd-3-clause
lscheinkman/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/__init__.py
69
28184
""" This is an object-orient plotting library. A procedural interface is provided by the companion pylab module, which may be imported directly, e.g:: from pylab import * or using ipython:: ipython -pylab For the most part, direct use of the object-oriented library is encouraged when programming rather tha...
agpl-3.0
krez13/scikit-learn
sklearn/model_selection/_validation.py
14
35648
""" The :mod:`sklearn.model_selection._validation` module includes classes and functions to validate the model. """ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>, # Gael Varoquaux <gael.varoquaux@normalesup.org>, # Olivier Grisel <olivier.grisel@ensta.org> # License: BSD 3 clause from __...
bsd-3-clause
scivision/piradar
PlotSpectrum.py
1
3699
#!/usr/bin/env python """ Plot time & frequency spectrum of a GNU Radio received file. Also attempts to playback sound from file (optionally, write .wav file) CW Example (file with Fs=100kHz, Fc=10kHz, taking 4 sec. time steps from 30 to 60 sec., 10x zero-padding) ./PlotSpectrum.py ~/Dropbox/piradar/data/MH_exercise.b...
agpl-3.0
MostafaGazar/tensorflow
tensorflow/contrib/learn/python/learn/estimators/rnn_test.py
8
5977
# 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
ryfeus/lambda-packs
Tensorflow_LightGBM_Scipy_nightly/source/scipy/interpolate/_fitpack_impl.py
10
46541
""" fitpack (dierckx in netlib) --- A Python-C wrapper to FITPACK (by P. Dierckx). FITPACK is a collection of FORTRAN programs for curve and surface fitting with splines and tensor product splines. See http://www.cs.kuleuven.ac.be/cwis/research/nalag/research/topics/fitpack.html or http://www.netlib....
mit
akrherz/idep
scripts/ucs/huc12results.py
2
1275
from geopandas import read_postgis from pandas.io.sql import read_sql from pyiem.util import get_dbconn years = 8.0 pgconn = get_dbconn("idep") # Get the initial geometries df = read_postgis( """ SELECT huc_12, geom from huc12 WHERE states ~* 'IA' and scenario = 0 """, pgconn, index_col="huc_12", ...
mit
hughperkins/gpu-experiments
gpuexperiments/globalwrite_gridsize_graphs.py
1
1977
from __future__ import print_function, division import argparse import string import numpy as np import os from collections import defaultdict import array import csv import matplotlib.pyplot as plt plt.rcdefaults() import matplotlib.pyplot as plt from os.path import join import lib_clgpuexp parser = argparse.Argumen...
bsd-2-clause
VDBWRAIR/bio_pieces
bio_bits/beast_checkpoint.py
3
5209
#!/usr/bin/env python # Designed to allow checkpointing of BEAST output files # Input: beast_analysis.xml output_file_1.log output_file_2.log ... tree_file.trees # Expect at least 3 files # This matches column names in log files to parameter names in the original XML to set initial conditions from __future__ import p...
gpl-2.0
cogeorg/BlackRhino
networkx/convert_matrix.py
3
33714
"""Functions to convert NetworkX graphs to and from numpy/scipy matrices. The preferred way of converting data to a NetworkX graph is through the graph constuctor. The constructor calls the to_networkx_graph() function which attempts to guess the input type and convert it automatically. Examples -------- Create a 10...
gpl-3.0
avolkov1/keras_experiments
examples/variational_autoencoder/variational_autoencoder_deconv_mgpu.py
1
5976
'''This script demonstrates how to build a variational autoencoder with Keras and deconvolution layers. Reference: "Auto-Encoding Variational Bayes" https://arxiv.org/abs/1312.6114 Multigpu modifications running asynchronous training. original implementation: https://github.com/fchollet/keras/blob/master/examples/va...
unlicense
pythonvietnam/scikit-learn
examples/mixture/plot_gmm_pdf.py
284
1528
""" ============================================= Density Estimation for a mixture of Gaussians ============================================= Plot the density estimation of a mixture of two Gaussians. Data is generated from two Gaussians with different centers and covariance matrices. """ import numpy as np import ma...
bsd-3-clause
macks22/gensim
gensim/sklearn_api/tfidf.py
1
1952
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz> # Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html """ Scikit learn interface for gensim for easy use of gensim with scikit-learn Follows scikit-learn API conventions """ from sklearn.ba...
lgpl-2.1
geopy/geopy
geopy/extra/rate_limiter.py
1
14731
""":class:`.RateLimiter` and :class:`.AsyncRateLimiter` allow to perform bulk operations while gracefully handling error responses and adding delays when needed. In the example below a delay of 1 second (``min_delay_seconds=1``) will be added between each pair of ``geolocator.geocode`` calls; all :class:`geopy.exc.Geo...
mit
Manolo94/manolo94.github.io
MLpython/HW5.py
1
7050
import pandas as pd import numpy as np import sys import random import copy # Task 1 task1_data = {'Wins_2016': [3, 3, 2, 2, 6, 6, 7, 7, 8, 7], 'Wins_2017': [5, 4, 8, 3, 2, 4, 3, 4, 5, 6]} task1_pd = pd.DataFrame(data=task1_data) iris_df = pd.read_csv('./iris_input/iris.data', names=['sepal_length', 'sepal_width', 'p...
apache-2.0
cjforman/pele
pele/potentials/_sutton_chen.py
5
3354
import numpy as np from pele.potentials import BasePotential from pele.potentials.fortran import scdiff_periodic as fortran_sc class SuttonChen(BasePotential): """The sutton chen potential for modelling the surfaces of metal crystals : First calculate the potential energy. Choosing SIG=...
gpl-3.0
tahoemph/polar_roses
python/polar_matplotlib_animate.py
1
1575
""" Started from a Matplotlib example by Jake Vanderplas (vanderplas@astro.washington.edu) """ import math from matplotlib import pyplot as plt from matplotlib import animation import numpy as np # First set up the figure, the axis, and the plot element we want to animate fig = plt.figure() ax = plt.axes(xlim=(-1.25,...
mit
Bhare8972/LOFAR-LIM
LIM_scripts/stationTimings/timingFitter_4_polt.py
1
24482
#!/usr/bin/env python3 #python import time from os import mkdir, listdir from os.path import isdir, isfile from itertools import chain #from pickle import load #external import numpy as np np.set_printoptions(precision=10, threshold=np.inf) from scipy.optimize import least_squares from matplotlib import pyplot as plt...
mit
jlegendary/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/bezier.py
70
14387
""" A module providing some utility functions regarding bezier path manipulation. """ import numpy as np from math import sqrt from matplotlib.path import Path from operator import xor # some functions def get_intersection(cx1, cy1, cos_t1, sin_t1, cx2, cy2, cos_t2, sin_t2): """ return a...
gpl-3.0
larlequin/toad
tasks/05-correction.py
2
23544
# -*- coding: utf-8 -*- import os import math import matplotlib from core.toad.generictask import GenericTask from lib.images import Images from lib import util, mriutil __author__ = "Mathieu Desrosiers" __copyright__ = "Copyright (C) 2014, TOAD" __credits__ = ["Mathieu Desrosiers", "Basile Pinsard"] matplotlib.u...
gpl-2.0
hejunbok/paparazzi
sw/airborne/test/stabilization/compare_ref_quat.py
38
1206
#! /usr/bin/env python from __future__ import division, print_function, absolute_import import numpy as np import matplotlib.pyplot as plt import ref_quat_float import ref_quat_int steps = 512 * 2 ref_eul_res = np.zeros((steps, 3)) ref_quat_res = np.zeros((steps, 3)) ref_quat_float.init() ref_quat_int.init() # re...
gpl-2.0
bearing/dosenet-analysis
Programming Lesson Modules/Module 5- Other Forms of Visualization.py
1
4056
""" # Module 4- Example Plot of Weather Data #### author: Radley Rigonan In this module, I will be desmonstrating a few other graphical capabilities in Python. I will be using the following link to create a table and pi chart: https://radwatch.berkeley.edu/sites/default/files/pictures/rooftop_tmp/weather.csv ""...
mit
kenshay/ImageScript
ProgramData/SystemFiles/Python/Lib/site-packages/mpl_toolkits/axisartist/floating_axes.py
18
22796
""" An experimental support for curvilinear grid. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import six from six.moves import zip # TODO : # *. see if tick_iterator method can be simplified by reusing the parent method. from itertools import chai...
gpl-3.0
ryfeus/lambda-packs
Pandas_numpy/source/pandas/io/sas/sas7bdat.py
5
27243
""" Read SAS7BDAT files Based on code written by Jared Hobbs: https://bitbucket.org/jaredhobbs/sas7bdat See also: https://github.com/BioStatMatt/sas7bdat Partial documentation of the file format: https://cran.r-project.org/web/packages/sas7bdat/vignettes/sas7bdat.pdf Reference for binary data compression: h...
mit
dhruv13J/scikit-learn
sklearn/ensemble/tests/test_forest.py
2
34969
""" Testing for the forest module (sklearn.ensemble.forest). """ # Authors: Gilles Louppe, # Brian Holt, # Andreas Mueller, # Arnaud Joly # License: BSD 3 clause import pickle from collections import defaultdict from itertools import product import numpy as np from scipy.sparse import csr_...
bsd-3-clause
Djabbz/scikit-learn
examples/applications/wikipedia_principal_eigenvector.py
233
7819
""" =============================== Wikipedia principal eigenvector =============================== A classical way to assert the relative importance of vertices in a graph is to compute the principal eigenvector of the adjacency matrix so as to assign to each vertex the values of the components of the first eigenvect...
bsd-3-clause
seckcoder/lang-learn
python/sklearn/examples/linear_model/plot_lasso_and_elasticnet.py
3
1765
""" ======================================== Lasso and Elastic Net for Sparse Signals ======================================== """ print __doc__ import numpy as np import pylab as pl from sklearn.metrics import r2_score ############################################################################### # generate some ...
unlicense
jorik041/scikit-learn
examples/linear_model/plot_logistic_l1_l2_sparsity.py
384
2601
""" ============================================== 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...
bsd-3-clause
weixuanfu2016/tpot
tests/stacking_estimator_tests.py
2
4622
# -*- coding: utf-8 -*- """This file is part of the TPOT library. TPOT was primarily developed at the University of Pennsylvania by: - Randal S. Olson (rso@randalolson.com) - Weixuan Fu (weixuanf@upenn.edu) - Daniel Angell (dpa34@drexel.edu) - and many more generous open source contributors TPOT is f...
lgpl-3.0
huongttlan/statsmodels
statsmodels/graphics/dotplots.py
31
18190
import numpy as np from statsmodels.compat import range from . import utils def dot_plot(points, intervals=None, lines=None, sections=None, styles=None, marker_props=None, line_props=None, split_names=None, section_order=None, line_order=None, stacked=False, styles_order=None, s...
bsd-3-clause
gautamkmr/incubator-mxnet
example/dec/dec.py
24
7846
# 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
JanKalin/zcutils
miningrate.py
1
7729
#!/usr/bin/env python ########################################################################### # author: JanKalin # # Calculates an estimate of mining rate on this computer ########################################################################### import argparse import datetime import matplotlib.pyplot as plt im...
mit
msdogan/pyvin
calvin/plots.py
1
2114
import pandas as pd import numpy as np import matplotlib.pyplot as plt import csv import matplotlib.cm as cm import matplotlib matplotlib.style.use('ggplot') def plot_clustered_stacked(dfall, labels=None, title="Water Supply Portfolio", H="/", **kwargs): n_df = len(dfall) n_col = len(dfall[0].columns) ...
mit
nbfigueroa/daft
examples/classic.py
7
1057
""" The Quintessential PGM ====================== This is a demonstration of a very common structure found in graphical models. It has been rendered using Daft's default settings for all the parameters and it shows off how much beauty is baked in by default. """ from matplotlib import rc rc("font", family="serif", s...
mit
tboyle1/DissertationCode
DeltaHedge.py
1
3679
import numpy as np import pandas as pd from pandas import DataFrame as df pd.set_option('display.width', 320) pd.set_option('display.max_rows', 100) pd.options.display.float_format = '{:,.2f}'.format from scipy.stats import norm import matplotlib.pyplot as plt def BlackScholes(tau, S, K, sigma): d1=np.log(S/K)/si...
unlicense
michaelbramwell/sms-tools
software/transformations_interface/sineTransformations_function.py
25
5018
# function call to the transformation functions of relevance for the sineModel import numpy as np import matplotlib.pyplot as plt from scipy.signal import get_window import sys, os sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../models/')) sys.path.append(os.path.join(os.path.dirname(os.p...
agpl-3.0
vigilv/scikit-learn
sklearn/linear_model/tests/test_sparse_coordinate_descent.py
244
9986
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_true from sklearn.utils.t...
bsd-3-clause
pombredanne/bokeh
examples/charts/server/interactive_excel.py
6
3202
import xlwings as xw import pandas as pd from pandas.util.testing import assert_frame_equal from bokeh.client import push_session from bokeh.charts import Line, Bar from bokeh.charts.operations import blend from bokeh.models import Paragraph from bokeh.io import curdoc, hplot, vplot wb = xw.Workbook() # Creates a co...
bsd-3-clause
stephenliu1989/HK_DataMiner
hkdataminer/cluster/dbscan_.py
1
15860
# -*- coding: utf-8 -*- """ DBSCAN: Density-Based Spatial Clustering of Applications with Noise """ # Author: Robert Layton <robertlayton@gmail.com> # Joel Nothman <joel.nothman@gmail.com> # Lars Buitinck # # License: BSD 3 clause import numpy as np import warnings from scipy import sparse from sklea...
apache-2.0
ch3ll0v3k/scikit-learn
sklearn/manifold/t_sne.py
106
20057
# Author: Alexander Fabisch -- <afabisch@informatik.uni-bremen.de> # License: BSD 3 clause (C) 2014 # This is the standard t-SNE implementation. There are faster modifications of # the algorithm: # * Barnes-Hut-SNE: reduces the complexity of the gradient computation from # N^2 to N log N (http://arxiv.org/abs/1301....
bsd-3-clause
numenta/NAB
nab/detectors/htmjava/nab/util.py
9
9025
# ---------------------------------------------------------------------- # Copyright (C) 2014-2015, 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 program is free software: you can redistribute it and/...
agpl-3.0
jkarnows/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
CI-WATER/gsshapy
gsshapy/grid/grid_to_gssha.py
1
55286
# -*- coding: utf-8 -*- # # grid_to_gssha.py # GSSHApy # # Created by Alan D Snow, 2016. # License BSD 3-Clause from builtins import range from datetime import datetime from io import open as io_open import logging import numpy as np from os import mkdir, path, remove, rename import pangaea as pa import pandas as ...
bsd-3-clause
AIML/scikit-learn
sklearn/svm/setup.py
321
3157
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 config = Configuration('svm', parent_package, top_path) config.add_subpackage('tests') # Section L...
bsd-3-clause
johnmgregoire/NanoCalorimetry
fixdramreaderror_1kHz_fV.py
1
6643
import numpy, h5py, pylab, copy from PnSC_h5io import * import scipy.optimize from matplotlib.ticker import FuncFormatter class fitfcns: #datatuples are x1,x2,...,y #.finalparams .sigmas .parnames useful, returns fitfcn(x) def genfit(self, fcn, initparams, datatuple, markstr='unspecified', parnames=[], interac...
bsd-3-clause
ianctse/pvlib-python
pvlib/test/test_tmy.py
2
1174
import inspect import os from pandas.util.testing import network test_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) tmy3_testfile = os.path.join(test_dir, '../data/703165TY.csv') tmy2_testfile = os.path.join(test_dir, '../data/12839.tm2') from pvlib import tmy def test_readtmy3():...
bsd-3-clause
jhprinz/openpathsampling
openpathsampling/pathsimulator.py
1
41587
import time import sys import logging import numpy as np import pandas as pd from openpathsampling.netcdfplus import StorableNamedObject, StorableObject import openpathsampling as paths import openpathsampling.tools import collections from openpathsampling.pathmover import SubPathMover from .ops_logging import init...
lgpl-2.1
larsoner/mne-python
examples/decoding/plot_receptive_field_mtrf.py
15
11238
""" .. _ex-receptive-field-mtrf: ========================================= Receptive Field Estimation and Prediction ========================================= This example reproduces figures from Lalor et al.'s mTRF toolbox in MATLAB :footcite:`CrosseEtAl2016`. We will show how the :class:`mne.decoding.ReceptiveField...
bsd-3-clause
Odingod/mne-python
examples/realtime/ftclient_rt_compute_psd.py
17
2460
""" ============================================================== Compute real-time power spectrum density with FieldTrip client ============================================================== Please refer to `ftclient_rt_average.py` for instructions on how to get the FieldTrip connector working in MNE-Python. This e...
bsd-3-clause
moutai/scikit-learn
sklearn/neighbors/tests/test_dist_metrics.py
38
6118
import itertools import pickle import numpy as np from numpy.testing import assert_array_almost_equal import scipy from scipy.spatial.distance import cdist from sklearn.neighbors.dist_metrics import DistanceMetric from nose import SkipTest def dist_func(x1, x2, p): return np.sum((x1 - x2) ** p) ** (1. / p) de...
bsd-3-clause
msto/svplot
svplot/venn.py
2
8650
# -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2016 msto <mstone5@mgh.harvard.edu> # # Distributed under terms of the MIT license. """ Simple venn diagrams. """ import matplotlib.pyplot as plt import matplotlib.patches as patches def venn4(subsets, set_labels=('A', 'B', 'C', 'D'), # s...
mit
pkruskal/scikit-learn
benchmarks/bench_plot_parallel_pairwise.py
297
1247
# Author: Mathieu Blondel <mathieu@mblondel.org> # License: BSD 3 clause 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
aglne/lenskit
lenskit-integration-tests/src/it/eval/item-item-identical/verify.py
5
2214
# LensKit, an open source recommender systems toolkit. # Copyright 2010-2014 Regents of the University of Minnesota and contributors # Work on LensKit has been funded by the National Science Foundation under # grants IIS 05-34939, 08-08692, 08-12148, and 10-17697. # # This program is free software; you can redistribute...
lgpl-2.1
NonVolatileComputing/arrow
python/pyarrow/tests/pandas_examples.py
1
3889
# -*- coding: utf-8 -*- # 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 # "...
apache-2.0
spectralDNS/spectralDNS
sandbox/cheb_helmholtz_neumann_sft.py
2
7391
from numpy.polynomial import chebyshev as n_cheb from sympy import chebyshevt, Symbol, sin, cos, pi, lambdify, sqrt as Sqrt import numpy as np import matplotlib.pyplot as plt from scipy.linalg import solve_banded from scipy.sparse import diags import scipy.sparse.linalg as la from spectralDNS.shen.shentransform import ...
lgpl-3.0
wathen/PhD
MHD/FEniCS/MHD/Stabilised/SaddlePointForm/Test/SplitMatrix/CoupleTest/MHDmatrixSetup.py
1
6202
import petsc4py import sys petsc4py.init(sys.argv) from petsc4py import PETSc from dolfin import * # from MatrixOperations import * import numpy as np #import matplotlib.pylab as plt from scipy.sparse import coo_matrix, csr_matrix, spdiags, bmat import os, inspect from HiptmairSetup import BoundaryEdge import matpl...
mit
bthirion/scikit-learn
sklearn/tests/test_discriminant_analysis.py
37
11979
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_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert...
bsd-3-clause
musically-ut/statsmodels
statsmodels/tsa/tests/test_seasonal.py
27
9216
import numpy as np from numpy.testing import assert_almost_equal, assert_equal, assert_raises from statsmodels.tsa.seasonal import seasonal_decompose from pandas import DataFrame, DatetimeIndex class TestDecompose: @classmethod def setupClass(cls): # even data = [-50, 175, 149, 214, 247, 237, ...
bsd-3-clause
B3AU/waveTree
examples/manifold/plot_compare_methods.py
8
3592
""" ========================================= Comparison of Manifold Learning methods ========================================= An illustration of dimensionality reduction on the S-curve dataset with various manifold learning methods. For a discussion and comparison of these algorithms, see the :ref:`manifold module...
bsd-3-clause
willzfarmer/datagraph
bin/graph.py
1
6342
#!/usr/bin/env python IMPORT_FLAG = False try: import csv import subprocess import argparse import sys import os import pydot import ast import networkx as nx import matplotlib.pyplot as plt except ImportError: IMPORT_FLAG = True def main(): args = get_args() if args....
bsd-3-clause
NelisVerhoef/scikit-learn
examples/decomposition/plot_ica_vs_pca.py
306
3329
""" ========================== FastICA on 2D point clouds ========================== This example illustrates visually in the feature space a comparison by results using two different component analysis techniques. :ref:`ICA` vs :ref:`PCA`. Representing ICA in the feature space gives the view of 'geometric ICA': ICA...
bsd-3-clause