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
vtesin/sklearn_tutorial
examples/svm_gui.py
8
11157
""" ========== Libsvm GUI ========== A simple graphical frontend for Libsvm mainly intended for didactic purposes. You can create data points by point and click and visualize the decision region induced by different kernels and parameter settings. To create positive examples click the left mouse button; to create neg...
bsd-3-clause
ThomasChauve/aita
AITAToolbox/.ipynb_checkpoints/aita-checkpoint.py
2
77555
# -*- coding: utf-8 -*- ''' Created on 3 juil. 2015 Toolbox for data obtained using G50 Automatique Ice Texture Analyser (AITA) provide by : Russell-Head, D.S., Wilson, C., 2001. Automated fabric analyser system for quartz and ice. J. Glaciol. 24, 117–130 @author: Thomas Chauve @contact: thomas.chauve@univ-grenoble-al...
gpl-3.0
DynaLite/DynaLite_1.0
Sources/SpeechProcessing/pyAudioAnalysis/audioFeatureExtraction.py
3
31678
import sys import time import os import glob import numpy import mlpy import cPickle import aifc import math from numpy import NaN, Inf, arange, isscalar, array from scipy.fftpack import rfft from scipy.fftpack import fft from scipy.fftpack.realtransforms import dct from scipy.signal import fftconvolve from matplotlib....
mit
olafhauk/mne-python
mne/inverse_sparse/mxne_optim.py
6
57847
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Daniel Strohmeier <daniel.strohmeier@gmail.com> # Mathurin Massias <mathurin.massias@gmail.com> # License: Simplified BSD from math import sqrt import numpy as np from scipy import linalg from .mxne_debiasing import compute_bias from ..util...
bsd-3-clause
rsignell-usgs/notebook
pyugrid/notebook_examples/pyugrid_cartopy_test.py
1
3029
# coding: utf-8 # # Test out standardized ADCIRC, SELFE and FVCOM datasets with pyugrid, IRIS and Cartopy # The datasets being accessed here are NetCDF files from ADCIRC, SELFE and FVCOM, with attributes added or modified virtually using NcML to meet the [UGRID conventions standard for unstructured grid models](htt...
mit
Haddy1/ClusterMDS
lib/libMDS.py
1
1353
#!/usr/bin/python from sklearn.decomposition import PCA import imp #Use Theano only if available try: imp.find_module('theano') use_theano = True except ImportError: use_theano = False #use SMACOF from libSMACOF_theano when Theano avalailable #from numpy implemention from libSMACOF when not if use_theano:...
gpl-3.0
zhmz90/first_step_with_julia_kaggle.jl
King/input.py
1
1976
import string import pandas as pd import numpy as np from numpy.random import shuffle #import skimage.io import imread from scipy.misc import imread import tensorflow as tf tf.app.flags.DEFINE_boolean("debug", True, "for debug models") tf.app.flags.DEFINE_boolean("use_fp16", False, "data type") FLAGS = tf.app.flags.FL...
mit
zorojean/scikit-learn
sklearn/ensemble/gradient_boosting.py
126
65552
"""Gradient Boosted Regression Trees This module contains methods for fitting gradient boosted regression trees for both classification and regression. The module structure is the following: - The ``BaseGradientBoosting`` base class implements a common ``fit`` method for all the estimators in the module. Regressio...
bsd-3-clause
fredhusser/scikit-learn
sklearn/preprocessing/data.py
113
56747
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Mathieu Blondel <mathieu@mblondel.org> # Olivier Grisel <olivier.grisel@ensta.org> # Andreas Mueller <amueller@ais.uni-bonn.de> # Eric Martin <eric@ericmart.in> # License: BSD 3 clause from itertools import chain, combina...
bsd-3-clause
lenovor/scikit-learn
sklearn/decomposition/base.py
313
5647
"""Principal Component Analysis Base Classes""" # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Denis A. Engemann <d.engemann@fz-juelich.de> # Kyle Kastner <kastnerkyle@gmail.com> # # Licen...
bsd-3-clause
cdegroc/scikit-learn
examples/linear_model/plot_sgd_penalties.py
7
1500
""" ============== SGD: Penalties ============== Plot the contours of the three penalties supported by `sklearn.linear_model.stochastic_gradient`. """ from __future__ import division print __doc__ import numpy as np import pylab as pl def l1(xs): return np.array([np.sqrt((1 - np.sqrt(x ** 2.0)) ** 2.0) for x i...
bsd-3-clause
ishanic/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
yonglehou/scikit-learn
examples/mixture/plot_gmm_pdf.py
284
1528
""" ============================================= Density Estimation for a mixture of Gaussians ============================================= Plot the density estimation of a mixture of two Gaussians. Data is generated from two Gaussians with different centers and covariance matrices. """ import numpy as np import ma...
bsd-3-clause
lidalei/DataMining
parameters_tunning/visualize_nn_train_process.py
1
1386
import json import matplotlib.pylab as plt import itertools import seaborn fig1, ax1 = plt.subplots(1, 1) fig2, ax2 = plt.subplots(1, 1) palette = itertools.cycle(seaborn.color_palette(n_colors = 10)) for hidden1 in [10, 50, 100, 150]: with open('train_process_hidden1_' + str(hidden1) + '.json', 'r') as f: ...
mit
rajul/mne-python
examples/inverse/plot_compute_mne_inverse_epochs_in_label.py
19
4539
""" ================================================== Compute MNE-dSPM inverse solution on single epochs ================================================== Compute dSPM inverse solution on single trial epochs restricted to a brain label. """ # Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # ...
bsd-3-clause
lin-credible/scikit-learn
examples/text/document_classification_20newsgroups.py
222
10500
""" ====================================================== Classification of text documents using sparse features ====================================================== This is an example showing how scikit-learn can be used to classify documents by topics using a bag-of-words approach. This example uses a scipy.spars...
bsd-3-clause
RPGOne/Skynet
scikit-learn-0.18.1/sklearn/feature_selection/tests/test_base.py
98
3681
import numpy as np from scipy import sparse as sp 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 from sklearn.utils.testing import assert_raises, assert_equal class StepSelector(Select...
bsd-3-clause
tswast/google-cloud-python
automl/tests/unit/gapic/v1beta1/test_gcs_client_v1beta1.py
2
6919
# -*- coding: utf-8 -*- # # Copyright 2019 Google 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...
apache-2.0
rustyrazorblade/ironeagle
ironeagle/__init__.py
1
1028
from cassandra.concurrent import execute_concurrent_with_args import pandas def save_dataframe_to_cassandra(session, dataframe, table, types=None): """ :param session: :type session: cassandra.cluster.Session :param dataframe: :type dataframe: pandas.DataFrame :param table: :return: "...
bsd-2-clause
harisbal/pandas
pandas/tests/indexes/test_frozen.py
2
3493
import warnings import numpy as np from pandas.compat import u from pandas.core.indexes.frozen import FrozenList, FrozenNDArray from pandas.tests.test_base import CheckImmutable, CheckStringMixin from pandas.util import testing as tm class TestFrozenList(CheckImmutable, CheckStringMixin): mutable_methods = ('ext...
bsd-3-clause
thientu/scikit-learn
examples/cluster/plot_kmeans_silhouette_analysis.py
242
5885
""" =============================================================================== Selecting the number of clusters with silhouette analysis on KMeans clustering =============================================================================== Silhouette analysis can be used to study the separation distance between the...
bsd-3-clause
Loisel/colorview2d
colorview2d/view.py
1
27152
# -*- coding: utf-8 -*- """ The view module hosts the View class, the central object of cv2d. """ import logging import os import sys import six import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter from matplotlib.widgets import Slider, Button import yaml from color...
bsd-2-clause
ratnania/pigasus
python/plugin/adaptiveMesh.py
1
6879
# -*- coding: UTF-8 -*- #! /usr/bin/python from caid.cad_geometry import square from caid.cad_geometry import circle from caid.cad_geometry import quart_circle from caid.cad_geometry import annulus from matplotlib import pyplot as plt import numpy as np from time import time import sys import inspect fi...
mit
COMPSCI290-S2016/Group3_LaplacianMesh
LapGUI.py
1
31160
#Based off of http://wiki.wxpython.org/GLCanvas #Lots of help from http://wiki.wxpython.org/Getting%20Started import sys sys.path.append("S3DGLPy") from OpenGL.GL import * from OpenGL.arrays import vbo import wx from wx import glcanvas from Primitives3D import * from PolyMesh import * from LaplacianMesh import * from ...
apache-2.0
FrederichRiver/neutrino
applications/venus/venus/stock_base.py
1
10456
#!/usr/bin/python3 import datetime import numpy as np import pandas as pd import re import requests from lxml import etree from dev_global.env import TIME_FMT from polaris.mysql8 import (mysqlBase, mysqlHeader) from jupiter.utils import trans __version__ = '1.0.10' class StockBase(object): """ param header...
bsd-3-clause
billy-inn/scikit-learn
doc/tutorial/text_analytics/skeletons/exercise_02_sentiment.py
256
2406
"""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
ldirer/scikit-learn
sklearn/feature_extraction/text.py
3
52600
# -*- coding: utf-8 -*- # Authors: Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Lars Buitinck # Robert Layton <robertlayton@gmail.com> # Jochen Wersdörfer <jochen@wersdoerfer.de> # Roman Sinayev <roman.sinayev@gmail.com> # # License: B...
bsd-3-clause
chintak/face_detection
models.py
1
15942
import numpy as np import os import theano import theano.tensor as T import lasagne from lasagne import layers from lasagne.init import Orthogonal from lasagne.updates import nesterov_momentum from nolearn.lasagne import NeuralNet from nolearn.lasagne import BatchIterator from lazy_batch_iterator import LazyBatchItera...
apache-2.0
davidbrandfonbrener/Project-Sisyphus
backend/visualizations.py
1
1392
#from backend.networks import Model import matplotlib.pyplot as plt import numpy as np #from backend.simulation_tools import Simulator # visualize network output on a trial, compared to desired output def visualize_2_input_one_output_trial(model, sess, data): preds = model.test(sess, data[0])[0] length = data...
mit
peraktong/Cannon-Experiment
0218_plot_three_suspect_star.py
1
56764
import numpy as np from astropy.table import Table from astropy.io import fits import matplotlib.pyplot as plt import matplotlib import pickle from TheCannon_2 import dataset,apogee from TheCannon_2 import model pkl_file = open('wl.pkl', 'rb') wl = pickle.load(pkl_file) pkl_file.close() # load path pkl_file = op...
mit
adamgreenhall/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
sanjayankur31/nest-simulator
pynest/examples/tsodyks_depressing.py
8
5619
# -*- coding: utf-8 -*- # # tsodyks_depressing.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 Lice...
gpl-2.0
iancze/PSOAP
scripts/psoap_predict_ST3.py
1
5233
#!/usr/bin/env python import argparse parser = argparse.ArgumentParser(description="Measure statistics across multiple chains.") parser.add_argument("--draws", type=int, default=0, help="In addition to plotting the mean GP, plot several draws of the GP to show the scatter in predicitions.") args = parser.parse_args()...
mit
Djabbz/scikit-learn
examples/plot_multilabel.py
236
4157
# Authors: Vlad Niculae, Mathieu Blondel # License: BSD 3 clause """ ========================= Multilabel classification ========================= This example simulates a multi-label document classification problem. The dataset is generated randomly based on the following process: - pick the number of labels: n ...
bsd-3-clause
johnyf/pyvectorized
pyvectorized/multidim_plot.py
1
5949
""" Common 2D and 3D plot, quiver, text functions 2013 (BSD-3) California Institute of Technology """ from __future__ import division from warnings import warn #import numpy as np from matplotlib import pyplot as plt from vectorized_meshgrid import vec2meshgrid def dimension(ndarray): """dimension of ndarray ...
bsd-3-clause
gfyoung/pandas
asv_bench/benchmarks/categoricals.py
2
9788
import string import sys import warnings import numpy as np import pandas as pd from .pandas_vb_common import tm try: from pandas.api.types import union_categoricals except ImportError: try: from pandas.types.concat import union_categoricals except ImportError: pass class Constructor: ...
bsd-3-clause
ddboline/kaggle_imdb_sentiment_model
train_word2vec_model.py
1
2397
#!/usr/bin/python import os import csv import gzip import multiprocessing from collections import defaultdict import pandas as pd import numpy as np import nltk from gensim.models import Word2Vec from sklearn.feature_extraction.text import CountVectorizer from KaggleWord2VecUtility import review_to_wordlist, revie...
mit
kylerbrown/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
puyokw/kaggle_digitRecognizer
Lasagne.py
1
3906
import numpy as np import pandas as pd from sklearn.preprocessing import LabelEncoder from sklearn.preprocessing import StandardScaler from lasagne.layers import DenseLayer from lasagne.layers import InputLayer from lasagne.layers import DropoutLayer from lasagne.layers import * from lasagne.nonlinearities import softm...
mit
IssamLaradji/scikit-learn
examples/cluster/plot_segmentation_toy.py
258
3336
""" =========================================== 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
ryfeus/lambda-packs
Tensorflow_LightGBM_Scipy_nightly/source/scipy/interpolate/ndgriddata.py
13
7473
""" Convenience interface to N-D interpolation .. versionadded:: 0.9 """ from __future__ import division, print_function, absolute_import import numpy as np from .interpnd import LinearNDInterpolator, NDInterpolatorBase, \ CloughTocher2DInterpolator, _ndim_coords_from_arrays from scipy.spatial import cKDTree _...
mit
wbengine/SPMILM
egs/1-billion/run_trf_2.py
1
6271
import os import sys import numpy as np import matplotlib.pyplot as plt sys.path.insert(0, os.getcwd() + '/../../tools/') import wb import trf # revise this function to config the dataset used to train different model def data(tskdir): train = tskdir + 'data/train.txt' valid = tskdir + 'data/valid.txt' te...
apache-2.0
kevin-coder/tensorflow-fork
tensorflow/contrib/learn/python/learn/learn_io/pandas_io_test.py
25
7883
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
StagPython/StagPy
setup.py
1
1411
import os from setuptools import setup with open('README.rst') as rdm: README = rdm.read() DEPENDENCIES = [ 'loam>=0.3.1', 'f90nml>=1.2', 'setuptools_scm>=4.1', ] HEAVY = [ 'numpy>=1.19', 'scipy>=1.5', 'pandas>=1.1', 'h5py>=3.0', 'matplotlib>=3.3', ] ON_RTD = os.environ.get('READ...
apache-2.0
weissercn/MLTools
Dalitz_simplified/evaluation_of_optimised_classifiers/svm_sin/svm_Sin_evaluation_of_optimised_classifiers.py
1
1573
import numpy as np import math import sys sys.path.insert(0,'../..') import os import classifier_eval_simplified from sklearn import tree from sklearn.ensemble import AdaBoostClassifier from sklearn.svm import SVC for dim in range(2,11): comp_file_list=[] ######################################################...
mit
vshtanko/scikit-learn
examples/cluster/plot_affinity_propagation.py
349
2304
""" ================================================= Demo of affinity propagation clustering algorithm ================================================= Reference: Brendan J. Frey and Delbert Dueck, "Clustering by Passing Messages Between Data Points", Science Feb. 2007 """ print(__doc__) from sklearn.cluster impor...
bsd-3-clause
astrofrog/glue-3d-viewer
glue_vispy_viewers/volume/layer_artist.py
2
8312
from __future__ import absolute_import, division, print_function import uuid import weakref from matplotlib.colors import ColorConverter from glue.core.data import Subset, Data from glue.core.exceptions import IncompatibleAttribute from glue.utils import broadcast_to from glue.core.fixed_resolution_buffer import ARR...
bsd-2-clause
jskDr/jamespy_py3
kkeras_util.py
2
2816
#from keras.models import Sequential from keras.layers import Dense, Input from keras.models import Model from keras.regularizers import l1 import matplotlib.pyplot as plt def plot_model_history( history): """ accuracy and loss are depicted. """ plt.plot(history.history['acc']) #plt.plot(history.history['val_acc...
mit
MicrosoftGenomics/PySnpTools
pysnptools/snpreader/snpreader.py
1
40556
import numpy as np import subprocess, sys import os.path from itertools import * import pandas as pd import logging import time import pysnptools.util as pstutil from pysnptools.pstreader import PstReader import warnings import pysnptools.standardizer as stdizer try: from builtins import range except: pass #!!...
apache-2.0
phobson/statsmodels
statsmodels/emplike/descriptive.py
6
39010
""" Empirical likelihood inference on descriptive statistics This module conducts hypothesis tests and constructs confidence intervals for the mean, variance, skewness, kurtosis and correlation. If matplotlib is installed, this module can also generate multivariate confidence region plots as well as mean-variance con...
bsd-3-clause
fredhusser/scikit-learn
examples/cluster/plot_color_quantization.py
297
3443
# -*- coding: utf-8 -*- """ ================================== Color Quantization using K-Means ================================== Performs a pixel-wise Vector Quantization (VQ) of an image of the summer palace (China), reducing the number of colors required to show the image from 96,615 unique colors to 64, while pre...
bsd-3-clause
Barmaley-exe/scikit-learn
examples/svm/plot_rbf_parameters.py
35
8096
''' ================== RBF SVM parameters ================== This example illustrates the effect of the parameters ``gamma`` and ``C`` of the Radius 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
nisse3000/pymatgen
dev_scripts/chemenv/strategies/multi_weights_strategy_parameters.py
14
15863
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. from __future__ import division, unicode_literals """ Script to visualize the model coordination environments """ __author__ = "David Waroquiers" __copyright__ = "Copyright 2012, The Materials Project" __vers...
mit
drodarie/nest-simulator
topology/pynest/hl_api.py
8
71159
# -*- coding: utf-8 -*- # # hl_api.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 # (a...
gpl-2.0
timothydmorton/bokeh
bokeh/charts/builder/boxplot_builder.py
41
11882
"""This is the Bokeh charts interface. It gives you a high level API to build complex plot is a simple way. This is the BoxPlot class which lets you build your BoxPlot plots just passing the arguments to the Chart class and calling the proper functions. It also add a new chained stacked method. """ #------------------...
bsd-3-clause
ronalcc/zipline
tests/test_sources.py
17
7041
# # Copyright 2013 Quantopian, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
apache-2.0
jorik041/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
berkeley-stat159/project-zeta
code/tsa_s3.py
3
11180
from __future__ import print_function, division import numpy as np import numpy.linalg as npl import matplotlib import matplotlib.pyplot as plt from matplotlib import colors from matplotlib import gridspec import os import re import json import nibabel as nib from utils import subject_class as sc from utils import outl...
bsd-3-clause
bjornsturmberg/NumBAT
lit_examples/simo-lit_02-Laude-AIPAdv_2013-silicon.py
1
3208
""" Replicating the results of Generation of phonons from electrostriction in small-core optical waveguides Laude et al. http://dx.doi.org/10.1063/1.4801936 Replicating silicon example. Note requirement for lots of modes and therefore lots of memory. """ import time import datetime import nu...
gpl-3.0
CforED/Machine-Learning
sklearn/linear_model/tests/test_omp.py
272
7752
# Author: Vlad Niculae # Licence: BSD 3 clause import numpy as np from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equa...
bsd-3-clause
Morgan-Stanley/treadmill
lib/python/treadmill/cli/scheduler/__init__.py
2
2655
"""Top level command for Treadmill reports. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import json import click import pandas as pd import tabulate from six.moves import urllib_parse from treadmill import ...
apache-2.0
theislab/scanpy
scanpy/external/tl/_palantir.py
1
9726
"""\ Run Diffusion maps using the adaptive anisotropic kernel """ from typing import Optional, List import pandas as pd from anndata import AnnData from ... import logging as logg def palantir( adata: AnnData, n_components: int = 10, knn: int = 30, alpha: float = 0, use_adjacency_matrix: bool = ...
bsd-3-clause
ryandougherty/mwa-capstone
MWA_Tools/build/matplotlib/lib/mpl_examples/mplot3d/mixed_subplots_demo.py
12
1032
""" Demonstrate the mixing of 2d and 3d subplots """ from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np def f(t): s1 = np.cos(2*np.pi*t) e1 = np.exp(-t) return np.multiply(s1,e1) ################ # First subplot ################ t1 = np.arange(0.0, 5.0, 0.1) t2 = n...
gpl-2.0
kernc/scikit-learn
sklearn/metrics/ranking.py
7
27694
"""Metrics to assess performance on classification task given scores Functions named as ``*_score`` return a scalar value to maximize: the higher the better Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize: the lower the better """ # Authors: Alexandre Gramfort <alexandre.gramfort@inria....
bsd-3-clause
joyeshmishra/spark-tk
regression-tests/sparktkregtests/testcases/graph/single_source_shortest_path_test.py
9
9396
# vim: set encoding=utf-8 # Copyright (c) 2016 Intel Corporation  # # 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 require...
apache-2.0
huzq/scikit-learn
examples/model_selection/plot_underfitting_overfitting.py
78
2702
""" ============================ Underfitting vs. Overfitting ============================ This example demonstrates the problems of underfitting and overfitting and how we can use linear regression with polynomial features to approximate nonlinear functions. The plot shows the function that we want to approximate, wh...
bsd-3-clause
jmcarpenter2/swifter
swifter/parallel_accessor.py
1
5445
import numpy as np import warnings from .base import _SwifterBaseObject, ERRORS_TO_HANDLE, suppress_stdout_stderr_logging class _SwifterParallelBaseObject(_SwifterBaseObject): def set_dask_threshold(self, dask_threshold=1): """ Set the threshold (seconds) for maximum allowed estimated duration of ...
mit
NunoEdgarGub1/scikit-learn
examples/cluster/plot_agglomerative_clustering.py
343
2931
""" Agglomerative clustering with and without structure =================================================== This example shows the effect of imposing a connectivity graph to capture local structure in the data. The graph is simply the graph of 20 nearest neighbors. Two consequences of imposing a connectivity can be s...
bsd-3-clause
chapmanb/bcbio-nextgen
tests/integration/rnaseq/test_ericscript.py
2
4719
from copy import deepcopy import functools import os import pytest import pandas as pd from bcbio.rnaseq import ericscript from bcbio.pipeline import config_utils, run_info from bcbio.log import setup_script_logging def create_sample_config(data_dir, work_dir, disambiguate=False): system_config, system_file = c...
mit
manashmndl/scikit-learn
examples/ensemble/plot_ensemble_oob.py
259
3265
""" ============================= OOB Errors for Random Forests ============================= The ``RandomForestClassifier`` is trained using *bootstrap aggregation*, where each new tree is fit from a bootstrap sample of the training observations :math:`z_i = (x_i, y_i)`. The *out-of-bag* (OOB) error is the average er...
bsd-3-clause
louispotok/pandas
pandas/tests/test_multilevel.py
1
107731
# -*- coding: utf-8 -*- # pylint: disable-msg=W0612,E1101,W0141 from warnings import catch_warnings import datetime import itertools import pytest import pytz from numpy.random import randn import numpy as np from pandas.core.index import Index, MultiIndex from pandas import Panel, DataFrame, Series, notna, isna, Tim...
bsd-3-clause
jbloomlab/phydms
setup.py
1
3584
"""Setup script for ``phydms``. Written by Jesse Bloom. """ import sys import os import re import glob try: from setuptools import setup from setuptools import Extension except ImportError: raise ImportError("You must install setuptools") if not (sys.version_info[0] == 3 and sys.version_info[1] >= 5): ...
gpl-3.0
tmills/uda
scripts/eval_bootstrap.py
1
9103
#!/usr/bin/env python import numpy as np import numpy.random import os from os.path import join,exists,dirname from sklearn import svm import sys from sklearn.datasets import load_svmlight_file, dump_svmlight_file from sklearn.metrics import f1_score from uda_common import evaluate_and_print_scores, align_test_X_train...
apache-2.0
tkaitchuck/nupic
external/linux64/lib/python2.6/site-packages/matplotlib/dates.py
54
33991
#!/usr/bin/env python """ Matplotlib provides sophisticated date plotting capabilities, standing on the shoulders of python :mod:`datetime`, the add-on modules :mod:`pytz` and :mod:`dateutils`. :class:`datetime` objects are converted to floating point numbers which represent the number of days since 0001-01-01 UTC. T...
gpl-3.0
themrmax/scikit-learn
examples/cluster/plot_kmeans_stability_low_dim_dense.py
338
4324
""" ============================================================ Empirical evaluation of the impact of k-means initialization ============================================================ Evaluate the ability of k-means initializations strategies to make the algorithm convergence robust as measured by the relative stan...
bsd-3-clause
rosswhitfield/mantid
Framework/PythonInterface/test/python/mantid/plots/axesfunctions3DTest.py
3
5493
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + impo...
gpl-3.0
Adai0808/scikit-learn
examples/manifold/plot_compare_methods.py
259
4031
""" ========================================= Comparison of Manifold Learning methods ========================================= An illustration of dimensionality reduction on the S-curve dataset with various manifold learning methods. For a discussion and comparison of these algorithms, see the :ref:`manifold module...
bsd-3-clause
goerz/mgplottools
mgplottools/mpl.py
1
16768
""" Support routines for matplotlib plotting. The module also contains a standard palette of colors (`colors` module dictionary) and line styles (`ls` module dictionary). For the colors, it is recommended to set up the color cycle by hand in your matplotlibrc file. Alternatively, you can call >>> mgplottools.mpl...
gpl-3.0
glouppe/scikit-learn
sklearn/metrics/cluster/supervised.py
22
30444
"""Utilities to evaluate the clustering performance of models Functions named as *_score return a scalar value to maximize: the higher the better. """ # Authors: Olivier Grisel <olivier.grisel@ensta.org> # Wei LI <kuantkid@gmail.com> # Diego Molla <dmolla-aliod@gmail.com> # License: BSD 3 clause fr...
bsd-3-clause
MartinSavc/scikit-learn
examples/linear_model/plot_sparse_recovery.py
243
7461
""" ============================================================ Sparse recovery: feature selection for sparse linear models ============================================================ Given a small number of observations, we want to recover which features of X are relevant to explain y. For this :ref:`sparse linear ...
bsd-3-clause
nikitasingh981/scikit-learn
sklearn/linear_model/sag.py
30
12959
"""Solvers for Ridge and LogisticRegression using SAG algorithm""" # Authors: Tom Dupre la Tour <tom.dupre-la-tour@m4x.org> # # License: BSD 3 clause import warnings import numpy as np from .base import make_dataset from .sag_fast import sag from ..exceptions import ConvergenceWarning from ..utils import check_arra...
bsd-3-clause
duthchao/kaggle-galaxies
predict_augmented_npy_maxout2048_extradense_pysex.py
7
9720
""" 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
scattering/ipeek
server/plot_dcs.py
1
3478
# -*- coding: utf-8 -*- import h5py import simplejson import os import numpy as np #import matplotlib.pyplot as plt from time import time def Elam(lam): """ convert wavelength in angstroms to energy in meV """ return 81.81/lam**2 def Ek(k): """ convert wave-vector in inver angstroms to energy ...
unlicense
mrgloom/h2o-3
h2o-py/h2o/h2o.py
1
75759
import warnings warnings.simplefilter('always', DeprecationWarning) import os import functools import os.path import re import urllib import urllib2 import json import imp import random import tabulate from connection import H2OConnection from job import H2OJob from expr import ExprNode from frame import H2OFrame, _py_...
apache-2.0
themrmax/scikit-learn
examples/gaussian_process/plot_gpc.py
103
3927
""" ==================================================================== Probabilistic predictions with Gaussian process classification (GPC) ==================================================================== This example illustrates the predicted probability of GPC for an RBF kernel with different choices of the hy...
bsd-3-clause
DANA-Laboratory/CoolProp
dev/scripts/fit_rational_functions.py
3
9253
from __future__ import division, print_function import json import matplotlib matplotlib.use('TKAgg') import matplotlib.pyplot as plt import CoolProp.CoolProp as CP import CoolProp import numpy as np import scipy.optimize import xalglib import os,sys def fit_rational_polynomial(x, y, xfine, n, d): def obj(x,...
mit
hainm/scikit-learn
doc/sphinxext/gen_rst.py
142
40026
""" Example generation for the scikit learn Generate the rst files for the examples by iterating over the python example files. Files that generate images should start with 'plot' """ from __future__ import division, print_function from time import time import ast import os import re import shutil import traceback i...
bsd-3-clause
Small-Bodies-Node/pds4-python-examples
examples/birc_example_display.py
2
10055
""" Example PDS4 Array_2D_Image display for BOPPS/BIRC data ======================================================= This document describes an example Python module that can read an image from a PDS4 data product. The code will read the data based on the label keywords, but does not otherwise validate the label. If ...
bsd-3-clause
phobson/statsmodels
examples/python/robust_models_0.py
33
2992
## Robust Linear Models from __future__ import print_function import numpy as np import statsmodels.api as sm import matplotlib.pyplot as plt from statsmodels.sandbox.regression.predstd import wls_prediction_std # ## Estimation # # Load data: data = sm.datasets.stackloss.load() data.exog = sm.add_constant(data.ex...
bsd-3-clause
mbr0wn/gnuradio
gr-digital/examples/example_fll.py
6
4947
#!/usr/bin/env python # # Copyright 2011-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # # SPDX-License-Identifier: GPL-3.0-or-later # # from gnuradio import gr, digital, filter from gnuradio import blocks from gnuradio import channels from gnuradio import eng_notation from gnuradio.eng_arg i...
gpl-3.0
ronojoy/BDA_py_demos
demos_ch6/demo6_2.py
19
1366
"""Bayesian Data Analysis, 3rd ed Chapter 6, demo 2 Posterior predictive checking Binomial example - Testing sequential dependence example """ from __future__ import division import numpy as np import matplotlib.pyplot as plt # edit default plot settings (colours from colorbrewer2.org) plt.rc('font', size=14) plt.r...
gpl-3.0
uglyboxer/linear_neuron
net-p3/lib/python3.5/site-packages/sklearn/tests/test_calibration.py
213
12219
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # License: BSD 3 clause import numpy as np from scipy import sparse from sklearn.utils.testing import (assert_array_almost_equal, assert_equal, assert_greater, assert_almost_equal, ...
mit
asadziach/tensorflow
tensorflow/contrib/learn/python/learn/dataframe/transforms/in_memory_source.py
82
6157
# 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
licode/scikit-beam
skbeam/testing/decorators.py
7
4462
######################################################################## # Copyright (c) 2014, Brookhaven Science Associates, Brookhaven # # National Laboratory. All rights reserved. # # # # Redistribution and use in ...
bsd-3-clause
VU-Cog-Sci/PRF_experiment
exp_tools/Trial.py
1
3101
#!/usr/bin/env python # encoding: utf-8 """ Session.py Created by Tomas HJ Knapen on 2009-11-26. Copyright (c) 2009 TK. All rights reserved. """ import os, sys, datetime import subprocess, logging import pickle, datetime import time as time_module import scipy as sp import numpy as np # import matplotlib.pylab as p...
mit
ucloud/uai-sdk
examples/mxnet/insightface/train/code/train_softmax_dist.py
1
26097
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import sys import math import random import logging import pickle import numpy as np from image_iter import FaceImageIter from image_iter import FaceImageIterList import mxnet as mx from mxnet import ...
apache-2.0
hainm/statsmodels
tools/backport_pr.py
30
5263
#!/usr/bin/env python """ Backport pull requests to a particular branch. Usage: backport_pr.py branch [PR] e.g.: python tools/backport_pr.py 0.13.1 123 to backport PR #123 onto branch 0.13.1 or python tools/backport_pr.py 1.x to see what PRs are marked for backport that have yet to be applied. Copied fr...
bsd-3-clause
mjudsp/Tsallis
examples/applications/topics_extraction_with_nmf_lda.py
38
3869
""" ======================================================================================= Topic extraction with Non-negative Matrix Factorization and Latent Dirichlet Allocation ======================================================================================= This is an example of applying Non-negative Matrix ...
bsd-3-clause
imaculate/scikit-learn
sklearn/metrics/ranking.py
17
27697
"""Metrics to assess performance on classification task given scores Functions named as ``*_score`` return a scalar value to maximize: the higher the better Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize: the lower the better """ # Authors: Alexandre Gramfort <alexandre.gramfort@inria....
bsd-3-clause
tarasane/h2o-3
h2o-py/h2o/h2o.py
1
69816
import warnings warnings.simplefilter('always', DeprecationWarning) import os import functools import os.path import re import urllib import urllib2 import imp import tabulate from connection import H2OConnection from job import H2OJob from expr import ExprNode from frame import H2OFrame, _py_tmp_key from model import ...
apache-2.0