repo_name
stringlengths
9
55
path
stringlengths
7
120
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
1.02k
169k
license
stringclasses
12 values
miaecle/deepchem
contrib/mpnn/donkey.py
7
3029
# 2017 DeepCrystal Technologies - Patrick Hop # # Data loading a splitting file # # MIT License - have fun!! # =========================================================== import os import random from collections import OrderedDict import deepchem as dc from deepchem.utils import ScaffoldGenerator from deepchem.utils....
mit
RecipeML/Recipe
recipe/classifiers/randomLogistic.py
1
2397
# -*- coding: utf-8 -*- """ Copyright 2016 Walter José and Alex de Sá This file is part of the RECIPE Algorithm. The RECIPE 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 (a...
gpl-3.0
CompPhysics/MachineLearning
doc/src/LectureNotes/_build/jupyter_execute/chapter8.py
1
48694
# Dimensionality Reduction ## Reducing the number of degrees of freedom, overarching view Many Machine Learning problems involve thousands or even millions of features for each training instance. Not only does this make training extremely slow, it can also make it much harder to find a good solution, as we will see....
cc0-1.0
weixuanfu/tpot
tpot/config/regressor_sparse.py
1
3127
# -*- coding: utf-8 -*- """This file is part of the TPOT library. TPOT was primarily developed at the University of Pennsylvania by: - Randal S. Olson (rso@randalolson.com) - Weixuan Fu (weixuanf@upenn.edu) - Daniel Angell (dpa34@drexel.edu) - and many more generous open source contributors TPOT is f...
lgpl-3.0
Nyker510/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
briehl/narrative
src/biokbase/narrative/tests/test_viewers.py
1
5395
import unittest import biokbase.auth from . import util """ Tests for the viewer module """ __author__ = "James Jeffryes <jjeffryes@mcs.anl.gov>" @unittest.skip("Skipping clustergrammer-based tests") class ViewersTestCase(unittest.TestCase): @classmethod def setUpClass(cls): cls.attribute_set_ref = ...
mit
danuker/trading-with-python
nautilus/nautilus.py
77
5403
''' Created on 26 dec. 2011 Copyright: Jev Kuznetsov License: BSD ''' from PyQt4.QtCore import * from PyQt4.QtGui import * from ib.ext.Contract import Contract from ib.opt import ibConnection from ib.ext.Order import Order import tradingWithPython.lib.logger as logger from tradingWithPython.lib.eve...
bsd-3-clause
mfjb/scikit-learn
examples/linear_model/plot_polynomial_interpolation.py
251
1895
#!/usr/bin/env python """ ======================== Polynomial interpolation ======================== This example demonstrates how to approximate a function with a polynomial of degree n_degree by using ridge regression. Concretely, from n_samples 1d points, it suffices to build the Vandermonde matrix, which is n_samp...
bsd-3-clause
bartslinger/paparazzi
sw/misc/attitude_reference/test_att_ref.py
49
3485
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2014 Antoine Drouin # # This file is part of paparazzi. # # paparazzi 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, or (at y...
gpl-2.0
vlukes/sfepy
examples/large_deformation/compare_elastic_materials.py
5
6888
#!/usr/bin/env python """ Compare various elastic materials w.r.t. uniaxial tension/compression test. Requires Matplotlib. """ from __future__ import absolute_import from argparse import ArgumentParser, RawDescriptionHelpFormatter import sys import six sys.path.append('.') import numpy as nm def define(): """Def...
bsd-3-clause
bgris/ODL_bgris
lib/python3.5/site-packages/matplotlib/backends/backend_webagg.py
10
12190
""" Displays Agg images in the browser, with interactivity """ from __future__ import (absolute_import, division, print_function, unicode_literals) # The WebAgg backend is divided into two modules: # # - `backend_webagg_core.py` contains code necessary to embed a WebAgg # plot inside of a web...
gpl-3.0
nrhine1/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
shikhardb/scikit-learn
examples/svm/plot_iris.py
62
3251
""" ================================================== Plot different SVM classifiers in the iris dataset ================================================== Comparison of different linear SVM classifiers on a 2D projection of the iris dataset. We only consider the first 2 features of this dataset: - Sepal length - Se...
bsd-3-clause
0asa/scikit-learn
sklearn/ensemble/partial_dependence.py
36
14909
"""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...
bsd-3-clause
karstenw/nodebox-pyobjc
examples/Extended Application/matplotlib/examples/mplot3d/contour3d_3.py
1
1072
''' ======================================== Projecting contour profiles onto a graph ======================================== Demonstrates displaying a 3D surface while also projecting contour 'profiles' onto the 'walls' of the graph. See contourf3d_demo2 for the filled version. ''' from mpl_toolkits.mplot3d import...
mit
waterponey/scikit-learn
examples/applications/plot_out_of_core_classification.py
51
13651
""" ====================================================== 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
endolith/scikit-image
skimage/io/manage_plugins.py
17
10353
"""Handle image reading, writing and plotting plugins. To improve performance, plugins are only loaded as needed. As a result, there can be multiple states for a given plugin: available: Defined in an *ini file located in `skimage.io._plugins`. See also `skimage.io.available_plugins`. partial definiti...
bsd-3-clause
moutai/scikit-learn
sklearn/datasets/tests/test_kddcup99.py
59
1336
"""Test kddcup99 loader. Only 'percent10' mode is tested, as the full data is too big to use in unit-testing. The test is skipped if the data wasn't previously fetched and saved to scikit-learn data folder. """ import errno from sklearn.datasets import fetch_kddcup99 from sklearn.utils.testing import assert_equal, S...
bsd-3-clause
shenzebang/scikit-learn
doc/datasets/mldata_fixture.py
367
1183
"""Fixture module to skip the datasets loading when offline Mock urllib2 access to mldata.org and create a temporary data folder. """ from os import makedirs from os.path import join import numpy as np import tempfile import shutil from sklearn import datasets from sklearn.utils.testing import install_mldata_mock fr...
bsd-3-clause
weaver-viii/h2o-3
h2o-py/tests/testdir_algos/glm/pyunit_link_functions_binomialGLM.py
3
1383
import sys sys.path.insert(1, "../../../") import h2o import pandas as pd import zipfile import statsmodels.api as sm def link_functions_binomial(ip,port): print("Read in prostate data.") h2o_data = h2o.import_file(path=h2o.locate("smalldata/prostate/prostate_complete.csv.zip")) h2o_data.head() sm_dat...
apache-2.0
jaidevd/scikit-learn
sklearn/gaussian_process/tests/test_gaussian_process.py
46
7057
""" Testing for Gaussian Process module (sklearn.gaussian_process) """ # Author: Vincent Dubourg <vincent.dubourg@gmail.com> # License: BSD 3 clause import numpy as np from sklearn.gaussian_process import GaussianProcess from sklearn.gaussian_process import regression_models as regression from sklearn.gaussian_proce...
bsd-3-clause
ibis-project/ibis
ibis/backends/parquet/tests/test_parquet.py
1
2747
import sys import pyarrow as pa import pyarrow.parquet as pq import pytest from pandas.util import testing as tm import ibis from ibis.backends.base.file import FileDatabase from ibis.backends.parquet import ParquetTable pytestmark = pytest.mark.skipif( sys.platform == 'win32', reason='See ibis issue #1698' ) ...
apache-2.0
zonemercy/Kaggle
quora/solution/keras_oof.py
1
10725
from __future__ import division import pandas as pd import numpy as np import random, os, gc import config from scipy import sparse as ssp from sklearn.utils import resample,shuffle from sklearn.metrics import log_loss, roc_auc_score from sklearn.cross_validation import train_test_split from sklearn.feature_selection i...
mit
mbayon/TFG-MachineLearning
venv/lib/python3.6/site-packages/pandas/tests/io/parser/common.py
4
60970
# -*- coding: utf-8 -*- import csv import os import platform import codecs import re import sys from datetime import datetime import pytest import numpy as np from pandas._libs.lib import Timestamp import pandas as pd import pandas.util.testing as tm from pandas import DataFrame, Series, Index, MultiIndex from pand...
mit
loli/sklearn-ensembletrees
examples/decomposition/plot_ica_vs_pca.py
43
3343
""" ========================== FastICA on 2D point clouds ========================== This example illustrates visually in the feature space a comparison by results using two different component analysis techniques. :ref:`ICA` vs :ref:`PCA`. Representing ICA in the feature space gives the view of 'geometric ICA': ICA...
bsd-3-clause
q1ang/scikit-learn
doc/tutorial/text_analytics/skeletons/exercise_01_language_train_model.py
254
2005
"""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
apbard/scipy
scipy/special/basic.py
1
61138
# # Author: Travis Oliphant, 2002 # from __future__ import division, print_function, absolute_import import warnings import numpy as np import math from scipy._lib.six import xrange from numpy import (pi, asarray, floor, isscalar, iscomplex, real, imag, sqrt, where, mgrid, sin, place, issubdtype,...
bsd-3-clause
passiweinberger/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/bezier.py
70
14387
""" A module providing some utility functions regarding bezier path manipulation. """ import numpy as np from math import sqrt from matplotlib.path import Path from operator import xor # some functions def get_intersection(cx1, cy1, cos_t1, sin_t1, cx2, cy2, cos_t2, sin_t2): """ return a...
agpl-3.0
djgagne/scikit-learn
sklearn/neighbors/tests/test_nearest_centroid.py
305
4121
""" Testing for the nearest centroid module. """ import numpy as np from scipy import sparse as sp from numpy.testing import assert_array_equal from numpy.testing import assert_equal from sklearn.neighbors import NearestCentroid from sklearn import datasets from sklearn.metrics.pairwise import pairwise_distances # t...
bsd-3-clause
seokjunbing/cs75
src/data_processing/compare_data_processing.py
1
2664
from Bio import SeqIO from os import listdir import pandas as pd from data_processing.read_dicts import construct_dicts """ This file should be used for reading the data files from other papers we are comparing the results to. This is required since their formats are somewhat different """ # FOLDERS DATA_FOLDER = '.....
gpl-3.0
maximus009/kaggle-galaxies
predict_augmented_npy_maxout2048.py
8
9452
""" Load an analysis file and redo the predictions on the validation set / test set, this time with augmented data and averaging. Store them as numpy files. """ import numpy as np # import pandas as pd import theano import theano.tensor as T import layers import cc_layers import custom import load_data import realtime...
bsd-3-clause
pelson/cartopy
lib/cartopy/examples/wmts_time.py
3
1957
""" Web Map Tile Service time dimension demonstration ------------------------------------------------- This example further demonstrates WMTS support within cartopy. Optional keyword arguments can be supplied to the OGC WMTS 'gettile' method. This allows for the specification of the 'time' dimension for a WMTS layer ...
lgpl-3.0
keirl/bigdata
code/plot_gas_per_capita.py
1
1522
#Import the numpy and pandas libraries import pandas as pd import plotly.plotly as plotly import os #Get the OS folder/directory path data_path = os.path.join(os.path.dirname(__file__),os.pardir,'rawdata') #Read the csv file with the state statistic results df = pd.read_csv(data_path+'/STATE_SUMMARY.CSV'); #Define a...
mit
marcsans/cnn-physics-perception
phy/lib/python2.7/site-packages/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 ...
mit
jeffery-do/Vizdoombot
doom/lib/python3.5/site-packages/matplotlib/backends/qt_editor/formlayout.py
4
20138
# -*- coding: utf-8 -*- """ formlayout ========== Module creating Qt form dialogs/layouts to edit various type of parameters formlayout License Agreement (MIT License) ------------------------------------------ Copyright (c) 2009 Pierre Raybaut Permission is hereby granted, free of charge, to any person obtaining ...
mit
RLPAgroScience/ROIseries
ROIseries/sub_routines/sub_routines.py
1
1059
import os import pandas as pd import numpy as np def file_search(top_dir, extension): result = [] for dir_path,dir_names,files in os.walk(top_dir): for name in files: if name.lower().endswith(extension): result.append(os.path.join(dir_path, name)) return result def so...
agpl-3.0
scienceguyrob/KnownSourceMatcher
KnownSourceMatcher/dist/Interactive.py
2
29344
""" This file is part of the KnownSourceMatcher. KnownSourceMatcher 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 version. KnownSourceMatcher is d...
gpl-2.0
zhoujh30/folium
folium/element.py
1
15488
# -*- coding: utf-8 -*- """ Elements ------ A generic class for creating Elements. """ from uuid import uuid4 from jinja2 import Environment, PackageLoader, Template ENV = Environment(loader=PackageLoader('folium', 'templates')) from collections import OrderedDict import json from .six import urlopen from .utilities...
mit
nhejazi/scikit-learn
sklearn/feature_selection/tests/test_from_model.py
7
7314
import numpy as np from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_false from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_array_almost_equal from ...
bsd-3-clause
lukeshingles/artistools
artistools/misc.py
1
43415
#!/usr/bin/env python3 import argparse from functools import lru_cache import gzip import hashlib # import inspect import lzma import math import multiprocessing import os.path import pickle import sys import time import xattr from collections import namedtuple from itertools import chain from functools import wraps #...
mit
Nikea/VisTrails
vistrails/tests/runtestsuite.py
2
20120
#!/usr/bin/env python # pragma: no testimport ############################################################################### ## ## Copyright (C) 2011-2014, NYU-Poly. ## Copyright (C) 2006-2011, University of Utah. ## All rights reserved. ## Contact: contact@vistrails.org ## ## This file is part of VisTrails. ## ## "R...
bsd-3-clause
johnbachman/belpy
indra/sources/trrust/processor.py
4
2252
from copy import deepcopy from indra.databases import hgnc_client from indra.statements import Agent, IncreaseAmount, DecreaseAmount, Evidence class TrrustProcessor(object): """Processor to extract INDRA Statements from Trrust data frame. Attributes ---------- df : pandas.DataFrame The Trrust...
mit
rubikloud/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
alexrudy/AstroObject
Examples/spectra.py
1
2361
#!/usr/bin/env python # -*- coding: utf-8 -*- # # spectra.py # AstroObject # # Created by Alexander Rudy on 2012-04-17. # Copyright 2012 Alexander Rudy. All rights reserved. # import numpy as np import matplotlib.pyplot as plt from AstroObject.loggers import * from AstroObject.anaspec import InterpolatedSpec...
gpl-3.0
blakeboswell/valence
build/lib/pyvalence/build/agilentgcms.py
1
20264
""" Read GCMS files produced by Agilent """ import re import csv import os import struct import numpy as np import pandas as pd import scipy.sparse class AgilentGcmsTableBase(object): """ Base class for Agilent GCMS builders. This class should not be instantiated directly. """ @classmethod def ...
bsd-3-clause
jefflyn/buddha
src/mlia/Ch05/EXTRAS/plot2D.py
4
1233
''' Created on Oct 6, 2010 @author: Peter ''' from numpy import * import matplotlib import matplotlib.pyplot as plt from matplotlib.patches import Rectangle import logRegres dataMat,labelMat=logRegres.loadDataSet() dataArr = array(dataMat) weights = logRegres.stocGradAscent0(dataArr,labelMat) n = shape(dataArr)[0] #...
artistic-2.0
mne-tools/mne-tools.github.io
0.20/_downloads/df37da09f8cc04b503dd281d8471168a/plot_dics.py
2
12493
# -*- coding: utf-8 -*- """ DICS for power mapping ====================== In this tutorial, we'll simulate two signals originating from two locations on the cortex. These signals will be sinusoids, so we'll be looking at oscillatory activity (as opposed to evoked activity). We'll use dynamic imaging of coherent sourc...
bsd-3-clause
udibr/fast-rcnn
lib/roi_data_layer/minibatch.py
44
7337
# -------------------------------------------------------- # Fast R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick # -------------------------------------------------------- """Compute minibatch blobs for training a Fast R-CNN network.""" impor...
mit
icdishb/scikit-learn
sklearn/linear_model/tests/test_base.py
120
10082
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # # License: BSD 3 clause import numpy as np from scipy import sparse from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.linear_model....
bsd-3-clause
mne-tools/mne-python
tutorials/preprocessing/25_background_filtering.py
3
48286
# -*- coding: utf-8 -*- r""" .. _disc-filtering: =================================== Background information on filtering =================================== Here we give some background information on filtering in general, and how it is done in MNE-Python in particular. Recommended reading for practical applications ...
bsd-3-clause
mihail911/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_pdf.py
69
71773
# -*- coding: iso-8859-1 -*- """ A PDF matplotlib backend (not yet complete) Author: Jouni K Seppänen <jks@iki.fi> """ from __future__ import division import os import re import sys import time import warnings import zlib import numpy as npy from cStringIO import StringIO from datetime import datetime from math impo...
gpl-3.0
Guneet-Dhillon/mxnet
example/kaggle-ndsb1/training_curves.py
52
1879
# 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
jplourenco/bokeh
bokeh/_legacy_charts/builder/tests/test_timeseries_builder.py
6
2807
""" This is the Bokeh charts testing interface. """ #----------------------------------------------------------------------------- # Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved. # # Powered by the Bokeh Development Team. # # The full license is in the file LICENSE.txt, distributed with thi...
bsd-3-clause
dimkal/mne-python
examples/visualization/plot_evoked_topomap.py
18
1498
""" ======================================== Plotting topographic maps of evoked data ======================================== Load evoked data and plot topomaps for selected time points. """ # Authors: Christian Brodbeck <christianbrodbeck@nyu.edu> # Tal Linzen <linzen@nyu.edu> # Denis A. Engeman <...
bsd-3-clause
jereze/scikit-learn
examples/linear_model/plot_theilsen.py
232
3615
""" ==================== Theil-Sen Regression ==================== Computes a Theil-Sen Regression on a synthetic dataset. See :ref:`theil_sen_regression` for more information on the regressor. Compared to the OLS (ordinary least squares) estimator, the Theil-Sen estimator is robust against outliers. It has a breakd...
bsd-3-clause
flightgong/scikit-learn
benchmarks/bench_plot_lasso_path.py
301
4003
"""Benchmarks of Lasso regularization path computation using Lars and CD The input data is mostly low rank but is a fat infinite tail. """ from __future__ import print_function from collections import defaultdict import gc import sys from time import time import numpy as np from sklearn.linear_model import lars_pat...
bsd-3-clause
benjaminwilson/word2vec-norm-experiments
article_generate_cosine_similarity.py
1
1368
import numpy as np import pandas as pd import sys from parameters import * from functions import * vectors_syn0_filename = sys.argv[1] word = sys.argv[2] # e.g. 'the' def row_normalise_dataframe(df): matrix = df.as_matrix() * 1. norms = np.sqrt((matrix ** 2).sum(axis=1)) normed_mat = matrix / norms[:, n...
apache-2.0
pgierz/MyPythonModules
basemap_wrappers/basemap_pacific.py
2
1642
import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap def map_pacif(coastlines=True, thisax=plt.gca(), fill_color='aqua'): m = Basemap(projection='cyl', llcrnrlat=-60, urcrnrlat=60, llcrnrlon=-270, urcrnrlon=-60, resolution='c', ax=thisax) if c...
gpl-2.0
KelumPerera/Pandas
Create Dataframes_DateTime Formating.py
1
3583
# -*- coding: utf-8 -*- """ Created on Fri May 05 21:25:51 2017 @author: Kelum Perera """ import pandas as pd # Take a 2D array as input to your DataFrame import numpy as np my_2darray = np.array([[1, 2, 3], [4, 5, 6]]) print(pd.DataFrame(my_2darray)) # Take a dictionary as input to your DataFr...
gpl-3.0
chuan9/chromium-crosswalk
chrome/test/nacl_test_injection/buildbot_chrome_nacl_stage.py
39
11336
#!/usr/bin/python # 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. """Do all the steps required to build and test against nacl.""" import optparse import os.path import re import shutil import subproc...
bsd-3-clause
jsilter/scipy
scipy/stats/_discrete_distns.py
2
20515
# # Author: Travis Oliphant 2002-2011 with contributions from # SciPy Developers 2004-2011 # from __future__ import division, print_function, absolute_import from scipy import special from scipy.special import entr, gammaln as gamln from numpy import floor, ceil, log, exp, sqrt, log1p, expm1, tanh, cosh, s...
bsd-3-clause
anaderi/lhcb_trigger_ml
setup.py
1
1694
from setuptools import setup import codecs with codecs.open('README.rst', encoding='utf-8') as readme_file: long_description = readme_file.read() setup( name="hep_ml", version="0.1.5", description="Machine Learning for High Energy Physics", long_description=long_description, url='https://git...
mit
tachylyte/HydroGeoPy
EXAMPLES/exampleMonteCarloUni.py
2
1242
# Simple test of probabilistic modelling # Calculates time to break through assuming plug flow from simplehydro import * from monte_carlo import * from conversion import * import matplotlib.pyplot as plt x = 10 # Distance, x (m) n = 0.3 # Effective porosity, n (-) K = 1e-7 # Hydraulic conductivi...
bsd-2-clause
diogo149/CauseEffectPairsPaper
configs/default_categorical_only.py
1
7287
import numpy as np from scipy.stats import skew, kurtosis, shapiro, pearsonr, ansari, mood, levene, fligner, bartlett, mannwhitneyu from scipy.spatial.distance import braycurtis, canberra, chebyshev, cityblock, correlation, cosine, euclidean, hamming, jaccard, kulsinski, matching, russellrao, sqeuclidean from sklearn.p...
mit
shikhardb/scikit-learn
sklearn/utils/graph.py
50
6169
""" Graph utilities and algorithms Graphs are represented with their adjacency matrices, preferably using sparse matrices. """ # Authors: Aric Hagberg <hagberg@lanl.gov> # Gael Varoquaux <gael.varoquaux@normalesup.org> # Jake Vanderplas <vanderplas@astro.washington.edu> # License: BSD 3 clause impo...
bsd-3-clause
sidnarayanan/BAdNet
train/images/utils.py
1
3654
import numpy as np # import seaborn from collections import namedtuple from keras import backend as K from keras.engine.topology import Layer from scipy.interpolate import interp1d ## Loss functions dice_smooth = 1. def dice_coef(y_true, y_pred): y_true_f = K.flatten(y_true) y_pred_f = K.flatten(y_pred) ...
mit
Chandra-MARX/marx-test
marxtest/plot_utils.py
1
2865
from matplotlib import scale as mscale from matplotlib import transforms as mtransforms from matplotlib.ticker import AutoLocator, ScalarFormatter class PowerScale(mscale.ScaleBase): """ Scales values v with with v^pow. """ name = 'power' def __init__(self, axis, **kwargs): """ po...
gpl-2.0
samzhang111/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
sapfo/medeas
src/old_scripts/main_simul_eigenvalues_distribution.py
1
7741
#!/usr/bin/env python """ Created Wed Oct 7 15:04:36 CEST 2015 @author: sapfo """ import matplotlib #matplotlib.use('Agg') import simul_ms import python_cmdscale #import python_pca import exp import sys import numpy as np import pylab as py from scipy.stats import norm ''' We want to pick n1, n2, D, T? Simulate ...
gpl-3.0
Aasmi/scikit-learn
benchmarks/bench_plot_parallel_pairwise.py
297
1247
# Author: Mathieu Blondel <mathieu@mblondel.org> # License: BSD 3 clause import time import pylab as pl from sklearn.utils import check_random_state from sklearn.metrics.pairwise import pairwise_distances from sklearn.metrics.pairwise import pairwise_kernels def plot(func): random_state = check_random_state(0) ...
bsd-3-clause
fabioticconi/scikit-learn
sklearn/utils/tests/test_estimator_checks.py
69
3894
import scipy.sparse as sp import numpy as np import sys from sklearn.externals.six.moves import cStringIO as StringIO from sklearn.base import BaseEstimator, ClassifierMixin from sklearn.utils.testing import assert_raises_regex, assert_true from sklearn.utils.estimator_checks import check_estimator from sklearn.utils....
bsd-3-clause
GGiecold/ECLAIR
src/ECLAIR/Statistical_performance/Robustness_analysis.py
1
18145
#!/usr/bin/env python # ECLAIR/src/ECLAIR/Statistics/Robustness_analysis.py; # Author: Gregory Giecold for the GC Yuan Lab # Affiliation: Harvard University # Contact: g.giecold@gmail.com; ggiecold@jimmy.harvard.edu """ECLAIR is a package for the robust and scalable inference of cell lineages from gene expression...
mit
pgaref/memcached_bench
Python_plots/plots/qjump_utils.py
3
4079
# Copyright (c) 2015, Malte Schwarzkopf # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditions and...
mit
ChrisEberl/Python_DIC
functions/CpCorr.py
1
14243
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on --/--/20-- @author: --- Revised by Charlie Bourigault @contact: bourigault.charlie@gmail.com Please report issues and request on the GitHub project from ChrisEberl (Python_DIC) More details regarding the project on the GitHub Wiki : https://github...
apache-2.0
yunfeilu/scikit-learn
examples/feature_selection/plot_rfe_with_cross_validation.py
226
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__) import matplotlib.p...
bsd-3-clause
mattions/TimeScales
branch_dist/import_digitezed_data.py
1
4254
# Author Michele Mattioni # Fri Oct 23 15:41:58 BST 2009 import pylab import numpy as np from numpy import sin, exp import matplotlib.pyplot as plt from helpers.loader import Loader class FitHandler(object): """Fit the data with a polynomial""" def fit(self, data, terms): polycoeffs = np.po...
bsd-3-clause
xzh86/scikit-learn
sklearn/metrics/cluster/tests/test_unsupervised.py
230
2823
import numpy as np from scipy.sparse import csr_matrix from sklearn import datasets from sklearn.metrics.cluster.unsupervised import silhouette_score from sklearn.metrics import pairwise_distances from sklearn.utils.testing import assert_false, assert_almost_equal from sklearn.utils.testing import assert_raises_regexp...
bsd-3-clause
jrmyp/attelo
attelo/metrics/constituency.py
3
11012
"""Metrics for constituency trees. TODO ---- * [ ] factor out the report from the parseval function, see `sklearn.metrics.classification.classification_report` * [ ] refactor the selection functions that enable to break down evaluations, to avoid almost duplicates (as currently) """ from __future__ import print_funct...
gpl-3.0
madjelan/scikit-learn
examples/feature_stacker.py
246
1906
""" ================================================= Concatenating multiple feature extraction methods ================================================= In many real-world examples, there are many ways to extract features from a dataset. Often it is beneficial to combine several methods to obtain good performance. Th...
bsd-3-clause
klusta-team/klustaviewa
klustaviewa/gui/mainwindow.py
1
49325
"""Main window.""" # ----------------------------------------------------------------------------- # Imports # ----------------------------------------------------------------------------- import pprint import time from StringIO import StringIO import os import sys import inspect import logging from collections import...
bsd-3-clause
tmhm/scikit-learn
examples/applications/plot_stock_market.py
227
8284
""" ======================================= Visualizing the stock market structure ======================================= This example employs several unsupervised learning techniques to extract the stock market structure from variations in historical quotes. The quantity that we use is the daily variation in quote ...
bsd-3-clause
quheng/scikit-learn
sklearn/pipeline.py
61
21271
""" The :mod:`sklearn.pipeline` module implements utilities to build a composite estimator, as a chain of transforms and estimators. """ # Author: Edouard Duchesnay # Gael Varoquaux # Virgile Fritsch # Alexandre Gramfort # Lars Buitinck # Licence: BSD from collections import defaultdict...
bsd-3-clause
mojoboss/scikit-learn
examples/ensemble/plot_gradient_boosting_quantile.py
392
2114
""" ===================================================== Prediction Intervals for Gradient Boosting Regression ===================================================== This example shows how quantile regression can be used to create prediction intervals. """ import numpy as np import matplotlib.pyplot as plt from skle...
bsd-3-clause
JPFrancoia/scikit-learn
sklearn/metrics/tests/test_pairwise.py
13
26241
import numpy as np from numpy import linalg from scipy.sparse import dok_matrix, csr_matrix, issparse from scipy.spatial.distance import cosine, cityblock, minkowski, wminkowski from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing impo...
bsd-3-clause
avmarchenko/exatomic
exatomic/qchem/output.py
2
2088
# -*- coding: utf-8 -*- # Copyright (c) 2015-2018, Exa Analytics Development Team # Distributed under the terms of the Apache License 2.0 """ Q-Chem Ouput Editor ####################### Editor classes for simple Q-Chem output files """ import six import numpy as np import pandas as pd from exa import TypedMeta from ex...
apache-2.0
linan7788626/pandas_tutorial
exercises/pandas_wind_statistics/pandas_wind_statistics_solution.py
4
5511
# Copyright 2015 Enthought, Inc. All Rights Reserved """ Wind Statistics ---------------- This exercise is an alternative version of the Numpy exercise but this time we will be using pandas for all tasks. The data have been modified to contain some missing values, identified by NaN. Using pandas should make this exer...
mit
boomsbloom/dtm-fmri
DTM/for_gensim/lib/python2.7/site-packages/pandas/tests/series/test_sorting.py
7
4805
# coding=utf-8 import numpy as np import random from pandas import (DataFrame, Series, MultiIndex) from pandas.util.testing import (assert_series_equal, assert_almost_equal) import pandas.util.testing as tm from .common import TestData class TestSeriesSorting(TestData, tm.TestCase): _multiprocess_can_split_ ...
mit
pletisan/python-data-viz-cookbook
3367OS_Code/3367OS_08_Code/ch08_rec06_textfont.py
1
1382
import matplotlib.pyplot as plt from matplotlib.font_manager import FontProperties # properties: families = ['serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'] sizes = ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'] styles = ['normal', 'italic', 'oblique'] weights = ['light...
mit
Akshay0724/scikit-learn
examples/model_selection/plot_confusion_matrix.py
63
3231
""" ================ Confusion matrix ================ Example of confusion matrix usage to evaluate the quality of the output of a classifier on the iris data set. The diagonal elements represent the number of points for which the predicted label is equal to the true label, while off-diagonal elements are those that ...
bsd-3-clause
probcomp/cgpm
tests/test_factor_analysis.py
1
8977
# -*- coding: utf-8 -*- # Copyright (c) 2015-2016 MIT Probabilistic Computing Project # 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 # Unles...
apache-2.0
GenericMappingTools/gmt-python
examples/tutorials/plot.py
1
3481
""" Plotting data points -------------------- GMT shines when it comes to plotting data on a map. We can use some sample data that is packaged with GMT to try this out. PyGMT provides access to these datasets through the :mod:`pygmt.datasets` package. If you don't have the data files already, they are automatically do...
bsd-3-clause
sergiohr/NeuroDB
test/test9.py
1
1313
''' Created on Feb 25, 2015 @author: sergio ''' import numpy as np import ctypes import numpy.ctypeslib as npct import matplotlib.pyplot as plt import psycopg2 import time from math import e, pow from scipy.optimize import leastsq if __name__ == '__main__': # username = 'postgres' # password = 'postgres' #...
gpl-3.0
fredhusser/scikit-learn
benchmarks/bench_multilabel_metrics.py
276
7138
#!/usr/bin/env python """ A comparison of multilabel target formats and metrics over them """ from __future__ import division from __future__ import print_function from timeit import timeit from functools import partial import itertools import argparse import sys import matplotlib.pyplot as plt import scipy.sparse as...
bsd-3-clause
ZENGXH/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
annayqho/TheCannon
code/lamost/li_giants/plot_residual.py
1
3418
""" Create some model spectra vs. data """ import numpy as np import matplotlib.pyplot as plt from math import log10, floor from matplotlib import rc import matplotlib.gridspec as gridspec from matplotlib.colors import LogNorm plt.rc('text', usetex=True) # rc('text.latex', preamble = ','.join('''\usepackage{txfonts}''...
mit
Insight-book/data-science-from-scratch
first-edition-ko/code/ch20_natural_language_processing.py
12
10007
from __future__ import division import math, random, re from collections import defaultdict, Counter from bs4 import BeautifulSoup import requests def plot_resumes(plt): data = [ ("big data", 100, 15), ("Hadoop", 95, 25), ("Python", 75, 50), ("R", 50, 40), ("machine learning", 80, 20), ("statistics", 20, ...
unlicense
lmarkely/enron_fraud
poi_id_modified.py
1
28009
#!/usr/bin/python import sys import pickle sys.path.append("../tools/") from feature_format import featureFormat, targetFeatureSplit from tester import dump_classifier_and_data ### Task 1: Select what features you'll use. ### features_list is a list of strings, each of which is a feature name. ### The first feature ...
mit
researchstudio-sat/wonpreprocessing
python-processing/scripts/evaluation_algorithms.py
1
20879
import numpy as np import sklearn.metrics as m from tools.cosine_link_prediction import cosinus_link_prediciton from tools.evaluation_utils import EvaluationReport, NeedEvaluationDetailDict, get_optimal_threshold, \ write_ROC_curve_file, write_precision_recall_curve_file from tools.graph_utils import create_gexf_gr...
apache-2.0
Eric89GXL/scikit-learn
examples/gaussian_process/plot_gp_regression.py
253
4054
#!/usr/bin/python # -*- coding: utf-8 -*- r""" ========================================================= Gaussian Processes regression: basic introductory example ========================================================= A simple one-dimensional regression exercise computed in two different ways: 1. A noise-free cas...
bsd-3-clause
ShownX/incubator-mxnet
example/rcnn/rcnn/pycocotools/coco.py
41
19083
# 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