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
saiwing-yeung/scikit-learn
sklearn/tests/test_base.py
5
7693
# Author: Gael Varoquaux # License: BSD 3 clause import sys import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_false from sklearn.utils.testing import assert_equal from sklearn.utils....
bsd-3-clause
ishank08/scikit-learn
sklearn/datasets/lfw.py
15
18695
"""Loader for the Labeled Faces in the Wild (LFW) dataset This dataset is a collection of JPEG pictures of famous people collected over the internet, all details are available on the official website: http://vis-www.cs.umass.edu/lfw/ Each picture is centered on a single face. The typical task is called Face Veri...
bsd-3-clause
enigmampc/catalyst
tests/pipeline/test_term.py
1
25102
""" Tests for Term. """ from collections import Counter from itertools import product from unittest import TestCase from toolz import assoc import pandas as pd from catalyst.assets import Asset from catalyst.errors import ( DTypeNotSpecified, InvalidOutputName, NonWindowSafeInput, NotDType, TermIn...
apache-2.0
reshama/data-science-from-scratch
code/clustering.py
60
6438
from __future__ import division from linear_algebra import squared_distance, vector_mean, distance import math, random import matplotlib.image as mpimg import matplotlib.pyplot as plt class KMeans: """performs k-means clustering""" def __init__(self, k): self.k = k # number of clusters ...
unlicense
iismd17/scikit-learn
sklearn/metrics/pairwise.py
49
44088
# -*- coding: utf-8 -*- # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Mathieu Blondel <mathieu@mblondel.org> # Robert Layton <robertlayton@gmail.com> # Andreas Mueller <amueller@ais.uni-bonn.de> # Philippe Gervais <philippe.gervais@inria.fr> # Lars Buitinck ...
bsd-3-clause
bthirion/nistats
nistats/tests/test_utils.py
1
7186
#!/usr/bin/env python import os import numpy as np import pandas as pd import scipy.linalg as spl from nibabel.tmpdirs import InTemporaryDirectory from nilearn.datasets.tests import test_utils as tst from nose import with_setup from nose.tools import (assert_true, assert_equal, ...
bsd-3-clause
schreiberx/sweet
scripts/normal_modes_plot_and_analyse.py
2
4514
#!/usr/bin/env python2 import sys import numpy as np from mpmath import mp import matplotlib.pyplot as plt import math if len(sys.argv) < 2: print("Execute with [executable] [input]") sys.exit(1) filename = sys.argv[1] print("Loading data from "+filename) data = np.loadtxt(filename, skiprows=0) rows,cols = data....
mit
lenovor/scikit-learn
sklearn/ensemble/tests/test_base.py
284
1328
""" Testing for the base module (sklearn.ensemble.base). """ # Authors: Gilles Louppe # License: BSD 3 clause from numpy.testing import assert_equal from nose.tools import assert_true from sklearn.utils.testing import assert_raise_message from sklearn.datasets import load_iris from sklearn.ensemble import BaggingCla...
bsd-3-clause
rohanp/scikit-learn
examples/gaussian_process/plot_gpr_co2.py
131
5705
""" ======================================================== Gaussian process regression (GPR) on Mauna Loa CO2 data. ======================================================== This example is based on Section 5.4.3 of "Gaussian Processes for Machine Learning" [RW2006]. It illustrates an example of complex kernel engine...
bsd-3-clause
Storj/storjnet
benchmark/filterupdates_push/quasar_extraprop_plot.py
1
2868
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt # pip install matplotlib import json x = [] y_success = [] y_redundant = [] y_spam = [] samples = [ json.load(open("benchmark/filterupdates_push/quasar_extraprop_a.json", "r")), json.load(open("benchmark/filterupdates_push/quasar_extraprop_b.json", "r...
mit
mhvk/astropy
astropy/visualization/wcsaxes/grid_paths.py
5
4066
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from matplotlib.lines import Path from astropy.coordinates.angle_utilities import angular_separation # Tolerance for WCS round-tripping, relative to the scale size ROUND_TRIP_RTOL = 1. # Tolerance for discontinuities relative to th...
bsd-3-clause
terkkila/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
philo-zhang/cnn-tracker
show_training_log.py
1
4683
import os import re import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from argparse import ArgumentParser from collections import defaultdict def _parse(file_path, pattern_iter, pattern_loss, pattern_accuracy): with open(file_path, 'r') as f: log = f.read() iter_list = map(in...
gpl-2.0
nmayorov/scikit-learn
examples/cluster/plot_segmentation_toy.py
91
3522
""" =========================================== Spectral clustering for image segmentation =========================================== In this example, an image with connected circles is generated and spectral clustering is used to separate the circles. In these settings, the :ref:`spectral_clustering` approach solve...
bsd-3-clause
jreback/pandas
pandas/tests/test_take.py
3
16875
from datetime import datetime import re import numpy as np import pytest from pandas._libs import iNaT import pandas._testing as tm import pandas.core.algorithms as algos @pytest.fixture(params=[True, False]) def writeable(request): return request.param # Check that take_nd works both with writeable arrays #...
bsd-3-clause
ningchi/scikit-learn
sklearn/tests/test_naive_bayes.py
142
17496
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
wathen/PhD
MHD/FEniCS/FieldSplit/LSC/MUresults/3d.py
1
12582
#!/opt/local/bin/python from dolfin import * import petsc4py import sys petsc4py.init(sys.argv) from petsc4py import PETSc # from MatrixOperations import * import numpy as np import matplotlib.pylab as plt import os import scipy.io #from PyTrilinos import Epetra, EpetraExt, AztecOO, ML, Amesos #from scipy2Trilinos i...
mit
xwolf12/androguard
elsim/elsim/elsim.py
37
16175
# This file is part of Elsim # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # All rights reserved. # # Elsim 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, ...
apache-2.0
nmayorov/scikit-learn
sklearn/linear_model/tests/test_theil_sen.py
58
9948
""" Testing for Theil-Sen module (sklearn.linear_model.theil_sen) """ # Author: Florian Wilhelm <florian.wilhelm@gmail.com> # License: BSD 3 clause from __future__ import division, print_function, absolute_import import os import sys from contextlib import contextmanager import numpy as np from numpy.testing import ...
bsd-3-clause
ndingwall/scikit-learn
sklearn/neighbors/_kde.py
7
10831
""" Kernel Density Estimation ------------------------- """ # Author: Jake Vanderplas <jakevdp@cs.washington.edu> import numpy as np from scipy.special import gammainc from ..base import BaseEstimator from ..utils import check_array, check_random_state from ..utils.validation import _check_sample_weight, check_is_fitt...
bsd-3-clause
quom/google-cloud-python
monitoring/google/cloud/monitoring/query.py
7
24410
# Copyright 2016 Google 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 writing, ...
apache-2.0
luo66/scikit-learn
examples/cluster/plot_adjusted_for_chance_measures.py
286
4353
""" ========================================================== Adjustment for chance in clustering performance evaluation ========================================================== The following plots demonstrate the impact of the number of clusters and number of samples on various clustering performance evaluation me...
bsd-3-clause
466152112/scikit-learn
examples/hetero_feature_union.py
288
6236
""" ============================================= Feature Union with Heterogeneous Data Sources ============================================= Datasets can often contain components of that require different feature extraction and processing pipelines. This scenario might occur when: 1. Your dataset consists of hetero...
bsd-3-clause
prateeksaxena2809/opencog
opencog/embodiment/Monitor/monitor_main.py
17
4138
#!/usr/bin/env python # # Main window for OAC monitor # # It is only used for development, you should use 'python oc_workbench.py' # to start the OpenCog workbench # # @author: Zhenhua Cai, czhedu@gmail.com # @date: 2011-03-30 # # @note: I borrowed some code from # http://matplotlib.sourceforge.net/examples/user_...
agpl-3.0
niamoto/niamoto-core
niamoto/data_marts/dimensions/base_dimension.py
2
12926
# coding: utf-8 import io from datetime import datetime from sqlalchemy.engine.reflection import Inspector from geoalchemy2 import Geography, Geometry import sqlalchemy as sa import pandas as pd from niamoto.db import metadata as meta from niamoto.db.connector import Connector from niamoto.conf import settings from ...
gpl-3.0
kenshay/ImageScript
ProgramData/SystemFiles/Python/Lib/site-packages/mpl_toolkits/axes_grid1/axes_rgb.py
6
7005
from __future__ import (absolute_import, division, print_function, unicode_literals) import six import numpy as np from .axes_divider import make_axes_locatable, Size, locatable_axes_factory import sys from .mpl_axes import Axes def make_rgb_axes(ax, pad=0.01, axes_class=None, add_all=True):...
gpl-3.0
calico/basenji
bin/basenji_sat_plot2.py
1
10706
#!/usr/bin/env python # Copyright 2017 Calico LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
apache-2.0
andrewnc/scikit-learn
doc/tutorial/text_analytics/solutions/exercise_02_sentiment.py
254
2795
"""Build a sentiment analysis / polarity model Sentiment analysis can be casted as a binary text classification problem, that is fitting a linear classifier on features extracted from the text of the user messages so as to guess wether the opinion of the author is positive or negative. In this examples we will use a ...
bsd-3-clause
awacha/saxsfittool
src/saxsfittool/fitfunction/ellipsoid/ellipsoid.py
1
7843
import numpy as np from matplotlib.axes import Axes from matplotlib.patches import Ellipse from .c_ellipsoid2 import AsymmetricEllipsoidalShell, EllipsoidalShellWithSizeDistribution from .c_gauss_ellipsoid import I0Rgfromrho, rhofromI0Rg, F2GaussianEllipsoid from ..core import FitFunction class F2AsymmetricCoreShell...
bsd-3-clause
aflaxman/scikit-learn
sklearn/model_selection/_search.py
8
56392
""" The :mod:`sklearn.model_selection._search` includes utilities to fine-tune the parameters of an estimator. """ from __future__ import print_function from __future__ import division # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>, # Gael Varoquaux <gael.varoquaux@normalesup.org> # Andreas...
bsd-3-clause
huobaowangxi/scikit-learn
sklearn/utils/tests/test_sparsefuncs.py
57
13752
import numpy as np import scipy.sparse as sp from scipy import linalg from numpy.testing import assert_array_almost_equal, assert_array_equal from sklearn.datasets import make_classification from sklearn.utils.sparsefuncs import (mean_variance_axis, inplace_column_scale, ...
bsd-3-clause
arnabgho/sklearn-theano
sklearn_theano/feature_extraction/caffe/googlenet.py
6
10608
"""Parser for bvlc caffe googlenet.""" # Authors: Michael Eickenberg # Kyle Kastner # License: BSD 3 Clause from sklearn.externals import joblib from ...datasets import get_dataset_dir, download from .caffemodel import _parse_caffe_model, parse_caffe_model import os from ...utils import check_tensor, get_mini...
bsd-3-clause
jlegendary/scikit-learn
examples/svm/plot_oneclass.py
249
2302
""" ========================================== One-class SVM with non-linear kernel (RBF) ========================================== An example using a one-class SVM for novelty detection. :ref:`One-class SVM <svm_outlier_detection>` is an unsupervised algorithm that learns a decision function for novelty detection: ...
bsd-3-clause
hargup/sympy
sympy/physics/quantum/tensorproduct.py
64
13572
"""Abstract tensor product.""" from __future__ import print_function, division from sympy import Expr, Add, Mul, Matrix, Pow, sympify from sympy.core.compatibility import u, range from sympy.core.trace import Tr from sympy.printing.pretty.stringpict import prettyForm from sympy.physics.quantum.qexpr import QuantumEr...
bsd-3-clause
JeanKossaifi/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
jmarcelogimenez/petroSym
petroSym/figureSampledLine.py
1
9390
# -*- coding: utf-8 -*- """ Created on Tue Aug 25 13:08:19 2015 @author: jgimenez """ from PyQt4 import QtGui, QtCore from figureSampledLine_ui import figureSampledLineUI from myNavigationToolbar import * from temporalNavigationToolbar import * from matplotlib.figure import Figure from matplotlib.backends.backend_qt...
gpl-2.0
huzq/scikit-learn
sklearn/metrics/cluster/tests/test_bicluster.py
19
1698
"""Testing for bicluster metrics module""" import numpy as np from sklearn.utils._testing import 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([True, True, T...
bsd-3-clause
huobaowangxi/scikit-learn
sklearn/linear_model/tests/test_ridge.py
130
22974
import numpy as np import scipy.sparse as sp from scipy import linalg from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_a...
bsd-3-clause
SitiBanc/1061_NCTU_IOMDS
1018/Homework4/HW4_2.py
1
1454
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Oct 19 16:36:02 2017 @author: sitibanc """ from sklearn import datasets import numpy as np # K-NN Classifier def knn(feature, target, K): N = feature.shape[0] # N筆資料 L = np.zeros((N, 1)) # Label (data屬於哪一個class) ...
apache-2.0
dariocorral/panoanda
panoanda/tickers.py
1
2954
""" Created on Sat Sep 16 18:32:01 2017 @author: dariocorral """ import os import oandapy import pandas as pd class Tickers(object): """ Basic info about tickers available for OANDA trading """ #oanda_api private attribute _oanda_api = oandapy.API(environment = os.environ['ENV'], ...
mit
Odingod/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
dkillick/iris
docs/iris/src/sphinxext/gen_gallery.py
2
6305
# # (C) Copyright 2012 MATPLOTLIB (vn 1.2.0) # ''' Generate a thumbnail gallery of examples. ''' from __future__ import (absolute_import, division, print_function) from six.moves import (filter, input, map, range, zip) # noqa import os import glob import re import warnings import matplotlib.image as image from ...
lgpl-3.0
dragoon/kilogram
kilogram/entity_types/word2vec/model.py
1
3920
import numpy as np from gensim.matutils import unitvec from gensim.models import word2vec # Import the built-in logging module and configure it so that Word2Vec # creates nice output messages import logging logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) def train_model(sou...
apache-2.0
hypergravity/bopy
bopy/spec/spec_quick_view.py
1
14339
# -*- coding: utf-8 -*- """ Author ------ Bo Zhang Email ----- bozhang@nao.cas.cn Created on ---------- - Wed Feb 24 15:05:00 2016 spec_quick_view Modifications ------------- - Aims ---- - method spec_quick_view: tool for quick view of spectra """ import numpy as np import matplotlib.pyplot as plt import as...
bsd-3-clause
syl20bnr/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/image.py
69
28764
""" The image module supports basic image loading, rescaling and display operations. """ from __future__ import division import os, warnings import numpy as np from numpy import ma from matplotlib import rcParams from matplotlib import artist as martist from matplotlib import colors as mcolors from matplotlib import...
gpl-3.0
RobertABT/heightmap
build/matplotlib/examples/pylab_examples/subplots_demo.py
9
2184
"""Examples illustrating the use of plt.subplots(). This function creates a figure and a grid of subplots with a single call, while providing reasonable control over how the individual plots are created. For very refined tuning of subplot creation, you can still use add_subplot() directly on a new figure. """ import...
mit
seunghwanl/APMAE4990
webapp/__init__.py
1
4985
from flask import Flask, render_template, request, url_for, flash, redirect from flask_bootstrap import Bootstrap from sqlalchemy import * from haversine import haversine from sklearn.ensemble import RandomForestRegressor from sklearn.externals import joblib from forms import LatLongForm import os app = Flask(__n...
apache-2.0
rdipietro/tensorflow
tensorflow/contrib/factorization/python/ops/kmeans.py
3
10875
# 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
google-research/kubric
kubric/plotting.py
1
5319
# Copyright 2021 The Kubric Authors. # # 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 w...
apache-2.0
mjudsp/Tsallis
examples/datasets/plot_random_multilabel_dataset.py
278
3402
""" ============================================== Plot randomly generated multilabel dataset ============================================== This illustrates the `datasets.make_multilabel_classification` dataset generator. Each sample consists of counts of two features (up to 50 in total), which are differently distri...
bsd-3-clause
pprett/scikit-learn
examples/ensemble/plot_voting_decision_regions.py
86
2386
""" ================================================== Plot the decision boundaries of a VotingClassifier ================================================== Plot the decision boundaries of a `VotingClassifier` for two features of the Iris dataset. Plot the class probabilities of the first sample in a toy dataset pred...
bsd-3-clause
tomlof/scikit-learn
examples/neighbors/plot_approximate_nearest_neighbors_hyperparameters.py
102
5177
""" ================================================= Hyper-parameters of Approximate Nearest Neighbors ================================================= This example demonstrates the behaviour of the accuracy of the nearest neighbor queries of Locality Sensitive Hashing Forest as the number of candidates and the numb...
bsd-3-clause
fengzhyuan/scikit-learn
sklearn/linear_model/tests/test_sparse_coordinate_descent.py
244
9986
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_true from sklearn.utils.t...
bsd-3-clause
jclosure/daw
DataAnalysisWeb/app/views.py
1
2213
""" Definition of views. """ from django.shortcuts import render from django.http import HttpRequest from django.template import RequestContext from datetime import datetime import pandas as pd import numpy as np import matplotlib.pyplot as plt import openpyxl import xlrd from django.utils.safestring import mark_safe...
mit
TaylorOshan/pysal
pysal/weights/Contiguity.py
5
14708
from warnings import warn as Warn from ..cg import asShape from ..core.FileIO import FileIO from .weights import W, WSP from ._contW_binning import ContiguityWeightsPolygons from ._contW_rtree import ContiguityWeights_rtree from ._contW_lists import ContiguityWeightsLists from .util import get_ids WT_TYPE = {'rook': 2,...
bsd-3-clause
franzpl/sweep
lin_sweep_kaiser_window_bandlimited_script6/lin_sweep_kaiser_window_bandlimited_script6.py
2
2166
#!/usr/bin/env python3 """The influence of windowing of bandlimited lin. sweep signals when using a Kaiser Window by fixing beta (=7) and fade_in (=0). fstart = 100 Hz fstop = 5000 Hz Deconvolution: Windowed """ import sys sys.path.append('..') import measurement_chain import plotting import calculatio...
mit
marcocaccin/scikit-learn
doc/conf.py
210
8446
# -*- coding: utf-8 -*- # # scikit-learn documentation build configuration file, created by # sphinx-quickstart on Fri Jan 8 09:13:42 2010. # # 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 # autogenerated file. ...
bsd-3-clause
deepesch/scikit-learn
examples/svm/plot_rbf_parameters.py
132
8096
''' ================== RBF SVM parameters ================== This example illustrates the effect of the parameters ``gamma`` and ``C`` of the Radial Basis Function (RBF) kernel SVM. Intuitively, the ``gamma`` parameter defines how far the influence of a single training example reaches, with low values meaning 'far' a...
bsd-3-clause
tedunderwood/GenreProject
python/workshop/predictauthors.py
1
4957
import re, os import csv import random, pickle import numpy as np import pandas as pd from sklearn.linear_model import LogisticRegression from bagofwords import WordVector, StandardizingVector root = '/Users/tunder/Dropbox/GLNworkshop/USpoetry' magazines = ['Bookman', 'Century', 'ContVerse', 'Crisis', 'Fugitive', 'Ha...
mit
0asa/scikit-learn
examples/linear_model/plot_sgd_penalties.py
249
1563
""" ============== SGD: Penalties ============== Plot the contours of the three penalties. All of the above are supported by :class:`sklearn.linear_model.stochastic_gradient`. """ from __future__ import division print(__doc__) import numpy as np import matplotlib.pyplot as plt def l1(xs): return np.array([np....
bsd-3-clause
BjerknesClimateDataCentre/QuinCe
DataPreparation/SAMI/add_year.py
2
1344
""" Output files from the SAMI client software contain a decimal day of year but no year. QuinCe requires a year. Eventually I'll build suitable functionality into QuinCe, but until then this utility can be used to add a Year column to SAMI output files. This is in no way good Python code. Do not use it for reference...
gpl-3.0
enigmampc/catalyst
catalyst/pipeline/factors/crypto/technical.py
1
24077
""" Technical Analysis Factors -------------------------- """ from __future__ import division from numbers import Number from numpy import ( abs, arange, average, clip, diff, dstack, exp, fmax, full, inf, isnan, log, NINF, sqrt, sum as np_sum, ) from numexpr ...
apache-2.0
willcode/gnuradio
gr-filter/examples/synth_to_chan.py
6
3134
#!/usr/bin/env python # # Copyright 2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # # SPDX-License-Identifier: GPL-3.0-or-later # # from gnuradio import gr from gnuradio import blocks from gnuradio import filter import sys import numpy try: from gnuradio import analog except Imp...
gpl-3.0
jseabold/statsmodels
statsmodels/tsa/deterministic.py
4
50951
from statsmodels.compat.pandas import Appender, to_numpy from abc import ABC, abstractmethod import datetime as dt from typing import Hashable, List, Optional, Sequence, Set, Tuple, Type, Union import numpy as np import pandas as pd from scipy.linalg import qr from statsmodels.iolib.summary import d_or_f from statsm...
bsd-3-clause
agrimaldi/metaseq
metaseq/arrayify.py
3
4962
""" Helper functions for converting genome-wide data into large NumPy arrays """ import os import pandas import pybedtools import numpy as np import _genomic_signal class Binner(object): def __init__(self, genome, windowsize, chrom=None, window_cache_dir=".", npz_dir='.', metric='mean0'): ...
mit
lcharleux/truss
doc/tests/test.py
1
1991
import truss import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from matplotlib import patches modulus = 210.e3 #Pa rho = 2700. #kg/m**3 surface = .001 #m**2 yield_stress = 400 #Pa from scipy import optimize m = truss.core.Model() A = m.add_node((0.,0.), label = "A") B = ...
gpl-2.0
charanpald/tyre-hug
tyrehug/exp/svdbenchmark.py
1
4877
import time import numpy import sppy import sppy.linalg import matplotlib.pyplot as plt import scipy.sparse import os from scipy.sparse.linalg import svds from pypropack import svdp from sparsesvd import sparsesvd from sklearn.decomposition import TruncatedSVD from sppy.linalg import GeneralLinearOperator def time_re...
mit
jor-/scipy
scipy/stats/kde.py
5
21807
#------------------------------------------------------------------------------- # # Define classes for (uni/multi)-variate kernel density estimation. # # Currently, only Gaussian kernels are implemented. # # Written by: Robert Kern # # Date: 2004-08-09 # # Modified: 2005-02-10 by Robert Kern. # Contr...
bsd-3-clause
jjhelmus/scipy
scipy/signal/signaltools.py
2
115724
# Author: Travis Oliphant # 1999 -- 2002 from __future__ import division, print_function, absolute_import import warnings import threading import sys import timeit from . import sigtools, dlti from ._upfirdn import upfirdn, _output_len from scipy._lib.six import callable from scipy._lib._version import NumpyVersion ...
bsd-3-clause
Jimmy-Morzaria/scikit-learn
sklearn/decomposition/truncated_svd.py
38
7697
"""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
jmmease/pandas
pandas/tests/indexes/common.py
2
37640
# -*- coding: utf-8 -*- import pytest from pandas import compat from pandas.compat import PY3 import numpy as np from pandas import (Series, Index, Float64Index, Int64Index, UInt64Index, RangeIndex, MultiIndex, CategoricalIndex, DatetimeIndex, TimedeltaIndex, PeriodIndex, Int...
bsd-3-clause
mortada/scipy
doc/source/tutorial/stats/plots/kde_plot3.py
132
1229
import numpy as np import matplotlib.pyplot as plt from scipy import stats np.random.seed(12456) x1 = np.random.normal(size=200) # random data, normal distribution xs = np.linspace(x1.min()-1, x1.max()+1, 200) kde1 = stats.gaussian_kde(x1) kde2 = stats.gaussian_kde(x1, bw_method='silverman') fig = plt.figure(figsi...
bsd-3-clause
RachitKansal/scikit-learn
examples/linear_model/plot_multi_task_lasso_support.py
249
2211
#!/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
viep/StockScraper
stockScraper.py
1
3582
from urllib2 import Request,urlopen,URLError import sys import mysql.connector import time import datetime import os import pandas as pd import threading from pandas.io import sql from sqlalchemy import create_engine def getPrice(tickers): link = 'http://download.finance.yahoo.com/d/quotes.csv?' arguments = 'f=aa2bb2...
mit
466152112/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
perryjohnson/biplaneblade
biplane_blade_lib/prep_stn16_mesh.py
1
30758
"""Write initial TrueGrid files for one biplane blade station. Usage ----- start an IPython (qt)console with the pylab flag: $ ipython qtconsole --pylab or $ ipython --pylab Then, from the prompt, run this script: |> %run biplane_blade_lib/prep_stnXX_mesh.py or |> import biplane_blade_lib/prep_stnXX_mesh ...
gpl-3.0
rubikloud/scikit-learn
sklearn/svm/classes.py
6
40597
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
dominicelse/scipy
tools/refguide_check.py
6
28914
#!/usr/bin/env python """ refguide_check.py [OPTIONS] [-- ARGS] Check for a Scipy submodule whether the objects in its __all__ dict correspond to the objects included in the reference guide. Example of usage:: $ python refguide_check.py optimize Note that this is a helper script to be able to check if things ar...
bsd-3-clause
nelson-liu/scikit-learn
doc/tutorial/text_analytics/skeletons/exercise_01_language_train_model.py
103
2017
"""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
georgid/sms-tools
lectures/3-Fourier-properties/plots-code/symmetry-real-even.py
26
1150
import matplotlib.pyplot as plt import numpy as np import sys import math from scipy.signal import triang from scipy.fftpack import fft, fftshift M = 127 N = 128 hM1 = int(math.floor((M+1)/2)) hM2 = int(math.floor(M/2)) x = triang(M) fftbuffer = np.zeros(N) fftbuffer[:hM1] = x[hM2:] fftbuffer[N-hM2:] = x[:hM2] X =...
agpl-3.0
fengzhyuan/scikit-learn
sklearn/utils/tests/test_random.py
230
7344
from __future__ import division import numpy as np import scipy.sparse as sp from scipy.misc import comb as combinations from numpy.testing import assert_array_almost_equal from sklearn.utils.random import sample_without_replacement from sklearn.utils.random import random_choice_csc from sklearn.utils.testing import ...
bsd-3-clause
fengzhyuan/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
lxneng/incubator-airflow
airflow/hooks/presto_hook.py
8
4438
# -*- coding: utf-8 -*- # # 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 #...
apache-2.0
GoogleCloudPlatform/professional-services
tools/ml-auto-eda/ml_eda/preprocessing/preprocessors/bigquery/bq_preprocessor.py
1
6974
# Copyright 2019 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 ...
apache-2.0
grochmal/capybara
src/proto/chopimg.py
1
1388
#!/usr/bin/env python import os,sys from PIL import Image import numpy as np import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt from matplotlib import cm __doc__ = 'Usage: chopimg.py file n output' def mark(ar, p): yn, xn = ar.shape xticks = [l*(xn/p) for l in range(1,p)] yticks...
gpl-3.0
chrsrds/scikit-learn
sklearn/datasets/tests/test_lfw.py
1
7469
"""This test for the LFW require medium-size data downloading and processing If the data has not been already downloaded by running the examples, the tests won't run (skipped). If the test are run, the first execution will be long (typically a bit more than a couple of minutes) but as the dataset loader is leveraging...
bsd-3-clause
shisha101/grasp_SM
e2u/e2u_demo_setup/script/grasp.py
1
84334
#!/usr/bin/python import rospy import rospkg import smach import smach_ros import tf import sys import copy import std_srvs import matplotlib.pyplot as plt import numpy import random import pdb from std_srvs.srv import Trigger, TriggerRequest, Empty from geometry_msgs.msg import PoseStamped from moveit_commander imp...
gpl-2.0
LumPenPacK/NetworkExtractionFromImages
osx_build/nefi2_osx_amd64_xcode_2015/site-packages/numpy/doc/creation.py
118
5507
""" ============== Array Creation ============== Introduction ============ There are 5 general mechanisms for creating arrays: 1) Conversion from other Python structures (e.g., lists, tuples) 2) Intrinsic numpy array array creation objects (e.g., arange, ones, zeros, etc.) 3) Reading arrays from disk, either from...
bsd-2-clause
toobaz/pandas
pandas/tests/test_nanops.py
2
43102
from functools import partial import warnings import numpy as np import pytest import pandas.util._test_decorators as td from pandas.core.dtypes.common import is_integer_dtype import pandas as pd from pandas import Series, isna from pandas.core.arrays import DatetimeArray import pandas.core.nanops as nanops import ...
bsd-3-clause
adamcandy/QGIS-Meshing
extras/contouring/bathymetry_metric.py
3
26872
#!/usr/bin/env python ########################################################################## # # Generation of boundary representation from arbitrary geophysical # fields and initialisation for anisotropic, unstructured meshing. # # Copyright (C) 2011-2013 Dr Adam S. Candy, adam.candy@imperial.ac.uk # # ...
lgpl-2.1
anandha2017/udacity
nd101 Deep Learning Nanodegree Foundation/DockerImages/17_Weight_Initialisation/notebooks/weight-initialization/helper.py
153
3649
import numpy as np import matplotlib.pyplot as plt import tensorflow as tf def hist_dist(title, distribution_tensor, hist_range=(-4, 4)): """ Display histogram of a TF distribution """ with tf.Session() as sess: values = sess.run(distribution_tensor) plt.title(title) plt.hist(values, ...
mit
Barmaley-exe/scikit-learn
sklearn/linear_model/tests/test_sparse_coordinate_descent.py
28
10014
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_true from sklearn.utils.t...
bsd-3-clause
markneville/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_gdk.py
69
15968
from __future__ import division import math import os import sys import warnings def fn_name(): return sys._getframe(1).f_code.co_name import gobject import gtk; gdk = gtk.gdk import pango pygtk_version_required = (2,2,0) if gtk.pygtk_version < pygtk_version_required: raise ImportError ("PyGTK %d.%d.%d is install...
agpl-3.0
SKIRT/PTS
magic/maps/dust/blackbody.py
1
22556
#!/usr/bin/env python # -*- coding: utf8 -*- # ***************************************************************** # ** PTS -- Python Toolkit for working with SKIRT ** # ** © Astronomical Observatory, Ghent University ** # ***************************************************************** ##...
agpl-3.0
rrohan/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
CIFASIS/pylearn2
pylearn2/scripts/papers/jia_huang_wkshp_11/evaluate.py
44
3208
from __future__ import print_function from optparse import OptionParser import warnings try: from sklearn.metrics import classification_report except ImportError: classification_report = None warnings.warn("couldn't find sklearn.metrics.classification_report") try: from sklearn.metrics import confusion...
bsd-3-clause
shuggiefisher/brain4k
brain4k/transforms/sklearn/__init__.py
2
4927
import logging import numpy as np from sklearn.cross_validation import train_test_split from sklearn.naive_bayes import MultinomialNB from brain4k.transforms import PipelineStage class NaiveBayes(PipelineStage): name = "org.scikit-learn.naive_bayes.MultinomialNB" def train(self): logging.debug( ...
apache-2.0
gfyoung/pandas
pandas/tests/groupby/test_value_counts.py
5
4820
""" these are systematically testing all of the args to value_counts with different size combinations. This is to ensure stability of the sorting and proper parameter handling """ from itertools import product import numpy as np import pytest from pandas import ( Categorical, CategoricalIndex, DataFrame,...
bsd-3-clause
johnbachman/indra
models/hello_indra.py
6
1821
import numpy as np from pysb.integrate import Solver from pysb.export import export from matplotlib import pyplot as plt from indra.sources import biopax from indra.sources import bel, trips from indra.util import plot_formatting as pf from indra.assemblers.pysb import PysbAssembler def plot_result(model, sol): pf...
bsd-2-clause
alexsavio/scikit-learn
sklearn/cross_validation.py
11
69870
""" 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 fro...
bsd-3-clause