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
Windy-Ground/scikit-learn
examples/cluster/plot_agglomerative_clustering_metrics.py
402
4492
""" Agglomerative clustering with different metrics =============================================== Demonstrates the effect of different metrics on the hierarchical clustering. The example is engineered to show the effect of the choice of different metrics. It is applied to waveforms, which can be seen as high-dimens...
bsd-3-clause
open-austin/construction-permits
permits/permits.py
1
4110
#!/usr/bin/env python # -*- coding: utf-8 -*- # todo: # throw out matches that match citycenter # extra column before geocoded fields # argparser for start_date, end_date import csv import logging from StringIO import StringIO import time import arrow import geocoder import requests import github from html2csv impo...
unlicense
elcritch/CuteMark
CuteMark/RendererPanel.py
1
3423
#!/usr/bin/env python3 # Import PySide classes import sys, collections, json, tabulate, shutil from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtWebKitWidgets import QWebView from PyQt5.QtWebKit import QWebSettings from PyQt5.QtNetwork import QNetworkRequest Signal = pyq...
mit
amozie/amozie
testzie/stock_rl/stock_gym_test.py
1
1393
from keras.applications.vgg16 import VGG16 import numpy as np import matplotlib.pyplot as plt from keras.models import Sequential, Model from keras.layers import Dense, Activation, Input, Dropout, GlobalAveragePooling2D, \ Flatten, RepeatVector, Permute, Reshape, GlobalMaxPooling2D from keras.datasets import mnist ...
apache-2.0
qifeigit/scikit-learn
examples/exercises/plot_cv_diabetes.py
231
2527
""" =============================================== Cross-validation on diabetes Dataset Exercise =============================================== A tutorial exercise which uses cross-validation with linear models. This exercise is used in the :ref:`cv_estimators_tut` part of the :ref:`model_selection_tut` section of ...
bsd-3-clause
dsullivan7/scikit-learn
examples/linear_model/plot_ols_ridge_variance.py
387
2060
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Ordinary Least Squares and Ridge Regression Variance ========================================================= Due to the few points in each dimension and the straight line that linear regression uses to follow thes...
bsd-3-clause
Erotemic/hotspotter
hsviz/viz.py
1
37764
from __future__ import division, print_function from hscom import __common__ (print, print_, print_on, print_off, rrr, profile, printDBG) = \ __common__.init(__name__, '[viz]', DEBUG=False) import matplotlib matplotlib.use('Qt4Agg') #import re import warnings # Scientific import numpy as np # Hotspotter import draw...
apache-2.0
pratapvardhan/scikit-learn
examples/manifold/plot_manifold_sphere.py
16
5103
#!/usr/bin/python # -*- coding: utf-8 -*- """ ============================================= Manifold Learning methods on a severed sphere ============================================= An application of the different :ref:`manifold` techniques on a spherical data-set. Here one can see the use of dimensionality reducti...
bsd-3-clause
harisbal/pandas
pandas/core/computation/expr.py
2
26587
""":func:`~pandas.eval` parsers """ import ast from functools import partial import tokenize import numpy as np from pandas.compat import StringIO, lmap, reduce, string_types, zip import pandas as pd from pandas import compat from pandas.core import common as com from pandas.core.base import StringMixin from pandas...
bsd-3-clause
kjyv/FloBaRoID
excitation/optimizer.py
2
25323
from __future__ import division from __future__ import print_function from builtins import range from builtins import object from typing import List, Tuple, Dict import sys import random import numpy as np import numpy.linalg as la import matplotlib import matplotlib.pyplot as plt from distutils.version import LooseV...
lgpl-3.0
stulp/dmpbbo
demos_cpp/dynamicalsystems/demoExponentialSystemWrapper.py
1
2205
# This file is part of DmpBbo, a set of libraries and programs for the # black-box optimization of dynamical movement primitives. # Copyright (C) 2014 Freek Stulp, ENSTA-ParisTech # # DmpBbo is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as publis...
lgpl-2.1
cl4rke/scikit-learn
examples/ensemble/plot_gradient_boosting_oob.py
230
4762
""" ====================================== Gradient Boosting Out-of-Bag estimates ====================================== Out-of-bag (OOB) estimates can be a useful heuristic to estimate the "optimal" number of boosting iterations. OOB estimates are almost identical to cross-validation estimates but they can be compute...
bsd-3-clause
Rossonero/bmlswp
ch05/classify.py
20
8239
# 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 time start_time = time.time() import numpy as np from sklearn.metrics import classification_re...
mit
ran5515/DeepDecision
tensorflow/examples/learn/iris_custom_model.py
37
3651
# 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
heistermann/wradvis
wradvis/mplcanvas.py
1
3592
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright (c) 2016, wradlib Development Team. All Rights Reserved. # Distributed under the MIT License. See LICENSE.txt for more info. # -----------------------------------------------------------------------------...
mit
wathen/PhD
MHD/FEniCS/FieldSplit/LSC/Convergence/NSpicard3Dnew.py
1
11197
#!/opt/local/bin/python from dolfin import * import petsc4py import sys petsc4py.init(sys.argv) from petsc4py import PETSc # from MatrixOperations import * import numpy as np #import matplotlib.pylab as plt import os import PETScIO as IO import time import common import CheckPetsc4py as CP import NSprecond from scip...
mit
RafaelCosman/pybrain
pybrain/rl/environments/cartpole/cartpole.py
24
4817
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de' from matplotlib.mlab import rk4 from math import sin, cos import time from scipy import eye, matrix, random, asarray from pybrain.rl.environments.graphical import GraphicalEnvironment class CartPoleEnvironment(GraphicalEnvironment): """ This environment impl...
bsd-3-clause
sightmachine/SimpleCV
SimpleCV/examples/util/ColorCube.py
13
1901
from SimpleCV import Image, Camera, Display, Color import pygame as pg import numpy as np from pylab import * from mpl_toolkits.mplot3d import axes3d from matplotlib.backends.backend_agg import FigureCanvasAgg import cv2 bins = 8 #precompute idxs = [] colors = [] offset = bins/2 skip = 255/bins for x in range(0,bins):...
bsd-3-clause
Yongliangdu/ThinkStats2
code/hinc.py
67
1494
"""This file contains code used in "Think Stats", by Allen B. Downey, available from greenteapress.com Copyright 2014 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ from __future__ import print_function import numpy as np import pandas import thinkplot import thinkstats2 def Clean(s):...
gpl-3.0
marcsans/cnn-physics-perception
phy/lib/python2.7/site-packages/sklearn/exceptions.py
14
4945
""" The :mod:`sklearn.exceptions` module includes all custom warnings and error classes used across scikit-learn. """ __all__ = ['NotFittedError', 'ChangedBehaviorWarning', 'ConvergenceWarning', 'DataConversionWarning', 'DataDimensionalityWarning', 'EfficiencyWarn...
mit
cycomachead/info290
lab6/michael_subm_1_2.py
2
2120
import numpy as np import pandas as pd from sklearn import ensemble train = pd.read_csv("train.csv") torig = pd.read_csv("test.csv") test = pd.read_csv("test.csv") rf = ensemble.RandomForestClassifier() # Convert Male / Female ==> 0 / 1 train = train.replace('male', 0) train = train.replace('female', 1) test = test....
bsd-2-clause
rgommers/statsmodels
statsmodels/sandbox/examples/ex_mixed_lls_timecorr.py
34
7824
# -*- coding: utf-8 -*- """Example using OneWayMixed with within group intertemporal correlation Created on Sat Dec 03 10:15:55 2011 Author: Josef Perktold This example constructs a linear model with individual specific random effects, and uses OneWayMixed to estimate it. This is a variation on ex_mixed_lls_0.py. ...
bsd-3-clause
m3rik/nn
CNTK/Assignment1_kinship/TODO1_kinship.py
1
5242
from Assignment1_kinship.kinship_data import kinship_dataset from cntk import Trainer, cntk_device, StreamConfiguration, learning_rate_schedule, UnitType from cntk.utils import * from cntk.device import cpu, set_default_device from cntk.learner import * from cntk.ops import * from cntk.tensor import * from cntk.axis i...
apache-2.0
Cophy08/ggplot
ggplot/stats/stat_hline.py
12
1317
from __future__ import (absolute_import, division, print_function, unicode_literals) import pandas as pd from ggplot.utils import pop, make_iterable, make_iterable_ntimes from ggplot.utils.exceptions import GgplotError from .stat import stat class stat_hline(stat): DEFAULT_PARAMS = {'geom...
bsd-2-clause
AnasGhrab/scikit-learn
setup.py
143
7364
#! /usr/bin/env python # # Copyright (C) 2007-2009 Cournapeau David <cournape@gmail.com> # 2010 Fabian Pedregosa <fabian.pedregosa@inria.fr> # License: 3-clause BSD descr = """A set of python modules for machine learning and data mining""" import sys import os import shutil from distutils.command.clean ...
bsd-3-clause
michigraber/scikit-learn
examples/neighbors/plot_approximate_nearest_neighbors_scalability.py
225
5719
""" ============================================ Scalability of Approximate Nearest Neighbors ============================================ This example studies the scalability profile of approximate 10-neighbors queries using the LSHForest with ``n_estimators=20`` and ``n_candidates=200`` when varying the number of sa...
bsd-3-clause
tequa/ammisoft
ammimain/WinPython-64bit-2.7.13.1Zero/python-2.7.13.amd64/Lib/site-packages/matplotlib/backends/backend_ps.py
10
61530
""" A PostScript backend, which can produce both PostScript .ps and .eps """ from __future__ import (absolute_import, division, print_function, unicode_literals) import six from six.moves import StringIO import glob, math, os, shutil, sys, time def _fn_name(): return sys._getframe(1).f_code.c...
bsd-3-clause
pypyrus/pypyrus
jupyter/config/jupyter_notebook_config.py
1
19505
#--- nbextensions configuration --- from jupyter_core.paths import jupyter_config_dir, jupyter_data_dir import os import sys # nbextensions # #data_dir = jupyter_data_dir() data_dir = os.path.join(os.getcwd(), 'jupyter', 'data') sys.path.append(os.path.join(data_dir, 'extensions')) c = get_config() c.NotebookApp.ser...
gpl-2.0
mxlei01/healthcareai-py
healthcareai/common/filters.py
4
3444
"""Filters This module contains filters for preprocessing data. Most operate on DataFrames and are named appropriately. """ from sklearn.base import TransformerMixin from pandas.core.frame import DataFrame from healthcareai.common.healthcareai_error import HealthcareAIError def validate_dataframe_input(possible_da...
mit
cbertinato/pandas
pandas/tests/io/parser/test_read_fwf.py
1
18906
""" Tests the 'read_fwf' function in parsers.py. This test suite is independent of the others because the engine is set to 'python-fwf' internally. """ from datetime import datetime from io import BytesIO, StringIO import numpy as np import pytest import pandas as pd from pandas import DataFrame, DatetimeIndex impor...
bsd-3-clause
tomlof/scikit-learn
sklearn/utils/graph.py
24
6326
""" 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
paladin74/neural-network-animation
matplotlib/tests/test_colorbar.py
9
9374
from __future__ import (absolute_import, division, print_function, unicode_literals) import six import numpy as np from numpy import ma import matplotlib from matplotlib.testing.decorators import image_comparison, cleanup import matplotlib.pyplot as plt from matplotlib import rcParams from mat...
mit
Haleyo/spark-tk
python/sparktk/frame/ops/histogram.py
13
4898
# 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
dsquareindia/scikit-learn
sklearn/cluster/birch.py
23
23648
# Authors: Manoj Kumar <manojkumarsivaraj334@gmail.com> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Joel Nothman <joel.nothman@gmail.com> # License: BSD 3 clause from __future__ import division import warnings import numpy as np from scipy import sparse from math import sqrt fro...
bsd-3-clause
boada/HETDEXCluster
legacy/stats/rejectOutliers_group.py
3
5612
import glob import pandas as pd import pylab as pyl from astLib import astCoords as aco from astLib import astStats as ast from astLib import astCalc as aca c = 2.99E5 # speed of light in km/s def parseResults(files): ''' Reads all of the results files and puts them into a list with the results. Returns field...
mit
JeffAbrahamson/UNA_compta
una_canonical.py
2
6371
#!/usr/bin/python3 """Convert the EBP or gnucash export to a canonical form. The input is a text export of the current year's books. """ import argparse import datetime import numpy as np import pandas as pd def get_data_ebp_v19(book_filename): """Fetch book data, return as a pandas DataFrame. Assume input...
gpl-3.0
CVML/scikit-learn
sklearn/ensemble/gradient_boosting.py
126
65552
"""Gradient Boosted Regression Trees This module contains methods for fitting gradient boosted regression trees for both classification and regression. The module structure is the following: - The ``BaseGradientBoosting`` base class implements a common ``fit`` method for all the estimators in the module. Regressio...
bsd-3-clause
fengzhyuan/scikit-learn
sklearn/preprocessing/tests/test_label.py
156
17626
import numpy as np from scipy.sparse import issparse from scipy.sparse import coo_matrix from scipy.sparse import csc_matrix from scipy.sparse import csr_matrix from scipy.sparse import dok_matrix from scipy.sparse import lil_matrix from sklearn.utils.multiclass import type_of_target from sklearn.utils.testing impor...
bsd-3-clause
infinnovation/piwall-cvtools
piwall.py
1
52153
#!/usr/bin/env python ''' Prototype .piwall generator to find monitor geometry from photograph of a piwall. Can operate sequentially on a set of photos to compare and contrast results. Commit Summary - Repeat test of the basic rectangle matching (c055d3a) against red backgrounds. - c055d3a Basic demonstra...
gpl-3.0
kmather73/ggplot
ggplot/scales/scale_y_continuous.py
12
1202
from __future__ import (absolute_import, division, print_function, unicode_literals) from .scale import scale from copy import deepcopy from matplotlib.pyplot import FuncFormatter dollar = lambda x, pos: '$%1.2f' % x currency = dollar comma = lambda x, pos: '{:0,d}'.format(int(x)) millions...
bsd-2-clause
eranchetz/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/rcsetup.py
69
23344
""" The rcsetup module contains the default values and the validation code for customization using matplotlib's rc settings. Each rc setting is assigned a default value and a function used to validate any attempted changes to that setting. The default values and validation functions are defined in the rcsetup module, ...
agpl-3.0
ibis-project/ibis
ibis/backends/dask/tests/execution/test_operations.py
1
30603
import operator from operator import methodcaller import dask.array as da import dask.dataframe as dd import numpy as np import numpy.testing as npt import pandas as pd import pytest from dask.dataframe.utils import tm import ibis import ibis.expr.datatypes as dt from ...execution import execute pytestmark = pytest...
apache-2.0
vivekmishra1991/scikit-learn
sklearn/linear_model/passive_aggressive.py
97
10879
# Authors: Rob Zinkov, Mathieu Blondel # License: BSD 3 clause from .stochastic_gradient import BaseSGDClassifier from .stochastic_gradient import BaseSGDRegressor from .stochastic_gradient import DEFAULT_EPSILON class PassiveAggressiveClassifier(BaseSGDClassifier): """Passive Aggressive Classifier Read mor...
bsd-3-clause
ceb8/astroquery
astroquery/hips2fits/core.py
1
17849
# -*- coding: utf-8 -* # Licensed under a 3-clause BSD style license - see LICENSE.rst from ..query import BaseQuery from ..utils.class_or_instance import class_or_instance from ..utils import async_to_sync from . import conf from astropy import wcs __all__ = ['hips2fits', 'hips2fitsClass'] __doctest_skip__ = ['hip...
bsd-3-clause
zihua/scikit-learn
sklearn/covariance/tests/test_robust_covariance.py
77
3825
# 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
ethen8181/machine-learning
big_data/sparkml/get_data.py
1
1071
import os import re import requests import pandas as pd def main(): file_path = 'adult.csv' if not os.path.isfile(file_path): def chunks(input_list, n_chunk): """take a list and break it up into n-size chunks""" for i in range(0, len(input_list), n_chunk): yield...
mit
tiamat-studios/pandascore-python
tests/test_lol.py
1
8074
import unittest import responses from pandascore import lol from tests.base_test import BaseTest class TestLeagueOfLegends(BaseTest): def setUp(self): super(TestLeagueOfLegends, self).setUp() self.lol = lol.LeagueOfLegends(access_token=self.access_token) @responses.activate def test_get_...
mit
jreback/pandas
pandas/tests/io/test_feather.py
3
6836
""" test feather-format compat """ from distutils.version import LooseVersion import numpy as np import pytest import pandas.util._test_decorators as td import pandas as pd import pandas._testing as tm from pandas.io.feather_format import read_feather, to_feather # isort:skip pyarrow = pytest.importorskip("pyarro...
bsd-3-clause
great-expectations/great_expectations
examples/expectations/column_map_expectation_template.py
1
8562
import json #!!! This giant block of imports should be something simpler, such as: # from great_exepectations.helpers.expectation_creation import * from great_expectations.execution_engine import ( PandasExecutionEngine, SparkDFExecutionEngine, SqlAlchemyExecutionEngine, ) from great_expectations.expectati...
apache-2.0
djgagne/scikit-learn
sklearn/metrics/regression.py
175
16953
"""Metrics to assess performance on regression task Functions named as ``*_score`` return a scalar value to maximize: the higher the better Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize: the lower the better """ # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Ma...
bsd-3-clause
khkaminska/bokeh
examples/plotting/file/boxplot.py
43
2269
import numpy as np import pandas as pd from bokeh.plotting import figure, show, output_file # Generate some synthetic time series for six different categories cats = list("abcdef") yy = np.random.randn(2000) g = np.random.choice(cats, 2000) for i, l in enumerate(cats): yy[g == l] += i // 2 df = pd.DataFrame(dict(s...
bsd-3-clause
johannfaouzi/pyts
pyts/approximation/sfa.py
1
6684
"""Code for Symbolic Fourier Approximation.""" # Author: Johann Faouzi <johann.faouzi@gmail.com> # License: BSD-3-Clause from sklearn.base import BaseEstimator from sklearn.pipeline import Pipeline from sklearn.utils.validation import check_is_fitted from .dft import DiscreteFourierTransform from .mcb import Multiple...
bsd-3-clause
chaluemwut/fbserver
venv/lib/python2.7/site-packages/sklearn/feature_extraction/tests/test_dict_vectorizer.py
8
3217
# Author: Lars Buitinck <L.J.Buitinck@uva.nl> # License: BSD 3 clause from random import Random import numpy as np import scipy.sparse as sp from numpy.testing import assert_array_equal from sklearn.utils.testing import (assert_equal, assert_in, assert_false, assert_true) from skle...
apache-2.0
hollabaq86/haikuna-matata
env/lib/python2.7/site-packages/nltk/tokenize/texttiling.py
7
16850
# Natural Language Toolkit: TextTiling # # Copyright (C) 2001-2017 NLTK Project # Author: George Boutsioukis # # URL: <http://nltk.org/> # For license information, see LICENSE.TXT import re import math try: import numpy except ImportError: pass from nltk.tokenize.api import TokenizerI BLOCK_COMPARISON, VOCA...
mit
mfjb/scikit-learn
examples/missing_values.py
233
3056
""" ====================================================== Imputing missing values before building an estimator ====================================================== This example shows that imputing the missing values can give better results than discarding the samples containing any missing value. Imputing does not ...
bsd-3-clause
atantet/ergoPack
example/plot/plotSpectrumUnfold.py
1
15008
import os import numpy as np import matplotlib.pyplot as plt import pylibconfig2 import ergoPlot ergoPlot.dpi = 2000 #configFile = '../cfg/OU2d.cfg' #compName1 = 'x_1' #compName2 = 'x_2' #configFile = '../cfg/Battisti1989.cfg' configFile = '../cfg/Suarez1988.cfg' compName1 = r'y' compName2 = r'y' #configFile = '../cf...
gpl-3.0
OpenElectronicsLab/eeg-mouse
src/generate_filter_coef.py
1
2331
#!/usr/bin/python import numpy as np from scipy import signal from matplotlib import pyplot as plt nyquest_freq = 250./2; # 7-14 Hz elliptic bandpass filter x_filter = signal.iirdesign( wp = [7./nyquest_freq, 14./nyquest_freq], ws = [4./nyquest_freq, 20./nyquest_freq], gstop=40, gpass=3, ftype='ellip' ) ...
gpl-3.0
dandanvidi/in-vivo-enzyme-kinetics
scripts/central_metabolism_vs_biosynthesis.py
3
3095
# -*- coding: utf-8 -*- """ Created on Wed Jun 1 10:48:23 2016 @author: dan """ from sklearn.cluster import KMeans from capacity_usage import CAPACITY_USAGE import matplotlib.pyplot as plt import pandas as pd import numpy as np from scipy.stats import ranksums def despine(ax, fontsize=15): ax.tick_params(right=0...
mit
tjd08a/open-catalog-generator
scripts/metrics.py
3
13286
#!/usr/bin/python #James Tobat, 2014 import json import sys import time #import matplotlib.pyplot as plt import csv import os.path # Command line arguments and global constants active_content_file = sys.argv[1] deployed_content_file = sys.argv[2] data_dir = sys.argv[3] metric_log_dir = sys.argv[4] date = time.strftime...
apache-2.0
samcervantes/scikit-learn-tutorials
statistical-learning-for-scientific-data-processing/setting-estimator-object/reshaping-dataset.py
1
1692
""" Scikit-learn requires an input dataset consisting of a 2D array of samples & features. The Digits dataset consists of a 3D array (1797, 8, 8) so it must first be transformed (shaped) into a 2D array. """ from sklearn import datasets from sklearn import svm digits = datasets.load_digits() print("The shape of the d...
bsd-3-clause
gifford-lab/bcbio-nextgen
bcbio/bam/coverage.py
7
6031
""" calculate coverage across a list of regions """ import os import six import matplotlib as mpl mpl.use('Agg', force=True) import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages import matplotlib import seaborn as sns import pandas as pd import pybedtools from bcbio.utils import rbind,...
mit
gerritholl/pyatmlab
pyatmlab/physics.py
1
36969
#!/usr/bin/env python # coding: utf-8 """Various small physics functions Mostly obtained from PyARTS """ import logging import numbers import datetime import calendar import itertools import numpy import scipy.interpolate import matplotlib import matplotlib.dates import numexpr import pyproj import pint from .c...
bsd-3-clause
chedeti/Bumpiness_Detector
aggregateBumpiness.py
2
2574
import numpy as np import matplotlib.pyplot as plt import matplotlib.font_manager import sys import collections import argparse ## Get user inputs and check if they are entered correctly parser = argparse.ArgumentParser() parser.add_argument("--featureFile", default="MBHxFeatures.npy") parser.add_argument("--outputFi...
mit
zhenwendai/RGP
autoreg/benchmark/run.py
1
2773
# Copyright (c) 2015, Zhenwen Dai # Licensed under the BSD 3-clause license (see LICENSE.txt) from __future__ import print_function from evaluation import RMSE from methods import Autoreg_onelayer, Autoreg_onelayer_bfgs from tasks import all_tasks from outputs import PickleOutput, CSV_Summary import numpy as np import...
bsd-3-clause
azjps/bokeh
examples/charts/server/interactive_excel.py
6
3225
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.io import curdoc from bokeh.layouts import row, column from bokeh.models import Paragraph wb = xw.Wo...
bsd-3-clause
HIPS/Kayak
examples/poisson_glm.py
3
1224
import numpy as np import numpy.random as npr import matplotlib.pyplot as plt import sys sys.path.append('..') import kayak N = 10000 D = 5 P = 1 learn = 0.00001 batch_size = 500 # Random inputs. X = npr.randn(N,D) true_W = npr.randn(D,P) lam = np.exp(np.dot(X, true_W)) Y = npr.poisson(lam) kyk_batcher = k...
mit
andyraib/data-storage
python_scripts/env/lib/python3.6/site-packages/pandas/io/common.py
7
14893
"""Common IO api utilities""" import sys import os import csv import codecs import mmap import zipfile from contextlib import contextmanager, closing from pandas.compat import StringIO, BytesIO, string_types, text_type from pandas import compat from pandas.formats.printing import pprint_thing from pandas.core.common ...
apache-2.0
skyglobe/geotop
tests/compare_version.py
2
9624
#!/usr/bin/env python # -*- coding: utf-8 -*-# # @(#)test_runner.py.in # # # Copyright (C) 2013, GC3, University of Zurich. All rights reserved. # # # 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 Foundatio...
gpl-3.0
wazeerzulfikar/scikit-learn
sklearn/cross_decomposition/tests/test_pls.py
24
14995
import numpy as np from numpy.testing import assert_approx_equal from sklearn.utils.testing import (assert_equal, assert_array_almost_equal, assert_array_equal, assert_true, assert_raise_message) from sklearn.datasets import load_linnerud from sklea...
bsd-3-clause
open2c/cooltools
tests/test_dotfinder_chunking.py
1
10245
# create a test for the chunking versions of 'get_adjusted_expected_tile_some_nans': import numpy as np import pandas as pd import os.path as op from cooltools import dotfinder from cooltools.lib.numutils import LazyToeplitz # adjust the path for data: testdir = op.realpath(op.dirname(__file__)) # mock input data...
mit
schevalier/Whetlab-Python-Client
examples/tutorial_example.py
1
1465
from sklearn.datasets import fetch_mldata data_set = fetch_mldata('yahoo-web-directory-topics') train_set = (data_set['data'][:1000],data_set['target'][:1000]) validation_set = (data_set['data'][1000:],data_set['target'][1000:]) parameters = { 'C':{'min':0.01, 'max':1000.0,'type':'float'}, 'degree':{'...
bsd-3-clause
pravsripad/mne-python
examples/preprocessing/plot_define_target_events.py
29
3376
""" ============================================================ Define target events based on time lag, plot evoked response ============================================================ This script shows how to define higher order events based on time lag between reference and target events. For illustration, we will...
bsd-3-clause
mhallsmoore/qstrader
tests/unit/system/rebalance/test_end_of_month_rebalance.py
1
1449
import pandas as pd import pytest import pytz from qstrader.system.rebalance.end_of_month import EndOfMonthRebalance @pytest.mark.parametrize( "start_date,end_date,pre_market,expected_dates,expected_time", [ ( '2020-03-11', '2020-12-31', False, [ '2020-03-31', '2020-04-30'...
mit
Abraxos/clustering_tsp_solver
tsp.py
1
27673
from re import compile from math import sqrt from collections import defaultdict from sys import maxsize from time import clock from itertools import product, permutations from sklearn.cluster import KMeans from sklearn.cluster import Birch from sklearn.cluster import DBSCAN from sklearn.cluster import AgglomerativeCl...
gpl-3.0
fbagirov/scikit-learn
examples/decomposition/plot_pca_vs_lda.py
182
1743
""" ======================================================= Comparison of LDA and PCA 2D projection of Iris dataset ======================================================= The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour and Virginica) with 4 attributes: sepal length, sepal width, petal length a...
bsd-3-clause
DanOlds/CATS
cats_v1.py
1
64341
from __future__ import print_function import sys from PyQt4 import QtCore, QtGui, uic import danfinitions as dan import os import glob import numpy as np import matplotlib.pyplot as plt import time from scipy.optimize import curve_fit import math import pandas as pd import warnings qtCreatorFile = "gui_cats_v1.ui" # ...
apache-2.0
gabrielcnr/sinteglas
df.py
1
4037
from PyQt4.QtCore import * from PyQt4.QtGui import * import pandas as pd import numpy as np class Column(object): def __init__(self, title, key, align='left', fmt='', cell_style_callback=None): self.title = title self.key = key self.align = align self.fmt = fmt ...
mit
bmmalone/pymisc-utils
setup.py
1
3066
from setuptools import find_packages, setup from setuptools.command.install import install as _install from setuptools.command.develop import develop as _develop import importlib ### # Console scripts ### console_scripts = [] ### # Dependencies ### install_requires = [ 'cython', 'dask[complete]', 'docopt...
mit
mfitzp/padua
padua/utils.py
1
9476
import numpy as np import scipy as sp import scipy.interpolate import requests from io import StringIO def qvalues(pv, m = None, verbose = False, lowmem = False, pi0 = None): """ Copyright (c) 2012, Nicolo Fusi, University of Sheffield All rights reserved. Estimates q-values from p-values Args ...
bsd-2-clause
Eric89GXL/scikit-learn
sklearn/linear_model/randomized_l1.py
8
22876
""" Randomized Lasso/Logistic: feature selection based on Lasso and sparse Logistic Regression """ # Author: Gael Varoquaux, Alexandre Gramfort # # License: BSD 3 clause import itertools from abc import ABCMeta, abstractmethod import numpy as np from scipy.sparse import issparse from scipy import sparse from scipy.in...
bsd-3-clause
richardwolny/sms-tools
lectures/09-Sound-description/plots-code/mfcc.py
25
1103
import numpy as np import matplotlib.pyplot as plt import essentia.standard as ess M = 1024 N = 1024 H = 512 fs = 44100 spectrum = ess.Spectrum(size=N) window = ess.Windowing(size=M, type='hann') mfcc = ess.MFCC(numberCoefficients = 12) x = ess.MonoLoader(filename = '../../../sounds/speech-male.wav', sampleRate = fs)(...
agpl-3.0
huzq/scikit-learn
sklearn/ensemble/_hist_gradient_boosting/tests/test_histogram.py
14
9004
import numpy as np import pytest from numpy.testing import assert_allclose from numpy.testing import assert_array_equal from sklearn.ensemble._hist_gradient_boosting.histogram import ( _build_histogram_naive, _build_histogram, _build_histogram_no_hessian, _build_histogram_root_no_hessian, _build_h...
bsd-3-clause
mingit/mstcp
arch/sim/test/buildtop/source/ns-3-dce/example/matplotlib-mptcp-lte-wifi-v6.py
2
1961
from matplotlib.pylab import * import time import numpy as np import subprocess # interaction mode needs to be turned off ion() fig = gcf() fig.canvas.set_window_title('Multipath TCP Throughput') while(True): # we'll limit ourselves to 5 seconds. clf() time.sleep (1) # lte with ope...
gpl-2.0
dr-nate/msmbuilder
msmbuilder/msm/core.py
10
22913
# Author: Robert McGibbon <rmcgibbo@gmail.com> # Contributors: # Copyright (c) 2014, Stanford University # All rights reserved. from __future__ import print_function, division, absolute_import import collections import numpy as np import scipy.linalg from scipy.sparse import csgraph, csr_matrix, coo_matrix from skle...
lgpl-2.1
fyffyt/scikit-learn
sklearn/ensemble/voting_classifier.py
178
8006
""" Soft Voting/Majority Rule classifier. This module contains a Soft Voting/Majority Rule classifier for classification estimators. """ # Authors: Sebastian Raschka <se.raschka@gmail.com>, # Gilles Louppe <g.louppe@gmail.com> # # Licence: BSD 3 clause import numpy as np from ..base import BaseEstimator f...
bsd-3-clause
elingg/tensorflow
tensorflow/contrib/learn/python/learn/estimators/__init__.py
6
11427
# 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
ningchi/scikit-learn
examples/text/document_clustering.py
31
8036
""" ======================================= 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
jinghaomiao/apollo
modules/tools/prediction/data_pipelines/cruise_models.py
3
5275
#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo 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...
apache-2.0
pompiduskus/scikit-learn
examples/ensemble/plot_voting_probas.py
316
2824
""" =========================================================== Plot class probabilities calculated by the VotingClassifier =========================================================== Plot the class probabilities of the first sample in a toy dataset predicted by three different classifiers and averaged by the `VotingC...
bsd-3-clause
BoltzmannBrain/nupic.research
projects/sequence_prediction/discrete_sequences/plotPerturbExperiment.py
5
3263
#!/usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2015, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions ...
agpl-3.0
huahbo/src
user/karl/rsf2numpy3.py
5
1730
#!/usr/bin/env python import rsf.api as rsf import numpy as np import scipy as sp import matplotlib.pyplot as plt import sys import os import c_m8r as c_rsf # next challenge is to get input file names from command line # use Msfin.c as example print "program name",sys.argv[0] print "type sys.argv=",type(sys.argv) if...
gpl-2.0
dotsdl/seaborn
seaborn/axisgrid.py
1
48212
from __future__ import division from itertools import product import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt from six import string_types from . import utils from .palettes import color_palette class Grid(object): """Base class for grids of subplots.""" _marg...
bsd-3-clause
mhue/scikit-learn
benchmarks/bench_multilabel_metrics.py
86
7286
#!/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
etsy/skyline
src/analyzer/algorithms.py
9
9794
import pandas import numpy as np import scipy import statsmodels.api as sm import traceback import logging from time import time from msgpack import unpackb, packb from redis import StrictRedis from settings import ( ALGORITHMS, CONSENSUS, FULL_DURATION, MAX_TOLERABLE_BOREDOM, MIN_TOLERABLE_LENGTH,...
mit
andrebrener/crypto_predictor
rsi.py
1
1655
# ============================================================================= # File: rsi.py # Author: Andre Brener # Created: 03 Jun 2017 # Last Modified: 07 Jun 2017 # Description: description # ============================================================================= import pandas as pd...
mit
stscieisenhamer/glue
glue/core/tests/test_pandas.py
1
2513
from __future__ import absolute_import, division, print_function import sys import numpy as np import pandas as pd from mock import MagicMock from pandas.util.testing import (assert_series_equal, assert_frame_equal) from ...external.six import PY3 from ..component import Component, De...
bsd-3-clause
smartscheduling/scikit-learn-categorical-tree
examples/mixture/plot_gmm_sin.py
248
2747
""" ================================= Gaussian Mixture Model Sine Curve ================================= This example highlights the advantages of the Dirichlet Process: complexity control and dealing with sparse data. The dataset is formed by 100 points loosely spaced following a noisy sine curve. The fit by the GMM...
bsd-3-clause
jrper/fluidity
tests/gls-Kato_Phillips-mixed_layer_depth/mixed_layer_depth_all.py
4
4600
#!/usr/bin/env python from numpy import arange,concatenate,array,argsort import os import sys import vtktools import math from pylab import * from matplotlib.ticker import MaxNLocator import re from scipy.interpolate import UnivariateSpline import glob #### taken from http://www.codinghorror.com/blog/archives/001018...
lgpl-2.1
ahill818/MetPy
examples/gridding/Find_Natural_Neighbors_Verification.py
3
2746
# Copyright (c) 2008-2016 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """ Find Natural Neighbors Verification =================================== Finding natural neighbors in a triangulation A triangle is a natural neighbor of a point if that po...
bsd-3-clause
BCCN-Prog/database
plotting.py
1
13274
import pandas as pd import numpy as np import matplotlib.pyplot as plt plt.style.use('ggplot') import operator import click import datetime import calendar from weather_loading import load_dataframe from scipy.stats import linregress from pylab import rcParams rcParams['figure.figsize'] = 20, 3 #setting plots size d...
bsd-3-clause