repo_name
stringlengths
6
103
path
stringlengths
4
209
copies
stringclasses
325 values
size
stringlengths
4
7
content
stringlengths
838
1.04M
license
stringclasses
15 values
kastnerkyle/pylearn2
pylearn2/scripts/datasets/make_mnistplus.py
5
8862
""" Script to generate the MNIST+ dataset. The purpose of this dataset is to make a more challenging MNIST-like dataset, with multiple factors of variation. These factors can serve to evaluate a model's performance at learning invariant features, or its ability to disentangle factors of variation in a multi-task classi...
bsd-3-clause
nicproulx/mne-python
tutorials/plot_brainstorm_auditory.py
3
16597
# -*- coding: utf-8 -*- """ ==================================== Brainstorm auditory tutorial dataset ==================================== Here we compute the evoked from raw for the auditory Brainstorm tutorial dataset. For comparison, see [1]_ and: http://neuroimage.usc.edu/brainstorm/Tutorials/Auditory Experi...
bsd-3-clause
alvarouc/polyssifier
polyssifier/poly_utils.py
1
10338
from sklearn.neighbors import KNeighborsClassifier from sklearn.svm import LinearSVC, SVC from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import RandomForestClassifier from sklearn.linear_model import (LogisticRegression, LinearRegression, ...
gpl-2.0
UMWRG/HydraPlatform
HydraServer/python/HydraServer/plugins/timeseries_functions.py
2
5406
# (c) Copyright 2013, 2014, University of Manchester # # HydraPlatform 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. # # HydraPlatfor...
gpl-3.0
kastnerkyle/pylearn2
pylearn2/scripts/datasets/step_through_small_norb.py
49
3123
#! /usr/bin/env python """ A script for sequentially stepping through SmallNORB, viewing each image and its label. Intended as a demonstration of how to iterate through NORB images, and as a way of testing SmallNORB's StereoViewConverter. If you just want an image viewer, consider pylearn2/scripts/show_binocular_gra...
bsd-3-clause
OpenMined/PySyft
benchmarks/macro_executor.py
1
3935
# stdlib from datetime import date import json import os from pathlib import Path import subprocess from time import time from typing import Dict from typing import List from typing import Optional from typing import Tuple # third party import pyarrow.parquet as pq # syft absolute import syft as sy from syft.core.adp...
apache-2.0
shangwuhencc/scikit-learn
sklearn/gaussian_process/tests/test_gaussian_process.py
265
6813
""" Testing for Gaussian Process module (sklearn.gaussian_process) """ # Author: Vincent Dubourg <vincent.dubourg@gmail.com> # Licence: BSD 3 clause from nose.tools import raises from nose.tools import assert_true import numpy as np from sklearn.gaussian_process import GaussianProcess from sklearn.gaussian_process ...
bsd-3-clause
lakshayg/tensorflow
tensorflow/contrib/slim/python/slim/data/dataset_data_provider.py
53
4253
# 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
wavycloud/pyboto3
pyboto3/glue.py
1
692979
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud 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 without limitation the rights to use, copy, modify, merge, p...
mit
shangwuhencc/scikit-learn
examples/linear_model/plot_ransac.py
249
1673
""" =========================================== Robust linear model estimation using RANSAC =========================================== In this example we see how to robustly fit a linear model to faulty data using the RANSAC algorithm. """ import numpy as np from matplotlib import pyplot as plt from sklearn import ...
bsd-3-clause
CredoReference/edx-platform
lms/djangoapps/course_api/blocks/tests/test_serializers.py
4
8709
""" Tests for Course Blocks serializers """ from mock import MagicMock from lms.djangoapps.course_blocks.api import get_course_block_access_transformers, get_course_blocks from openedx.core.djangoapps.content.block_structure.transformers import BlockStructureTransformers from student.roles import CourseStaffRole from ...
agpl-3.0
nicproulx/mne-python
tutorials/plot_artifacts_detection.py
5
5377
""" .. _tut_artifacts_detect: Introduction to artifacts and artifact detection ================================================ Since MNE supports the data of many different acquisition systems, the particular artifacts in your data might behave very differently from the artifacts you can observe in our tutorials and...
bsd-3-clause
shangwuhencc/scikit-learn
examples/exercises/plot_iris_exercise.py
320
1602
""" ================================ SVM Exercise ================================ A tutorial exercise for using different SVM kernels. This exercise is used in the :ref:`using_kernels_tut` part of the :ref:`supervised_learning_tut` section of the :ref:`stat_learn_tut_index`. """ print(__doc__) import numpy as np i...
bsd-3-clause
NUKnightLab/panda
panda/migrations/0025_add_subscription_permissions.py
6
14192
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import DataMigration from django.db import models class Migration(DataMigration): def forwards(self, orm): """ This migration will fail if run against a clean database (fresh setup) This is fine because the permi...
mit
nicproulx/mne-python
tutorials/plot_stats_cluster_methods.py
5
8797
# doc:slow-example """ .. _tut_stats_cluster_methods: ====================================================== Permutation t-test on toy data with spatial clustering ====================================================== Following the illustrative example of Ridgway et al. 2012 [1]_, this demonstrates some basic ideas ...
bsd-3-clause
kastnerkyle/pylearn2
pylearn2/tests/test_theano.py
45
4805
""" Include tests related to Theano. 1) One test on one thing Pylearn2 depend to be done by Theano. 2) One test for a rare corner case crash in Theano that we where not able to reproduce rapidly enough without having this tests depend on Pylearn2. """ __authors__ = "Ian Goodfellow" __copyright__ = "Copyright 2010-20...
bsd-3-clause
gacarrillor/QGIS
tests/src/python/featuresourcetestbase.py
8
57101
# -*- coding: utf-8 -*- """QGIS Unit test utils for QgsFeatureSource subclasses. .. note:: This program 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 (at your option) any lat...
gpl-2.0
shangwuhencc/scikit-learn
examples/cluster/plot_cluster_iris.py
347
2593
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= K-means Clustering ========================================================= The plots display firstly what a K-means algorithm would yield using three clusters. It is then shown what the effect of a bad initializa...
bsd-3-clause
lakshayg/tensorflow
tensorflow/contrib/boosted_trees/examples/mnist.py
61
5840
# 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
aalmah/pylearn2
pylearn2/utils/utlc.py
49
7347
"""Several utilities for experimenting upon utlc datasets""" # Standard library imports import logging import os import inspect import zipfile from tempfile import TemporaryFile # Third-party imports import numpy import theano from pylearn2.datasets.utlc import load_ndarray_dataset, load_sparse_dataset from pylearn2.u...
bsd-3-clause
ephes/scikit-learn
examples/linear_model/plot_ols_3d.py
347
2040
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Sparsity Example: Fitting only features 1 and 2 ========================================================= Features 1 and 2 of the diabetes-dataset are fitted and plotted below. It illustrates that although feature...
bsd-3-clause
roxyboy/scikit-learn
sklearn/utils/multiclass.py
83
12343
# Author: Arnaud Joly, Joel Nothman, Hamzeh Alsalhi # # License: BSD 3 clause """ Multi-class / multi-label utility function ========================================== """ from __future__ import division from collections import Sequence from itertools import chain from scipy.sparse import issparse from scipy.sparse....
bsd-3-clause
roxyboy/scikit-learn
sklearn/metrics/pairwise.py
103
42995
# -*- coding: utf-8 -*- # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Mathieu Blondel <mathieu@mblondel.org> # Robert Layton <robertlayton@gmail.com> # Andreas Mueller <amueller@ais.uni-bonn.de> # Philippe Gervais <philippe.gervais@inria.fr> # Lars Buitinck ...
bsd-3-clause
rv816/lightfm
examples/movielens/data.py
11
3560
import itertools import os import zipfile import numpy as np import requests import scipy.sparse as sp def _get_movielens_path(): """ Get path to the movielens dataset file. """ return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'movielens.zip') def _download...
apache-2.0
dotsdl/msmbuilder
msmbuilder/tests/test_metzner_mcmc.py
2
3416
import numpy as np from msmbuilder.cluster import NDGrid from msmbuilder.example_datasets import load_doublewell from msmbuilder.msm import BayesianMarkovStateModel from msmbuilder.msm import MarkovStateModel from msmbuilder.msm._metzner_mcmc_fast import metzner_mcmc_fast from msmbuilder.msm._metzner_mcmc_slow import m...
lgpl-2.1
unreal666/namebench
nb_third_party/dns/rdata.py
215
14860
# Copyright (C) 2001-2007, 2009, 2010 Nominum, Inc. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose with or without fee is hereby granted, # provided that the above copyright notice and this permission notice # appear in all copies. # # THE SOFTWARE IS PROVIDED ...
apache-2.0
ephes/scikit-learn
examples/applications/plot_prediction_latency.py
233
11277
""" ================== Prediction Latency ================== This is an example showing the prediction latency of various scikit-learn estimators. The goal is to measure the latency one can expect when doing predictions either in bulk or atomic (i.e. one by one) mode. The plots represent the distribution of the pred...
bsd-3-clause
yinwenpeng/rescale
en/parser/nltk_lite/probability.py
10
59364
# Natural Language Toolkit: Probability and Statistics # # Copyright (C) 2001-2006 University of Pennsylvania # Author: Edward Loper <edloper@gradient.cis.upenn.edu> # Steven Bird <sb@csse.unimelb.edu.au> (additions) # Trevor Cohn <tacohn@cs.mu.oz.au> (additions) # URL: <http://nltk.sf.net> # For licens...
gpl-3.0
roxyboy/scikit-learn
examples/neighbors/plot_nearest_centroid.py
263
1804
""" =============================== Nearest Centroid Classification =============================== Sample usage of Nearest Centroid 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 ListedColormap f...
bsd-3-clause
boscotsang/BayesDigitClassify
classify_ternary.py
1
2776
import numpy from sklearn.metrics import confusion_matrix def load_data(): train_labels = [] with open('digitdata/traininglabels', 'rb') as f: for i, line in enumerate(f): train_labels.append(int(line)) train_labels = numpy.array(train_labels, dtype=int) train_x = numpy.zeros((trai...
mit
ephes/scikit-learn
sklearn/utils/tests/test_class_weight.py
139
11909
import numpy as np from sklearn.linear_model import LogisticRegression from sklearn.datasets import make_blobs from sklearn.utils.class_weight import compute_class_weight from sklearn.utils.class_weight import compute_sample_weight from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testin...
bsd-3-clause
fberanizo/neural_network
tests/ibovespa/mlp.py
1
5708
# -*- coding: utf-8 -*- import sys, os sys.path.insert(0, os.path.abspath('../..')) import unittest, pandas, numpy, datetime, itertools, mlp from sklearn import cross_validation, preprocessing class MLP(unittest.TestCase): """Test cases for Ibovespa tendency problem.""" grid_search = True def test_1(sel...
bsd-2-clause
moverlan/LOTlib
LOTlib/Examples/SymbolicRegression/Galileo/Run.py
1
1312
# -*- coding: utf-8 -*- """ This uses Galileo's data on a falling ball. See: http://www.amstat.org/publications/jse/v3n1/datasets.dickey.html See also: Jeffreys, W. H., and Berger, J. O. (1992), "Ockham's Razor and Bayesian Analysis," American Scientist, 80, 64-72 (Erratum, p. 116). """ from LOTlib.Hypotheses.Gau...
gpl-3.0
cpausmit/IntelROCCS
Detox/python/siteProperties.py
3
12964
#==================================================================================================== # C L A S S E S concerning the site description #==================================================================================================== #----------------------------------------------------------------...
mit
google-research/selfstudy-adversarial-robustness
defense_randomneuron/model.py
1
2860
# Copyright 2021 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 or agreed to in writing, ...
apache-2.0
roxyboy/scikit-learn
sklearn/neighbors/tests/test_nearest_centroid.py
302
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
JustinNoel1/ML-Course
linear-regression/python/linreg.py
1
1895
from sklearn.linear_model import LinearRegression import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from sklearn.metrics import mean_squared_error # Fix the number of samples and our seed NUM_SAMPLES = 200 np.random.seed(42) # Our "true function" def f(x): return 1.5*x + 0.5 #Const...
apache-2.0
SKA-INAF/caesar
scripts/skymodel_generator.py
1
65709
#!/usr/bin/env python ################################################## ### MODULE IMPORT ################################################## ## STANDARD MODULES import os import sys import subprocess import string import time import signal from threading import Thread import datetime import numpy as np impor...
gpl-3.0
aalmah/pylearn2
pylearn2/train_extensions/plots.py
34
9617
""" Plot monitoring extensions while training. """ __authors__ = "Laurent Dinh" __copyright__ = "Copyright 2014, Universite de Montreal" __credits__ = ["Laurent Dinh"] __license__ = "3-clause BSD" __maintainer__ = "Laurent Dinh" __email__ = "dinhlaur@iro" import logging import os import os.path import stat import num...
bsd-3-clause
a-parhom/edx-platform
lms/djangoapps/course_api/blocks/tests/test_api.py
2
11195
""" Tests for Blocks api.py """ from itertools import product from mock import patch import ddt from django.test.client import RequestFactory from django.test.utils import override_settings import course_blocks.api as course_blocks_api from openedx.core.djangoapps.content.block_structure.api import clear_course_fro...
agpl-3.0
roxyboy/scikit-learn
examples/cluster/plot_segmentation_toy.py
257
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
aalmah/pylearn2
pylearn2/utils/datasets.py
44
9068
""" Several utilities to evaluate an ALC on the dataset, to iterate over minibatches from a dataset, or to merge three data with given proportions """ # Standard library imports import logging import os import functools from itertools import repeat import warnings # Third-party imports import numpy import scipy from t...
bsd-3-clause
gibiansky/tensorflow
tensorflow/examples/learn/iris_with_pipeline.py
13
1854
# 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 appl...
apache-2.0
roxyboy/scikit-learn
sklearn/decomposition/tests/test_incremental_pca.py
294
8265
"""Tests for Incremental PCA.""" import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_raises from sklearn import datasets from sklearn.decomposition import PCA, IncrementalPCA iris = datasets.load...
bsd-3-clause
ephes/scikit-learn
sklearn/decomposition/tests/test_incremental_pca.py
294
8265
"""Tests for Incremental PCA.""" import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_raises from sklearn import datasets from sklearn.decomposition import PCA, IncrementalPCA iris = datasets.load...
bsd-3-clause
ephes/scikit-learn
sklearn/externals/joblib/__init__.py
85
4795
""" Joblib is a set of tools to provide **lightweight pipelining in Python**. In particular, joblib offers: 1. transparent disk-caching of the output values and lazy re-evaluation (memoize pattern) 2. easy simple parallel computing 3. logging and tracing of the execution Joblib is optimized to be **fast*...
bsd-3-clause
edx/edx-platform
openedx/features/course_experience/tests/views/test_course_outline.py
2
34442
""" Tests for the Course Outline view and supporting views. """ import datetime import re from unittest.mock import Mock, patch import ddt from completion.waffle import ENABLE_COMPLETION_TRACKING_SWITCH from completion.models import BlockCompletion from completion.test_utils import CompletionWaffleTestMixin from dja...
agpl-3.0
rgommers/statsmodels
statsmodels/tsa/filters/bk_filter.py
28
3112
from __future__ import absolute_import import numpy as np from scipy.signal import fftconvolve from ._utils import _maybe_get_pandas_wrapper def bkfilter(X, low=6, high=32, K=12): """ Baxter-King bandpass filter Parameters ---------- X : array-like A 1 or 2d ndarray. If 2d, variables are ...
bsd-3-clause
jeffreyliu3230/osf.io
website/addons/dataverse/tests/test_client.py
16
8789
from nose.tools import * import mock import unittest from dataverse import Connection, Dataverse, DataverseFile, Dataset from dataverse.exceptions import UnauthorizedError from framework.exceptions import HTTPError from website.addons.dataverse.tests.utils import DataverseAddonTestCase from website.addons.dataverse.t...
apache-2.0
gdementen/larray
larray/tests/generate_data.py
2
9260
import os from larray import ndtest, open_excel, Session, X DATA_DIR = os.path.join(os.path.dirname(__file__), 'data') def generate_tests_files(): tests = {'1d': 3, '2d': "a=1..3; b=b0,b1", '2d_classic': "a=a0..a2;b=b0..b2", '3d': "a=1..3; b=b0,b1; c=c0..c2", ...
gpl-3.0
LohithBlaze/scikit-learn
sklearn/utils/tests/test_multiclass.py
128
12853
from __future__ import division import numpy as np import scipy.sparse as sp from itertools import product from sklearn.externals.six.moves import xrange from sklearn.externals.six import iteritems from scipy.sparse import issparse from scipy.sparse import csc_matrix from scipy.sparse import csr_matrix from scipy.sp...
bsd-3-clause
Diyago/Machine-Learning-scripts
DEEP LEARNING/Kaggle Avito Demand Prediction Challenge/image feat. extraction/avito_deepIQA/deepIQA/evaluate_back.py
1
2442
#!/usr/bin/python2 import argparse import cv2 import numpy as np import six from chainer import cuda from chainer import serializers from sklearn.feature_extraction.image import extract_patches from deepIQA.fr_model import FRModel from deepIQA.nr_model import Model parser = argparse.ArgumentParser(description="evalu...
apache-2.0
mlperf/training_results_v0.5
v0.5.0/google/cloud_v3.8/resnet-tpuv3-8/code/resnet/model/tpu/models/official/amoeba_net/amoeba_net.py
5
15390
# 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
grehujt/SmallPythonProjects
ClusteringRelatedPosts/solution.py
1
2849
import scipy as sp from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer import nltk.stem stemmer = nltk.stem.SnowballStemmer('english') class StemmedCountVectorizer(CountVectorizer): def build_analyzer(self): analyzer = super(CountVectorizer, self).build_analyzer() return...
mit
jzt5132/scikit-learn
sklearn/__init__.py
59
3038
""" Machine learning module for Python ================================== sklearn is a Python module integrating classical machine learning algorithms in the tightly-knit world of scientific Python packages (numpy, scipy, matplotlib). It aims to provide simple and efficient solutions to learning problems that are acc...
bsd-3-clause
LohithBlaze/scikit-learn
sklearn/tree/tests/test_export.py
75
9318
""" Testing for export functions of decision trees (sklearn.tree.export). """ from numpy.testing import assert_equal from nose.tools import assert_raises from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor from sklearn.tree import export_graphviz from sklearn.externals.six import StringIO # toy sa...
bsd-3-clause
jzt5132/scikit-learn
examples/linear_model/plot_ols_ridge_variance.py
380
2060
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Ordinary Least Squares and Ridge Regression Variance ========================================================= Due to the few points in each dimension and the straight line that linear regression uses to follow thes...
bsd-3-clause
aspidites/django
django/contrib/gis/geoip2/base.py
73
8630
import os import socket import geoip2.database from django.conf import settings from django.core.validators import ipv4_re from django.utils import six from django.utils.ipv6 import is_valid_ipv6_address from .resources import City, Country # Creating the settings dictionary with any settings, if needed. GEOIP_SETT...
bsd-3-clause
qinjian623/dlnotes
tutorials/pytorch/drl/enduro.py
1
5020
import argparse import gym import numpy as np import cv2 from itertools import count import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.autograd as autograd from torch.autograd import Variable parser = argparse.ArgumentParser(description='PyTorch REINFORCE exa...
gpl-3.0
jzt5132/scikit-learn
examples/mixture/plot_gmm_selection.py
247
3223
""" ================================= Gaussian Mixture Model Selection ================================= This example shows that model selection can be performed with Gaussian Mixture Models using information-theoretic criteria (BIC). Model selection concerns both the covariance type and the number of components in th...
bsd-3-clause
MohammedWasim/scikit-learn
sklearn/mixture/tests/test_gmm.py
199
17427
import unittest import copy import sys from nose.tools import assert_true import numpy as np from numpy.testing import (assert_array_equal, assert_array_almost_equal, assert_raises) from scipy import stats from sklearn import mixture from sklearn.datasets.samples_generator import make_spd_ma...
bsd-3-clause
LohithBlaze/scikit-learn
sklearn/datasets/svmlight_format.py
113
15826
"""This module implements a loader and dumper for the svmlight format This format is a text-based format, with one sample per line. It does not store zero valued features hence is suitable for sparse dataset. The first element of each line can be used to store a target variable to predict. This format is used as the...
bsd-3-clause
jzt5132/scikit-learn
examples/feature_selection/plot_feature_selection.py
248
2827
""" =============================== Univariate Feature Selection =============================== An example showing univariate feature selection. Noisy (non informative) features are added to the iris data and univariate feature selection is applied. For each feature, we plot the p-values for the univariate feature s...
bsd-3-clause
JSilva90/MITWS
Asynchronous_SFS/new_async.py
1
5082
from __future__ import division import multiprocessing as mp import time import pandas as pd import numpy as np import sys import utils #from sklearn.model_selection import StratifiedKFold from sklearn.ensemble import RandomForestClassifier from ML_test import ML_test from ML_data import ML_instance max_search_leve...
gpl-3.0
glouppe/scikit-learn
examples/covariance/plot_lw_vs_oas.py
150
2951
""" ============================= Ledoit-Wolf vs OAS estimation ============================= The usual covariance maximum likelihood estimate can be regularized using shrinkage. Ledoit and Wolf proposed a close formula to compute the asymptotically optimal shrinkage parameter (minimizing a MSE criterion), yielding th...
bsd-3-clause
glouppe/scikit-learn
sklearn/neighbors/tests/test_neighbors.py
22
45330
from itertools import product import pickle import numpy as np from scipy.sparse import (bsr_matrix, coo_matrix, csc_matrix, csr_matrix, dok_matrix, lil_matrix) from sklearn import metrics from sklearn.model_selection import train_test_split from sklearn.model_selection import cross_val_scor...
bsd-3-clause
automl/auto-sklearn
autosklearn/pipeline/components/data_preprocessing/rescaling/power_transformer.py
1
1715
from typing import Dict, Optional, Tuple, Union import numpy as np from autosklearn.pipeline.base import DATASET_PROPERTIES_TYPE from autosklearn.pipeline.components.base import AutoSklearnPreprocessingAlgorithm from autosklearn.pipeline.components.data_preprocessing.rescaling.abstract_rescaling import ( # noqa: E50...
bsd-3-clause
fx2003/tensorflow-study
TensorFlow实战/models/cognitive_mapping_and_planning/scripts/script_preprocess_annoations_S3DIS.py
14
7024
# 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 applicab...
mit
switowski/invenio
invenio/modules/indexer/tokenizers/BibIndexDOITokenizer.py
12
2004
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2013, 2015 CERN. # # Invenio 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 (at your option) any...
gpl-2.0
MatthieuCourbariaux/BinaryConnect
svhn.py
3
10981
# Copyright 2015 Matthieu Courbariaux # This file is part of BinaryConnect. # BinaryConnect 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 l...
gpl-2.0
sgenoud/scikit-learn
examples/linear_model/plot_sgd_iris.py
3
2170
""" ======================================== Plot multi-class SGD on the iris dataset ======================================== Plot decision surface of multi-class SGD on iris dataset. The hyperplanes corresponding to the three one-versus-all (OVA) classifiers are represented by the dashed lines. """ print __doc__ i...
bsd-3-clause
glouppe/scikit-learn
sklearn/cluster/__init__.py
359
1228
""" The :mod:`sklearn.cluster` module gathers popular unsupervised clustering algorithms. """ from .spectral import spectral_clustering, SpectralClustering from .mean_shift_ import (mean_shift, MeanShift, estimate_bandwidth, get_bin_seeds) from .affinity_propagation_ import affinity_propagati...
bsd-3-clause
luo66/scikit-learn
sklearn/linear_model/tests/test_bayes.py
296
1770
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # # License: BSD 3 clause import numpy as np from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import SkipTest from sklearn.linear_model.bayes import BayesianRidge, ARDRegres...
bsd-3-clause
elkingtonmcb/h2o-2
bench/BMscripts/glmBench.py
11
9671
#GLM bench import os, sys, time, csv, socket, string sys.path.append('../py/') sys.path.extend(['.','..']) import h2o_cmd, h2o, h2o_hosts, h2o_browse as h2b, h2o_import as h2i, h2o_rf, h2o_jobs csv_header = ('h2o_build','nMachines','nJVMs','Xmx/JVM','dataset','nTrainRows','nTestRows','nCols','trainParseWallTime','nfol...
apache-2.0
codeworldprodigy/lab2
lib/jinja2/jinja2/visitor.py
1402
3316
# -*- coding: utf-8 -*- """ jinja2.visitor ~~~~~~~~~~~~~~ This module implements a visitor for the nodes. :copyright: (c) 2010 by the Jinja Team. :license: BSD. """ from jinja2.nodes import Node class NodeVisitor(object): """Walks the abstract syntax tree and call visitor functions for every...
apache-2.0
davidhstocker/Graphyne
Smoketest.py
1
217442
#!/usr/bin/env python3 """ Smoketest.py: Regression testing utility for Graphyne. Multiprocessing wrapper for Smokest, allowing multiple simultaneous tests against different persistence types. """ from tkinter.test.runtktests import this_dir_path from graphyne.DatabaseDrivers.DriverTermplate import linkTypes __au...
apache-2.0
mlperf/training_results_v0.5
v0.5.0/google/cloud_v2.8/gnmt-tpuv2-8/code/gnmt/model/t2t/tensor2tensor/layers/transformer_layers.py
3
13829
# 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
tomsilver/nupic
tests/swarming/nupic/swarming/experiments/input_predicted_field/description.py
1
14270
# ---------------------------------------------------------------------- # 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
LohithBlaze/scikit-learn
benchmarks/bench_plot_svd.py
322
2899
"""Benchmarks of Singular Value Decomposition (Exact and Approximate) The data is mostly low rank but is a fat infinite tail. """ import gc from time import time import numpy as np from collections import defaultdict from scipy.linalg import svd from sklearn.utils.extmath import randomized_svd from sklearn.datasets.s...
bsd-3-clause
jzt5132/scikit-learn
sklearn/linear_model/bayes.py
219
15248
""" Various bayesian regression """ from __future__ import print_function # Authors: V. Michel, F. Pedregosa, A. Gramfort # License: BSD 3 clause from math import log import numpy as np from scipy import linalg from .base import LinearModel from ..base import RegressorMixin from ..utils.extmath import fast_logdet, p...
bsd-3-clause
MohammedWasim/scikit-learn
sklearn/linear_model/bayes.py
219
15248
""" Various bayesian regression """ from __future__ import print_function # Authors: V. Michel, F. Pedregosa, A. Gramfort # License: BSD 3 clause from math import log import numpy as np from scipy import linalg from .base import LinearModel from ..base import RegressorMixin from ..utils.extmath import fast_logdet, p...
bsd-3-clause
MohammedWasim/scikit-learn
examples/mixture/plot_gmm_sin.py
247
2747
""" ================================= Gaussian Mixture Model Sine Curve ================================= This example highlights the advantages of the Dirichlet Process: complexity control and dealing with sparse data. The dataset is formed by 100 points loosely spaced following a noisy sine curve. The fit by the GMM...
bsd-3-clause
jzt5132/scikit-learn
sklearn/utils/tests/test_testing.py
106
4210
import warnings import unittest import sys from nose.tools import assert_raises from sklearn.utils.testing import ( _assert_less, _assert_greater, assert_less_equal, assert_greater_equal, assert_warns, assert_no_warnings, assert_equal, set_random_state, assert_raise_message) from ...
bsd-3-clause
jzt5132/scikit-learn
sklearn/neighbors/base.py
71
31147
"""Base and mixin classes for nearest neighbors""" # Authors: Jake Vanderplas <vanderplas@astro.washington.edu> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Sparseness support by Lars Buitinck <L.J.Buitinck@uva.nl> # Multi-output...
bsd-3-clause
Vict0rSch/deep_learning
keras/feedforward/feedforward_keras_mnist.py
1
2623
import time import numpy as np from matplotlib import pyplot as plt from keras.utils import np_utils import keras.callbacks as cb from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation from keras.optimizers import RMSprop from keras.datasets import mnist class LossHistory(cb.Call...
gpl-2.0
luo66/scikit-learn
examples/applications/plot_outlier_detection_housing.py
241
5577
""" ==================================== Outlier detection on a real data set ==================================== This example illustrates the need for robust covariance estimation on a real data set. It is useful both for outlier detection and for a better understanding of the data structure. We selected two sets o...
bsd-3-clause
sgenoud/scikit-learn
sklearn/setup.py
1
2735
import os from os.path import join import warnings def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info, BlasNotFoundError import numpy libraries = [] if os.name == 'posix': libraries.appe...
bsd-3-clause
LohithBlaze/scikit-learn
examples/linear_model/plot_multi_task_lasso_support.py
248
2211
#!/usr/bin/env python """ ============================================= Joint feature selection with multi-task Lasso ============================================= The multi-task lasso allows to fit multiple regression problems jointly enforcing the selected features to be the same across tasks. This example simulates...
bsd-3-clause
glouppe/scikit-learn
sklearn/utils/tests/test_validation.py
54
18600
"""Tests for input validation functions""" import warnings from tempfile import NamedTemporaryFile from itertools import product import numpy as np from numpy.testing import assert_array_equal import scipy.sparse as sp from nose.tools import assert_raises, assert_true, assert_false, assert_equal from sklearn.utils....
bsd-3-clause
RensaProject/nodebox_linguistics_extended
nodebox_linguistics_extended/parser/nltk_lite/__init__.py
10
2228
# Natural Language Toolkit (NLTK-Lite) # # Copyright (C) 2001-2006 University of Pennsylvania # Authors: Steven Bird <sb@csse.unimelb.edu.au> # Edward Loper <edloper@gradient.cis.upenn.edu> # URL: <http://nltk.sf.net> # For license information, see LICENSE.TXT """ NLTK-Lite is a collection of lightweight NLP ...
gpl-2.0
lukeiwanski/tensorflow
tensorflow/contrib/losses/python/metric_learning/metric_loss_ops_test.py
40
20535
# 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
MohammedWasim/scikit-learn
sklearn/feature_selection/tests/test_feature_select.py
102
22297
""" Todo: cross-check the F-value with stats model """ from __future__ import division import itertools import warnings import numpy as np from scipy import stats, sparse from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_raises...
bsd-3-clause
jfconavarrete/kaggle-facebook
src/data/pre_process_k_means.py
1
1226
import pandas as pd import numpy as np import seaborn as sb import matplotlib.pyplot as plt import cv2 from sklearn import metrics from sklearn.cluster import MiniBatchKMeans, KMeans from sklearn.decomposition import PCA from sklearn.preprocessing import scale from sklearn import cross_validation as cv from sklearn im...
mit
tomsilver/nupic
examples/opf/experiments/spatial_classification/category_1/description.py
17
1557
# ---------------------------------------------------------------------- # 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
MohammedWasim/scikit-learn
examples/covariance/plot_lw_vs_oas.py
247
2903
""" ============================= Ledoit-Wolf vs OAS estimation ============================= The usual covariance maximum likelihood estimate can be regularized using shrinkage. Ledoit and Wolf proposed a close formula to compute the asymptotically optimal shrinkage parameter (minimizing a MSE criterion), yielding th...
bsd-3-clause
LohithBlaze/scikit-learn
examples/linear_model/plot_polynomial_interpolation.py
250
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
jzt5132/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
jzt5132/scikit-learn
examples/bicluster/plot_spectral_coclustering.py
274
1736
""" ============================================== A demo of the Spectral Co-Clustering algorithm ============================================== This example demonstrates how to generate a dataset and bicluster it using the the Spectral Co-Clustering algorithm. The dataset is generated using the ``make_biclusters`` f...
bsd-3-clause
automl/auto-sklearn
test/test_metalearning/pyMetaLearn/test_metalearning_configuration.py
1
1879
import logging import os import autosklearn.metalearning.optimizers.metalearn_optimizer.metalearner as metalearner # noqa: E501 import autosklearn.pipeline.classification from autosklearn.metalearning.metalearning.meta_base import MetaBase import unittest logging.basicConfig() class MetalearningConfiguration(unit...
bsd-3-clause
sgenoud/scikit-learn
sklearn/cluster/tests/test_k_means.py
3
18449
"""Testing for K-means""" import numpy as np import warnings from scipy import sparse as sp from numpy.testing import assert_equal from numpy.testing import assert_array_equal from numpy.testing import assert_array_almost_equal from nose import SkipTest from nose.tools import assert_almost_equal from nose.tools import...
bsd-3-clause