repo_name
stringlengths
6
103
path
stringlengths
5
191
copies
stringlengths
1
4
size
stringlengths
4
6
content
stringlengths
986
970k
license
stringclasses
15 values
glouppe/scikit-learn
sklearn/utils/tests/test_shortest_path.py
292
2841
from collections import defaultdict import numpy as np from numpy.testing import assert_array_almost_equal from sklearn.utils.graph import (graph_shortest_path, single_source_shortest_path_length) def floyd_warshall_slow(graph, directed=False): N = graph.shape[0] #set nonzer...
bsd-3-clause
bytedance/fedlearner
test/trainer/test_horizontal_nn_trainer.py
1
18484
# Copyright 2020 The FedLearner 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
DwangoMediaVillage/pqkmeans
pqkmeans/encoder/encoder_base.py
2
1627
import numpy import sklearn import typing class EncoderBase(sklearn.base.BaseEstimator): def fit_generator(self, x_train): # type: (typing.Iterable[typing.Iterator[float]]) -> None raise NotImplementedError() def transform_generator(self, x_test): # type: (typing.Iterable[typing.Itera...
mit
LohithBlaze/scikit-learn
sklearn/feature_extraction/tests/test_dict_vectorizer.py
274
3790
# Authors: Lars Buitinck <L.J.Buitinck@uva.nl> # Dan Blanchard <dblanchard@ets.org> # License: BSD 3 clause from random import Random import numpy as np import scipy.sparse as sp from numpy.testing import assert_array_equal from sklearn.utils.testing import (assert_equal, assert_in, ...
bsd-3-clause
jzt5132/scikit-learn
sklearn/feature_extraction/tests/test_dict_vectorizer.py
274
3790
# Authors: Lars Buitinck <L.J.Buitinck@uva.nl> # Dan Blanchard <dblanchard@ets.org> # License: BSD 3 clause from random import Random import numpy as np import scipy.sparse as sp from numpy.testing import assert_array_equal from sklearn.utils.testing import (assert_equal, assert_in, ...
bsd-3-clause
lilleswing/deepchem
contrib/one_shot_models/examples/muv_attn_one_fold.py
8
2521
""" Train low-data attn models on MUV. Test last fold only. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import numpy as np np.random.seed(123) import tensorflow as tf tf.set_random_seed(123) import deepchem as dc from datasets import load_muv_convmo...
mit
ethen8181/machine-learning
projects/kaggle_rossman_store_sales/gbt_module/model.py
1
5582
import numpy as np from sklearn.base import BaseEstimator from sklearn.model_selection import RandomizedSearchCV, PredefinedSplit __all__ = ['GBTPipeline'] class GBTPipeline(BaseEstimator): """ Gradient Boosted Tree Pipeline set up to do train/validation split and hyperparameter search. """ def ...
mit
glouppe/scikit-learn
sklearn/utils/testing.py
13
27118
"""Testing utilities.""" # Copyright (c) 2011, 2012 # Authors: Pietro Berkes, # Andreas Muller # Mathieu Blondel # Olivier Grisel # Arnaud Joly # Denis Engemann # Giorgio Patrini # License: BSD 3 clause import os import inspect import pkgutil import warnings import...
bsd-3-clause
glouppe/scikit-learn
examples/covariance/plot_robust_vs_empirical_covariance.py
71
6451
r""" ======================================= Robust vs Empirical covariance estimate ======================================= The usual covariance maximum likelihood estimate is very sensitive to the presence of outliers in the data set. In such a case, it would be better to use a robust estimator of covariance to guar...
bsd-3-clause
LohithBlaze/scikit-learn
sklearn/ensemble/__init__.py
216
1307
""" The :mod:`sklearn.ensemble` module includes ensemble-based methods for classification and regression. """ from .base import BaseEnsemble from .forest import RandomForestClassifier from .forest import RandomForestRegressor from .forest import RandomTreesEmbedding from .forest import ExtraTreesClassifier from .fores...
bsd-3-clause
glouppe/scikit-learn
examples/model_selection/plot_validation_curve.py
135
1931
""" ========================== Plotting Validation Curves ========================== In this plot you can see the training scores and validation scores of an SVM for different values of the kernel parameter gamma. For very low values of gamma, you can see that both the training score and the validation score are low. ...
bsd-3-clause
luo66/scikit-learn
examples/neighbors/plot_digits_kde_sampling.py
250
2022
""" ========================= Kernel Density Estimation ========================= This example shows how kernel density estimation (KDE), a powerful non-parametric density estimation technique, can be used to learn a generative model for a dataset. With this generative model in place, new samples can be drawn. These...
bsd-3-clause
fx2003/tensorflow-study
TensorFlow实战/models/attention_ocr/python/datasets/fsns_test.py
15
3374
# Copyright 2017 The TensorFlow Authors All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
mit
automl/auto-sklearn
test/test_pipeline/components/feature_preprocessing/test_select_rates_classification.py
1
4623
import numpy as np import scipy.sparse import sklearn.preprocessing from autosklearn.pipeline.components.feature_preprocessing.select_rates_classification import ( # noqa: E501 SelectClassificationRates, ) from autosklearn.pipeline.util import _test_preprocessing, get_dataset import unittest class SelectClassi...
bsd-3-clause
sgenoud/scikit-learn
benchmarks/bench_lasso.py
6
3368
""" Benchmarks of Lasso vs LassoLars First, we fix a training set and increase the number of samples. Then we plot the computation time as function of the number of samples. In the second benchmark, we increase the number of dimensions of the training set. Then we plot the computation time as function of the number o...
bsd-3-clause
MohammedWasim/scikit-learn
sklearn/tests/test_naive_bayes.py
70
17509
import pickle from io import BytesIO import numpy as np import scipy.sparse from sklearn.datasets import load_digits, load_iris from sklearn.cross_validation import cross_val_score, train_test_split from sklearn.externals.six.moves import zip from sklearn.utils.testing import assert_almost_equal from sklearn.utils.te...
bsd-3-clause
sgenoud/scikit-learn
sklearn/feature_selection/tests/test_rfe.py
1
1626
""" Testing Recursive feature elimination """ import numpy as np from numpy.testing import assert_array_almost_equal from nose.tools import assert_true from sklearn.feature_selection.rfe import RFE, RFECV from sklearn.datasets import load_iris from sklearn.metrics import zero_one from sklearn.svm import SVC from skle...
bsd-3-clause
manipopopo/tensorflow
tensorflow/contrib/learn/python/learn/datasets/base_test.py
132
3072
# 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
lukeiwanski/tensorflow
tensorflow/contrib/learn/python/learn/datasets/base_test.py
132
3072
# 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
CCI-Tools/cate-core
cate/ops/correlation.py
1
14291
# The MIT License (MIT) # Copyright (c) 2016, 2017 by the ESA CCI Toolbox development team and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including wi...
mit
oaelhara/numbbo
code-postprocessing/bbob_pproc/compall/ppfigs.py
1
22256
#! /usr/bin/env python # -*- coding: utf-8 -*- """Creates ERTs and convergence figures for multiple algorithms.""" from __future__ import absolute_import import os import matplotlib.pyplot as plt import numpy from pdb import set_trace from .. import toolsdivers, toolsstats, bestalg, pproc, genericsettings, htmldesc, p...
bsd-3-clause
LohithBlaze/scikit-learn
examples/svm/plot_separating_hyperplane_unbalanced.py
326
1850
""" ================================================= SVM: Separating hyperplane for unbalanced classes ================================================= Find the optimal separating hyperplane using an SVC for classes that are unbalanced. We first find the separating plane with a plain SVC and then plot (dashed) the ...
bsd-3-clause
jzt5132/scikit-learn
examples/svm/plot_separating_hyperplane_unbalanced.py
326
1850
""" ================================================= SVM: Separating hyperplane for unbalanced classes ================================================= Find the optimal separating hyperplane using an SVC for classes that are unbalanced. We first find the separating plane with a plain SVC and then plot (dashed) the ...
bsd-3-clause
glouppe/scikit-learn
sklearn/cross_decomposition/cca_.py
145
3192
from .pls_ import _PLS __all__ = ['CCA'] class CCA(_PLS): """CCA Canonical Correlation Analysis. CCA inherits from PLS with mode="B" and deflation_mode="canonical". Read more in the :ref:`User Guide <cross_decomposition>`. Parameters ---------- n_components : int, (default 2). numb...
bsd-3-clause
eadgarchen/tensorflow
tensorflow/contrib/learn/python/learn/estimators/stability_test.py
110
6455
# 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
glouppe/scikit-learn
sklearn/svm/tests/test_sparse.py
21
13181
from nose.tools import assert_raises, assert_true, assert_false import numpy as np from scipy import sparse from numpy.testing import (assert_array_almost_equal, assert_array_equal, assert_equal) from sklearn import datasets, svm, linear_model, base from sklearn.datasets import make_classif...
bsd-3-clause
elkingtonmcb/h2o-2
py/testdir_kevin/test_parse_specific_case5.py
9
4807
import unittest, random, sys, time, os sys.path.extend(['.','..','../..','py']) import h2o, h2o_cmd, h2o_import as h2i import codecs, unicodedata print "create some specific small datasets with exp row/col combinations" print "This is trying a random sample of utf8 symbols inserted in an enum" # 0x1 can be the hive s...
apache-2.0
glouppe/scikit-learn
examples/mixture/plot_gmm.py
35
2875
""" ================================= Gaussian Mixture Model Ellipsoids ================================= Plot the confidence ellipsoids of a mixture of two Gaussians with EM and variational Dirichlet process. Both models have access to five components with which to fit the data. Note that the EM model will necessari...
bsd-3-clause
sgenoud/scikit-learn
sklearn/semi_supervised/label_propagation.py
4
13783
# coding=utf8 """ Label propagation in the context of this module refers to a set of semisupervised classification algorithms. In the high level, these algorithms work by forming a fully-connected graph between all points given and solving for the steady-state distribution of labels at each point. These algorithms per...
bsd-3-clause
mlflow/mlflow
examples/ray_serve/train_model.py
1
1302
import mlflow from sklearn.datasets import load_iris from sklearn.ensemble import GradientBoostingClassifier from sklearn.metrics import mean_squared_error from sklearn.utils import shuffle if __name__ == "__main__": # Enable auto-logging mlflow.set_tracking_uri("sqlite:///mlruns.db") mlflow.sklearn.auto...
apache-2.0
mileistone/test
vedanet/models/yolo_abc.py
1
2243
# # Darknet YOLOv2 model # Copyright EAVISE # import os from collections import OrderedDict, Iterable import torch import torch.nn as nn from .. import data as vnd from ._darknet import Darknet __all__ = ['YoloABC'] class YoloABC(Darknet): def __init__(self): """ Network initialisation """ s...
mit
glouppe/scikit-learn
examples/neighbors/plot_classification.py
285
1790
""" ================================ Nearest Neighbors Classification ================================ Sample usage of Nearest Neighbors classification. It will plot the decision boundaries for each class. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColorm...
bsd-3-clause
glouppe/scikit-learn
examples/cluster/plot_lena_segmentation.py
269
2444
""" ========================================= Segmenting the picture of Lena in regions ========================================= This example uses :ref:`spectral_clustering` on a graph created from voxel-to-voxel difference on an image to break this image into multiple partly-homogeneous regions. This procedure (spe...
bsd-3-clause
mlperf/training_results_v0.5
v0.5.0/nvidia/submission/code/translation/pytorch/eval_lm.py
7
4361
#!/usr/bin/env python3 -u # Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory. import n...
apache-2.0
mlflow/mlflow
mlflow/mleap.py
1
12700
""" The ``mlflow.mleap`` module provides an API for saving Spark MLLib models using the `MLeap <https://github.com/combust/mleap>`_ persistence mechanism. NOTE: You cannot load the MLeap model flavor in Python; you must download it using the Java API method ``downloadArtifacts(String runId)`` and load the mod...
apache-2.0
LohithBlaze/scikit-learn
sklearn/ensemble/voting_classifier.py
177
8006
""" Soft Voting/Majority Rule classifier. This module contains a Soft Voting/Majority Rule classifier for classification estimators. """ # Authors: Sebastian Raschka <se.raschka@gmail.com>, # Gilles Louppe <g.louppe@gmail.com> # # Licence: BSD 3 clause import numpy as np from ..base import BaseEstimator f...
bsd-3-clause
jnewland/home-assistant
homeassistant/components/android_ip_webcam/__init__.py
5
9513
"""Support for Android IP Webcam.""" import asyncio import logging from datetime import timedelta import voluptuous as vol from homeassistant.core import callback from homeassistant.const import ( CONF_NAME, CONF_HOST, CONF_PORT, CONF_USERNAME, CONF_PASSWORD, CONF_SENSORS, CONF_SWITCHES, CONF_TIMEOUT, CONF_SC...
apache-2.0
eadgarchen/tensorflow
tensorflow/contrib/keras/api/keras/__init__.py
128
1935
# 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
mlperf/training_results_v0.5
v0.5.0/google/cloud_v2.8/resnet-tpuv2-8/code/resnet/model/models/official/recommendation/neumf_model.py
4
19328
# Copyright 2018 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
luo66/scikit-learn
sklearn/utils/tests/test_seq_dataset.py
93
2471
# Author: Tom Dupre la Tour <tom.dupre-la-tour@m4x.org> # # License: BSD 3 clause import numpy as np import scipy.sparse as sp from sklearn.utils.seq_dataset import ArrayDataset, CSRDataset from sklearn.datasets import load_iris from numpy.testing import assert_array_equal from nose.tools import assert_equal iris =...
bsd-3-clause
lukeiwanski/tensorflow
tensorflow/python/data/kernel_tests/sequence_dataset_op_test.py
18
7947
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
mlperf/training_results_v0.5
v0.5.0/google/cloud_v2.8/gnmt-tpuv2-8/code/gnmt/model/t2t/tensor2tensor/data_generators/algorithmic_math.py
3
21962
# coding=utf-8 # Copyright 2018 The Tensor2Tensor 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...
apache-2.0
manipopopo/tensorflow
tensorflow/python/data/kernel_tests/iterator_ops_test.py
3
35917
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
luo66/scikit-learn
sklearn/datasets/tests/test_base.py
204
5878
import os import shutil import tempfile import warnings import nose import numpy from pickle import loads from pickle import dumps from sklearn.datasets import get_data_home from sklearn.datasets import clear_data_home from sklearn.datasets import load_files from sklearn.datasets import load_sample_images from sklearn...
bsd-3-clause
automl/auto-sklearn
autosklearn/pipeline/classification.py
1
14739
from typing import Optional, Union import copy from itertools import product import numpy as np from ConfigSpace.configuration_space import Configuration, ConfigurationSpace from ConfigSpace.forbidden import ForbiddenAndConjunction, ForbiddenEqualsClause from sklearn.base import ClassifierMixin from autosklearn.askl...
bsd-3-clause
tomsilver/nupic
tests/swarming/nupic/swarming/experiments/delta/description.py
1
14792
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This progra...
gpl-3.0
fx2003/tensorflow-study
TensorFlow实战/models/slim/datasets/download_and_convert_flowers.py
7
7201
# 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...
mit
elkingtonmcb/h2o-2
py/testdir_release/c5/test_c5_KMeans_sphere15_180GB_fvec.py
9
6725
import unittest, time, sys, random, math, json sys.path.extend(['.','..','../..','py']) import h2o, h2o_cmd, h2o_kmeans, h2o_import as h2i, h2o_common import socket print "Assumes you ran ../build_for_clone.py in this directory" print "Using h2o-nodes.json. Also the sandbox dir" DO_KMEANS = True # assumes the cloud w...
apache-2.0
lilleswing/deepchem
examples/factors/FACTORS_datasets.py
8
4118
""" FACTORS dataset loader. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import os import shutil import time import numpy as np import deepchem as dc from factors_features import factors_descriptors def remove_missing_entries(dataset): """Remove ...
mit
rcln/tag.suggestion
code_python27/tfidfANDclasification/classByTags.py
1
6011
# -*- coding: utf-8 -*- """ Created on Sat Sep 19 15:21:27 2015 @author: ivan """ from __future__ import division import numpy as np from lxml import etree import os import argparse from sklearn import svm from sklearn.naive_bayes import MultinomialNB from sklearn import metrics from sklearn.neighbors import KNeighbor...
gpl-2.0
dahlstrom-g/intellij-community
python/helpers/third_party/thriftpy/_shaded_ply/ctokens.py
206
3177
# ---------------------------------------------------------------------- # ctokens.py # # Token specifications for symbols in ANSI C and C++. This file is # meant to be used as a library in other tokenizers. # ---------------------------------------------------------------------- # Reserved words tokens = [ # Li...
apache-2.0
lukeiwanski/tensorflow
tensorflow/contrib/learn/python/learn/preprocessing/categorical.py
40
4795
# 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
farizrahman4u/keras-contrib
tests/tooling/test_codeowners.py
2
4034
import os import pytest from github import Github try: import pathlib except ImportError: import pathlib2 as pathlib path_to_keras_contrib = pathlib.Path(__file__).resolve().parents[2] path_to_codeowners = path_to_keras_contrib / 'CODEOWNERS' authenticated = True try: github_client = Github(o...
mit
ishanic/scikit-learn
sklearn/decomposition/base.py
310
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
ChanChiChoi/scikit-learn
sklearn/decomposition/base.py
310
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
dsquareindia/scikit-learn
benchmarks/bench_glm.py
95
1515
""" A comparison of different methods in GLM Data comes from a random square matrix. """ from datetime import datetime import numpy as np from sklearn import linear_model from sklearn.utils.bench import total_seconds if __name__ == '__main__': import matplotlib.pyplot as plt n_iter = 40 time_ridge = ...
bsd-3-clause
dsquareindia/scikit-learn
sklearn/neural_network/rbm.py
46
12291
"""Restricted Boltzmann Machine """ # Authors: Yann N. Dauphin <dauphiya@iro.umontreal.ca> # Vlad Niculae # Gabriel Synnaeve # Lars Buitinck # License: BSD 3 clause import time import numpy as np import scipy.sparse as sp from ..base import BaseEstimator from ..base import TransformerMixi...
bsd-3-clause
krdyke/OGP-metadata-py
src/arcgis2ogp.py
1
9925
from time import clock from datetime import datetime import os, math, sys import pytz import urllib import StringIO import glob import json from logger import Logger from keyword_parse import keywordParse from datatype_parse import * import xml.etree.ElementTree as ET from xml.etree.ElementTree import ElementTree, Elem...
mit
ishanic/scikit-learn
examples/gaussian_process/plot_gp_regression.py
252
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
kylerbrown/scikit-learn
examples/gaussian_process/plot_gp_regression.py
252
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
fredhusser/scikit-learn
sklearn/cluster/tests/test_affinity_propagation.py
338
2620
""" Testing for Clustering methods """ import numpy as np from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.cluster.affinity_propagation_ import AffinityPropagation from sklearn.cluster.affinity_propagatio...
bsd-3-clause
kylerbrown/scikit-learn
sklearn/cluster/tests/test_affinity_propagation.py
338
2620
""" Testing for Clustering methods """ import numpy as np from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.cluster.affinity_propagation_ import AffinityPropagation from sklearn.cluster.affinity_propagatio...
bsd-3-clause
BayesWatch/tf-variational-dropout
models/resnet.py
1
4928
''' Functional definition for resnet inspired by https://github.com/szagoruyko/functional-zoo Unlike the original code, we're going to access the variables in the model in the orthodox tensorflow way with variable_scopes. It wouldn't be hard to write an iterator that accesses variables defined in the same scope and mo...
gpl-3.0
kylerbrown/scikit-learn
sklearn/utils/tests/test_fixes.py
278
1829
# Authors: Gael Varoquaux <gael.varoquaux@normalesup.org> # Justin Vincent # Lars Buitinck # License: BSD 3 clause import numpy as np from nose.tools import assert_equal from nose.tools import assert_false from nose.tools import assert_true from numpy.testing import (assert_almost_equal, ...
bsd-3-clause
fredhusser/scikit-learn
examples/svm/plot_separating_hyperplane.py
291
1273
""" ========================================= SVM: Maximum margin separating hyperplane ========================================= Plot the maximum margin separating hyperplane within a two-class separable dataset using a Support Vector Machine classifier with linear kernel. """ print(__doc__) import numpy as np impor...
bsd-3-clause
ishanic/scikit-learn
examples/applications/svm_gui.py
285
11161
""" ========== 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
andrewnc/scikit-learn
sklearn/__check_build/__init__.py
342
1671
""" Module to give helpful messages to the user that did not compile the scikit properly. """ import os INPLACE_MSG = """ It appears that you are importing a local scikit-learn source tree. For this, you need to have an inplace install. Maybe you are in the source directory and you need to try from another location.""...
bsd-3-clause
ishanic/scikit-learn
sklearn/__check_build/__init__.py
342
1671
""" Module to give helpful messages to the user that did not compile the scikit properly. """ import os INPLACE_MSG = """ It appears that you are importing a local scikit-learn source tree. For this, you need to have an inplace install. Maybe you are in the source directory and you need to try from another location.""...
bsd-3-clause
kylerbrown/scikit-learn
sklearn/__check_build/__init__.py
342
1671
""" Module to give helpful messages to the user that did not compile the scikit properly. """ import os INPLACE_MSG = """ It appears that you are importing a local scikit-learn source tree. For this, you need to have an inplace install. Maybe you are in the source directory and you need to try from another location.""...
bsd-3-clause
kylerbrown/scikit-learn
sklearn/metrics/cluster/unsupervised.py
228
8281
""" Unsupervised evaluation metrics. """ # Authors: Robert Layton <robertlayton@gmail.com> # # License: BSD 3 clause import numpy as np from ...utils import check_random_state from ..pairwise import pairwise_distances def silhouette_score(X, labels, metric='euclidean', sample_size=None, random...
bsd-3-clause
ChanChiChoi/scikit-learn
sklearn/__check_build/__init__.py
342
1671
""" Module to give helpful messages to the user that did not compile the scikit properly. """ import os INPLACE_MSG = """ It appears that you are importing a local scikit-learn source tree. For this, you need to have an inplace install. Maybe you are in the source directory and you need to try from another location.""...
bsd-3-clause
fredhusser/scikit-learn
examples/ensemble/plot_voting_decision_regions.py
228
2386
""" ================================================== Plot the decision boundaries of a VotingClassifier ================================================== Plot the decision boundaries of a `VotingClassifier` for two features of the Iris dataset. Plot the class probabilities of the first sample in a toy dataset pred...
bsd-3-clause
kylerbrown/scikit-learn
examples/ensemble/plot_voting_decision_regions.py
228
2386
""" ================================================== Plot the decision boundaries of a VotingClassifier ================================================== Plot the decision boundaries of a `VotingClassifier` for two features of the Iris dataset. Plot the class probabilities of the first sample in a toy dataset pred...
bsd-3-clause
fredhusser/scikit-learn
doc/tutorial/text_analytics/skeletons/exercise_02_sentiment.py
255
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
dsquareindia/scikit-learn
benchmarks/bench_plot_neighbors.py
96
6469
""" Plot the scaling of the nearest neighbors algorithms with k, D, and N """ from time import time import numpy as np import matplotlib.pyplot as plt from matplotlib import ticker from sklearn import neighbors, datasets def get_data(N, D, dataset='dense'): if dataset == 'dense': np.random.seed(0) ...
bsd-3-clause
lukovnikov/qelos
qelos/scripts/webqa/preprocessing/checkentities.py
1
2030
from __future__ import print_function import csv, re import qelos as q ##################################################################### ## CHECK WHAT ENTITY LINKING FILE COVERS FROM IDEAL ENTITY LINKING ## ##################################################################### def run(graphp="../../../../dataset...
mit
dsquareindia/scikit-learn
examples/cluster/plot_segmentation_toy.py
89
3522
""" =========================================== Spectral clustering for image segmentation =========================================== In this example, an image with connected circles is generated and spectral clustering is used to separate the circles. In these settings, the :ref:`spectral_clustering` approach solve...
bsd-3-clause
dsquareindia/scikit-learn
examples/manifold/plot_manifold_sphere.py
80
5055
#!/usr/bin/python # -*- coding: utf-8 -*- """ ============================================= Manifold Learning methods on a severed sphere ============================================= An application of the different :ref:`manifold` techniques on a spherical data-set. Here one can see the use of dimensionality reducti...
bsd-3-clause
distributed-system-analysis/pbench
lib/pbench/test/unit/server/query_apis/test_query_builder.py
2
6545
from typing import Optional import pytest from pbench.server import JSON from pbench.server.api.resources import API_METHOD, API_OPERATION, ApiSchema from pbench.server.api.resources.query_apis import ElasticBase from pbench.server.auth.auth import Auth from pbench.server.database.models.users import User ADMIN_ID =...
gpl-3.0
ChanChiChoi/scikit-learn
sklearn/manifold/t_sne.py
105
20057
# Author: Alexander Fabisch -- <afabisch@informatik.uni-bremen.de> # License: BSD 3 clause (C) 2014 # This is the standard t-SNE implementation. There are faster modifications of # the algorithm: # * Barnes-Hut-SNE: reduces the complexity of the gradient computation from # N^2 to N log N (http://arxiv.org/abs/1301....
bsd-3-clause
ChanChiChoi/scikit-learn
sklearn/utils/metaestimators.py
281
2353
"""Utilities for meta-estimators""" # Author: Joel Nothman # Andreas Mueller # Licence: BSD from operator import attrgetter from functools import update_wrapper __all__ = ['if_delegate_has_method'] class _IffHasAttrDescriptor(object): """Implements a conditional property using the descriptor protocol. ...
bsd-3-clause
fredhusser/scikit-learn
examples/ensemble/plot_gradient_boosting_quantile.py
385
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
MegaShow/college-programming
Homework/Principles of Artificial Neural Networks/Week 15 Image Caption/src/agent.py
1
6788
"""Agent""" import torch from torch.nn.utils.rnn import pack_padded_sequence from net import Decoder, Encoder from action import Action, AverageMeter from dataset import Dataset class Agent: def __init__(self): super(Agent, self).__init__() #self.config = config self.action = Action() ...
mit
codeforsanjose/MobilityMapApi
src/sa_api_v2/south_migrations/0030_auto__add_field_submittedthing_submitter.py
2
9106
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'SubmittedThing.submitter' db.add_column('sa_api_submittedthing', 'submitter', ...
gpl-3.0
andrewnc/scikit-learn
examples/ensemble/plot_ensemble_oob.py
257
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
fredhusser/scikit-learn
examples/ensemble/plot_ensemble_oob.py
257
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
google/uncertainty-baselines
baselines/diabetic_retinopathy_detection/jax_finetune_deterministic.py
1
22801
# coding=utf-8 # Copyright 2022 The Uncertainty Baselines 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 ap...
apache-2.0
UpSea/midProjects
01_aat-ebook-full-source-code-20160430/chapter13/reuters-svm.py
1
6726
from __future__ import print_function import pprint import re try: from html.parser import HTMLParser except ImportError: from HTMLParser import HTMLParser from sklearn.cross_validation import train_test_split from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics import confusion_ma...
mit
IndraVikas/scikit-learn
examples/applications/svm_gui.py
285
11161
""" ========== 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
frank-tancf/scikit-learn
sklearn/cluster/tests/test_k_means.py
40
27789
"""Testing for K-means""" import sys import numpy as np from scipy import sparse as sp from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import SkipTest from sklearn.utils.testing i...
bsd-3-clause
raghavrv/scikit-learn
sklearn/__check_build/__init__.py
342
1671
""" Module to give helpful messages to the user that did not compile the scikit properly. """ import os INPLACE_MSG = """ It appears that you are importing a local scikit-learn source tree. For this, you need to have an inplace install. Maybe you are in the source directory and you need to try from another location.""...
bsd-3-clause
IndraVikas/scikit-learn
sklearn/decomposition/tests/test_kernel_pca.py
154
8058
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import (assert_array_almost_equal, assert_less, assert_equal, assert_not_equal, assert_raises) from sklearn.decomposition import PCA, KernelPCA from sklearn.datasets import mak...
bsd-3-clause
IndraVikas/scikit-learn
sklearn/metrics/cluster/unsupervised.py
228
8281
""" Unsupervised evaluation metrics. """ # Authors: Robert Layton <robertlayton@gmail.com> # # License: BSD 3 clause import numpy as np from ...utils import check_random_state from ..pairwise import pairwise_distances def silhouette_score(X, labels, metric='euclidean', sample_size=None, random...
bsd-3-clause
frank-tancf/scikit-learn
sklearn/preprocessing/tests/test_imputation.py
46
12381
import numpy as np 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 import assert_false from sklearn.utils.testing import assert_true from sklearn.preprocessing.imput...
bsd-3-clause
IndraVikas/scikit-learn
examples/ensemble/plot_voting_decision_regions.py
228
2386
""" ================================================== Plot the decision boundaries of a VotingClassifier ================================================== Plot the decision boundaries of a `VotingClassifier` for two features of the Iris dataset. Plot the class probabilities of the first sample in a toy dataset pred...
bsd-3-clause
christianurich/VIBe2UrbanSim
3rdparty/opus/src/psrc_parcel/models/water_demand_model.py
2
5875
# Opus/UrbanSim urban simulation software. # Copyright (C) 2005-2009 University of Washington # See opus_core/LICENSE import re from numpy import array, exp, arange, zeros from opus_core.resources import Resources from opus_core.regression_model import RegressionModel from opus_core.variables.variable_name imp...
gpl-2.0
pkruskal/scikit-learn
sklearn/metrics/tests/test_pairwise.py
104
22788
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
nightjean/Deep-Learning
tensorflow/contrib/keras/python/keras/datasets/__init__.py
57
1290
# 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
ammarkhann/FinalSeniorCode
lib/python2.7/site-packages/numpy/lib/function_base.py
19
164441
from __future__ import division, absolute_import, print_function import collections import operator import re import sys import warnings import numpy as np import numpy.core.numeric as _nx from numpy.core import linspace, atleast_1d, atleast_2d, transpose from numpy.core.numeric import ( ones, zeros, arange, conc...
mit
ageron/tensorflow
tensorflow/contrib/learn/python/learn/estimators/logistic_regressor_test.py
44
4901
# 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