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
georgid/SourceFilterContoursMelody
smstools/software/models_interface/spsModel_function.py
2
3560
# function to call the extractHarmSpec analysis/synthesis functions in software/models/spsModel.py import sys, os sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../models/')) import numpy as np import matplotlib.pyplot as plt from scipy.signal import get_window import spsModel as SPS import...
gpl-3.0
russel1237/scikit-learn
examples/ensemble/plot_gradient_boosting_regression.py
227
2520
""" ============================ Gradient Boosting regression ============================ Demonstrate Gradient Boosting on the Boston housing dataset. This example fits a Gradient Boosting model with least squares loss and 500 regression trees of depth 4. """ print(__doc__) # Author: Peter Prettenhofer <peter.prett...
bsd-3-clause
rajul/mne-python
mne/stats/tests/test_cluster_level.py
8
20475
import os import os.path as op import numpy as np from numpy.testing import (assert_equal, assert_array_equal, assert_array_almost_equal) from nose.tools import assert_true, assert_raises from scipy import sparse, linalg, stats from mne.fixes import partial import warnings from mne.parallel i...
bsd-3-clause
a301-teaching/a301_code
notebooks/python/resample.py
1
7031
# coding: utf-8 # ## working with projections # # We have been using [fast_hist](https://github.com/a301-teaching/a301_code/blob/f8c2e8cc8dce36c9852ca99ccfe19250d1405b50/a301lib/geolocate.py#L124) # and [fast_avg](https://github.com/a301-teaching/a301_code/blob/f8c2e8cc8dce36c9852ca99ccfe19250d1405b50/a301lib/geoloc...
mit
nolanliou/tensorflow
tensorflow/python/estimator/canned/linear_testing_utils.py
4
80247
# 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
cbertinato/pandas
pandas/tests/arithmetic/conftest.py
1
5813
import numpy as np import pytest import pandas as pd import pandas.util.testing as tm # ------------------------------------------------------------------ # Helper Functions def id_func(x): if isinstance(x, tuple): assert len(x) == 2 return x[0].__name__ + '-' + str(x[1]) else: retur...
bsd-3-clause
mgraffg/RGP
EvoDAG/tests/test_node.py
2
21536
# Copyright 2015 Mario Graff Guerrero # 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 wri...
apache-2.0
gfyoung/pandas
pandas/tests/arithmetic/test_interval.py
2
10345
import operator import numpy as np import pytest from pandas.core.dtypes.common import is_list_like import pandas as pd from pandas import ( Categorical, Index, Interval, IntervalIndex, Period, Series, Timedelta, Timestamp, date_range, period_range, timedelta_range, ) impo...
bsd-3-clause
yanlend/scikit-learn
sklearn/linear_model/tests/test_ransac.py
216
13290
import numpy as np from numpy.testing import assert_equal, assert_raises from numpy.testing import assert_array_almost_equal from sklearn.utils.testing import assert_raises_regexp from scipy import sparse from sklearn.utils.testing import assert_less from sklearn.linear_model import LinearRegression, RANSACRegressor f...
bsd-3-clause
heli522/scikit-learn
sklearn/datasets/tests/test_svmlight_format.py
228
11221
from bz2 import BZ2File import gzip from io import BytesIO import numpy as np import os import shutil from tempfile import NamedTemporaryFile from sklearn.externals.six import b from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert...
bsd-3-clause
rexshihaoren/scikit-learn
examples/text/mlcomp_sparse_document_classification.py
292
4498
""" ======================================================== Classification of text documents: using a MLComp dataset ======================================================== This is an example showing how the scikit-learn can be used to classify documents by topics using a bag-of-words approach. This example uses a s...
bsd-3-clause
tawsifkhan/scikit-learn
sklearn/metrics/tests/test_classification.py
83
49782
from __future__ import division, print_function import numpy as np from scipy import linalg from functools import partial from itertools import product import warnings from sklearn import datasets from sklearn import svm from sklearn.datasets import make_multilabel_classification from sklearn.preprocessing import la...
bsd-3-clause
pearsonlab/nipype
tools/make_examples.py
10
2906
#!/usr/bin/env python """Run the py->rst conversion and run all examples. This also creates the index.rst file appropriately, makes figures, etc. """ from past.builtins import execfile # ----------------------------------------------------------------------------- # Library imports # ---------------------------------...
bsd-3-clause
joernhees/scikit-learn
sklearn/metrics/classification.py
4
72788
"""Metrics to assess performance on classification task given class 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.gramf...
bsd-3-clause
rubikloud/scikit-learn
examples/applications/plot_out_of_core_classification.py
255
13919
""" ====================================================== Out-of-core classification of text documents ====================================================== This is an example showing how scikit-learn can be used for classification using an out-of-core approach: learning from data that doesn't fit into main memory. ...
bsd-3-clause
tmhm/scikit-learn
examples/ensemble/plot_partial_dependence.py
249
4456
""" ======================== Partial Dependence Plots ======================== Partial dependence plots show the dependence between the target function [1]_ and a set of 'target' features, marginalizing over the values of all other features (the complement features). Due to the limits of human perception the size of t...
bsd-3-clause
kadrlica/obztak
obztak/bliss.py
1
23344
#!/usr/bin/env python """ Code related to the Magellanic Satellites Survey (MagLiteS). """ import os,sys import logging import copy from collections import OrderedDict as odict import numpy as np import fitsio from obztak.field import FieldArray, SISPI_DICT, SEP from obztak.survey import Survey from obztak.scheduler ...
mit
akionakamura/scikit-learn
examples/mixture/plot_gmm_classifier.py
250
3918
""" ================== GMM classification ================== Demonstration of Gaussian mixture models for classification. See :ref:`gmm` for more information on the estimator. Plots predicted labels on both training and held out test data using a variety of GMM classifiers on the iris dataset. Compares GMMs with sp...
bsd-3-clause
appapantula/scikit-learn
sklearn/ensemble/voting_classifier.py
178
8006
""" Soft Voting/Majority Rule classifier. This module contains a Soft Voting/Majority Rule classifier for classification estimators. """ # Authors: Sebastian Raschka <se.raschka@gmail.com>, # Gilles Louppe <g.louppe@gmail.com> # # Licence: BSD 3 clause import numpy as np from ..base import BaseEstimator f...
bsd-3-clause
robin-lai/scikit-learn
examples/cluster/plot_lena_segmentation.py
271
2444
""" ========================================= Segmenting the picture of Lena in regions ========================================= This example uses :ref:`spectral_clustering` on a graph created from voxel-to-voxel difference on an image to break this image into multiple partly-homogeneous regions. This procedure (spe...
bsd-3-clause
chriscrosscutler/scikit-image
doc/examples/plot_join_segmentations.py
14
1967
""" ========================================== Find the intersection of two segmentations ========================================== When segmenting an image, you may want to combine multiple alternative segmentations. The `skimage.segmentation.join_segmentations` function computes the join of two segmentations, in wh...
bsd-3-clause
subutai/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_svg.py
69
23593
from __future__ import division import os, codecs, base64, tempfile, urllib, gzip, cStringIO try: from hashlib import md5 except ImportError: from md5 import md5 #Deprecated in 2.5 from matplotlib import verbose, __version__, rcParams from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\ ...
agpl-3.0
person142/scipy
scipy/spatial/_plotutils.py
8
6957
import numpy as np from scipy._lib.decorator import decorator as _decorator __all__ = ['delaunay_plot_2d', 'convex_hull_plot_2d', 'voronoi_plot_2d'] @_decorator def _held_figure(func, obj, ax=None, **kw): import matplotlib.pyplot as plt # type: ignore[import] if ax is None: fig = plt.figure() ...
bsd-3-clause
louispotok/pandas
pandas/tests/io/msgpack/test_newspec.py
22
2650
# coding: utf-8 from pandas.io.msgpack import packb, unpackb, ExtType def test_str8(): header = b'\xd9' data = b'x' * 32 b = packb(data.decode(), use_bin_type=True) assert len(b) == len(data) + 2 assert b[0:2] == header + b'\x20' assert b[2:] == data assert unpackb(b) == data data = ...
bsd-3-clause
rspavel/spack
var/spack/repos/builtin/packages/py-quast/package.py
5
1332
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyQuast(PythonPackage): """Quality Assessment Tool for Genome Assemblies""" homepage ...
lgpl-2.1
dkushner/zipline
tests/test_transforms_talib.py
17
6080
# # 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
Prasad9/incubator-mxnet
example/rcnn/rcnn/core/tester.py
25
10193
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
apache-2.0
gclenaghan/scikit-learn
examples/linear_model/plot_multi_task_lasso_support.py
102
2319
#!/usr/bin/env python """ ============================================= Joint feature selection with multi-task Lasso ============================================= The multi-task lasso allows to fit multiple regression problems jointly enforcing the selected features to be the same across tasks. This example simulates...
bsd-3-clause
steinnp/Big-Data-Final
Classification/neural_network_classifier.py
1
4297
import sys, os foo_dir = os.path.dirname(os.path.join(os.getcwd(), __file__)) sys.path.append(os.path.normpath(os.path.join(foo_dir, '../DataGathering', '..'))) sys.path.append(os.path.normpath(os.path.join(foo_dir, '../Classification', '..'))) sys.path.append(os.path.normpath(os.path.join(foo_dir, '../TextCleaning', '...
mit
lancezlin/ml_template_py
lib/python2.7/site-packages/sklearn/ensemble/partial_dependence.py
8
15443
"""Partial dependence plots for tree ensembles. """ # Authors: Peter Prettenhofer # License: BSD 3 clause from itertools import count import numbers import numpy as np from scipy.stats.mstats import mquantiles from ..utils.extmath import cartesian from ..externals.joblib import Parallel, delayed from ..externals im...
mit
ctogle/dilapidator
test/geometry/ray3_tests.py
1
2623
from dilap.geometry.vec3 import vec3 from dilap.geometry.ray3 import ray3 import matplotlib.pyplot as plt import unittest,numpy,math #python3 -m unittest discover -v ./ "*tests.py" class test_ray3(unittest.TestCase): def test_cp(self): r1 = ray3(vec3(1,1,2),vec3(0,1,0)) r2 = ray3(vec3(1,1,2),ve...
mit
machinelearningnanodegree/stanford-cs231
solutions/levin/assignment2/convolutionalnetwork/convolutionalnetwork.py
1
21893
import sys import os from astropy.units import ys from gevent.hub import sleep sys.path.insert(0, os.path.abspath('..')) import random import numpy as np import matplotlib.pyplot as plt from assignment2.cs231n.layers import affine_forward from assignment2.cs231n.layers import affine_backward from assignment2.cs231n.l...
mit
jpautom/scikit-learn
sklearn/cross_validation.py
5
67227
""" The :mod:`sklearn.cross_validation` module includes utilities for cross- validation and performance evaluation. """ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>, # Gael Varoquaux <gael.varoquaux@normalesup.org>, # Olivier Grisel <olivier.grisel@ensta.org> # License: BSD 3 clause from...
bsd-3-clause
IBT-FMI/SAMRI
samri/plotting/summary.py
1
16538
#!/usr/bin/env python # -*- coding: utf-8 -*- from itertools import product from copy import deepcopy import nibabel as nib import numpy as np import multiprocessing as mp import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import statsmodels.formula.api as smf from joblib import Parallel, delaye...
gpl-3.0
larsmans/scikit-learn
sklearn/covariance/graph_lasso_.py
17
23130
"""GraphLasso: sparse inverse covariance estimation with an l1-penalized estimator. """ # Author: Gael Varoquaux <gael.varoquaux@normalesup.org> # License: BSD 3 clause # Copyright: INRIA import warnings import operator import sys import time import numpy as np from scipy import linalg from .empirical_covariance_ im...
bsd-3-clause
henrykironde/scikit-learn
examples/tree/plot_tree_regression.py
206
1476
""" =================================================================== Decision Tree Regression =================================================================== A 1D regression with decision tree. The :ref:`decision trees <tree>` is used to fit a sine curve with addition noisy observation. As a result, it learns ...
bsd-3-clause
georgetown-analytics/travel-trends
prgm/NYTWrangler.py
1
2670
#!/usr/bin/env python from os import getcwd from os import listdir from json import load import pandas as pd from pandas.io.json import json_normalize import sqlite3 class NYT_Wrangle(object): def __init__(self): # self.json_indexer = ['pub_date', 'lead_paragraph', ['headline', 'main'], 'abstract', 'word_count'...
mit
ocefpaf/system-test
Theme_2_Extreme_Events/Scenario_2B/HF_Radar_Currents/HF_Radar_Currents_west_coast.py
2
23185
# -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # <markdowncell> # ># IOOS System Test: [HF Radar](https://github.com/ioos/system-test/wiki/Development-of-Test-Themes) Coastal Inundation # <markdowncell> # ### Can we obtain HF radar current data at stations located within a bounding box? # This notebook is based...
unlicense
hlin117/scikit-learn
sklearn/decomposition/tests/test_online_lda.py
24
14430
import numpy as np from scipy.linalg import block_diag from scipy.sparse import csr_matrix from scipy.special import psi from sklearn.decomposition import LatentDirichletAllocation from sklearn.decomposition._online_lda import (_dirichlet_expectation_1d, _dirichlet_expect...
bsd-3-clause
grisaitis/sklearn-pmml
sklearn_pmml/convert/test/test_derived_fields.py
3
2027
import pytest from sklearn.tree import DecisionTreeClassifier from sklearn_pmml import EstimatorConverter, TransformationContext, pmml from sklearn_pmml.convert.features import * test_cases = [ ( [ RealNumericFeature(name='f1'), ], [ DerivedFeature( f...
mit
toobaz/pandas
pandas/core/dtypes/base.py
2
8839
"""Extend pandas with custom array types""" from typing import List, Optional, Tuple, Type import numpy as np from pandas.errors import AbstractMethodError from pandas.core.dtypes.generic import ABCDataFrame, ABCIndexClass, ABCSeries class ExtensionDtype: """ A custom data type, to be paired with an Extens...
bsd-3-clause
massmutual/scikit-learn
examples/decomposition/plot_pca_vs_fa_model_selection.py
142
4467
""" =============================================================== Model selection with Probabilistic PCA and Factor Analysis (FA) =============================================================== Probabilistic PCA and Factor Analysis are probabilistic models. The consequence is that the likelihood of new data can be u...
bsd-3-clause
davidgbe/scikit-learn
sklearn/datasets/base.py
196
18554
""" Base IO code for all datasets """ # Copyright (c) 2007 David Cournapeau <cournape@gmail.com> # 2010 Fabian Pedregosa <fabian.pedregosa@inria.fr> # 2010 Olivier Grisel <olivier.grisel@ensta.org> # License: BSD 3 clause import os import csv import shutil from os import environ from os.pa...
bsd-3-clause
unnikrishnankgs/va
venv/lib/python3.5/site-packages/matplotlib/tests/test_backend_ps.py
5
4960
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) import io import re import numpy as np import six import matplotlib import matplotlib.pyplot as plt from matplotlib import patheffects from matplotlib.testing.decorators import cleanup...
bsd-2-clause
nwillemse/nctrader
nctrader/price_handler/iterator/pandas/bar.py
1
3338
from ..base import AbstractBarEventIterator class PandasDataFrameBarEventIterator(AbstractBarEventIterator): """ PandasDataFrameBarEventIterator is designed to read a Pandas DataFrame like Open High Low Close Volume Adj Close Date 2010-01-04 626.951088...
mit
lazywei/scikit-learn
sklearn/ensemble/weight_boosting.py
30
40648
"""Weight Boosting This module contains weight boosting estimators for both classification and regression. The module structure is the following: - The ``BaseWeightBoosting`` base class implements a common ``fit`` method for all the estimators in the module. Regression and classification only differ from each ot...
bsd-3-clause
YihaoLu/statsmodels
statsmodels/datasets/cpunish/data.py
25
2597
"""US Capital Punishment dataset.""" __docformat__ = 'restructuredtext' COPYRIGHT = """Used with express permission from the original author, who retains all rights.""" TITLE = __doc__ SOURCE = """ Jeff Gill's `Generalized Linear Models: A Unified Approach` http://jgill.wustl.edu/research/books.html """...
bsd-3-clause
synthicity/urbansim
urbansim/developer/sqftproforma.py
4
29510
from __future__ import division import numpy as np import pandas as pd import logging logger = logging.getLogger(__name__) class SqFtProFormaConfig(object): """ This class encapsulates the configuration options for the square foot based pro forma. Parameters ---------- parcel_sizes : list ...
bsd-3-clause
rubikloud/scikit-learn
sklearn/utils/tests/test_utils.py
215
8100
import warnings import numpy as np import scipy.sparse as sp from scipy.linalg import pinv2 from itertools import chain from sklearn.utils.testing import (assert_equal, assert_raises, assert_true, assert_almost_equal, assert_array_equal, SkipTest, ...
bsd-3-clause
CompPhysics/ThesisProjects
doc/MSc/msc_students/former/sean/Thesis/Codes/PythonCode/CCD_alt_v2.py
1
10945
from sympy import * #from pylab import * import numpy as np import math import matplotlib.pyplot as plt #CLASSES class HEG: #Homogenous Electron Gas def __init__(self): pass #3d box potential def makeStateSpace(self): #N = num of particles, NB = size of basis (number of energy levels) states = [] for n2 in...
cc0-1.0
cllamb0/dosenet-raspberrypi
rt_waterfall_D3S.py
3
3186
from auxiliaries import set_verbosity import time import numpy as np import matplotlib.pyplot as plt class Rt_Waterfall_D3S(object): """ Class for running the D3S in real-time waterfall mode """ def __init__(self, manager=None, verbosity=1, log...
mit
hsiaoyi0504/scikit-learn
sklearn/neural_network/tests/test_rbm.py
142
6276
import sys import re import numpy as np from scipy.sparse import csc_matrix, csr_matrix, lil_matrix from sklearn.utils.testing import (assert_almost_equal, assert_array_equal, assert_true) from sklearn.datasets import load_digits from sklearn.externals.six.moves import cStringIO as ...
bsd-3-clause
aabadie/scikit-learn
sklearn/neighbors/tests/test_ball_tree.py
159
10196
import pickle import numpy as np from numpy.testing import assert_array_almost_equal from sklearn.neighbors.ball_tree import (BallTree, NeighborsHeap, simultaneous_sort, kernel_norm, nodeheap_sort, DTYPE, ITYPE) from sklearn.neighbors.dis...
bsd-3-clause
Windy-Ground/scikit-learn
sklearn/utils/arpack.py
265
64837
""" This contains a copy of the future version of scipy.sparse.linalg.eigen.arpack.eigsh It's an upgraded wrapper of the ARPACK library which allows the use of shift-invert mode for symmetric matrices. Find a few eigenvectors and eigenvalues of a matrix. Uses ARPACK: http://www.caam.rice.edu/software/ARPACK/ """ #...
bsd-3-clause
otmaneJai/Zipline
zipline/utils/factory.py
1
10430
# # 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
hdmetor/scikit-learn
sklearn/feature_selection/rfe.py
137
17066
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Vincent Michel <vincent.michel@inria.fr> # Gilles Louppe <g.louppe@gmail.com> # # License: BSD 3 clause """Recursive feature elimination for feature ranking""" import warnings import numpy as np from ..utils import check_X_y, safe_sqr fro...
bsd-3-clause
xya/sms-tools
lectures/03-Fourier-properties/plots-code/zero-padding.py
26
1083
import numpy as np import matplotlib.pyplot as plt from scipy.signal import hamming from scipy.fftpack import fft, fftshift plt.figure(1, figsize=(9.5, 6)) M = 8 N1 = 8 N2 = 16 N3 = 32 x = np.cos(2*np.pi*2/M*np.arange(M)) * np.hanning(M) plt.subplot(4,1,1) plt.title('x, M=8') plt.plot(np.arange(-M/2.0,M/2), x, 'b', m...
agpl-3.0
zzcclp/spark
python/pyspark/pandas/tests/test_series.py
9
118972
# # 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
Ferouk/Twitter-Sentiment-Analysis
training.py
1
4656
from __future__ import absolute_import, print_function import pickle import random import nltk from nltk.classify.scikitlearn import SklearnClassifier from nltk.tokenize import word_tokenize from sklearn.linear_model import LogisticRegression, SGDClassifier from sklearn.naive_bayes import MultinomialNB, BernoulliNB f...
mit
rajegannathan/grasp-lift-eeg-cat-dog-solution-updated
python-packages/mne-python-0.10/mne/viz/tests/test_3d.py
13
7481
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Denis Engemann <denis.engemann@gmail.com> # Martin Luessi <mluessi@nmr.mgh.harvard.edu> # Eric Larson <larson.eric.d@gmail.com> # Mainak Jas <mainak@neuro.hut.fi> # Mark Wronkiewicz <wronk.mark@gmail.c...
bsd-3-clause
BrainTech/openbci
obci/analysis/balance/wii_preprocessing.py
1
2905
# -*- coding: utf-8 -*- from __future__ import print_function, division import numpy as np import matplotlib.pyplot as py from obci.analysis.obci_signal_processing import read_manager from obci.analysis.obci_signal_processing.signal import read_data_source from obci.analysis.obci_signal_processing.tags import smart_tag...
gpl-3.0
dingocuster/scikit-learn
sklearn/tests/test_naive_bayes.py
70
17509
import pickle from io import BytesIO import numpy as np import scipy.sparse from sklearn.datasets import load_digits, load_iris from sklearn.cross_validation import cross_val_score, train_test_split from sklearn.externals.six.moves import zip from sklearn.utils.testing import assert_almost_equal from sklearn.utils.te...
bsd-3-clause
dsquareindia/scikit-learn
sklearn/metrics/cluster/tests/test_bicluster.py
394
1770
"""Testing for bicluster metrics module""" import numpy as np from sklearn.utils.testing import assert_equal, assert_almost_equal from sklearn.metrics.cluster.bicluster import _jaccard from sklearn.metrics import consensus_score def test_jaccard(): a1 = np.array([True, True, False, False]) a2 = np.array([T...
bsd-3-clause
blackecho/Deep-Belief-Network
yadlt/models/recurrent/lstm.py
2
6589
"""LSTM Tensorflow implementation.""" from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf from yadlt.core import Model from yadlt.utils import utilities class LSTM(Model): """Long Short-Term Memory Network tensorflow implementation. The interfac...
apache-2.0
zaxtax/scikit-learn
examples/mixture/plot_gmm.py
36
2875
""" ================================= 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
duncanwp/iris
docs/iris/example_code/Meteorology/COP_1d_plot.py
5
4186
""" Global average annual temperature plot ====================================== Produces a time-series plot of North American temperature forecasts for 2 different emission scenarios. Constraining data to a limited spatial area also features in this example. The data used comes from the HadGEM2-AO model simulations...
lgpl-3.0
ngoix/OCRF
examples/applications/wikipedia_principal_eigenvector.py
16
7819
""" =============================== Wikipedia principal eigenvector =============================== A classical way to assert the relative importance of vertices in a graph is to compute the principal eigenvector of the adjacency matrix so as to assign to each vertex the values of the components of the first eigenvect...
bsd-3-clause
yavalvas/yav_com
build/matplotlib/lib/mpl_examples/pylab_examples/multiple_yaxis_with_spines.py
6
1582
import matplotlib.pyplot as plt def make_patch_spines_invisible(ax): ax.set_frame_on(True) ax.patch.set_visible(False) for sp in ax.spines.itervalues(): sp.set_visible(False) fig, host = plt.subplots() fig.subplots_adjust(right=0.75) par1 = host.twinx() par2 = host.twinx() # Offset the right spi...
mit
IL2HorusTeam/il2-heightmap-creator
il2fb/maps/heightmaps/rendering.py
1
4124
# -*- coding: utf-8 -*- import argparse import logging from array import array from pathlib import Path import matplotlib.pyplot as plt import numpy as np from matplotlib.colors import LinearSegmentedColormap from pylab import contour, contourf from il2fb.maps.heightmaps.constants import HEIGHT_PACK_FORMAT from i...
mit
OshynSong/scikit-learn
sklearn/neural_network/tests/test_rbm.py
225
6278
import sys import re import numpy as np from scipy.sparse import csc_matrix, csr_matrix, lil_matrix from sklearn.utils.testing import (assert_almost_equal, assert_array_equal, assert_true) from sklearn.datasets import load_digits from sklearn.externals.six.moves import cStringIO as ...
bsd-3-clause
MartinSavc/scikit-learn
examples/linear_model/plot_iris_logistic.py
283
1678
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Logistic Regression 3-class Classifier ========================================================= Show below is a logistic-regression classifiers decision boundaries on the `iris <http://en.wikipedia.org/wiki/Iris_f...
bsd-3-clause
Cophy08/ggplot
ggplot/stats/stat_vline.py
12
1316
from __future__ import (absolute_import, division, print_function, unicode_literals) import pandas as pd from ggplot.utils import pop, make_iterable, make_iterable_ntimes from ggplot.utils.exceptions import GgplotError from .stat import stat class stat_vline(stat): DEFAULT_PARAMS = {'geom...
bsd-2-clause
MDAnalysis/pmda
pmda/rms/rmsd.py
1
4773
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*- # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 # # PMDA # Copyright (c) 2019 The MDAnalysis Development Team and contributors # (see the file AUTHORS for the full list of names) # # Released under the GNU Public Licence, v2 or any higher ve...
gpl-2.0
wronk/mne-python
examples/time_frequency/plot_source_label_time_frequency.py
4
3776
""" ========================================================= Compute power and phase lock in label of the source space ========================================================= Compute time-frequency maps of power and phase lock in the source space. The inverse method is linear based on dSPM inverse operator. The ex...
bsd-3-clause
MyAOSP/external_chromium_org
chrome/browser/nacl_host/test/gdb_rsp.py
99
2431
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # This file is based on gdb_rsp.py file from NaCl repository. import re import socket import time def RspChecksum(data): checksum = 0 for char in ...
bsd-3-clause
davidam/python-examples
scikit/confusion-matrix.py
1
2514
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (C) 2018 David Arroyo Menéndez # Author: David Arroyo Menéndez <davidam@gnu.org> # Maintainer: David Arroyo Menéndez <davidam@gnu.org> # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as p...
gpl-3.0
kcavagnolo/astroML
book_figures/chapter2/fig_balltree_example.py
3
3873
""" Ball Tree Example ----------------- Figure 2.5. This example creates a simple Ball tree partition of a two-dimensional parameter space, and plots a visualization of the result. """ # Author: Jake VanderPlas # License: BSD # The figure produced by this code is published in the textbook # "Statistics, Data Minin...
bsd-2-clause
roxyboy/scikit-learn
sklearn/datasets/species_distributions.py
198
7923
""" ============================= Species distribution dataset ============================= This dataset represents the geographic distribution of species. The dataset is provided by Phillips et. al. (2006). The two species are: - `"Bradypus variegatus" <http://www.iucnredlist.org/apps/redlist/details/3038/0>`_...
bsd-3-clause
dajusc/trimesh
tests/notebooks.py
2
5546
import os import sys import json import inspect import subprocess import numpy as np # current working directory cwd = os.path.dirname(os.path.abspath( inspect.getfile(inspect.currentframe()))) def load_notebook(file_obj): """ Load an ipynb file into a cleaned and stripped string that can be ran with...
mit
vibhorag/scikit-learn
sklearn/utils/tests/test_fixes.py
281
1829
# Authors: Gael Varoquaux <gael.varoquaux@normalesup.org> # Justin Vincent # Lars Buitinck # License: BSD 3 clause import numpy as np from nose.tools import assert_equal from nose.tools import assert_false from nose.tools import assert_true from numpy.testing import (assert_almost_equal, ...
bsd-3-clause
CCI-Tools/cate-core
cate/webapi/mpl.py
2
12044
# The MIT License (MIT) # Copyright (c) 2016, 2017 by the ESA CCI Toolbox development team and contributors # # 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 wi...
mit
MechCoder/scikit-learn
examples/covariance/plot_mahalanobis_distances.py
348
6232
r""" ================================================================ Robust covariance estimation and Mahalanobis distances relevance ================================================================ An example to show covariance estimation with the Mahalanobis distances on Gaussian distributed data. For Gaussian dis...
bsd-3-clause
vernor1/vehicle_detection
classifier.py
1
4380
import cv2 import glob import numpy as np import os.path import pickle from feature_extraction import ExtractFeatures from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.svm import LinearSVC class TClassifier(): """ Vehicle/non-vehicle classifier cla...
apache-2.0
mikecroucher/GPy
GPy/examples/dimensionality_reduction.py
5
25399
# Copyright (c) 2012-2014, GPy authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) import numpy as _np default_seed = 123344 # default_seed = _np.random.seed(123344) def bgplvm_test_model(optimize=False, verbose=1, plot=False, output_dim=200, nan=False): """ model for testin...
bsd-3-clause
ssaeger/scikit-learn
examples/cluster/plot_kmeans_silhouette_analysis.py
83
5888
""" =============================================================================== Selecting the number of clusters with silhouette analysis on KMeans clustering =============================================================================== Silhouette analysis can be used to study the separation distance between the...
bsd-3-clause
ShefaliGups11/Implementation-of-SFB-in-ns-3
src/flow-monitor/examples/wifi-olsr-flowmon.py
59
7427
# -*- Mode: Python; -*- # Copyright (c) 2009 INESC Porto # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, #...
gpl-2.0
jason-neal/equanimous-octo-tribble
octotribble/snr_calculations.py
1
8067
#!/usr/bin/env python from __future__ import division import argparse import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from astropy.io import fits from numpy.lib import stride_tricks # Testing for a snr of my spectra import SpectralTools as s_tools def _parser(): ""...
mit
beepee14/scikit-learn
examples/covariance/plot_outlier_detection.py
235
3891
""" ========================================== Outlier detection with several methods. ========================================== When the amount of contamination is known, this example illustrates two different ways of performing :ref:`outlier_detection`: - based on a robust estimator of covariance, which is assumin...
bsd-3-clause
moutai/scikit-learn
sklearn/metrics/tests/test_regression.py
272
6066
from __future__ import division, print_function import numpy as np from itertools import product from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils....
bsd-3-clause
architecture-building-systems/CEAforArcGIS
cea/interfaces/cli/list_demand_graphs_fields.py
2
1545
""" List the fields that can be used for the demand-graphs ``--analysis-fields`` parameter given a scenario """ import os import pandas as pd import cea.config import cea.inputlocator def demand_graph_fields(scenario): """Lists the available fields for the demand graphs - these are fields that are present in ...
mit
MSHallOpenSoft/plotter
sympyPlot_implicit.py
1
15281
"""Implicit plotting module for SymPy The module implements a data series called ImplicitSeries which is used by ``Plot`` class to plot implicit plots for different backends. The module, by default, implements plotting using interval arithmetic. It switches to a fall back algorithm if the expression cannot be plotted ...
gpl-2.0
dougalsutherland/py-sdm
sdm/features.py
1
48075
from __future__ import division, print_function from collections import Counter, defaultdict from contextlib import closing from functools import partial from glob import glob import operator as op import os import cPickle as pickle import shutil import sys import numpy as np from .utils import (imap, izip, iterkeys...
bsd-3-clause
thesuperzapper/tensorflow
tensorflow/python/estimator/inputs/queues/feeding_functions_test.py
58
9375
# 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
gweidner/incubator-systemml
src/main/python/systemml/mlcontext.py
7
25911
# ------------------------------------------------------------- # # 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 unde...
apache-2.0
ucbtrans/sumo-project
car_following_model/macrosim.py
1
4653
''' Macro-simulation... ''' import sys import numpy as np import matplotlib.pyplot as plt from Link import Link import plot_routines as pr import pickle def initialize(): ''' Returns array of links, simulation step length in seconds and total simulation time. ''' dt = 0.05 # seconds total_t...
bsd-2-clause
TomAugspurger/pandas
pandas/tests/io/test_html.py
1
39222
from functools import partial from importlib import reload from io import BytesIO, StringIO import os import re import threading from urllib.error import URLError import numpy as np from numpy.random import rand import pytest from pandas.compat import is_platform_windows from pandas.errors import ParserError import p...
bsd-3-clause
SciTools/iris
lib/iris/tests/test_plot.py
3
31896
# Copyright Iris contributors # # This file is part of Iris and is released under the LGPL license. # See COPYING and COPYING.LESSER in the root of the repository for full # licensing details. # import iris tests first so that some things can be initialised before # importing anything else import iris.tests as tests ...
lgpl-3.0
Windy-Ground/scikit-learn
examples/calibration/plot_calibration.py
225
4795
""" ====================================== Probability calibration of classifiers ====================================== When performing classification you often want to predict not only the class label, but also the associated probability. This probability gives you some kind of confidence on the prediction. However,...
bsd-3-clause
allafort/StatisticalMethods
examples/Cepheids/straightline_utils.py
14
2858
# numpy: numerical library import numpy as np # avoid broken installs by forcing Agg backend... #import matplotlib #matplotlib.use('Agg') # pylab: matplotlib's matlab-like interface import pylab as plt # The data we will fit: # x, y, sigma_y data1 = np.array([[201,592,61],[244,401,25],[47,583,38],[287,402,15],[203,49...
gpl-2.0
montoyjh/pymatgen
pymatgen/io/abinit/tests/test_abiinspect.py
3
4081
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. import os import tempfile from pymatgen.util.testing import PymatgenTest from pymatgen.io.abinit.abiinspect import * _test_dir = os.path.join(os.path.dirname(__file__), "..", "..", "..", "..", ...
mit