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 |
|---|---|---|---|---|---|
Ziqi-Li/bknqgis | pandas/pandas/tests/indexes/timedeltas/test_construction.py | 9 | 3546 | import pytest
import numpy as np
from datetime import timedelta
import pandas as pd
import pandas.util.testing as tm
from pandas import TimedeltaIndex, timedelta_range, to_timedelta
class TestTimedeltaIndex(object):
_multiprocess_can_split_ = True
def test_construction_base_constructor(self):
arr =... | gpl-2.0 |
rajul/ginga | ginga/examples/matplotlib/example1_mpl.py | 4 | 5888 | #! /usr/bin/env python
#
# example1_mpl.py -- Simple, configurable FITS viewer using a matplotlib
# QtAgg backend for Ginga and embedded in a Qt program.
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD li... | bsd-3-clause |
HIIT/elfi | elfi/methods/parameter_inference.py | 1 | 49555 | """This module contains common inference methods."""
__all__ = ['Rejection', 'SMC', 'BayesianOptimization', 'BOLFI']
import logging
from math import ceil
import matplotlib.pyplot as plt
import numpy as np
import elfi.client
import elfi.methods.mcmc as mcmc
import elfi.visualization.interactive as visin
import elfi.... | bsd-3-clause |
jrleeman/MetPy | metpy/plots/_util.py | 4 | 8941 | # Copyright (c) 2015,2017,2018 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Utilities for use in making plots."""
from datetime import datetime
import posixpath
from matplotlib.collections import LineCollection
import matplotlib.patheffects as... | bsd-3-clause |
miku/libtasks | libtasks/helper.py | 1 | 1105 | #!/usr/bin/env python
# coding: utf-8
from libtasks import xisbn
import pandas as pd
import marcx
"""
This module contains some helpers.
"""
def read_tsv_to_dict(path, sep='\t'):
"""
Convert a *two* column TSV file into a dictionary where
the first column is the key and the second column is the value.
... | mit |
phware/programingworkshop | Python/pandas_and_parallel/mesonet_calculations.py | 8 | 1428 | import pandas as pd
import datetime as dt
import numpy as np
from parse_mesonet import MesoArrays
def to_xy(dire, speed):
''' Calculates the u and v directions for wind barb plotting from
the direction and speed
'''
u = np.zeros_like(dire)
v = np.zeros_like(dire)
u = -np.sin(dire * np.pi/180... | mit |
oxtopus/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/delaunay/testfuncs.py | 72 | 20890 | """Some test functions for bivariate interpolation.
Most of these have been yoinked from ACM TOMS 792.
http://netlib.org/toms/792
"""
import numpy as np
from triangulate import Triangulation
class TestData(dict):
def __init__(self, *args, **kwds):
dict.__init__(self, *args, **kwds)
self.__dict__ ... | gpl-3.0 |
ptkool/spark | python/pyspark/sql/pandas/conversion.py | 1 | 19223 | #
# 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 |
jsochacki/simpyle_systems | simpyle_systems/synthesizer.py | 1 | 59493 | """
Author: socHACKi
This module is a collection of classes that can be used to help
the user make system level synthesizer design choices and analysis.
There are also some matlab like functions that are implemented.
"""
import numpy as np
import os
import pandas as pd
import matplotlib.pyplot as plt
plt.ioff()
#fro... | bsd-3-clause |
garth5689/pyd2l | pyd2l/plot.py | 1 | 3535 | import random
from itertools import accumulate
import matplotlib.pyplot as plt
from matplotlib import lines
def get_pick(pick_method, match):
pick = None
if pick_method == 'random':
pick = random.choice([match.winner, match.loser])
elif pick_method == 'favorite':
pick = match.favorite()
... | gpl-2.0 |
alexrutar/banditvis | banditvis/animation.py | 1 | 18173 | import copy
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import matplotlib.patches as mpatches
from scipy.stats import beta
from .simulation import ReMapSim
from .formatting import cmap_colors, mpl_defaults
import time
def HistAnimation(core_di... | mit |
kumkee/marketdata | marketdata/globalpricematrix.py | 1 | 2778 | from coinlist import CoinList
import pandas as pd
from time import time
from time import sleep
import numpy as np
NOW = 0
FIVE_MINUTES = 60*5
FIFTEEN_MINUTES = FIVE_MINUTES * 3
HALF_HOUR = FIFTEEN_MINUTES * 2
HOUR = HALF_HOUR * 2
TWO_HOUR = HOUR * 2
FOUR_HOUR = HOUR * 4
DAY = HOUR * 24
YEAR = DAY * 365
CSV_DEFAULT = ... | gpl-3.0 |
mdrumond/tensorflow | tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined_test.py | 52 | 69800 | # 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 |
costypetrisor/scikit-learn | examples/ensemble/plot_adaboost_twoclass.py | 347 | 3268 | """
==================
Two-class AdaBoost
==================
This example fits an AdaBoosted decision stump on a non-linearly separable
classification dataset composed of two "Gaussian quantiles" clusters
(see :func:`sklearn.datasets.make_gaussian_quantiles`) and plots the decision
boundary and decision scores. The di... | bsd-3-clause |
dsquareindia/scikit-learn | sklearn/datasets/twenty_newsgroups.py | 31 | 13747 | """Caching loader for the 20 newsgroups text classification dataset
The description of the dataset is available on the official website at:
http://people.csail.mit.edu/jrennie/20Newsgroups/
Quoting the introduction:
The 20 Newsgroups data set is a collection of approximately 20,000
newsgroup documents,... | bsd-3-clause |
weidel-p/nest-simulator | pynest/examples/synapsecollection.py | 12 | 5672 | # -*- coding: utf-8 -*-
#
# synapsecollection.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 Licen... | gpl-2.0 |
abhishekkrthakur/scikit-learn | sklearn/feature_extraction/tests/test_dict_vectorizer.py | 276 | 3790 | # Authors: Lars Buitinck <L.J.Buitinck@uva.nl>
# Dan Blanchard <dblanchard@ets.org>
# 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,
... | bsd-3-clause |
cameronlai/ml-class-python | skeletons/ex3/ex3_nn_sklearn.py | 1 | 2814 | import numpy as np
import matplotlib.pyplot as plt
import scipy.io as sio
from sklearn.neural_network import MLPClassifier
from ex3 import *
## Machine Learning Online Class - Exercise 3: Neural Network - One-vs-all with sci-kit learn
# Instructions
# ------------
#
# This file contains code that helps you get st... | mit |
cbertinato/pandas | pandas/tests/arrays/sparse/test_libsparse.py | 1 | 22116 | import operator
import numpy as np
import pytest
import pandas._libs.sparse as splib
import pandas.util._test_decorators as td
from pandas import Series
from pandas.core.arrays.sparse import BlockIndex, IntIndex, _make_index
import pandas.util.testing as tm
TEST_LENGTH = 20
plain_case = dict(xloc=[0, 7, 15], xlen=... | bsd-3-clause |
Fireblend/scikit-learn | sklearn/tree/export.py | 53 | 15772 | """
This module defines export functions for decision trees.
"""
# Authors: Gilles Louppe <g.louppe@gmail.com>
# Peter Prettenhofer <peter.prettenhofer@gmail.com>
# Brian Holt <bdholt1@gmail.com>
# Noel Dawe <noel@dawe.me>
# Satrajit Gosh <satrajit.ghosh@gmail.com>
# Trevor... | bsd-3-clause |
toogy/mnist-em-bmm-gmm | mixture.py | 1 | 4719 | from datetime import datetime
import sys
import numpy as np
from sklearn.cluster import KMeans
EPS = np.finfo(float).eps
class mixture:
def __init__(self, n_components, init_params='wm', n_iter=100, tol=1e-3,
covariance_type='diag', min_covar=1e-4, verbose=False):
#: number of componen... | mit |
AlexanderFabisch/scikit-learn | sklearn/cluster/tests/test_bicluster.py | 143 | 9461 | """Testing for Spectral Biclustering methods"""
import numpy as np
from scipy.sparse import csr_matrix, issparse
from sklearn.model_selection import ParameterGrid
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_equal
... | bsd-3-clause |
urschrei/geopandas | tests/test_plotting.py | 1 | 8763 | from __future__ import absolute_import, division
import numpy as np
import os
import shutil
import tempfile
import matplotlib
matplotlib.use('Agg', warn=False)
from matplotlib.pyplot import Artist, savefig, clf, cm, get_cmap
from matplotlib.testing.noseclasses import ImageComparisonFailure
from matplotlib.testing.com... | bsd-3-clause |
karstenw/nodebox-pyobjc | examples/Extended Application/matplotlib/examples/animation/animate_decay.py | 1 | 1780 | """
=====
Decay
=====
This example showcases a sinusoidal decay animation.
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
# nodebox section
if __name__ == '__builtin__':
# were in nodebox
import os
import tempfile
W = 800
inset = 20
size(W, 60... | mit |
vkscool/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_qt4.py | 69 | 20664 | from __future__ import division
import math
import os
import sys
import matplotlib
from matplotlib import verbose
from matplotlib.cbook import is_string_like, onetrue
from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \
FigureManagerBase, FigureCanvasBase, NavigationToolbar2, IdleEvent, curso... | gpl-3.0 |
vigilv/scikit-learn | sklearn/svm/classes.py | 126 | 40114 | import warnings
import numpy as np
from .base import _fit_liblinear, BaseSVC, BaseLibSVM
from ..base import BaseEstimator, RegressorMixin
from ..linear_model.base import LinearClassifierMixin, SparseCoefMixin, \
LinearModel
from ..feature_selection.from_model import _LearntSelectorMixin
from ..utils import check_X... | bsd-3-clause |
hydraplatform/hydra-server | hydra_server/server/complexmodels.py | 1 | 62708 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) Copyright 2013 to 2017 University of Manchester
#
# HydraPlatform 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... | lgpl-3.0 |
JsNoNo/scikit-learn | sklearn/decomposition/truncated_svd.py | 199 | 7744 | """Truncated SVD for sparse matrices, aka latent semantic analysis (LSA).
"""
# Author: Lars Buitinck <L.J.Buitinck@uva.nl>
# Olivier Grisel <olivier.grisel@ensta.org>
# Michael Becker <mike@beckerfuffle.com>
# License: 3-clause BSD.
import numpy as np
import scipy.sparse as sp
try:
from scipy.sp... | bsd-3-clause |
nesterione/scikit-learn | examples/bicluster/plot_spectral_biclustering.py | 403 | 2011 | """
=============================================
A demo of the Spectral Biclustering algorithm
=============================================
This example demonstrates how to generate a checkerboard dataset and
bicluster it using the Spectral Biclustering algorithm.
The data is generated with the ``make_checkerboard`... | bsd-3-clause |
MartinSavc/scikit-learn | examples/linear_model/plot_omp.py | 385 | 2263 | """
===========================
Orthogonal Matching Pursuit
===========================
Using orthogonal matching pursuit for recovering a sparse signal from a noisy
measurement encoded with a dictionary
"""
print(__doc__)
import matplotlib.pyplot as plt
import numpy as np
from sklearn.linear_model import OrthogonalM... | bsd-3-clause |
cgomezfandino/Project_PTX | MeanReverting/mrbt_Oanda.py | 1 | 9655 | __author__ = 'cgomezfandino@gmail.com'
import datetime as dt
import v20
from configparser import ConfigParser
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn
# Create an object config
config = ConfigParser()
# Read the config
config.read("../API_Connection_Oanda/pyalgo.cfg")
cla... | mit |
zutshi/S3CAMR | examples/pwa_tt/pwa.py | 1 | 3130 | # -*- coding: utf-8 -*-
"""
PWA System: Time triggered switched linear system w/o inputs
MUST define the global SYS_ID after loading the module
"""
import random
import numpy as np
from scipy.integrate import ode
import matplotlib.pyplot as plt
import utils as U
PLOT = False
class SIM(object):
def __init__... | bsd-2-clause |
lukeiwanski/tensorflow | tensorflow/contrib/losses/python/metric_learning/metric_loss_ops_test.py | 41 | 20535 | # 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 |
hbenniou/trunk | doc/sphinx/ipython_directive013.py | 8 | 27280 | # -*- coding: utf-8 -*-
"""Sphinx directive to support embedded IPython code.
From: https://github.com/ipython/ipython/blob/master/docs/sphinxext/ipython_directive.py
This directive allows pasting of entire interactive IPython sessions, prompts
and all, and their code will actually get re-executed at doc build time, w... | gpl-2.0 |
kazemakase/scikit-learn | sklearn/cluster/birch.py | 207 | 22706 | # 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 |
sassoftware/sas-viya-machine-learning | gaussian_process_models/Bayesian_optimization_util.py | 1 | 2139 | import numpy as np
import matplotlib.pyplot as plt
def plot_approximation(gpr, X, Y, X_sample, Y_sample, X_next=None, show_legend=False):
mu, std = gpr.predict(X, return_std=True)
plt.fill_between(X.ravel(),
mu.ravel() + 1.96 * std,
mu.ravel() - 1.96 * std,
... | apache-2.0 |
Adai0808/BuildingMachineLearningSystemsWithPython | ch07/boston_cv_penalized.py | 24 | 1381 | # This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
# This script fits several forms of penalized regression
from __future__ import print_function
import ... | mit |
yunfeilu/scikit-learn | examples/linear_model/plot_logistic_path.py | 349 | 1195 | #!/usr/bin/env python
"""
=================================
Path with L1- Logistic Regression
=================================
Computes path on IRIS dataset.
"""
print(__doc__)
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD 3 clause
from datetime import datetime
import numpy as np
import... | bsd-3-clause |
CorySimon/CorySimon.github.io | codes/overboarding.py | 1 | 3038 | import numpy as np
import math
import matplotlib.pyplot as plt
from scipy.stats import norm
plt.style.use('bmh')
import matplotlib
matplotlib.rc('lines',linewidth=3)
matplotlib.rc('font',size=16)
# revenue we make from each ticket sold ($)
revenue_per_ticket = 250
# cost of a voucher ($)
cost_per_voucher = 800
# prob... | mit |
cjt5144/Cython-Cpp-Examples | optimization/build/lib/optimization/knapsack/pank.py | 2 | 1773 | #!/usr/bin/python
# (c) 2015 Christopher Thompson
# license: https://github.com/cjt5144/Cython-Cpp-Examples/blob/master/LICENSE
import numpy as np
import pandas as pd
def pank(df):
"""
Convert type groups to dict of tuples.
Args:
-----
df : DataFrame
Must contain columns ['id', 'wt', 'val', 'type']
Re... | mit |
cjwoodruff/machine-learning | ml-1.py | 1 | 1969 | from statistics import mean
import numpy as np
import random
import matplotlib.pyplot as plt
from matplotlib import style
style.use('ggplot')
# Creates the dataset that provides the scatterplot
# the correlation value in the function call is automatically
# set to 'False', but the value of pos or neg can be given for
... | apache-2.0 |
benoitsteiner/tensorflow-xsmm | tensorflow/examples/tutorials/input_fn/boston.py | 76 | 2920 | # 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 |
kylerbrown/scikit-learn | examples/linear_model/plot_lasso_model_selection.py | 311 | 5431 | """
===================================================
Lasso model selection: Cross-Validation / AIC / BIC
===================================================
Use the Akaike information criterion (AIC), the Bayes Information
criterion (BIC) and cross-validation to select an optimal value
of the regularization paramet... | bsd-3-clause |
FrederikDiehl/NNForSKLearn | NeuralNetwork.py | 1 | 14455 | __author__ = 'Frederik Diehl'
import numpy as np
from sklearn.base import BaseEstimator, RegressorMixin
from sklearn.utils import check_random_state
from sklearn.preprocessing import MinMaxScaler
class NeuralNetwork(BaseEstimator, RegressorMixin, object):
_maxSteps = None
_maxNonChangingSteps = None
_l... | mit |
hitszxp/scikit-learn | examples/cluster/plot_cluster_comparison.py | 9 | 4727 | """
=========================================================
Comparing different clustering algorithms on toy datasets
=========================================================
This example aims at showing characteristics of different
clustering algorithms on datasets that are "interesting"
but still in 2D. The last ... | bsd-3-clause |
kjohnsson/modality | modality/util/KernelDensityDerivative.py | 1 | 2425 | '''
Based on Bruce E. Hansen 2009: Lecture Notes on Nonparametrics,
http://www.ssc.wisc.edu/~bhansen/718/NonParametrics1.pdf.
'''
from __future__ import unicode_literals
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
class KernelDensityDerivative(object):
def __... | mit |
Nyker510/scikit-learn | sklearn/externals/joblib/__init__.py | 36 | 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 |
reyoung/Paddle | benchmark/paddle/image/plotlog.py | 7 | 3298 | # Copyright (c) 2016 PaddlePaddle 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 applic... | apache-2.0 |
JPFrancoia/scikit-learn | sklearn/tests/test_grid_search.py | 27 | 29492 | """
Testing for grid search module (sklearn.grid_search)
"""
from collections import Iterable, Sized
from sklearn.externals.six.moves import cStringIO as StringIO
from sklearn.externals.six.moves import xrange
from itertools import chain, product
import pickle
import warnings
import sys
import numpy as np
import sci... | bsd-3-clause |
bnaul/scikit-learn | sklearn/preprocessing/_function_transformer.py | 11 | 5948 | import warnings
from ..base import BaseEstimator, TransformerMixin
from ..utils.validation import _allclose_dense_sparse
from ..utils.validation import _deprecate_positional_args
def _identity(X):
"""The identity function.
"""
return X
class FunctionTransformer(TransformerMixin, BaseEstimator):
"""... | bsd-3-clause |
CNS-OIST/STEPS_Example | other_tutorials/OCNC2017/ex1_reac.py | 1 | 3385 | # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Example 1: Second-order reaction, well-mixed simulation
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Import biochemical model module
import steps.model as smod
# Create model container
mdl = smod.Model()
# Create chemical spe... | gpl-2.0 |
nhuntwalker/astroML | book_figures/chapter5/fig_likelihood_gausslin.py | 3 | 3951 | """
Log-likelihood for Gaussian plus linear background
--------------------------------------------------
Figure 5.13
An illustration of the logarithm of the posterior probability density function
:math:`L(\sigma,A)` (see eq. 5.85) for data generated using N = 200,
:math:`\mu=5`, :math:`\sigma = 1`, and A = 0.5, with ... | bsd-2-clause |
cl4rke/scikit-learn | sklearn/decomposition/tests/test_sparse_pca.py | 142 | 5990 | # Author: Vlad Niculae
# License: BSD 3 clause
import sys
import numpy as np
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import SkipTest
from sklearn.utils.testing import ass... | bsd-3-clause |
schets/scikit-learn | examples/model_selection/grid_search_digits.py | 227 | 2665 | """
============================================================
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.grid_search.GridSearc... | bsd-3-clause |
wazeerzulfikar/scikit-learn | examples/svm/plot_separating_hyperplane_unbalanced.py | 25 | 1866 | """
=================================================
SVM: Separating hyperplane for unbalanced classes
=================================================
Find the optimal separating hyperplane using an SVC for classes that
are unbalanced.
We first find the separating plane with a plain SVC and then plot
(dashed) the ... | bsd-3-clause |
giorgiop/scikit-learn | sklearn/externals/joblib/testing.py | 45 | 2720 | """
Helper for testing.
"""
import sys
import warnings
import os.path
import re
import subprocess
import threading
from sklearn.externals.joblib._compat import PY3_OR_LATER
def warnings_to_stdout():
""" Redirect all warnings to stdout.
"""
showwarning_orig = warnings.showwarning
def showwarning(msg... | bsd-3-clause |
RPGOne/Skynet | scikit-learn-c604ac39ad0e5b066d964df3e8f31ba7ebda1e0e/examples/model_selection/plot_train_error_vs_test_error.py | 349 | 2577 | """
=========================
Train error vs Test error
=========================
Illustration of how the performance of an estimator on unseen data (test data)
is not the same as the performance on training data. As the regularization
increases the performance on train decreases while the performance on test
is optim... | bsd-3-clause |
mhallsmoore/qstrader | tests/unit/simulation/test_daily_bday.py | 1 | 2849 | import pandas as pd
import pytest
import pytz
from qstrader.simulation.daily_bday import DailyBusinessDaySimulationEngine
from qstrader.simulation.event import SimulationEvent
@pytest.mark.parametrize(
"starting_day,ending_day,pre_market,post_market,expected_events",
[
(
'2020-01-01', '20... | mit |
ofgulban/scikit-image | doc/examples/features_detection/plot_gabors_from_astronaut.py | 9 | 3405 | """
============================================================
Gabors / Primary Visual Cortex "Simple Cells" from an Image
============================================================
How to build a (bio-plausible) *sparse* dictionary (or 'codebook', or
'filterbank') for e.g. image classification without any fancy m... | bsd-3-clause |
startcode/apollo | modules/tools/mapshow/subplot_traj_path.py | 2 | 2918 | #!/usr/bin/env python
###############################################################################
# Copyright 2017 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 |
vortex-ape/scikit-learn | examples/neighbors/plot_regression.py | 35 | 1421 | """
============================
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 <alexandre.gramfort@... | bsd-3-clause |
saiwing-yeung/scikit-learn | sklearn/manifold/isomap.py | 50 | 7515 | """Isomap for manifold learning"""
# Author: Jake Vanderplas -- <vanderplas@astro.washington.edu>
# License: BSD 3 clause (C) 2011
import numpy as np
from ..base import BaseEstimator, TransformerMixin
from ..neighbors import NearestNeighbors, kneighbors_graph
from ..utils import check_array
from ..utils.graph import... | bsd-3-clause |
alexandrebarachant/mne-python | mne/surface.py | 5 | 45614 | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Matti Hamalainen <msh@nmr.mgh.harvard.edu>
# Denis A. Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import os
from os import path as op
import sys
from struct import pack
from glob import glob
from distutils.v... | bsd-3-clause |
DanHickstein/pyBASEX | doc/conf.py | 1 | 10890 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# PyAbel documentation build configuration file, created by
# sphinx-quickstart on Wed Jan 13 17:11:12 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# aut... | gpl-2.0 |
autocorr/besl | besl/dpdf_calc.py | 1 | 21410 | """
================
DPDF Monte Carlo
================
Routines for handling EMAF DPDF's. Citation: Ellsworth-Bowers et al. (2013).
"""
# TODO read DPDFs
# create functions for:
# dust masses
# sizes / radius
# bolometric luminosity
# isotropic water maser luminosity
import os as _os
import numpy as _np
impo... | gpl-3.0 |
KaiWeiChang/vowpal_wabbit | python/sklearn_vw.py | 3 | 20760 | # -*- coding: utf-8 -*-
# pylint: disable=line-too-long, unused-argument, invalid-name, too-many-arguments, too-many-locals
"""
Utilities to support integration of Vowpal Wabbit and scikit-learn
"""
import numpy as np
from pyvw import vw
import re
from scipy.sparse import csr_matrix
from sklearn import metrics
from sk... | bsd-3-clause |
huzq/scikit-learn | examples/ensemble/plot_gradient_boosting_quantile.py | 10 | 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 |
eickenberg/scikit-learn | sklearn/setup.py | 4 | 3091 | import os
from os.path import join
import warnings
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
from numpy.distutils.system_info import get_info, BlasNotFoundError
import numpy
libraries = []
if os.name == 'posix':
libraries.appe... | bsd-3-clause |
xmnlab/minilab | university/coursera/dsp/externo/gs_orthonormalization.py | 1 | 5110 | # Nabin Sharma
# Oct 19, 2013
from __future__ import division
from mpl_toolkits.mplot3d import proj3d
from matplotlib.patches import FancyArrowPatch
import matplotlib.pyplot as plt
import numpy
def gs_orthonormalization(V):
"""
V is a matrix where each column contains the vectors spanning
the space of whi... | gpl-3.0 |
wanggang3333/scikit-learn | sklearn/pipeline.py | 162 | 21103 | """
The :mod:`sklearn.pipeline` module implements utilities to build a composite
estimator, as a chain of transforms and estimators.
"""
# Author: Edouard Duchesnay
# Gael Varoquaux
# Virgile Fritsch
# Alexandre Gramfort
# Lars Buitinck
# Licence: BSD
from collections import defaultdict... | bsd-3-clause |
codester2/devide.johannes | install_packages/ip_wxpython.py | 5 | 9252 | # Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
import config
import os
import utils
import sys
import shutil
from install_package import InstallPackage
import utils
from distutils import sysconfig
WXP_VER = '2.8.11.0'
WXP_URL_BASE = "http://surfnet.dl.sourceforge.net/sou... | bsd-3-clause |
fabioticconi/scikit-learn | examples/covariance/plot_sparse_cov.py | 300 | 5078 | """
======================================
Sparse inverse covariance estimation
======================================
Using the GraphLasso estimator to learn a covariance and sparse precision
from a small number of samples.
To estimate a probabilistic model (e.g. a Gaussian model), estimating the
precision matrix, t... | bsd-3-clause |
peterfpeterson/mantid | scripts/Muon/GUI/Common/plot_widget/plotting_canvas/plotting_canvas_presenter.py | 3 | 18154 | # Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2020 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
from... | gpl-3.0 |
rkadlec/ubuntu-ranking-dataset-creator | statistics/utils.py | 1 | 4504 | import unicodecsv
import matplotlib.pyplot as plt
import numpy
from collections import defaultdict
from scipy.stats import chisquare, ttest_ind
def n_utterances_counts(f_name, eou='__eou__'):
n_utterances = []
reader = unicodecsv.reader(open(f_name))
next(reader) # skip header
for line in reader:
... | apache-2.0 |
hazim-j/MUR-Motorsports-BMS-Monitor | BmsMonitorApp.py | 1 | 9932 | '''
BmsMonitorApp.py (DESIGN 1)
For MUR: Battery Management System.
Computer Program for real time data visualisation of current, temp & voltage.
Author: Hazim Jumali (mjumali@student.unimelb.edu.au)
'''
#import libraries
import threading
from sys import platform
from collections import deque
import serial
... | mit |
sniemi/SamPy | sandbox/src/plot_GET.py | 1 | 5291 | import matplotlib
matplotlib.rc('text', usetex = True)
matplotlib.rc('xtick', labelsize = 9)
matplotlib.rc('ytick', labelsize = 9)
matplotlib.rc('axes', linewidth=0.8)
matplotlib.rcParams['legend.fontsize'] = 7
import idlsave, time
import pylab as P
import numpy as N
import datetime as D
def fromJulian(j):
'''
... | bsd-2-clause |
wumch/miner | src/classifier.py | 1 | 4879 | #!/data/pyenv/keras/bin/python
import os
import random
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from sklearn.pipeline import Pipeline
from sklearn.neural_network import MLPClassifier
import jieba
class Tokenizer:
data_path = '/data/code/pubu/etc/data'
... | apache-2.0 |
chanceraine/nupic.research | projects/sequence_prediction/continuous_sequence/data/generatePerturbedNYCtaxiData.py | 1 | 2353 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013-2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This p... | agpl-3.0 |
dusenberrymw/deep-histopath | deephistopath/wsi/slide.py | 1 | 32987 | # ------------------------------------------------------------------------
#
# 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 requi... | apache-2.0 |
ProkopHapala/ProbeParticleModel | examples/_bak/watter_monomer_4fold/LJ_4fold.py | 1 | 2389 | #!/usr/bin/python
#import matplotlib
#matplotlib.use('Agg') # Force matplotlib to not use any Xwindows backend.
import os
import numpy as np
import matplotlib.pyplot as plt
import sys
LWD = '/home/prokop/git/ProbeParticleModel/code'
print(" # ========== make & load ProbeParticle C++ library ")
'''
def makeclea... | mit |
Lab603/PicEncyclopedias | jni-build/jni-build/jni/include/tensorflow/contrib/learn/python/learn/tests/dataframe/in_memory_source_test.py | 30 | 3738 | # 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... | mit |
linebp/pandas | pandas/tests/frame/test_validate.py | 7 | 1110 | from pandas.core.frame import DataFrame
import pytest
class TestDataFrameValidate(object):
"""Tests for error handling related to data types of method arguments."""
df = DataFrame({'a': [1, 2], 'b': [3, 4]})
def test_validate_bool_args(self):
# Tests for error handling related to boolean argumen... | bsd-3-clause |
guaix-ucm/megaradrp | megaradrp/simulation/actions.py | 2 | 25324 | #
# Copyright 2015-2021 Universidad Complutense de Madrid
#
# This file is part of Megara DRP
#
# SPDX-License-Identifier: GPL-3.0+
# License-Filename: LICENSE.txt
#
"""Sequences for observing modes of MEGARA"""
import math
import logging
import numpy as np
from scipy.interpolate import RectBivariateSpline
from scip... | gpl-3.0 |
gef756/statsmodels | statsmodels/tsa/filters/hp_filter.py | 27 | 3507 | from __future__ import absolute_import
from scipy import sparse
from scipy.sparse import dia_matrix, eye as speye
from scipy.sparse.linalg import spsolve
import numpy as np
from ._utils import _maybe_get_pandas_wrapper
def hpfilter(X, lamb=1600):
"""
Hodrick-Prescott filter
Parameters
----------
... | bsd-3-clause |
justthetips/PerformanceAnalytics | performanceanalytics/charts/performance_histogram.py | 1 | 2856 | # MIT License
# Copyright (c) 2017 Jacob Bourne
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, p... | mit |
CELMA-project/CELMA | celma/pickleTweaks/field1D/jParSeeSaw.py | 1 | 2532 | #!/usr/bin/env python
"""
Creation of the see-saw comparison.
"""
import pickle
import matplotlib.pylab as plt
import numpy as np
import scipy.constants as cst
from boututils.options import BOUTOptions
import os, sys
# If we add to sys.path, then it must be an absolute path
commonDir = os.path.abspath("./../../../co... | lgpl-3.0 |
percyfal/snakemakelib | snakemakelib/report/picard.py | 1 | 25057 | # Copyright (c) 2014 Per Unneberg
import os
import sys
import re
import csv
import texttable as tt
import collections
from snakemakelib.report.utils import Template
import matplotlib
matplotlib.use('Agg')
from pylab import *
import matplotlib.pyplot as plt
import numpy as np
# http://stackoverflow.com/questions/217090... | mit |
ellisk42/TikZ | utilities.py | 1 | 10100 | import os
from random import random,shuffle,seed
import math
import sys
import io
import numpy as np
from PIL import Image
def makeImageArray(l):
assert isinstance(l,list)
if not isinstance(l[0],list): l = [[c] for c in l]
for c in l:
assert allSame(c, lambda i: i.shape)
assert allSame([ c[0]... | gpl-3.0 |
riordan/professorblastoff | pytry.py | 1 | 1675 | import numpy as np
import cv2
from matplotlib import pyplot as plt
MIN_MATCH_COUNT = 10
img1 = cv2.imread('box.png',0) # queryImage
img2 = cv2.imread('scene.png',0) # trainImage
# Initiate SIFT detector
sift = cv2.SIFT()
# find the keypoints and descriptors with SIFT
kp1, des1 = sift.detectAndCompute(img1,... | apache-2.0 |
amitjamadagni/sympy | sympy/physics/quantum/circuitplot.py | 3 | 7280 | """Matplotlib based plotting of quantum circuits.
Todo:
* Optimize printing of large circuits.
* Get this to work with single gates.
* Do a better job checking the form of circuits to make sure it is a Mul of
Gates.
* Get multi-target gates plotting.
* Get initial and final states to plot.
* Get measurements to plo... | bsd-3-clause |
nikitasingh981/scikit-learn | sklearn/metrics/ranking.py | 25 | 27863 | """Metrics to assess performance on classification task given scores
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.... | bsd-3-clause |
earcher/nvil_example | code/lib/plot_cov.py | 1 | 2325 | # covariance plotting code, generously provided by the answer
# to this Stack Exchange question: https://stackoverflow.com/questions/12301071/multidimensional-confidence-intervals
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
import numpy as np
def plot_point_cov(points, nstd=2, ax=None, **kw... | mit |
quiltdata/quilt-compiler | api/python/quilt3/formats.py | 1 | 39009 | """ formats.py
This module handles binary formats, and conversion to/from objects.
# FormatRegistry Class (singleton)
The `FormatsRegistry` class acts as a global container for registered formats,
and provides a place to register and discover formats.
Formats may be discovered by:
* metadata
* file extensio... | apache-2.0 |
nrhine1/scikit-learn | examples/model_selection/plot_precision_recall.py | 249 | 6150 | """
================
Precision-Recall
================
Example of Precision-Recall metric to evaluate classifier output quality.
In information retrieval, precision is a measure of result relevancy, while
recall is a measure of how many truly relevant results are returned. A high
area under the curve represents both ... | bsd-3-clause |
lkuchenb/shogun | applications/easysvm/tutpaper/svm_params.py | 26 | 12935 |
#from matplotlib import rc
#rc('text', usetex=True)
fontsize = 16
contourFontsize = 12
showColorbar = False
xmin = -1
xmax = 1
ymin = -1.05
ymax = 1
import sys,os
import numpy
import shogun
from shogun.Kernel import GaussianKernel, LinearKernel, PolyKernel
from shogun.Features import RealFeatures, BinaryLabels
from... | gpl-3.0 |
zuotingbing/spark | python/pyspark/sql/pandas/functions.py | 5 | 28261 | #
# 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 |
ioggstream/python-course | python-for-sysadmin/test_prerequisites.py | 1 | 1376 | """Test Python for System Administrator Prerequisites
usage: nosetests -v test_prerequisites.py
expected output:
test_prerequisites.test_imports('nose',) ... ok
test_prerequisites.test_imports('psutil',) ... ok
test_prerequisites.test_imports('scipy',) ... ok
test_prerequisites.test_imports('matplotlib',) ... ... | agpl-3.0 |
opencobra/cobrapy | src/cobra/sampling/hr_sampler.py | 1 | 20467 | """Provide the base class and associated functions for Hit-and-Run samplers."""
import ctypes
import logging
from abc import ABC, abstractmethod
from multiprocessing import Array
from time import time
from typing import TYPE_CHECKING, NamedTuple, Optional, Tuple
import numpy as np
import pandas as pd
from optlang.int... | gpl-2.0 |
mrcaps/rainmon | code/run_abilene.py | 1 | 4579 | #Copyright (c) 2012, Carnegie Mellon University.
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions
#are met:
#1. Redistributions of source code must retain the above copyright
# notice, this list of condition... | bsd-3-clause |
sohale/nn-it | boltz1.py | 1 | 15347 | import numpy as np
#print help(np.floor)
#print dir(np.zeros((1,1)))
#exit()
VERBOSE = True
#removes correaltions
class DistrInterface(object):
""" Measures and mimics correlation ininput data"""
def energy(self, state):
pass
def sample(self):
#sample freely, no input condisioned (clamped... | gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.