repo_name
stringlengths
6
67
path
stringlengths
5
185
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
1.02k
962k
license
stringclasses
15 values
CarterBain/AlephNull
tests/risk/answer_key.py
3
11125
# # Copyright 2013 Quantopian, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
apache-2.0
yvlasov/ConProbIN
try-ml/plot_regression.py
1
1435
#!/usr/bin/python """ ============================ Nearest Neighbors regression ============================ Demonstrate the resolution of a regression problem using a k-Nearest Neighbor and the interpolation of the target using both barycenter and constant weights. """ print(__doc__) # Author: Alexandre Gramfort <a...
mit
Aasmi/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
ua-snap/downscale
snap_scripts/baseline_climatologies/cru_cl20_climatology_preprocess_2km.py
1
7559
# # # PREPROCESS CRU CL20 1961-1990 CLIMATOLOGY DATA (http://www.cru.uea.ac.uk/cru/data/hrg/tmc) # # author: Michael Lindgren (malindgren@alaska.edu) -- Sept. 2016 # # # # import numpy as np def xyz_to_grid( x, y, z, xi, yi, method='linear', output_dtype=np.float32 ): ''' interpolate points to a grid. simple wrappe...
mit
rueberger/brio
brio/misc/plotting.py
1
11003
""" This model contains various plotting utilities """ import time import itertools import numpy as np import seaborn as sns import matplotlib.pyplot as plt import matplotlib as mpl import string from .sta import auto_sta, factor from brio.blocks.layer import LIFLayer plt.ion() SEAMAP = mpl.colors.ListedColormap(sns....
gpl-2.0
vrv/tensorflow
tensorflow/contrib/learn/python/learn/tests/dataframe/feeding_queue_runner_test.py
62
5053
# Copyright 2015 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
ssaeger/scikit-learn
sklearn/utils/multiclass.py
40
12966
# Author: Arnaud Joly, Joel Nothman, Hamzeh Alsalhi # # License: BSD 3 clause """ Multi-class / multi-label utility function ========================================== """ from __future__ import division from collections import Sequence from itertools import chain from scipy.sparse import issparse from scipy.sparse....
bsd-3-clause
jdanbrown/pydatalab
google/datalab/bigquery/_schema.py
5
12449
# Copyright 2015 Google Inc. 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 applicable law or agreed ...
apache-2.0
schreiberx/sweet
benchmarks_sphere/paper_jrn_sl_exp/test_compare_wt_dt_vs_accuracy_galewsky_M512_6hours_l_n_uv/postprocessing_consolidate_prog_vrt.py
8
6177
#! /usr/bin/env python3 import sys import math from mule.plotting.Plotting import * from mule.postprocessing.JobsData import * from mule.postprocessing.JobsDataConsolidate import * sys.path.append('../') import pretty_plotting as pp sys.path.pop() mule_plotting_usetex(False) groups = ['runtime.timestepping_method'...
mit
QuLogic/vispy
vispy/testing/__init__.py
21
2415
# -*- coding: utf-8 -*- # Copyright (c) 2015, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. """ Testing ======= This module provides functions useful for running tests in vispy. Tests can be run in a few ways: * From Python, you can import ``vispy`` and do ``vis...
bsd-3-clause
madjelan/Data-Science-45min-Intros
ml-basis-expansion-101/kernel.py
347
5100
""" =================================== Simple 1D Kernel Density Estimation =================================== This example uses the :class:`sklearn.neighbors.KernelDensity` class to demonstrate the principles of Kernel Density Estimation in one dimension. The first plot shows one of the problems with using histogram...
unlicense
jkleve/Optimization-Algorithms
utils/plot_utils.py
1
2558
import matplotlib.pyplot as plt # plotting import matplotlib.mlab as mlab import numpy as np np.seterr(divide='ignore', invalid='ignore') # TODO FIX!!! import sys sys.path.append("../functions") import rosenbrock_function class PlotUtils: def __init__(self, num_dims, bounds, func): # you can only plot u...
mit
davidnmurray/iris
lib/iris/tests/unit/plot/test_pcolor.py
1
2423
# (C) British Crown Copyright 2014 - 2016, Met Office # # This file is part of Iris. # # Iris is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option) any l...
gpl-3.0
brucexiaok/HyperLPR
hyperlpr/segmentation.py
1
9655
#coding=utf-8 import cv2 import numpy as np # from matplotlib import pyplot as plt import scipy.ndimage.filters as f import scipy import time import scipy.signal as l from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten from keras.layers import Conv2D, MaxPool2D from k...
apache-2.0
CforED/Machine-Learning
examples/model_selection/grid_search_digits.py
44
2672
""" ============================================================ Parameter estimation using grid search with cross-validation ============================================================ This examples shows how a classifier is optimized by cross-validation, which is done using the :class:`sklearn.model_selection.GridS...
bsd-3-clause
karthikvadla16/spark-tk
regression-tests/sparktkregtests/testcases/models/pca_test.py
12
12264
# 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
CCI-Tools/ect-core
test/util/im/test_cmaps.py
2
3391
from unittest import TestCase from cate.util.im.cmaps import get_cmaps class CmapsTest(TestCase): def test_get_cmaps_returns_singleton(self): cmaps = get_cmaps() self.assertIs(cmaps, get_cmaps()) self.assertIs(cmaps, get_cmaps()) def test_get_cmaps_retruns_equal_size_recs(self): ...
mit
phiedulxp/tweet_search
experiment/ea/make_tweet_tokenized_data_worker.py
1
2519
import os import re import codecs import random import multiprocessing from multiprocessing import Pool from tqdm import tqdm import pandas as pd import spacy import json from bson import json_util import redis r = redis.StrictRedis(host='localhost',port=6379, db=0) import pymongo client = pymongo.MongoClient(...
mit
rahuldhote/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
cauchycui/scikit-learn
doc/tutorial/text_analytics/solutions/exercise_01_language_train_model.py
254
2253
"""Build a language detector model The goal of this exercise is to train a linear classifier on text features that represent sequences of up to 3 consecutive characters so as to be recognize natural languages by using the frequencies of short character sequences as 'fingerprints'. """ # Author: Olivier Grisel <olivie...
bsd-3-clause
ryandougherty/mwa-capstone
MWA_Tools/build/matplotlib/lib/mpl_examples/animation/old_animation/animation_blit_tk.py
4
1202
# For detailed comments on animation and the techniqes used here, see # the wiki entry http://www.scipy.org/Cookbook/Matplotlib/Animations import matplotlib matplotlib.use('TkAgg') import sys import pylab as p import numpy as npy import time ax = p.subplot(111) canvas = ax.figure.canvas # create the initial line x...
gpl-2.0
giorgiop/scikit-learn
sklearn/calibration.py
18
19402
"""Calibration of predicted probabilities.""" # Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Balazs Kegl <balazs.kegl@gmail.com> # Jan Hendrik Metzen <jhm@informatik.uni-bremen.de> # Mathieu Blondel <mathieu@mblondel.org> # # License: BSD 3 clause from __future__ impo...
bsd-3-clause
paix120/DataScienceLearningClubActivities
Activity06/jenks.py
1
3584
#original code from: https://gist.github.com/drewda/1299198 #note: danieljlewis site referenced there doesn't appear to exist anymore def getJenksBreaks( dataList, numClass ): print("starting getJenksBreaks function...") dataList.sort() mat1 = [] for i in range(0,len(dataList)+1): temp = [] ...
gpl-2.0
johnson1228/pymatgen
pymatgen/io/abinit/utils.py
1
28136
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """Tools and helper functions for abinit calculations""" from __future__ import unicode_literals, division, print_function import os import six import re import collections import shutil import operator import ...
mit
mifumagalli/mypython
ifu/muse_redux_line.py
1
49249
""" These are sets of procedures optimised for almost empty fields but with extended line emission """ from __future__ import print_function def individual_resample(listob,refpath='./',nproc=24): """ Loop over each OB and re-run scipost using a final coadded cube as a reference for WCS. This produc...
gpl-2.0
jkoelker/python-eoddata
eoddata/datareader.py
1
9079
# -*- coding: utf-8 -*- import os import logging import pandas as pd import pytz from tzlocal import windows_tz import appdirs import ws LOG = logging.getLogger(__name__) _TYPE_MAP = {'integer': int, 'unicode': str, 'string': str, 'boolean': bool, 'datetime': '...
mit
shaunstanislaus/pandashells
pandashells/test/lomb_scargle_lib_tests.py
10
3222
#! /usr/bin/env python from unittest import TestCase import pandas as pd import numpy as np from pandashells.lib.lomb_scargle_lib import ( _next_power_two, _compute_pad, _compute_params, lomb_scargle, ) class NextPowerTwoTest(TestCase): def test_proper_return(self): past_100 = _next_powe...
bsd-2-clause
rknLA/sms-tools
lectures/08-Sound-transformations/plots-code/sineModelFreqScale-orchestra.py
21
2666
import numpy as np import matplotlib.pyplot as plt from scipy.signal import hamming, hanning, triang, blackmanharris, resample import math import sys, os, functools, time sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/')) sys.path.append(os.path.join(os.path.dirname...
agpl-3.0
ElOceanografo/PyCWT
pycwt/pycwt.py
1
25290
''' Python Continuous Wavelet Transform =================================== This module implements the Continuous Wavelet Transform (CWT). Mathematics are taken from Torrence and Compo 1998, and this Python code is a significantly refactored (though (hopefully!) mathematically identical) version of their Matlab origin...
gpl-2.0
hksonngan/pynopticon
src/em/gauss_mix.py
4
26027
# /usr/bin/python # Last Change: Tue Jul 17 11:00 PM 2007 J """Module implementing GM, a class which represents Gaussian mixtures. GM instances can be used to create, sample mixtures. They also provide different plotting facilities, such as isodensity contour for multi dimensional models, ellipses of confidence.""" ...
gpl-3.0
manashmndl/scikit-learn
sklearn/linear_model/tests/test_least_angle.py
44
17033
import tempfile import shutil import os.path as op import warnings from nose.tools import assert_equal import numpy as np from scipy import linalg from sklearn.cross_validation import train_test_split from sklearn.externals import joblib from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.t...
bsd-3-clause
renewables-ninja/gsee
setup.py
1
1793
#!/usr/bin/env python import os from setuptools import setup, find_packages, Extension # Sets the __version__ variable with open("gsee/_version.py", "r") as f: exec(f.read()) with open("README.md", "r") as f: long_description = f.read() # Numpy headers are always required for compliation, but to allow # `py...
bsd-3-clause
kellyschrock/apm_planner
libs/mavlink/share/pyshared/pymavlink/examples/mavgraph.py
29
5951
#!/usr/bin/env python ''' graph a MAVLink log file Andrew Tridgell August 2011 ''' import sys, struct, time, os, datetime import math, re import pylab, pytz, matplotlib from math import * # allow import from the parent directory, where mavlink.py is sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__f...
agpl-3.0
vibhorag/scikit-learn
sklearn/metrics/cluster/__init__.py
312
1322
""" The :mod:`sklearn.metrics.cluster` submodule contains evaluation metrics for cluster analysis results. There are two forms of evaluation: - supervised, which uses a ground truth class values for each sample. - unsupervised, which does not and measures the 'quality' of the model itself. """ from .supervised import ...
bsd-3-clause
BitTiger-MP/DS502-AI-Engineer
DS502-1702/Jason_course/Week4_Codelab2/class1_softmax_regression.py
1
2305
import numpy as np from sklearn import linear_model, datasets import matplotlib.pyplot as plt def onehot(y): n = len(np.unique(y)) m = y.shape[0] b = np.zeros((m, n)) for i in xrange(m): b[i, y[i]] = 1 return b def softmax(X): return (np.exp(X).T / np.sum(np.exp(X), axis=1)).T def ...
apache-2.0
deepmind/deepmind-research
side_effects_penalties/results_summary.py
1
7853
# Copyright 2019 DeepMind Technologies Limited. # # 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...
apache-2.0
BerryAI/Acai
OpenMRS/API/user.py
1
2005
""" user.py ~~~ This module provides all API for users :auther: Alexander Z Wang """ import sklearn major_version, minor_version = tuple(sklearn.__version__.split('.')[:2]) if int(minor_version) >= 18 or int(major_version) >= 1: from sklearn.neural_network import MLPClassifier user_model_type ...
mit
gef756/statsmodels
statsmodels/sandbox/tools/mctools.py
33
17175
'''Helper class for Monte Carlo Studies for (currently) statistical tests Most of it should also be usable for Bootstrap, and for MC for estimators. Takes the sample generator, dgb, and the statistical results, statistic, as functions in the argument. Author: Josef Perktold (josef-pktd) License: BSD-3 TODOs, Desig...
bsd-3-clause
simon-pepin/scikit-learn
examples/ensemble/plot_random_forest_embedding.py
286
3531
""" ========================================================= Hashing feature transformation using Totally Random Trees ========================================================= RandomTreesEmbedding provides a way to map data to a very high-dimensional, sparse representation, which might be beneficial for classificati...
bsd-3-clause
cojacoo/echoRD_model
echoRD/hydro_tools.py
1
49640
#hydro_plot - some python functions for hydrological visualisation #(cc) jackisch@kit.edu import numpy as np import pandas as pd import scipy as sp import matplotlib.pyplot as plt import matplotlib #TOOLS # a simple progress bar import sys, time try: from IPython.display import clear_output have_ipython = True...
gpl-3.0
rwhitt2049/trouve
trouve/find_events.py
1
3625
import numpy as np import pandas as pd import toolz from trouve.events import Events @toolz.curry def find_events(condition, period, name='events', transformations=None): """Find events based off a condition Find events based off a ``bool`` conditional array and apply a sequence of transformation functi...
mit
cauchycui/scikit-learn
sklearn/semi_supervised/label_propagation.py
128
15312
# 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
jlegendary/scikit-learn
examples/cluster/plot_affinity_propagation.py
349
2304
""" ================================================= Demo of affinity propagation clustering algorithm ================================================= Reference: Brendan J. Frey and Delbert Dueck, "Clustering by Passing Messages Between Data Points", Science Feb. 2007 """ print(__doc__) from sklearn.cluster impor...
bsd-3-clause
pxzhang94/GAN
GAN/mode_regularized_gan/mode_reg_gan_pytorch.py
1
3606
import torch import torch.nn import torch.nn.functional as nn import torch.autograd as autograd import torch.optim as optim import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import os from torch.autograd import Variable from tensorflow.examples.tutorials.mnist import input_data ...
apache-2.0
alexeyum/scikit-learn
sklearn/exceptions.py
35
4329
""" The :mod:`sklearn.exceptions` module includes all custom warnings and error classes used across scikit-learn. """ __all__ = ['NotFittedError', 'ChangedBehaviorWarning', 'ConvergenceWarning', 'DataConversionWarning', 'DataDimensionalityWarning', 'EfficiencyWarn...
bsd-3-clause
RTHMaK/RPGOne
doc/examples/features_detection/plot_censure.py
8
1167
""" ======================== CENSURE feature detector ======================== The CENSURE feature detector is a scale-invariant center-surround detector (CENSURE) that claims to outperform other detectors and is capable of real-time implementation. """ from skimage import data from skimage import transform as tf fro...
apache-2.0
Christoph/tag-connect
hmm_stuff/CRF.py
1
1847
from sklearn.metrics import classification_report, confusion_matrix from sklearn.preprocessing import LabelBinarizer import sklearn import pycrfsuite import pandas as pd import spacy nlp = spacy.load('en') data = pd.read_csv("data/train_small.csv") test = pd.read_csv("data/test_hand_labeled.csv") docs = [nlp(row) for...
mit
larsoner/mne-python
mne/decoding/tests/test_base.py
12
15702
# Author: Jean-Remi King, <jeanremi.king@gmail.com> # Marijn van Vliet, <w.m.vanvliet@gmail.com> # # License: BSD (3-clause) import numpy as np from numpy.testing import (assert_array_equal, assert_array_almost_equal, assert_equal, assert_allclose, assert_array_less) import pytest f...
bsd-3-clause
hsaputra/tensorflow
tensorflow/contrib/gan/python/estimator/python/gan_estimator_test.py
10
12183
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
cainiaocome/scikit-learn
sklearn/covariance/robust_covariance.py
198
29735
""" Robust location and covariance estimators. Here are implemented estimators that are resistant to outliers. """ # Author: Virgile Fritsch <virgile.fritsch@inria.fr> # # License: BSD 3 clause import warnings import numbers import numpy as np from scipy import linalg from scipy.stats import chi2 from . import empir...
bsd-3-clause
sangwook236/sangwook-library
python/test/language_processing/ocropus_data.py
2
10608
import time, glob import numpy as np import cv2 #import sklearn #import swl.machine_learning.util as swl_ml_util #import hangeul_util as hg_util import text_line_data # REF [site] >> https://github.com/tmbdev/ocropy class OcropusTextLineDatasetBase(text_line_data.FileBasedTextLineDatasetBase): def __init__(self, lab...
gpl-2.0
mdeger/nest-simulator
examples/neuronview/neuronview.py
13
10676
# -*- coding: utf-8 -*- # # neuronview.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or ...
gpl-2.0
sniemi/EuclidVisibleInstrument
sandbox/example_digits.py
1
1213
# load the digits dataset from scikit-learn # 901 samples, about 180 samples per class # the digits represented 0,1,2,3,4 from sklearn import datasets digits = datasets.load_digits(n_class=4) data = digits.data # matrix where each row is a vector that represent a digit. num = digits.target # num[i] is the digit repres...
bsd-2-clause
depet/scikit-learn
sklearn/decomposition/tests/test_pca.py
1
12507
import warnings import numpy as np from scipy.sparse import csr_matrix 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...
bsd-3-clause
tyarkoni/pliers
setup.py
1
1553
from setuptools import setup, find_packages import os extra_setuptools_args = dict( tests_require=['pytest'] ) thispath, _ = os.path.split(__file__) ver_file = os.path.join(thispath, 'pliers', 'version.py') with open(ver_file) as fp: exec(fp.read(), globals(), locals()) setup( name="pliers", versio...
bsd-3-clause
NunoEdgarGub1/scikit-learn
sklearn/metrics/classification.py
28
67703
"""Metrics to assess performance on classification task given classe prediction 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.gram...
bsd-3-clause
verilylifesciences/purplequery
purplequery/dataframe_node.py
1
18815
# Copyright 2019 Verily Life Sciences LLC # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. '''All subclasses of DataframeNode''' import itertools import operator from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union # noqa: F401 import ...
bsd-3-clause
rseubert/scikit-learn
sklearn/tests/test_dummy.py
27
17468
from __future__ import division import warnings import numpy as np import scipy.sparse as sp from sklearn.base import clone 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 a...
bsd-3-clause
pythonvietnam/scikit-learn
sklearn/externals/joblib/__init__.py
72
4795
""" Joblib is a set of tools to provide **lightweight pipelining in Python**. In particular, joblib offers: 1. transparent disk-caching of the output values and lazy re-evaluation (memoize pattern) 2. easy simple parallel computing 3. logging and tracing of the execution Joblib is optimized to be **fast*...
bsd-3-clause
pnedunuri/scipy
scipy/interpolate/fitpack2.py
39
61117
""" fitpack --- curve and surface fitting with splines fitpack is based on a collection of Fortran routines DIERCKX by P. Dierckx (see http://www.netlib.org/dierckx/) transformed to double routines by Pearu Peterson. """ # Created by Pearu Peterson, June,August 2003 from __future__ import division, print_function, abs...
bsd-3-clause
BennerLab/atg
atg/data/ensembl.py
1
7239
""" Find species data in Ensembl, recording genome and annotation URLs. """ import os import sys import pandas import ftplib import string import atg.config import atg.data.retrieve ENSEMBL_SPECIES_INFORMATION = 'ftp://ftp.ensemblgenomes.org/pub/release-35/species.txt' ENSEMBL_DNA_BASE_LOCATION = string.Template('pub...
gpl-3.0
kinghadi/word_cloud
doc/sphinxext/gen_rst.py
17
33207
""" Example generation for the python wordcloud project. Stolen from scikit-learn with modifications from PyStruct. Generate the rst files for the examples by iterating over the python example files. Hacked to plot every example (not only those that start with 'plot'). """ from time import time import os import shuti...
mit
jamesp/shallowwater
beta_plane/exoplanet.py
1
4070
import sys import numpy as np import xarray as xr from tqdm import tqdm from shallowwater import PeriodicLinearShallowWater from plotting import plot_wind_arrows nx = 128*4 ny = 129 nd = 25 # number of days to run DAY = 86400 RADIUS = 6371e3 PLOT = False SNAP_DAYS = 5 # # Radius of deformation: Rd = sqrt(2 c /...
mit
Clyde-fare/scikit-learn
examples/mixture/plot_gmm.py
248
2817
""" ================================= Gaussian Mixture Model Ellipsoids ================================= Plot the confidence ellipsoids of a mixture of two Gaussians with EM and variational Dirichlet process. Both models have access to five components with which to fit the data. Note that the EM model will necessari...
bsd-3-clause
ml-lab/neuralnilm
neuralnilm/data/source.py
4
3500
from __future__ import print_function, division from copy import copy import numpy as np import pandas as pd from .batch import Batch import logging logger = logging.getLogger(__name__) class Sequence(object): """ Attributes ---------- input : np.ndarray target : np.ndarray all_appliances : ...
apache-2.0
MJuddBooth/pandas
pandas/tests/extension/base/printing.py
2
1231
import io import pytest import pandas as pd from pandas import compat from .base import BaseExtensionTests class BasePrintingTests(BaseExtensionTests): """Tests checking the formatting of your EA when printed.""" @pytest.mark.parametrize("size", ["big", "small"]) def test_array_repr(self, data, size):...
bsd-3-clause
ganeshgore/myremolab
server/src/test/util/stress.py
2
8986
#!/usr/bin/env python #-*-*- encoding: utf-8 -*-*- # # Copyright (C) 2005 onwards University of Deusto # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # # This software consists of contributions made by many individual...
bsd-2-clause
Sentient07/scikit-learn
benchmarks/bench_plot_approximate_neighbors.py
244
6011
""" Benchmark for approximate nearest neighbor search using locality sensitive hashing forest. There are two types of benchmarks. First, accuracy of LSHForest queries are measured for various hyper-parameters and index sizes. Second, speed up of LSHForest queries compared to brute force method in exact nearest neigh...
bsd-3-clause
tempbottle/Nuitka
tests/library/compile_library.py
1
4896
#!/usr/bin/env python # Copyright 2015, Kay Hayen, mailto:kay.hayen@gmail.com # # Python test originally created or extracted from other peoples work. The # parts from me are licensed as below. It is at least Free Softwar where # it's copied from other people. In these cases, that will normally be # ...
apache-2.0
wzbozon/statsmodels
statsmodels/sandbox/tsa/garch.py
25
52178
'''general non-linear MLE for time series analysis idea for general version ------------------------ subclass defines geterrors(parameters) besides loglike,... and covariance matrix of parameter estimates (e.g. from hessian or outerproduct of jacobian) update: I don't really need geterrors directly, but get_h the con...
bsd-3-clause
harterj/moose
modules/tensor_mechanics/test/tests/drucker_prager/small_deform3.py
24
3894
#!/usr/bin/env python3 #* This file is part of the MOOSE framework #* https://www.mooseframework.org #* #* All rights reserved, see COPYRIGHT for full restrictions #* https://github.com/idaholab/moose/blob/master/COPYRIGHT #* #* Licensed under LGPL 2.1, please see LICENSE for details #* https://www.gnu.org/licenses/lgp...
lgpl-2.1
a113n/bcbio-nextgen
bcbio/rnaseq/featureCounts.py
1
4334
import os import shutil import bcbio.bam as bam from bcbio.utils import (file_exists, safe_makedir, append_stem) from bcbio.pipeline import config_utils from bcbio.bam import is_paired from bcbio.provenance import do from bcbio.distributed.transaction import file_transaction import bcbio.pipeline.datadict as dd try: ...
mit
jorgehog/Deux-kMC
scripts/felix_cav/sequential_analyze.py
1
3360
import sys import os import numpy as np from os.path import join from matplotlib.pylab import * sys.path.append(join(os.getcwd(), "..")) from parse_h5_output import ParseKMCHDF5 from intercombinatorzor import ICZ def find_front_pos(heights): return heights.mean() #9 14 17 39 43 56 59 61 62 64 def main(): ...
gpl-3.0
jkarnows/scikit-learn
examples/decomposition/plot_incremental_pca.py
244
1878
""" =============== Incremental PCA =============== Incremental principal component analysis (IPCA) is typically used as a replacement for principal component analysis (PCA) when the dataset to be decomposed is too large to fit in memory. IPCA builds a low-rank approximation for the input data using an amount of memo...
bsd-3-clause
moberweger/deep-prior-pp
src/util/handdetector.py
1
39679
"""Provides a basic hand detector in depth images. HandDetector provides interface for detecting hands in depth image, by using the center of mass. Copyright 2015 Markus Oberweger, ICG, Graz University of Technology <oberweger@icg.tugraz.at> This file is part of DeepPrior. DeepPrior is free software: you can redist...
gpl-3.0
quheng/scikit-learn
sklearn/utils/tests/test_extmath.py
70
16531
# Authors: Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Denis Engemann <d.engemann@fz-juelich.de> # # License: BSD 3 clause import numpy as np from scipy import sparse from scipy import linalg from scipy import stats from sklearn.utils.testing import assert_eq...
bsd-3-clause
dch312/numpy
numpy/lib/polynomial.py
82
37957
""" Functions to operate on polynomials. """ from __future__ import division, absolute_import, print_function __all__ = ['poly', 'roots', 'polyint', 'polyder', 'polyadd', 'polysub', 'polymul', 'polydiv', 'polyval', 'poly1d', 'polyfit', 'RankWarning'] import re import warnings import numpy.core....
bsd-3-clause
kaichogami/scikit-learn
sklearn/ensemble/tests/test_partial_dependence.py
365
6996
""" Testing for the partial dependence module. """ import numpy as np from numpy.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import if_matplotlib from sklearn.ensemble.partial_dependence import partial_dependence from sklearn.ensemble.partial_dependence...
bsd-3-clause
tejasckulkarni/hydrology
Plots/MCMC/distribution_plot.py
1
10969
__author__ = 'kiruba' import numpy as np import matplotlib.pyplot as plt import pandas as pd import checkdam.checkdam as cd from datetime import timedelta import scipy.stats as stats import matplotlib matplotlib.rc('font', **{'family': 'sans-serif', 'serif': ['Computer Modern Roman']}) matplotlib.rc('text', usetex=Tru...
gpl-3.0
ahmadia/bokeh
examples/plotting/file/unemployment.py
46
1846
from collections import OrderedDict import numpy as np from bokeh.plotting import ColumnDataSource, figure, show, output_file from bokeh.models import HoverTool from bokeh.sampledata.unemployment1948 import data # Read in the data with pandas. Convert the year column to string data['Year'] = [str(x) for x in data['Y...
bsd-3-clause
OpenDrift/opendrift
opendrift/models/oceandrift.py
1
26233
# This file is part of OpenDrift. # # OpenDrift 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, version 2 # # OpenDrift is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without ev...
gpl-2.0
WindfallLabs/dslw
dslw/addons/_gpd.py
1
8015
# -*- coding: utf-8 -*- """ addons/_gpd.py -- geopandas addons for dslw (not implemented) Copyright (c) 2016 Garin Wally MIT License; see LICENSE """ from __future__ import unicode_literals import re from os.path import commonprefix import sys import apsw from pandas import read_sql from geopandas import GeoSeries,...
mit
ChanChiChoi/scikit-learn
benchmarks/bench_plot_nmf.py
206
5890
""" Benchmarks of Non-Negative Matrix Factorization """ from __future__ import print_function from collections import defaultdict import gc from time import time import numpy as np from scipy.linalg import norm from sklearn.decomposition.nmf import NMF, _initialize_nmf from sklearn.datasets.samples_generator import...
bsd-3-clause
talevy/hetnet
oldsim/simcode/draw.py
1
1414
from numpy import sqrt, linspace import numpy as np import scipy as sp from scipy.integrate import odeint from pylab import plot, axis, show, savefig import matplotlib.pyplot as plt from math import pow import random from igraph import * import sys import glob from urchinsim import * def plotdiff(x, y, filepath): ...
bsd-2-clause
PatrickChrist/scikit-learn
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
Laurae2/LightGBM
tests/python_package_test/test_engine.py
1
23263
# coding: utf-8 # pylint: skip-file import copy import math import os import unittest import lightgbm as lgb import random import numpy as np from sklearn.datasets import (load_boston, load_breast_cancer, load_digits, load_iris, load_svmlight_file) from sklearn.metrics import log_loss, me...
mit
commaai/panda
tests/safety/test_tesla.py
1
6109
#!/usr/bin/env python3 import unittest import numpy as np from panda import Panda from panda.tests.safety import libpandasafety_py import panda.tests.safety.common as common from panda.tests.safety.common import CANPackerPanda ANGLE_DELTA_BP = [0., 5., 15.] ANGLE_DELTA_V = [5., .8, .15] # windup limit ANGLE_DELTA_...
mit
nchaparr/Sam_Output_Anls
Cont_Stat.py
1
4094
from netCDF4 import Dataset import glob,os.path import numpy as np from scipy.interpolate import UnivariateSpline import matplotlib import matplotlib.pyplot as plt #import site #site.addsitedir('/tera/phil/nchaparr/python') import nchap_fun as nc from nchap_class import * """ For contour plotting statistics output f...
mit
alkamid/wiktionary
statPlot.py
1
1816
import matplotlib.pyplot as plt import numpy as np import datetime as dt from matplotlib.ticker import MultipleLocator # we should have this plot in Polish and English terms = { 'pages': {'en': 'pages', 'pl': 'strony'}, 'entries': {'en': 'entries', 'pl': 'hasła'}, 'ylabel': {'en': 'number of pages ...
mit
jmcorgan/gnuradio
gr-digital/examples/berawgn.py
32
4886
#!/usr/bin/env python # # Copyright 2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your optio...
gpl-3.0
tawsifkhan/scikit-learn
sklearn/utils/multiclass.py
83
12343
# Author: Arnaud Joly, Joel Nothman, Hamzeh Alsalhi # # License: BSD 3 clause """ Multi-class / multi-label utility function ========================================== """ from __future__ import division from collections import Sequence from itertools import chain from scipy.sparse import issparse from scipy.sparse....
bsd-3-clause
bootphon/abx_numpy
examples/2D_normal_example.py
1
1680
""" This example apply the abx evaluation on 2D data sampled from gaussian distributions (diagonal covariance) """ from __future__ import print_function import abx_numpy import numpy as np def sample_data(parameters): data = [] n_samples = [] for klass in parameters: sample = np.empty((klass['N']...
gpl-3.0
endlessm/chromium-browser
third_party/llvm/libc/AOR_v20.02/math/tools/plot.py
1
1404
#!/usr/bin/python # ULP error plot tool. # # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception import numpy as np import matplotlib.pyplot as plt import sys import re # ex...
bsd-3-clause
rbalda/neural_ocr
env/lib/python2.7/site-packages/scipy/optimize/nonlin.py
34
46681
r""" Nonlinear solvers ----------------- .. currentmodule:: scipy.optimize This is a collection of general-purpose nonlinear multidimensional solvers. These solvers find *x* for which *F(x) = 0*. Both *x* and *F* can be multidimensional. Routines ~~~~~~~~ Large-scale nonlinear solvers: .. autosummary:: newto...
mit
jseabold/scipy
scipy/interpolate/fitpack.py
16
46294
#!/usr/bin/env python """ 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 ...
bsd-3-clause
freeman-lab/dask
dask/dataframe/core.py
1
41050
from __future__ import division from itertools import count from math import ceil, sqrt from functools import wraps import bisect import os from toolz import (merge, partial, accumulate, unique, first, dissoc, valmap, first, partition) import toolz from operator import getitem, setitem from datetime import dat...
bsd-3-clause
RPGroup-PBoC/gist_pboc_2017
code/project_pt2_measurement.py
1
6926
# Import the necessary modules. import numpy as np import matplotlib.pyplot as plt import seaborn as sns # Image processing utilities import skimage.io import skimage.filters import skimage.segmentation import skimage.measure # In this script, we will learn some more principles regarding image processing # and segmen...
mit
lthurlow/Network-Grapher
proj/external/numpy-1.7.0/doc/source/conf.py
7
10752
# -*- coding: utf-8 -*- import sys, os, re # Check Sphinx version import sphinx if sphinx.__version__ < "1.0.1": raise RuntimeError("Sphinx 1.0.1 or newer required") needs_sphinx = '1.0' # ----------------------------------------------------------------------------- # General configuration # -------------------...
mit
anguyen8/cnn-vis
cnn_vis.org.py
1
25133
import sys import argparse, os, tempfile from collections import defaultdict import matplotlib.pyplot as plt import numpy as np from scipy.misc import imresize, imsave, imread from scipy.ndimage.filters import gaussian_filter import os os.environ['GLOG_minloglevel'] = '2' # suprress Caffe verbose prints import sett...
mit
ephes/scikit-learn
examples/ensemble/plot_gradient_boosting_quantile.py
392
2114
""" ===================================================== Prediction Intervals for Gradient Boosting Regression ===================================================== This example shows how quantile regression can be used to create prediction intervals. """ import numpy as np import matplotlib.pyplot as plt from skle...
bsd-3-clause