repo_name
stringlengths
7
92
path
stringlengths
5
149
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
911
693k
license
stringclasses
15 values
hainm/scikit-learn
benchmarks/bench_sample_without_replacement.py
397
8008
""" Benchmarks for sampling without replacement of integer. """ from __future__ import division from __future__ import print_function import gc import sys import optparse from datetime import datetime import operator import matplotlib.pyplot as plt import numpy as np import random from sklearn.externals.six.moves i...
bsd-3-clause
ua-snap/downscale
old/bin/hur_cru_ts31_to_cl20_downscaling.py
3
22421
# # # # Current implementation of the cru ts31 (ts32) delta downscaling procedure # # Author: Michael Lindgren (malindgren@alaska.edu) # # # import numpy as np def write_gtiff( output_arr, template_meta, output_filename, compress=True ): ''' DESCRIPTION: ------------ output a GeoTiff given a numpy ndarray, rasterio...
mit
r-mart/scikit-learn
sklearn/metrics/tests/test_ranking.py
127
40813
from __future__ import division, print_function import numpy as np from itertools import product import warnings from scipy.sparse import csr_matrix from sklearn import datasets from sklearn import svm from sklearn import ensemble from sklearn.datasets import make_multilabel_classification from sklearn.random_projec...
bsd-3-clause
cqychen/quants
quants/loaddata/skyeye_ods_invest_refer_sh_margins_detail.py
1
2670
#coding=utf8 import tushare as ts; import pymysql; import time as dt from datashape.coretypes import string from pandas.io.sql import SQLDatabase import sqlalchemy import datetime from sqlalchemy import create_engine from pandas.io import sql import threading import pandas as pd; import sys sys.path.append('../') #添加配...
epl-1.0
jundongl/scikit-feature
skfeature/example/test_JMI.py
3
1482
import scipy.io from sklearn.metrics import accuracy_score from sklearn import cross_validation from sklearn import svm from skfeature.function.information_theoretical_based import JMI def main(): # load data mat = scipy.io.loadmat('../data/colon.mat') X = mat['X'] # data X = X.astype(float) y ...
gpl-2.0
jtwhite79/pyemu
pyemu/utils/gw_utils.py
1
110032
"""MODFLOW support utilities""" import os from datetime import datetime import shutil import warnings import numpy as np import pandas as pd import re pd.options.display.max_colwidth = 100 from pyemu.pst.pst_utils import ( SFMT, IFMT, FFMT, pst_config, parse_tpl_file, try_process_output_file, )...
bsd-3-clause
MadsJensen/agency_connectivity
tf_functions.py
1
5293
""" Functions for TF analysis. @author: mje @email: mads [] cnru.dk """ import mne from mne.time_frequency import (psd_multitaper, tfr_multitaper, tfr_morlet, cwt_morlet) from mne.viz import iter_topography import matplotlib.pyplot as plt import numpy as np def calc_psd_epochs(epochs...
bsd-3-clause
sassoftware/saspy
saspy/sasiocom.py
1
37140
# # Copyright SAS Institute # # 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
ycaihua/scikit-learn
sklearn/decomposition/tests/test_incremental_pca.py
23
8317
"""Tests for Incremental PCA.""" import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_raises from sklearn import datasets from sklearn.decomposition import PCA, IncrementalPCA iris = datasets.load...
bsd-3-clause
yangw1234/BigDL
pyspark/bigdl/optim/optimizer.py
2
40389
# # Copyright 2016 The BigDL 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 ...
apache-2.0
idlead/scikit-learn
sklearn/metrics/cluster/bicluster.py
359
2797
from __future__ import division import numpy as np from sklearn.utils.linear_assignment_ import linear_assignment from sklearn.utils.validation import check_consistent_length, check_array __all__ = ["consensus_score"] def _check_rows_and_columns(a, b): """Unpacks the row and column arrays and checks their shap...
bsd-3-clause
kikocorreoso/mplutils
mplutils/axes.py
1
8516
# -*- coding: utf-8 -*- """ Created on Sun Feb 21 23:43:37 2016 @author: kiko """ from __future__ import division, absolute_import from .settings import RICH_DISPLAY import numpy as np if RICH_DISPLAY: from IPython.display import display def axes_set_better_defaults(ax, axes_color ...
mit
abimannans/scikit-learn
sklearn/linear_model/__init__.py
270
3096
""" The :mod:`sklearn.linear_model` module implements generalized linear models. It includes Ridge regression, Bayesian Regression, Lasso and Elastic Net estimators computed with Least Angle Regression and coordinate descent. It also implements Stochastic Gradient Descent related algorithms. """ # See http://scikit-le...
bsd-3-clause
DiamondLightSource/auto_tomo_calibration-experimental
measure_resolution/lmfit-py/examples/confidence_interval.py
4
2924
# -*- coding: utf-8 -*- """ Created on Sun Apr 15 19:47:45 2012 @author: Tillsten """ import numpy as np from lmfit import Parameters, Minimizer, conf_interval, report_fit, report_ci from numpy import linspace, zeros, sin, exp, random, sqrt, pi, sign from scipy.optimize import leastsq try: import matplotlib.pypl...
apache-2.0
lizardsystem/threedilib
threedilib/modeling/convert.py
1
8275
# (c) Nelen & Schuurmans. GPL licensed, see LICENSE.rst. # -*- coding: utf-8 -*- """ Convert shapefiles with z coordinates. Choose from the following formats: 'inp' to create an inp file, 'img' to create an image with a plot of the feature, or 'shp' to output a shapefile with the average height of a feature stored in ...
gpl-3.0
JackKelly/neuralnilm_prototype
scripts/e115.py
2
3654
from __future__ import print_function, division import matplotlib matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! from neuralnilm import Net, RealApplianceSource, BLSTMLayer, SubsampleLayer, DimshuffleLayer from lasagne.nonlinearities import sigmoid, rectify from lasagne.objectives import c...
mit
sinhrks/scikit-learn
examples/decomposition/plot_pca_vs_lda.py
176
2027
""" ======================================================= Comparison of LDA and PCA 2D projection of Iris dataset ======================================================= The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour and Virginica) with 4 attributes: sepal length, sepal width, petal length a...
bsd-3-clause
Pymatteo/QtNMR
build/exe.win32-3.4/scipy/cluster/tests/test_hierarchy.py
7
34863
#! /usr/bin/env python # # Author: Damian Eads # Date: April 17, 2008 # # Copyright (C) 2008 Damian Eads # # 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 copy...
gpl-3.0
lbishal/scikit-learn
sklearn/feature_extraction/dict_vectorizer.py
234
12267
# Authors: Lars Buitinck # Dan Blanchard <dblanchard@ets.org> # License: BSD 3 clause from array import array from collections import Mapping from operator import itemgetter import numpy as np import scipy.sparse as sp from ..base import BaseEstimator, TransformerMixin from ..externals import six from ..ext...
bsd-3-clause
Universal-Model-Converter/UMC3.0a
data/Python/x86/Lib/site-packages/scipy/misc/common.py
2
14711
""" Functions which are common and require SciPy Base and Level 1 SciPy (special, linalg) """ from __future__ import division, print_function, absolute_import from scipy.lib.six.moves import xrange from numpy import exp, log, asarray, arange, newaxis, hstack, product, array, \ where, zeros, extract...
mit
kiyoto/statsmodels
statsmodels/sandbox/panel/mixed.py
31
21019
""" Mixed effects models Author: Jonathan Taylor Author: Josef Perktold License: BSD-3 Notes ------ It's pretty slow if the model is misspecified, in my first example convergence in loglike is not reached within 2000 iterations. Added stop criteria based on convergence of parameters instead. With correctly specifi...
bsd-3-clause
ElDeveloper/scikit-learn
doc/sphinxext/numpy_ext/docscrape_sphinx.py
408
8061
import re import inspect import textwrap import pydoc from .docscrape import NumpyDocString from .docscrape import FunctionDoc from .docscrape import ClassDoc class SphinxDocString(NumpyDocString): def __init__(self, docstring, config=None): config = {} if config is None else config self.use_plots...
bsd-3-clause
Garrett-R/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
iismd17/scikit-learn
sklearn/feature_selection/tests/test_chi2.py
221
2398
""" Tests for chi2, currently the only feature selection function designed specifically to work with sparse matrices. """ import numpy as np from scipy.sparse import coo_matrix, csr_matrix import scipy.stats from sklearn.feature_selection import SelectKBest, chi2 from sklearn.feature_selection.univariate_selection im...
bsd-3-clause
UNR-AERIAL/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
Titan-C/scikit-learn
examples/cluster/plot_ward_structured_vs_unstructured.py
1
3369
""" =========================================================== Hierarchical clustering: structured vs unstructured ward =========================================================== Example builds a swiss roll dataset and runs hierarchical clustering on their position. For more information, see :ref:`hierarchical_clus...
bsd-3-clause
petebachant/PXL
pxl/tests/test_fdiff.py
1
1436
from __future__ import division, print_function from .. import fdiff from ..fdiff import * import matplotlib.pyplot as plt import pandas as pd import os import numpy as np from uncertainties import unumpy plot = False def test_second_order_diff(): """Test `second_order_diff`.""" # Create a non-equally space...
gpl-3.0
JT5D/scikit-learn
examples/linear_model/lasso_dense_vs_sparse_data.py
13
1862
""" ============================== Lasso on dense and sparse data ============================== We show that linear_model.Lasso provides the same results for dense and sparse data and that in the case of sparse data the speed is improved. """ print(__doc__) from time import time from scipy import sparse from scipy ...
bsd-3-clause
loli/sklearn-ensembletrees
examples/plot_rfe_with_cross_validation.py
24
1384
""" =================================================== Recursive feature elimination with cross-validation =================================================== A recursive feature elimination example with automatic tuning of the number of features selected with cross-validation. """ print(__doc__) from sklearn.svm im...
bsd-3-clause
jm-begon/scikit-learn
sklearn/cluster/spectral.py
233
18153
# -*- coding: utf-8 -*- """Algorithms for spectral clustering""" # Author: Gael Varoquaux gael.varoquaux@normalesup.org # Brian Cheung # Wei LI <kuantkid@gmail.com> # License: BSD 3 clause import warnings import numpy as np from ..base import BaseEstimator, ClusterMixin from ..utils import check_rand...
bsd-3-clause
edfall/vnpy
vn.datayes/storage.py
29
18623
import os import json import pymongo import pandas as pd from datetime import datetime, timedelta from api import Config, PyApi from api import BaseDataContainer, History, Bar from errors import (VNPAST_ConfigError, VNPAST_RequestError, VNPAST_DataConstructorError, VNPAST_DatabaseError) class DBConfig(Co...
mit
tomlof/scikit-learn
examples/manifold/plot_lle_digits.py
138
8594
""" ============================================================================= Manifold learning on handwritten digits: Locally Linear Embedding, Isomap... ============================================================================= An illustration of various embeddings on the digits dataset. The RandomTreesEmbed...
bsd-3-clause
craigcitro/pydatalab
solutionbox/code_free_ml/test_mltoolbox/test_transform.py
2
8503
from __future__ import absolute_import from __future__ import print_function import json import os import pandas as pd from PIL import Image import shutil from six.moves.urllib.request import urlopen import subprocess import tempfile import unittest import uuid import tensorflow as tf from tensorflow.python.lib.io im...
apache-2.0
barjacks/pythonrecherche
07 Selenium, more beautifulsoup/zh_wie_neu.py
1
1387
# coding: utf-8 from bs4 import BeautifulSoup import pandas as pd import requests import time import progressbar bar = progressbar.ProgressBar() lst = [] lst_pass = [] for elem,i in zip(range(1697,13000), bar((range(1697,13000)))): url = "https://www.zueriwieneu.ch/report/" + str(elem) response = requests....
mit
mne-tools/mne-tools.github.io
0.21/_downloads/33b5e3cff5c172d72c79c6eec192b031/plot_label_from_stc.py
20
4093
""" ================================================= Generate a functional label from source estimates ================================================= Threshold source estimates and produce a functional label. The label is typically the region of interest that contains high values. Here we compare the average time ...
bsd-3-clause
glouppe/scikit-learn
sklearn/manifold/isomap.py
229
7169
"""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
freeman-lab/dask
dask/tests/test_core.py
7
3541
from dask.utils import raises from dask.core import (istask, get, get_dependencies, flatten, subs, preorder_traversal) def contains(a, b): """ >>> contains({'x': 1, 'y': 2}, {'x': 1}) True >>> contains({'x': 1, 'y': 2}, {'z': 3}) False """ return all(a.get(k) == v for k, v in b.it...
bsd-3-clause
latticelabs/Mitty
mitty/benchmarking/misalignment_plot.py
1
9184
"""Prepare a binned matrix of misalignments and plot it in different ways""" import click import pysam import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from matplotlib.path import Path import matplotlib.patches as patches from matplotlib.colors import LogNorm import numpy as np def we_have_too...
gpl-2.0
idf/scipy_util
scipy_util/image/color_kmeans.py
1
2314
# USAGE # python color_kmeans.py --image images/jp.png --clusters 3 # Author: Adrian Rosebrock # Website: www.pyimagesearch.com # import the necessary packages from sklearn.cluster import KMeans import matplotlib.pyplot as plt import numpy as np import argparse import cv2 def centroid_histogram(clt): # grab the...
bsd-3-clause
robogen/CMS-Mining
RunScripts/es_mainreduce.py
1
20005
from elasticsearch import Elasticsearch import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages from matplotlib.dates import AutoDateLocator, AutoDateFormatter import numpy as np import datetime as dt import math import json with open('sites.json', 'r+') as txt: sitesArray = json.load(...
mit
psci2195/espresso-ffans
samples/lb_profile.py
1
2856
# Copyright (C) 2010-2019 The ESPResSo project # # This file is part of ESPResSo. # # ESPResSo is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later v...
gpl-3.0
adamgreenhall/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
pypot/scikit-learn
sklearn/preprocessing/tests/test_label.py
48
18419
import numpy as np from scipy.sparse import issparse from scipy.sparse import coo_matrix from scipy.sparse import csc_matrix from scipy.sparse import csr_matrix from scipy.sparse import dok_matrix from scipy.sparse import lil_matrix from sklearn.utils.multiclass import type_of_target from sklearn.utils.testing impor...
bsd-3-clause
czhengsci/veidt
veidt/utils/data_selection.py
1
4503
# coding: utf-8 # Copyright (c) Materials Virtual Lab # Distributed under the terms of the BSD License. from __future__ import division, print_function, unicode_literals, \ absolute_import import random import numpy as np import pandas as pd from copy import copy from pymatgen import Structure class MonteCarloS...
bsd-3-clause
to266/hyperspy
hyperspy/drawing/marker.py
2
4900
# -*- coding: utf-8 -*- # Copyright 2007-2016 The HyperSpy developers # # This file is part of HyperSpy. # # HyperSpy is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at...
gpl-3.0
JohanComparat/pySU
spm/bin_spiders/spiders_last_burst_vs_radius.py
1
5578
import astropy.cosmology as co aa=co.Planck15 import astropy.io.fits as fits import astropy.units as u from astropy.coordinates import angles #import AngularSeparation from astropy import coordinates as coord import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as p import numpy as n import os import sys ...
cc0-1.0
ryanpbrewster/SciVis-2015
examples/sdf_example.py
1
2689
""" The Example is from http://darksky.slac.stanford.edu/scivis2015/examples.html """ from sdfpy import load_sdf from thingking import loadtxt prefix = "../data/" # Load N-body particles from a = 1.0 dataset. Particles have positions with # units of proper kpc, and velocities with units of km/s. particles = load_sdf...
mit
valexandersaulys/prudential_insurance_kaggle
venv/lib/python2.7/site-packages/pandas/__init__.py
9
2140
# pylint: disable-msg=W0614,W0401,W0611,W0622 __docformat__ = 'restructuredtext' try: from pandas import hashtable, tslib, lib except ImportError as e: # pragma: no cover module = str(e).lstrip('cannot import name ') # hack but overkill to use re raise ImportError("C extension: {0} not built. If you wa...
gpl-2.0
harisbal/pandas
pandas/tests/arrays/categorical/test_missing.py
1
3078
# -*- coding: utf-8 -*- import collections import numpy as np import pytest from pandas.compat import lrange from pandas.core.dtypes.dtypes import CategoricalDtype from pandas import Categorical, Index, isna import pandas.util.testing as tm class TestCategoricalMissing(object): def test_na_flags_int_categori...
bsd-3-clause
justincassidy/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
b-carter/numpy
numpy/core/tests/test_multiarray.py
1
260744
from __future__ import division, absolute_import, print_function import collections import tempfile import sys import shutil import warnings import operator import io import itertools import functools import ctypes import os import gc from contextlib import contextmanager if sys.version_info[0] >= 3: import builti...
bsd-3-clause
nwjs/chromium.src
tools/perf/cli_tools/soundwave/worker_pool.py
10
2508
# Copyright 2018 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. """ Use a pool of workers to concurrently process a sequence of items. Example usage: from soundwave import worker_pool def MyWorker(args): ...
bsd-3-clause
ndaniels/Ammolite
scripts/figure-generators/smsdIsoCompare.py
1
1534
import matplotlib.pyplot as plt from pylab import polyfit, poly1d, show, savefig import sys def isNumber( s): try: float(s) return True except ValueError: return False def makeGraph(X,Y, xName, yName, name="NoName"): fig = plt.figure() ax = fig.add_subplot(111) superName = "Comparison of {} and {}".format(...
gpl-2.0
waterponey/scikit-learn
sklearn/neighbors/tests/test_kd_tree.py
159
7852
import numpy as np from numpy.testing import assert_array_almost_equal from sklearn.neighbors.kd_tree import (KDTree, NeighborsHeap, simultaneous_sort, kernel_norm, nodeheap_sort, DTYPE, ITYPE) from sklearn.neighbors.dist_metrics import Dista...
bsd-3-clause
RPGOne/Skynet
scikit-learn-c604ac39ad0e5b066d964df3e8f31ba7ebda1e0e/sklearn/neighbors/tests/test_dist_metrics.py
48
4949
import itertools import numpy as np from numpy.testing import assert_array_almost_equal import scipy from scipy.spatial.distance import cdist from sklearn.neighbors.dist_metrics import DistanceMetric from nose import SkipTest def cmp_version(version1, version2): version1 = tuple(map(int, version1.split('.')[:2]...
bsd-3-clause
boomsbloom/dtm-fmri
DTM/for_gensim/lib/python2.7/site-packages/pandas/computation/ops.py
7
15881
"""Operator classes for eval. """ import operator as op from functools import partial from datetime import datetime import numpy as np from pandas.types.common import is_list_like, is_scalar import pandas as pd from pandas.compat import PY3, string_types, text_type import pandas.core.common as com from pandas.format...
mit
themrmax/scikit-learn
sklearn/manifold/tests/test_t_sne.py
11
25443
import sys from sklearn.externals.six.moves import cStringIO as StringIO import numpy as np import scipy.sparse as sp from sklearn.neighbors import BallTree from sklearn.utils.testing import assert_less_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from skle...
bsd-3-clause
hirofumi0810/asr_preprocessing
swbd/main.py
1
15071
#! /usr/bin/env python # -*- coding: utf-8 -*- """Make dataset for the End-to-End model (Switchboard corpus). Note that feature extraction depends on transcripts. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from os.path import join, isfile impor...
mit
zrhans/pythonanywhere
pyscripts/ply_wrose.py
1
1678
""" DATA,Chuva,Chuva_min,Chuva_max,VVE,VVE_min,VVE_max,DVE,DVE_min,DVE_max,Temp.,Temp._min,Temp._max,Umidade,Umidade_min,Umidade_max,Rad.,Rad._min,Rad._max,Pres.Atm.,Pres.Atm._min,Pres.Atm._max,Temp.Int.,Temp.Int._min,Temp.Int._max,CH4,CH4_min,CH4_max,HCnM,HCnM_min,HCnM_max,HCT,HCT_min,HCT_max,SO2,SO2_min,SO2_max,O3,O3...
apache-2.0
gdementen/PyTables
c-blosc/bench/plot-speeds.py
11
6852
"""Script for plotting the results of the 'suite' benchmark. Invoke without parameters for usage hints. :Author: Francesc Alted :Date: 2010-06-01 """ import matplotlib as mpl from pylab import * KB_ = 1024 MB_ = 1024*KB_ GB_ = 1024*MB_ NCHUNKS = 128 # keep in sync with bench.c linewidth=2 #markers= ['+', ',', 'o...
bsd-3-clause
andres-liiver/IAPB13_suvendatud
Kodutoo_16/Kodutoo_16_Andres.py
1
2985
''' Kodutoo 16 14.11.2014 Andres Liiver ''' import time from matplotlib import pyplot as plt from Tund16gen import * def timeFunc(func, *args): start = time.clock() func(*args) return time.clock() - start def linear_search(lst, num): for item in lst: if item == num: return True ...
mit
MartinDelzant/scikit-learn
sklearn/linear_model/tests/test_coordinate_descent.py
114
25281
# Authors: Olivier Grisel <olivier.grisel@ensta.org> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD 3 clause from sys import version_info import numpy as np from scipy import interpolate, sparse from copy import deepcopy from sklearn.datasets import load_boston from sklearn.utils.testing ...
bsd-3-clause
datapythonista/pandas
pandas/core/arrays/sparse/accessor.py
2
11479
"""Sparse accessor""" import numpy as np from pandas.compat._optional import import_optional_dependency from pandas.core.dtypes.cast import find_common_type from pandas.core.accessor import ( PandasDelegate, delegate_names, ) from pandas.core.arrays.sparse.array import SparseArray from pandas.core.arrays.sp...
bsd-3-clause
alanmcruickshank/superset-dev
superset/connectors/druid/models.py
1
45334
# pylint: disable=invalid-unary-operand-type from collections import OrderedDict from copy import deepcopy from datetime import datetime, timedelta import json import logging from multiprocessing import Pool from dateutil.parser import parse as dparse from flask import escape, Markup from flask_appbuilder import Model...
apache-2.0
hunse/vrep-python
dvs-play.py
1
1515
""" Play DVS events in real time TODO: deal with looping event times for recordings > 65 s """ import numpy as np import matplotlib.pyplot as plt import dvs def close(a, b, atol=1e-8, rtol=1e-5): return np.abs(a - b) < atol + rtol * b def imshow(image, ax=None): ax = plt.gca() if ax is None else ax ax.i...
gpl-2.0
Barmaley-exe/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
Srisai85/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
joshbohde/scikit-learn
examples/plot_roc_crossval.py
2
2019
""" ============================================================= Receiver operating characteristic (ROC) with cross validation ============================================================= Example of Receiver operating characteristic (ROC) metric to evaluate the quality of the output of a classifier using cross-valid...
bsd-3-clause
Griger/Intel-CervicalCancer-KaggleCompetition
featureHOG.py
1
1456
from keras.preprocessing.image import ImageDataGenerator, array_to_img, img_to_array, load_img import numpy as np from math import pi from keras.preprocessing.image import ImageDataGenerator import cv2 from sklearn.cluster import KMeans import sklearn.preprocessing as prepro # Generamos nuevos ejemplos ''' ...
gpl-3.0
WladimirSidorenko/SentiLex
scripts/vo.py
1
10974
#!/usr/bin/env python2.7 # -*- mode: python; coding: utf-8; -*- """Module for generating lexicon using Velikovich's method (2010). """ ################################################################## # Imports from __future__ import unicode_literals, print_function from collections import Counter from copy import...
mit
belkinsky/SFXbot
src/pyAudioAnalysis/audioTrainTest.py
1
46228
import sys import numpy import time import os import glob import pickle import shutil import audioop import signal import csv import ntpath from . import audioFeatureExtraction as aF from . import audioBasicIO from matplotlib.mlab import find import matplotlib.pyplot as plt import scipy.io as sIO from scipy import lina...
mit
cmbclh/vnpy1.7
vnpy/trader/app/login/uiLoginWidget.py
1
7055
# encoding: UTF-8 ''' 登陆模块相关的GUI控制组件 ''' import sys sys.path.append('../') #sys.path.append('D:\\tr\\vnpy-master\\vn.trader\\DAO') sys.path.append('D:\\tr\\vnpy-1.7\\vnpy\\DAO') sys.path.append('D:\\tr\\vnpy-1.7\\vnpy\\common') import vnpy.DAO import vnpy.common from vnpy.DAO import * import pandas as pd import Tki...
mit
Texju/DIT-Machine_Learning
Codes/validation.py
1
1983
# -*- coding: utf-8 -*- """ Created on Wed May 24 15:00:15 2017 @author: Julien Couillard & Jean Thevenet """ from sklearn import cross_validation from sklearn import metrics import numpy class MLValidation: """This class calculates the preciseness of our tree against a set of data""" def __init__(self, ...
gpl-3.0
SU-ECE-17-7/hotspotter
_graveyard/voting_rules1.py
2
20685
#_________________ # OLD def build_voters_profile(hs, qcx, K): '''This is too similar to assign_matches_vsmany right now''' cx2_nx = hs.tables.cx2_nx hs.ensure_matcher(match_type='vsmany', K=K) K += 1 cx2_desc = hs.feats.cx2_desc cx2_kpts = hs.feats.cx2_kpts cx2_rchip_size = hs.get_cx2_rch...
apache-2.0
wxiang7/airflow
airflow/hooks/dbapi_hook.py
3
7095
from builtins import str from past.builtins import basestring from datetime import datetime import numpy import logging from airflow.hooks.base_hook import BaseHook from airflow.exceptions import AirflowException class DbApiHook(BaseHook): """ Abstract base class for sql hooks. """ # Override to pro...
apache-2.0
lenovor/scikit-learn
sklearn/tests/test_qda.py
155
3481
import numpy as np from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_raises from sklearn.utils.testing import ignore_war...
bsd-3-clause
beepee14/scikit-learn
sklearn/linear_model/__init__.py
270
3096
""" The :mod:`sklearn.linear_model` module implements generalized linear models. It includes Ridge regression, Bayesian Regression, Lasso and Elastic Net estimators computed with Least Angle Regression and coordinate descent. It also implements Stochastic Gradient Descent related algorithms. """ # See http://scikit-le...
bsd-3-clause
arcyfelix/ML-DL-AI
Supervised Learning/GANs/GAN.py
1
3364
# -*- coding: utf-8 -*- """ GAN Example Use a generative adversarial network (GAN) to generate digit images from a noise distribution. References: - Generative adversarial nets. I Goodfellow, J Pouget-Abadie, M Mirza, B Xu, D Warde-Farley, S Ozair, Y. Bengio. Advances in neural information processing system...
apache-2.0
cauchycui/scikit-learn
sklearn/decomposition/tests/test_truncated_svd.py
240
6055
"""Test truncated SVD transformer.""" import numpy as np import scipy.sparse as sp from sklearn.decomposition import TruncatedSVD from sklearn.utils import check_random_state from sklearn.utils.testing import (assert_array_almost_equal, assert_equal, assert_raises, assert_greater, ...
bsd-3-clause
ssaeger/scikit-learn
sklearn/feature_selection/tests/test_base.py
143
3670
import numpy as np from scipy import sparse as sp from nose.tools import assert_raises, assert_equal from numpy.testing import assert_array_equal from sklearn.base import BaseEstimator from sklearn.feature_selection.base import SelectorMixin from sklearn.utils import check_array class StepSelector(SelectorMixin, Ba...
bsd-3-clause
Daniel-Brosnan-Blazquez/DIT-100
debugging/trajectory_planning_profiles/trapezoidal-profile.py
1
7690
import numpy import time from matplotlib import pyplot def main (params): angle = params['p0'] vel = params['v0'] sign = params['sign'] # Plan the trajectory if it is not planned T = 0 Ta = 0 Td = 0 ...
gpl-3.0
samuel1208/scikit-learn
sklearn/tests/test_pipeline.py
162
14875
""" Test the pipeline module. """ import numpy as np from scipy import sparse from sklearn.externals.six.moves import zip from sklearn.utils.testing import assert_raises, assert_raises_regex, assert_raise_message from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_false from sklearn...
bsd-3-clause
rigetticomputing/grove
grove/tomography/state_tomography.py
1
11664
############################################################################## # Copyright 2017-2018 Rigetti Computing # # 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...
apache-2.0
kevin-intel/scikit-learn
sklearn/datasets/_openml.py
2
34451
import gzip import json import os import shutil import hashlib from os.path import join from warnings import warn from contextlib import closing from functools import wraps from typing import Callable, Optional, Dict, Tuple, List, Any, Union import itertools from collections.abc import Generator from collections import...
bsd-3-clause
RachitKansal/scikit-learn
sklearn/neighbors/tests/test_approximate.py
71
18815
""" Testing for the approximate neighbor search using Locality Sensitive Hashing Forest module (sklearn.neighbors.LSHForest). """ # Author: Maheshakya Wijewardena, Joel Nothman import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_a...
bsd-3-clause
kaiserroll14/301finalproject
main/pandas/sparse/panel.py
9
18717
""" Data structures for sparse float data. Life is made simpler by dealing only with float64 data """ # pylint: disable=E1101,E1103,W0231 import warnings from pandas.compat import range, lrange, zip from pandas import compat import numpy as np from pandas.core.index import Index, MultiIndex, _ensure_index from panda...
gpl-3.0
duonys/deep-learning-chainer
dlchainer/SdA.py
1
5225
#-*- coding: utf-8 -*- from abc import ABCMeta, abstractmethod import copy import numpy as np from sklearn.base import BaseEstimator, ClassifierMixin, RegressorMixin from sklearn.externals.six import with_metaclass from chainer import Variable, FunctionSet, optimizers, cuda import chainer.functions as F from .dA impor...
mit
robbymeals/scikit-learn
sklearn/cluster/tests/test_dbscan.py
114
11393
""" Tests for DBSCAN clustering algorithm """ import pickle import numpy as np from scipy.spatial import distance from scipy import sparse from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing im...
bsd-3-clause
EclipseXuLu/DataHouse
DataHouse/crawler/university_spider.py
1
3941
import requests from bs4 import BeautifulSoup from lxml import etree import pandas as pd from io import StringIO, BytesIO university_list = [] class University(): def __init__(self, name='', is_985=False, is_211=False, has_institute=False, location='', orgnization='', education_level='', educat...
mit
reinaldomaslim/Singaboat_RobotX2016
robotx_nav/nodes/task2_toplevel_try.py
3
4644
#!/usr/bin/env python import multiprocessing as mp import rospy from visualization_msgs.msg import MarkerArray, Marker from geometry_msgs.msg import Point, Quaternion import numpy as np from sklearn.cluster import KMeans, DBSCAN from sklearn import svm from move_base_loiter import Loiter from move_base_waypoint import ...
gpl-3.0
natsheh/semantic_query
api.py
1
4747
# -*- coding: utf-8 -*- # # This file is part of semantic_query. # Copyright (C) 2016 CIAPPLE. # # This is a free software; you can redistribute it and/or modify it # under the terms of the Revised BSD License; see LICENSE file for # more details. # Semantic Query API # Author: Hussein AL-NATSHEH <h.natsheh@ciapple.c...
bsd-3-clause
giorgiop/scikit-learn
examples/linear_model/plot_sgd_loss_functions.py
73
1232
""" ========================== SGD: convex loss functions ========================== A plot that compares the various convex loss functions supported by :class:`sklearn.linear_model.SGDClassifier` . """ print(__doc__) import numpy as np import matplotlib.pyplot as plt def modified_huber_loss(y_true, y_pred): z ...
bsd-3-clause
trungnt13/scikit-learn
sklearn/datasets/lfw.py
38
19042
"""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
fmfn/UnbalancedDataset
examples/applications/plot_outlier_rejections.py
2
4354
""" =============================================================== Customized sampler to implement an outlier rejections estimator =============================================================== This example illustrates the use of a custom sampler to implement an outlier rejections estimator. It can be used easily wi...
mit
Nyker510/scikit-learn
sklearn/decomposition/tests/test_incremental_pca.py
297
8265
"""Tests for Incremental PCA.""" import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_raises from sklearn import datasets from sklearn.decomposition import PCA, IncrementalPCA iris = datasets.load...
bsd-3-clause
nmih/ssbio
ssbio/databases/pdb.py
1
34959
""" PDBProp ======= """ import gzip import json import logging import os.path as op import mmtf import os from cobra.core import DictList import pandas as pd import requests import deprecation from Bio.PDB import PDBList from lxml import etree from six.moves.urllib_error import URLError from six.moves.urllib.request i...
mit
weidel-p/nest-simulator
pynest/examples/pulsepacket.py
12
11358
# -*- coding: utf-8 -*- # # pulsepacket.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or...
gpl-2.0
Lyleo/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_fltkagg.py
69
20839
""" A backend for FLTK Copyright: Gregory Lielens, Free Field Technologies SA and John D. Hunter 2004 This code is released under the matplotlib license """ from __future__ import division import os, sys, math import fltk as Fltk from backend_agg import FigureCanvasAgg import os.path import matplotli...
gpl-3.0
BhallaLab/moose-full
moose-examples/snippets/switchKineticSolvers.py
2
5089
######################################################################### ## This program is part of 'MOOSE', the ## Messaging Object Oriented Simulation Environment. ## Copyright (C) 2014 Upinder S. Bhalla. and NCBS ## It is made available under the terms of the ## GNU Lesser General Public License version 2...
gpl-2.0
zhenv5/scikit-learn
sklearn/neighbors/approximate.py
71
22357
"""Approximate nearest neighbor search""" # Author: Maheshakya Wijewardena <maheshakya.10@cse.mrt.ac.lk> # Joel Nothman <joel.nothman@gmail.com> import numpy as np import warnings from scipy import sparse from .base import KNeighborsMixin, RadiusNeighborsMixin from ..base import BaseEstimator from ..utils.va...
bsd-3-clause