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
smukoehler/SDB-control
SDBmodel.py
1
1900
import os import sys from sklearn import linear_model import numpy import collections class SDBmodel: def __init__(self): self.clf = linear_model.Lasso(alpha=0.001 , max_iter=10000) self.input_data = [] self.state_data = [] def add_data(self, input_vector, state_vector): self.input_data.append( input_vector...
bsd-2-clause
jchodera/MSMs
code/sandbox/tica_kde.py
3
1065
from sklearn.covariance import EllipticEnvelope import sklearn.neighbors from sklearn.svm import OneClassSVM import os from msmbuilder import example_datasets, cluster, msm, featurizer, lumping, utils, dataset, decomposition sysname = os.path.split(os.getcwd())[-1] dt = 0.25 tica_lagtime = 400 regularization_string = ...
gpl-2.0
lcharleux/oscillators
oscillators/example_code/linear_oscillator_energy.py
1
1849
import numpy as np import matplotlib.pyplot as plt from scipy import integrate, misc, fftpack, ndimage from oscillators.oscillators import Oscillator, FindSteadyState # Inputs a = .01 # damping / mass omega0 = 1. # resonance pulsation omegad = 2. # drive pulsation def ep_func(x): return .5 * omega0**2 * x**2 def ...
gpl-2.0
shyamalschandra/scikit-learn
benchmarks/bench_plot_omp_lars.py
266
4447
"""Benchmarks of orthogonal matching pursuit (:ref:`OMP`) versus least angle regression (:ref:`least_angle_regression`) The input data is mostly low rank but is a fat infinite tail. """ from __future__ import print_function import gc import sys from time import time import numpy as np from sklearn.linear_model impo...
bsd-3-clause
trueyao/spark-lever
python/pyspark/sql/context.py
2
25683
# # 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
mrcslws/htmresearch
projects/capybara/sandbox/clustering/demo_online_clustering.py
8
5795
import random import time import numpy as np import scipy from htmresearch.frameworks.clustering.distances import kernel_dist from htmresearch.frameworks.clustering.online_agglomerative_clustering \ import OnlineAgglomerativeClustering from matplotlib import pyplot as plt from htmresearch.frameworks.capybara.unsupe...
agpl-3.0
keiserlab/e3fp-paper
e3fp_paper/plotting/defaults.py
1
1723
"""Defaults used for plotting. Author: Seth Axen E-mail: seth.axen@gmail.com """ from matplotlib import rc, rcParams try: import seaborn as sns sns.set_style("white") except ImportError: pass rcParams['text.latex.preamble'] = [r'\usepackage{siunitx}', r'\sisetup{detect-...
lgpl-3.0
AmineEch/BrainCNN
predict_categ.py
1
4720
from __future__ import print_function, division import matplotlib.pyplot as plt plt.interactive(False) from scipy.stats import pearsonr from keras.models import Sequential from keras.layers import Convolution2D from keras.layers import Dense, Dropout, Flatten, Activation from keras.layers.advanced_activations import L...
mit
christer155/PTVS
Python/Product/ML/ProjectTemplates/ClusteringTemplate/clustering.py
18
10394
''' This script perfoms the basic process for applying a machine learning algorithm to a dataset using Python libraries. The four steps are: 1. Download a dataset (using pandas) 2. Process the numeric data (using numpy) 3. Train and evaluate learners (using scikit-learn) 4. Plot and compare results...
apache-2.0
bugra/l1
l1/example/snp500.py
1
2499
from l1 import l1, strip_outliers from matplotlib import pyplot as plt import numpy as np import os plt.style.use('fivethirtyeight') _DATA_DIR = 'data' _FIG_DIR = 'figures' _SNP500_FILE_NAME = 'snp500.txt' _SNP500_FILE_PATH = os.path.join(_DATA_DIR, _SNP500_FILE_NAME) def get_signal(file_path=_SNP500_FILE_PATH): ...
apache-2.0
pratapvardhan/pandas
pandas/_version.py
5
16218
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains th...
bsd-3-clause
cactusbin/nyt
matplotlib/examples/api/line_with_text.py
6
1629
""" Show how to override basic methods so an artist can contain another artist. In this case, the line contains a Text instance to label it. """ import numpy as np import matplotlib.pyplot as plt import matplotlib.lines as lines import matplotlib.transforms as mtransforms import matplotlib.text as mtext class MyLine...
unlicense
terrychenism/caffe-windows-cudnn
python/detect.py
23
5743
#!/usr/bin/env python """ detector.py is an out-of-the-box windowed detector callable from the command line. By default it configures and runs the Caffe reference ImageNet model. Note that this model was trained for image classification and not detection, and finetuning for detection can be expected to improve results...
bsd-2-clause
IDEALLab/design_method_recommendation_JMD_2014
rec_utils.py
1
2681
''' Some helper functions to assist in the plotting and wrangling of data ''' import numpy as np import matplotlib.pylab as plt from matplotlib.ticker import MaxNLocator,AutoLocator almost_black = '#262626' def is_homogeneous(l): ''' Checks to see if a list has all identical entries ''' for i in rang...
apache-2.0
mattgiguere/doglodge
code/drive_bf_us_cities.py
1
3134
#!/usr/bin/env python """ PURPOSE: To scrape all the bf data for all US cities with more than 100k people. Created on 2015-09-22T21:29:50 """ from __future__ import division, print_function import sys import datetime import argparse import pandas as pd import splinter_scrape_bf as ssbf __author__ = "Matt Giguere ...
mit
YinongLong/scikit-learn
sklearn/semi_supervised/label_propagation.py
17
15941
# coding=utf8 """ Label propagation in the context of this module refers to a set of semisupervised classification algorithms. In the high level, these algorithms work by forming a fully-connected graph between all points given and solving for the steady-state distribution of labels at each point. These algorithms per...
bsd-3-clause
SciTools/iris
docs/iris/gallery_code/meteorology/plot_lagged_ensemble.py
2
5977
""" Seasonal Ensemble Model Plots ============================= This example demonstrates the loading of a lagged ensemble dataset from the GloSea4 model, which is then used to produce two types of plot: * The first shows the "postage stamp" style image with an array of 14 images, one for each ensemble member wit...
lgpl-3.0
h2oai/h2o-3
h2o-py/tests/testdir_algos/xgboost/pyunit_xgboost_reweight_tree.py
2
2701
from __future__ import print_function import sys sys.path.insert(1,"../../../") import h2o from h2o.estimators.xgboost import H2OXGBoostEstimator from tests import pyunit_utils from pandas.testing import assert_frame_equal import json import math def xgboost_reweight_tree(): prostate_frame = h2o.import_file(path=...
apache-2.0
david-hoffman/scripts
imreg.py
1
9130
# -*- coding: utf-8 -*- # imreg.py # Copyright (c) 2011-2014, Christoph Gohlke # Copyright (c) 2011-2014, The Regents of the University of California # Produced at the Laboratory for Fluorescence Dynamics # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are ...
apache-2.0
Nyker510/scikit-learn
sklearn/utils/random.py
234
10510
# Author: Hamzeh Alsalhi <ha258@cornell.edu> # # License: BSD 3 clause from __future__ import division import numpy as np import scipy.sparse as sp import operator import array from sklearn.utils import check_random_state from sklearn.utils.fixes import astype from ._random import sample_without_replacement __all__ =...
bsd-3-clause
mehdidc/scikit-learn
sklearn/linear_model/stochastic_gradient.py
4
50656
# Authors: Peter Prettenhofer <peter.prettenhofer@gmail.com> (main author) # Mathieu Blondel (partial_fit support) # # License: BSD 3 clause """Classification and regression using Stochastic Gradient Descent (SGD).""" import numpy as np import scipy.sparse as sp import warnings from abc import ABCMeta, abstr...
bsd-3-clause
DonBeo/scikit-learn
sklearn/feature_selection/tests/test_rfe.py
2
7885
""" Testing Recursive feature elimination """ import numpy as np from numpy.testing import assert_array_almost_equal, assert_array_equal from nose.tools import assert_equal, assert_true from scipy import sparse from sklearn.feature_selection.rfe import RFE, RFECV from sklearn.datasets import load_iris, make_friedman1...
bsd-3-clause
xwolf12/scikit-learn
sklearn/utils/__init__.py
132
14185
""" The :mod:`sklearn.utils` module includes various utilities. """ from collections import Sequence import numpy as np from scipy.sparse import issparse import warnings from .murmurhash import murmurhash3_32 from .validation import (as_float_array, assert_all_finite, ...
bsd-3-clause
russellclarke82/CV
Pi/NevinsMcTwis.py
1
10509
#!/usr/bin/python # PROJECT ON HOLD FOR NOW # # This needs to be completely objective and work with minimal # effort and config at best a list or URLs and some search terms. # Docs: https://www.crummy.com/software/BeautifulSoup/bs4/doc/ # Source 1: http://web.stanford.edu/~zlotnick/TextAsData/Web_Scraping_with_Beaut...
apache-2.0
sidgonuts/march-madness
sim_tournament.py
1
5495
# File: sim_tournament.py # Author: Siddhartha Nutulapati # # Goal: simulate a march madness tournament based solely on the seeding # of the inital teams, assuming that each team wins with a probability # proportional to the difference in seeding # Import required packages import csv import random import numpy as np i...
mit
alvations/Sensible-SemEval
paramsearch.py
2
1904
# -*- coding: utf-8 -*- from __future__ import print_function import io import random import sys from itertools import product try: import cPickle as pickle except: import pickle from sklearn import cross_validation from passage.preprocessing import Tokenizer from passage.layers import Embedding, GatedRecurrent,...
mit
ryfeus/lambda-packs
Sklearn_scipy_numpy/source/sklearn/datasets/tests/test_lfw.py
230
7880
"""This test for the LFW require medium-size data dowloading and processing If the data has not been already downloaded by running the examples, the tests won't run (skipped). If the test are run, the first execution will be long (typically a bit more than a couple of minutes) but as the dataset loader is leveraging ...
mit
cogmission/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/artist.py
69
33042
from __future__ import division import re, warnings import matplotlib import matplotlib.cbook as cbook from transforms import Bbox, IdentityTransform, TransformedBbox, TransformedPath from path import Path ## Note, matplotlib artists use the doc strings for set and get # methods to enable the introspection methods of ...
agpl-3.0
victorbergelin/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
lthurlow/Network-Grapher
proj/external/matplotlib-1.2.1/build/lib.linux-i686-2.7/matplotlib/testing/jpl_units/StrConverter.py
6
5174
#=========================================================================== # # StrConverter # #=========================================================================== """StrConverter module containing class StrConverter.""" #=========================================================================== # Place al...
mit
rishita/mxnet
example/kaggle-ndsb1/submission_dsb.py
15
4287
from __future__ import print_function import pandas as pd import os import time as time ## Receives an array with probabilities for each class (columns) X images in test set (as listed in test.lst) and formats in Kaggle submission format, saves and compresses in submission_path def gen_sub(predictions,test_lst_path="...
apache-2.0
tkarna/cofs
test/firedrake/test_divergence_2d.py
1
5049
""" Tests convergence of div(uv) in 2D """ from firedrake import * from thetis.utility import get_functionspace import numpy from scipy import stats import os op2.init(log_level=WARNING) def compute(refinement=1, order=1, do_export=False): print('--- soving refinement {:}'.format(refinement)) n = 5*refinemen...
mit
StevePny/NOAA-GFDL-MOM6-examples
tools/analysis/VerticalSplitScale.py
2
7428
from __future__ import unicode_literals import numpy as np from numpy import ma from matplotlib import scale as mscale from matplotlib import transforms as mtransforms from matplotlib.ticker import Formatter, FixedLocator, MaxNLocator, AutoLocator class VerticalSplitScale(mscale.ScaleBase): """ Scales data i...
gpl-3.0
datapythonista/pandas
pandas/tests/indexes/categorical/test_append.py
3
2191
import pytest from pandas import ( CategoricalIndex, Index, ) import pandas._testing as tm class TestAppend: @pytest.fixture def ci(self): categories = list("cab") return CategoricalIndex(list("aabbca"), categories=categories, ordered=False) def test_append(self, ci): # a...
bsd-3-clause
egalli/Node-DC-EIS
Node-DC-EIS-client/runspec.py
1
54186
#!/usr/bin/python # 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 required by applicable...
apache-2.0
pratiknarang/peershark
plotGraphs.py
2
1498
import numpy import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import pylab import os import multiprocessing as MP from P2P_CONSTANTS import * def plotGraph(x, y, z, filename): v = [0,5000,0,200] plt.axis(v) plt.scatter(x, y, alpha = 0.10, cmap=plt.cm.cool, edgecolors='None') # plt.colorbar()...
mit
Tjorriemorrie/trading
06_randomforests/minmax/predict.py
1
3710
import logging import pandas as pd import numpy as np from pprint import pprint from sklearn import cross_validation, externals from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifier from sklearn.preprocessing import scale, MinMaxScaler from progressbar import ProgressBar currencies = [ 'GBPUSD...
mit
webmasterraj/FogOrNot
flask/lib/python2.7/site-packages/pandas/io/common.py
4
4935
"""Common IO api utilities""" import sys import os import zipfile from contextlib import contextmanager, closing from pandas.compat import StringIO, string_types, BytesIO from pandas import compat if compat.PY3: from urllib.request import urlopen, pathname2url _urlopen = urlopen from urllib.parse import...
gpl-2.0
dinos66/termAnalysis
forTateDataset/clusterEvolutionDetection.py
1
19992
# -*- coding: utf-8 -*- ''' Term cluster evolution detection ''' print('Term cluster evolution detection and term similarity estimation') #-------------------------------------------- import glob, pickle, pprint, random, re, itertools, time, os from nltk.corpus import wordnet as wn from itertools import product impo...
apache-2.0
IPGP/DSM-Kernel
examples/single_kernel/simple_plot_kernel.py
1
2675
#!/usr/bin/env python """ This is a very simple plot script that reads a 3D DSM-Kernel sensitivity kernel file and make a plot of it. """ import matplotlib.pyplot as plt import numpy as np def read_fortran_record(binfile, count, dtype): """reads a sequential fortran binary file record""" rec_start = np.fromfi...
gpl-3.0
awickert/river-network-evolution
ThreeChannels_generalizing.py
1
17224
#from __future__ import division import numpy as np from scipy.sparse import spdiags, block_diag from scipy.sparse.linalg import spsolve, isolve from matplotlib import pyplot as plt import copy class rnet(object): def __init__(self): pass def sediment__discharge_per_unit_width(self): """ Compute q_s ...
gpl-3.0
wanggang3333/scikit-learn
sklearn/ensemble/forest.py
176
62555
"""Forest of trees-based ensemble methods Those methods include random forests and extremely randomized trees. The module structure is the following: - The ``BaseForest`` base class implements a common ``fit`` method for all the estimators in the module. The ``fit`` method of the base ``Forest`` class calls the ...
bsd-3-clause
rishikksh20/scikit-learn
examples/missing_values.py
71
3055
""" ====================================================== 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
schets/scikit-learn
examples/linear_model/plot_sgd_comparison.py
167
1659
""" ================================== Comparing various online solvers ================================== An example showing how different online solvers perform on the hand-written digits dataset. """ # Author: Rob Zinkov <rob at zinkov dot com> # License: BSD 3 clause import numpy as np import matplotlib.pyplot a...
bsd-3-clause
louisLouL/pair_trading
capstone_env/lib/python3.6/site-packages/pandas/core/config.py
11
22966
""" The config module holds package-wide configurables and provides a uniform API for working with them. Overview ======== This module supports the following requirements: - options are referenced using keys in dot.notation, e.g. "x.y.option - z". - keys are case-insensitive. - functions should accept partial/regex k...
mit
dgwakeman/mne-python
examples/inverse/plot_lcmv_beamformer_volume.py
18
3046
""" =================================================================== Compute LCMV inverse solution on evoked data in volume source space =================================================================== Compute LCMV inverse solution on an auditory evoked dataset in a volume source space. It stores the solution in...
bsd-3-clause
ryfeus/lambda-packs
Sklearn_scipy_numpy/source/numpy/lib/twodim_base.py
83
26903
""" Basic functions for manipulating 2d arrays """ from __future__ import division, absolute_import, print_function from numpy.core.numeric import ( asanyarray, arange, zeros, greater_equal, multiply, ones, asarray, where, int8, int16, int32, int64, empty, promote_types, diagonal, ) from numpy.core import...
mit
huobaowangxi/scikit-learn
examples/neighbors/plot_approximate_nearest_neighbors_hyperparameters.py
227
5170
""" ================================================= Hyper-parameters of Approximate Nearest Neighbors ================================================= This example demonstrates the behaviour of the accuracy of the nearest neighbor queries of Locality Sensitive Hashing Forest as the number of candidates and the numb...
bsd-3-clause
simonsfoundation/CaImAn
caiman/source_extraction/cnmf/spatial.py
1
42586
#!/usr/bin/env python """ Created on Wed Aug 05 20:38:27 2015 # -*- coding: utf-8 -*- @author: agiovann """ # noinspection PyCompatibility from past.builtins import basestring from past.utils import old_div from builtins import zip from builtins import map from builtins import str from builtins import range import ...
gpl-2.0
nhejazi/scikit-learn
examples/neighbors/plot_digits_kde_sampling.py
108
2026
""" ========================= Kernel Density Estimation ========================= This example shows how kernel density estimation (KDE), a powerful non-parametric density estimation technique, can be used to learn a generative model for a dataset. With this generative model in place, new samples can be drawn. These...
bsd-3-clause
Denvi/FlatCAM
tests/other/test_plotg.py
1
1609
from shapely.geometry import LineString, Polygon from shapely.ops import cascaded_union, unary_union from matplotlib.pyplot import plot, subplot, show from camlib import * def plotg2(geo, solid_poly=False, color="black", linestyle='solid'): try: for sub_geo in geo: plotg2(sub_geo, solid_poly=...
mit
tjctw/PythonNote
thinkstat/descriptive.py
3
4308
"""This file contains code used in "Think Stats", by Allen B. Downey, available from greenteapress.com Copyright 2010 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ import first import math import Pmf import survey import thinkstats import matplotlib.pyplot as pyplot import myplot def ...
cc0-1.0
imaculate/scikit-learn
doc/datasets/mldata_fixture.py
367
1183
"""Fixture module to skip the datasets loading when offline Mock urllib2 access to mldata.org and create a temporary data folder. """ from os import makedirs from os.path import join import numpy as np import tempfile import shutil from sklearn import datasets from sklearn.utils.testing import install_mldata_mock fr...
bsd-3-clause
h2oai/h2o-dev
h2o-py/h2o/model/model_base.py
2
60005
# -*- encoding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals import os import traceback import warnings import h2o from h2o.exceptions import H2OValueError from h2o.job import H2OJob from h2o.utils.backward_compatibility import backwards_compatible from h2o.utils.compat...
apache-2.0
microsoft/EconML
econml/dml/dml.py
1
68549
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from warnings import warn import numpy as np from sklearn.base import TransformerMixin, clone from sklearn.exceptions import NotFittedError from sklearn.linear_model import (ElasticNetCV, LassoCV, LogisticRegressionCV) from ...
mit
snurkabill/pydeeplearn
code/similarity/similarityUtils.py
3
18752
""" Utils for the similarity experiments. """ __author__ = "Mihaela Rosca" __contact__ = "mihaela.c.rosca@gmail.com" from sklearn import cross_validation import matplotlib.pyplot as plt import itertools import sys # We need this to import other modules sys.path.append("..") from read.readfacedatabases import * DEBU...
bsd-3-clause
jacksapper/math-thesis
ode.py
1
2110
# -*- coding: utf-8 -*- #---IMPORTS--- import numpy as np import matplotlib.pyplot as plt #---CONSTANTS--- LBOUND = 0. UBOUND = 1. POINTS = 2**7 EPSILON = 10**-9 INITIAL = (0,1) #Matrix is O(POINTS**2) #---DERIVED CONSTANTS--- INTERVAL_LENGTH = (UBOUND-LBOUND)/(POINTS-1) D0 = .5*(np.eye(POINTS-1,POINTS) \ + np.roll(n...
gpl-3.0
rmackay9/rmackay9-ardupilot
Tools/FilterTestTool/FilterTest.py
30
22307
#!/usr/bin/env python # -*- coding: utf-8 -*- """ ArduPilot IMU Filter Test Class 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 versi...
gpl-3.0
openai/baselines
baselines/logger.py
1
14802
import os import sys import shutil import os.path as osp import json import time import datetime import tempfile from collections import defaultdict from contextlib import contextmanager DEBUG = 10 INFO = 20 WARN = 30 ERROR = 40 DISABLED = 50 class KVWriter(object): def writekvs(self, kvs): raise NotImpl...
mit
eternallyBaffled/itrade
itrade_wxabout.py
1
8673
#!/usr/bin/env python # ============================================================================ # Project Name : iTrade # Module Name : itrade_wxabout.py # # Description: wxPython About box # # The Original Code is iTrade code (http://itrade.sourceforge.net). # # The Initial Developer of the Original Cod...
gpl-3.0
m-kostrzewa/FuzzyCarRisk
gui.py
1
16811
#!/usr/bin/env python3 """ author: Kamil Cukrowski, 2016 """ from tkinter import * import tkinter import tkinter.ttk from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg import matplotlib.pyplot as plt from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg import numpy as ...
mit
akionakamura/scikit-learn
examples/manifold/plot_swissroll.py
330
1446
""" =================================== Swiss Roll reduction with LLE =================================== An illustration of Swiss Roll reduction with locally linear embedding """ # Author: Fabian Pedregosa -- <fabian.pedregosa@inria.fr> # License: BSD 3 clause (C) INRIA 2011 print(__doc__) import matplotlib.pyplot...
bsd-3-clause
ekumenlabs/terminus
terminus/generators/street_plot_generator.py
1
2486
""" Copyright (C) 2017 Open Source Robotics Foundation 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
NicovincX2/Python-3.5
Analyse (mathématiques)/Analyse numérique/Interpolation numérique/Interpolation spatiale/reg_grid_inter.py
1
1862
# -*- coding: utf-8 -*- import os import matplotlib as mpl mpl.rcParams["font.family"] = "serif" mpl.rcParams["font.size"] = "12" import numpy as np from numpy import polynomial as P from scipy import interpolate import matplotlib.pyplot as plt from scipy import linalg x = y = np.linspace(-2, 2, 10) def f(x, y): ...
gpl-3.0
felipebetancur/scipy
doc/source/tutorial/stats/plots/kde_plot3.py
132
1229
import numpy as np import matplotlib.pyplot as plt from scipy import stats np.random.seed(12456) x1 = np.random.normal(size=200) # random data, normal distribution xs = np.linspace(x1.min()-1, x1.max()+1, 200) kde1 = stats.gaussian_kde(x1) kde2 = stats.gaussian_kde(x1, bw_method='silverman') fig = plt.figure(figsi...
bsd-3-clause
nhejazi/scikit-learn
sklearn/mixture/tests/test_gaussian_mixture.py
27
40216
# Author: Wei Xue <xuewei4d@gmail.com> # Thierry Guillemot <thierry.guillemot.work@gmail.com> # License: BSD 3 clauseimport warnings import sys import warnings import numpy as np from scipy import stats, linalg from sklearn.covariance import EmpiricalCovariance from sklearn.datasets.samples_generator import...
bsd-3-clause
Lawrence-Liu/scikit-learn
sklearn/datasets/mlcomp.py
289
3855
# Copyright (c) 2010 Olivier Grisel <olivier.grisel@ensta.org> # License: BSD 3 clause """Glue code to load http://mlcomp.org data as a scikit.learn dataset""" import os import numbers from sklearn.datasets.base import load_files def _load_document_classification(dataset_path, metadata, set_=None, **kwargs): if ...
bsd-3-clause
google/gcnn-survey-paper
utils/link_prediction_utils.py
1
3591
#Copyright 2018 Google 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 # # https://www.apache.org/licenses/LICENSE-2.0 # #Unless required by applicable law or agreed to in writing, softwa...
apache-2.0
winklerand/pandas
pandas/tests/frame/test_alter_axes.py
2
43964
# -*- coding: utf-8 -*- from __future__ import print_function import inspect import pytest from datetime import datetime, timedelta import numpy as np from pandas.compat import lrange, PY2 from pandas import (DataFrame, Series, Index, MultiIndex, RangeIndex, date_range, IntervalIndex, ...
bsd-3-clause
lixun910/pysal
pysal/model/spvcm/custom_plots/svcp.py
2
1686
import matplotlib.pyplot as plt import seaborn as sns import numpy as np def corrplot(m, burn=0, thin=None, percentiles=[25,50,75], support=np.linspace(.001,1,num=1000), figure_kw=None, plot_kw=None, kde_kw=None): if figure_kw is None: figure_kw = {'figsize':(2.1*8,8), 'sharey':Tr...
bsd-3-clause
clemkoa/scikit-learn
sklearn/neural_network/tests/test_stochastic_optimizers.py
146
4310
import numpy as np from sklearn.neural_network._stochastic_optimizers import (BaseOptimizer, SGDOptimizer, AdamOptimizer) from sklearn.utils.testing import (assert_array_equal, assert_true, ...
bsd-3-clause
nelango/ViralityAnalysis
model/lib/pandas/io/tests/test_clipboard.py
13
3748
import numpy as np from numpy.random import randint import nose import pandas as pd from pandas import DataFrame from pandas import read_clipboard from pandas import get_option from pandas.util import testing as tm from pandas.util.testing import makeCustomDataframe as mkdf, disabled try: import pandas.util.cli...
mit
brguez/TEIBA
src/python/prepareHistology.py
1
2762
#!/usr/bin/env python #coding: utf-8 def header(string): """ Display header """ timeInfo = time.strftime("%Y-%m-%d %H:%M") print '\n', timeInfo, "****", string, "****" def info(string): """ Display basic information """ timeInfo = time.strftime("%Y-%m-%d %H:%M") print ...
gpl-3.0
molpopgen/fwdpy11
examples/python_genetic_values/pysnowdrift.py
1
3865
""" Simulates the dynamics of Figure 1A from DOI: 10.1126/science.1101456. Final output is a plot of the phenotypes over time, based on sampling every 100 generations. """ import math import sys import attr import matplotlib.pyplot as plt import numpy as np import fwdpy11 @attr.s() class PySnowdrift(fwdpy11.PyDipl...
gpl-3.0
jseabold/scikit-learn
sklearn/utils/setup.py
296
2884
import os from os.path import join from sklearn._build_utils import get_blas_info def configuration(parent_package='', top_path=None): import numpy from numpy.distutils.misc_util import Configuration config = Configuration('utils', parent_package, top_path) config.add_subpackage('sparsetools') ...
bsd-3-clause
mbayon/TFG-MachineLearning
vbig/lib/python2.7/site-packages/pandas/tests/series/test_validate.py
7
1058
import pytest from pandas.core.series import Series class TestSeriesValidate(object): """Tests for error handling related to data types of method arguments.""" s = Series([1, 2, 3, 4, 5]) def test_validate_bool_args(self): # Tests for error handling related to boolean arguments. invalid_v...
mit
oliverlee/antlia
python/antlia/trial.py
1
10206
# -*- coding: utf-8 -*- import numpy as np import scipy.signal import matplotlib.pyplot as plt import seaborn as sns from antlia.filter import fft from antlia.pattern import ExtremaList, SteerEvent, window class Trial(object): def __init__(self, data, period): self.data = data self.period...
bsd-2-clause
WuShichao/computational-physics
2/2_6/2_6.py
1
2826
# -*- coding: utf-8 -*- """ Created on Wed Jan 13 14:17:40 2016 欧拉法计算无空气阻力和有空气阻力时炮弹的弹道 @author: nightwing """ from math import cos,sin,sqrt,pi import matplotlib.pyplot as plt g = 9.8 #重力加速度(m/s2) dt = 0.01 #时间间隔(s) v0 = 700.0 #初始速度(m/s) k = 4*10**(-5) #B2/m(m-1) trajectory1 = [] #此列表存储无空气阻力时的弹...
gpl-3.0
emilybache/texttest-runner
src/main/python/lib/default/batch/testoverview.py
1
40966
# Code to generate HTML report of historical information. This report generated # either via the -coll flag, or via -s 'batch.GenerateHistoricalReport <batchid>' import os, plugins, time, HTMLgen, HTMLcolors, cgi, sys, logging, jenkinschanges, locale from cPickle import Unpickler, UnpicklingError from ordereddict impo...
mit
jaredwo/topowx
scripts/step07_update_stn_loc.py
1
2436
''' Script to update locations of stations that failed location quality assurance and had their location manually corrected. ''' from twx.db import StationDataDb, build_por_mask, LON, LAT, ELEV from twx.qa import LocQA from twx.utils import TwxConfig import numpy as np import os import pandas as pd if __name__ == '__...
gpl-3.0
soulmachine/scikit-learn
sklearn/decomposition/tests/test_pca.py
1
11194
import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_rai...
bsd-3-clause
tavo91/NER-WNUT17
main.py
1
5169
import numpy as np seed_number = 1337 np.random.seed(seed_number) from common import utilities as utils from common import representation as rep from models import network from models import crf from settings import * from sklearn.metrics import confusion_matrix from sklearn.metrics import classification_report def ...
mit
andyraib/data-storage
python_scripts/env/lib/python3.6/site-packages/matplotlib/tri/triplot.py
21
3124
from __future__ import (absolute_import, division, print_function, unicode_literals) import six import numpy as np from matplotlib.tri.triangulation import Triangulation def triplot(ax, *args, **kwargs): """ Draw a unstructured triangular grid as lines and/or markers. The triang...
apache-2.0
luisera/hmtk
hmtk/plotting/seismicity/max_magnitude/cumulative_moment.py
2
3482
#!/usr/bin/env/python # LICENSE # # Copyright (c) 2010-2013, GEM Foundation, G. Weatherill, M. Pagani, D. Monelli # # The Hazard Modeller's Toolkit (hmtk) is free software: you can redistribute # it and/or modify it under the terms of the GNU Affero General Public License # as published by the Free Software Foundation,...
agpl-3.0
chugunovyar/factoryForBuild
env/lib/python2.7/site-packages/matplotlib/tri/triplot.py
21
3124
from __future__ import (absolute_import, division, print_function, unicode_literals) import six import numpy as np from matplotlib.tri.triangulation import Triangulation def triplot(ax, *args, **kwargs): """ Draw a unstructured triangular grid as lines and/or markers. The triang...
gpl-3.0
zrhans/pythonanywhere
.virtualenvs/django19/lib/python3.4/site-packages/pandas/tests/test_nanops.py
9
40509
# -*- coding: utf-8 -*- from __future__ import division, print_function from functools import partial import warnings import numpy as np from pandas import Series from pandas.core.common import isnull, is_integer_dtype import pandas.core.nanops as nanops import pandas.util.testing as tm use_bn = nanops._USE_BOTTLENE...
apache-2.0
bthirion/nistats
examples/04_low_level_functions/plot_hrf.py
1
2356
"""Example of hemodynamic reponse functions. ========================================= Plot the hemodynamic reponse function (hrf) model in SPM together with the hrf shape proposed by G.Glover, as well as their time and dispersion derivatives. Requires matplotlib. The hrf is the filter that couples neural responses ...
bsd-3-clause
arahuja/scikit-learn
examples/linear_model/plot_polynomial_interpolation.py
251
1895
#!/usr/bin/env python """ ======================== Polynomial interpolation ======================== This example demonstrates how to approximate a function with a polynomial of degree n_degree by using ridge regression. Concretely, from n_samples 1d points, it suffices to build the Vandermonde matrix, which is n_samp...
bsd-3-clause
fspaolo/scikit-learn
sklearn/svm/tests/test_sparse.py
5
10546
import warnings from nose.tools import assert_raises, assert_true, assert_false import numpy as np from scipy import sparse from numpy.testing import (assert_array_almost_equal, assert_array_equal, assert_equal) from sklearn import datasets, svm, linear_model, base from sklearn.datasets imp...
bsd-3-clause
wasserfeder/lomap
examples/ijrr2014_rec_hor/view.py
1
6104
#! /usr/bin/env python # Copyright (C) 2012-2015, Alphan Ulusoy (alphan@bu.edu) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any late...
gpl-2.0
Batch21/pywr
examples/two_reservoir_moea.py
1
8981
""" This example shows the trade-off (pareto frontier) of deficit against cost by altering a reservoir control curve. Two types of control curve are possible. The first is a monthly control curve containing one value for each month. The second is a harmonic control curve with cosine terms around a mean. Both Parameter...
gpl-3.0
neale/CS-program
434-MachineLearning/final_project/linearClassifier/sklearn/linear_model/__init__.py
83
3139
""" The :mod:`sklearn.linear_model` module implements generalized linear models. It includes Ridge regression, Bayesian Regression, Lasso and Elastic Net estimators computed with Least Angle Regression and coordinate descent. It also implements Stochastic Gradient Descent related algorithms. """ # See http://scikit-le...
unlicense
mlskit/astromlskit
GMM/EMC/demo.py
1
1989
import csv import os import sys import numpy as np import matplotlib.pyplot as plt from algorithm import EM import argparse def line_plot(data_arrays, xlabel, ylabel, labels, title, f): """ Plots a scatter chart. Parameters ---------- data_arrays: 2d numpy array Data to be plotted. This a...
gpl-3.0
MechCoder/scikit-learn
sklearn/tree/tests/test_tree.py
17
64758
""" Testing for the tree module (sklearn.tree). """ import copy import pickle from functools import partial from itertools import product import struct import numpy as np from scipy.sparse import csc_matrix from scipy.sparse import csr_matrix from scipy.sparse import coo_matrix from sklearn.random_projection import s...
bsd-3-clause
bikong2/scikit-learn
sklearn/feature_selection/tests/test_chi2.py
221
2398
""" Tests for chi2, currently the only feature selection function designed specifically to work with sparse matrices. """ import numpy as np from scipy.sparse import coo_matrix, csr_matrix import scipy.stats from sklearn.feature_selection import SelectKBest, chi2 from sklearn.feature_selection.univariate_selection im...
bsd-3-clause
Yangqing/caffe
examples/web_demo/app.py
10
7400
import os import time import cPickle import datetime import logging import flask import werkzeug import optparse import tornado.wsgi import tornado.httpserver import numpy as np import pandas as pd from PIL import Image as PILImage import cStringIO as StringIO import urllib import caffe import exifutil REPO_DIRNAME = ...
bsd-2-clause
gingi99/research_dr
python/Experiment/ExperimentsStats.py
1
17116
# coding: utf-8 # python 3.5 from itertools import product from sklearn.metrics import accuracy_score from multiprocessing import Pool from multiprocessing import freeze_support import numpy as np import sys import os sys.path.append(os.path.dirname(os.path.abspath("__file__"))+'/../MLEM2') #sys.path.append('/Users/ook...
mit
msracver/Deformable-ConvNets
lib/dataset/pycocotools/coco.py
5
18005
__author__ = 'tylin' __version__ = '1.0.1' # Interface for accessing the Microsoft COCO dataset. # Microsoft COCO is a large image dataset designed for object detection, # segmentation, and caption generation. pycocotools is a Python API that # assists in loading, parsing and visualizing the annotations in COCO. # Ple...
mit
lostcontrol/msp_tools
msp_vibration/msp_vibration.py
1
7817
#!/usr/bin/python # msp_vibration - vibration analyzer for Cleanflight # Copyright (C) 2016 - Cyril Jaquier # # 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...
gpl-3.0
jmschrei/scikit-learn
benchmarks/bench_plot_neighbors.py
287
6433
""" Plot the scaling of the nearest neighbors algorithms with k, D, and N """ from time import time import numpy as np import pylab as pl from matplotlib import ticker from sklearn import neighbors, datasets def get_data(N, D, dataset='dense'): if dataset == 'dense': np.random.seed(0) return np....
bsd-3-clause