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 |
|---|---|---|---|---|---|
rflamary/POT | examples/plot_otda_mapping.py | 2 | 4084 | # -*- coding: utf-8 -*-
"""
===========================================
OT mapping estimation for domain adaptation
===========================================
This example presents how to use MappingTransport to estimate at the same
time both the coupling transport and approximate the transport map with either
a line... | mit |
herilalaina/scikit-learn | sklearn/utils/tests/test_graph.py | 37 | 1042 | # Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD 3 clause
import numpy as np
from scipy import sparse
from sklearn.utils.graph import graph_laplacian
from sklearn.utils.testing import ignore_warnings
@ignore_warnings(category=DeprecationWarning)
def test_graph_laplacian():
for mat in (np.... | bsd-3-clause |
schets/scikit-learn | sklearn/covariance/tests/test_robust_covariance.py | 212 | 3359 | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Virgile Fritsch <virgile.fritsch@inria.fr>
#
# License: BSD 3 clause
import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_alm... | bsd-3-clause |
h2oai/h2o | py/testdir_multi_jvm/test_parse_with_cancel.py | 8 | 3409 | import unittest, time, sys, random
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_import as h2i, h2o_jobs
DELETE_KEYS = True
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
h2o.init(3, java_heap_GB=4)
... | apache-2.0 |
xzturn/tensorflow | tensorflow/python/data/experimental/ops/enumerate_ops.py | 11 | 1965 | # 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 |
nhuntwalker/astroML | astroML/linear_model/kernel_regression.py | 4 | 1568 | import numpy as np
from .linear_regression import gaussian_basis
from sklearn.metrics import pairwise_kernels
class NadarayaWatson(object):
"""Nadaraya-Watson Kernel Regression
This is basically a gaussian-weighted moving average of points
Parameters
----------
kernel : string
kernel is ... | bsd-2-clause |
shareactorIO/pipeline | source.ml/jupyterhub.ml/notebooks/zz_old/TensorFlow/Fundamentals/distributed_cnn.py | 3 | 12868 | import tensorflow as tf
import numpy as np
# Modules required for file download and extraction
import os
import sys
import tarfile
from six.moves.urllib.request import urlretrieve
from scipy import ndimage
outdir = '/tmp/pipeline/datasets/notmist/'
def maybe_download(filename, url, force=False):
"""Download a fil... | apache-2.0 |
fayf/pyload | module/lib/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... | gpl-3.0 |
herilalaina/scikit-learn | examples/model_selection/plot_underfitting_overfitting.py | 67 | 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 |
schets/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 |
pravsripad/mne-python | tutorials/preprocessing/10_preprocessing_overview.py | 13 | 11064 | # -*- coding: utf-8 -*-
"""
.. _tut-artifact-overview:
==============================
Overview of artifact detection
==============================
This tutorial covers the basics of artifact detection, and introduces the
artifact detection tools available in MNE-Python.
We begin as always by importing the necessary... | bsd-3-clause |
tersmitten/ansible | lib/ansible/modules/cloud/google/gcp_bigquery_dataset_facts.py | 10 | 7722 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | gpl-3.0 |
xiaolonw/fast-rcnn-normal | tools/reval.py | 50 | 2749 | #!/usr/bin/env python
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Reval = re-eval. Re-evaluate saved detections... | mit |
CCI-Tools/sandbox | notebooks/Marco/open_ESACCI-AEROSOL-AATSR-MOTNHLY.py | 1 | 3160 | from datetime import datetime
from mz_common import extract_time_index, timeseries, subset, ect_open_mfdataset
import xarray as xr
import pandas as pd
'''
"*-ESACCI-L3C_AEROSOL-AER_PRODUCTS-AATSR-ENVISAT-ADV_MOTNHLY-v2.30.nc"
These product have only 2 dimensions 'latitude' and 'longitude'.
This script creates a datas... | gpl-3.0 |
EderSantana/fuel | tests/test_serialization.py | 3 | 1400 | import os
import tempfile
import numpy
from six.moves import cPickle
from fuel.streams import DataStream
from fuel.datasets import MNIST
from fuel.schemes import SequentialScheme
from tests import skip_if_not_available
def test_in_memory():
skip_if_not_available(datasets=['mnist.hdf5'])
# Load MNIST and get... | mit |
shareactorIO/pipeline | source.ml/jupyterhub.ml/notebooks/zz_old/TensorFlow/SkFlow_DEPRECATED/resnet.py | 6 | 6093 | # Copyright 2015-present Scikit Flow 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... | apache-2.0 |
marmarko/ml101 | tensorflow/examples/skflow/iris_custom_decay_dnn.py | 56 | 1959 | # 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... | bsd-2-clause |
pravsripad/mne-python | mne/decoding/tests/test_receptive_field.py | 11 | 22701 | # Authors: Chris Holdgraf <choldgraf@gmail.com>
#
# License: BSD-3-Clause
import os.path as op
import pytest
import numpy as np
from numpy import einsum
from numpy.fft import rfft, irfft
from numpy.testing import assert_array_equal, assert_allclose, assert_equal
from mne.utils import requires_sklearn
from mne.decodi... | bsd-3-clause |
pytroll/pyresample | pyresample/future/resamplers/resampler.py | 1 | 9727 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019-2021 Pyresample developers
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at y... | lgpl-3.0 |
schets/scikit-learn | sklearn/externals/joblib/__init__.py | 35 | 4382 | """ 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 |
herilalaina/scikit-learn | examples/model_selection/plot_train_error_vs_test_error.py | 38 | 2577 | """
=========================
Train error vs Test error
=========================
Illustration of how the performance of an estimator on unseen data (test data)
is not the same as the performance on training data. As the regularization
increases the performance on train decreases while the performance on test
is optim... | bsd-3-clause |
nhuntwalker/astroML | book_figures/chapter5/fig_model_comparison_mcmc.py | 4 | 8103 | """
MCMC Model Comparison
---------------------
Figure 5.24
The top-right panel shows the posterior pdf for mu and sigma for a single
Gaussian fit to the data shown in figure 5.23. The remaining panels show the
projections of the five-dimensional pdf for a Gaussian mixture model with
two components. Contours are based... | bsd-2-clause |
oldzhu/linux | tools/power/pm-graph/analyze_suspend.py | 55 | 176452 | #!/usr/bin/python
#
# Tool for analyzing suspend/resume timing
# Copyright (c) 2013, Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This prog... | gpl-2.0 |
herilalaina/scikit-learn | sklearn/metrics/setup.py | 68 | 1061 | import os
import os.path
import numpy
from numpy.distutils.misc_util import Configuration
from sklearn._build_utils import get_blas_info
def configuration(parent_package="", top_path=None):
config = Configuration("metrics", parent_package, top_path)
cblas_libs, blas_info = get_blas_info()
if os.name ==... | bsd-3-clause |
MebiusHKU/flask-web | flask/lib/python2.7/site-packages/sqlalchemy/orm/query.py | 29 | 138170 | # orm/query.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""The Query class and support.
Defines the :class:`.Query` class, the central
constru... | bsd-3-clause |
schets/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 |
megahertz0/tusharedemo | sklearn_stock.py | 1 | 6088 | # -*- coding: utf-8 -*-
"""
Created on Sat May 06 18:35:03 2017
@author: megahertz
"""
import base
import datetime
from math import sqrt
import matplotlib.pyplot as plt
from matplotlib import pyplot
from multiprocessing import Pool
import pandas as pd
import numpy as np
from sklearn import datasets
from sklearn.line... | lgpl-3.0 |
rhiever/sklearn-benchmarks | model_code/random_search_preprocessing/MultinomialNB.py | 1 | 2033 | import sys
import pandas as pd
import numpy as np
from sklearn.preprocessing import Binarizer, MaxAbsScaler, MinMaxScaler
from sklearn.preprocessing import Normalizer, PolynomialFeatures, RobustScaler, StandardScaler
from sklearn.decomposition import FastICA, PCA
from sklearn.kernel_approximation import RBFSampler, Ny... | mit |
schets/scikit-learn | sklearn/utils/tests/test_sparsefuncs.py | 57 | 13752 | import numpy as np
import scipy.sparse as sp
from scipy import linalg
from numpy.testing import assert_array_almost_equal, assert_array_equal
from sklearn.datasets import make_classification
from sklearn.utils.sparsefuncs import (mean_variance_axis,
inplace_column_scale,
... | bsd-3-clause |
keras-team/keras-io | examples/generative/pixelcnn.py | 1 | 6349 | """
Title: PixelCNN
Author: [ADMoreau](https://github.com/ADMoreau)
Date created: 2020/05/17
Last modified: 2020/05/23
Description: PixelCNN implemented in Keras.
"""
"""
## Introduction
PixelCNN is a generative model proposed in 2016 by van den Oord et al.
(reference: [Conditional Image Generation with PixelCNN Deco... | apache-2.0 |
zmr/namsel | config_manager.py | 1 | 3038 | '''A set of utilities for defining and working with namsel-ocr config files
'''
import json
import codecs
import os
import glob
import numpy as np
from utils import create_unique_id, local_file
from collections import Counter
CONF_DIR = './confs'
if not os.path.exists(CONF_DIR):
os.mkdir(CONF_DIR)
def _open(fl,... | mit |
schets/scikit-learn | sklearn/feature_selection/rfe.py | 8 | 16893 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Vincent Michel <vincent.michel@inria.fr>
# Gilles Louppe <g.louppe@gmail.com>
#
# License: BSD 3 clause
"""Recursive feature elimination for feature ranking"""
import warnings
import numpy as np
from ..utils import check_X_y, safe_sqr
fro... | bsd-3-clause |
schets/scikit-learn | examples/linear_model/plot_omp.py | 379 | 2263 | """
===========================
Orthogonal Matching Pursuit
===========================
Using orthogonal matching pursuit for recovering a sparse signal from a noisy
measurement encoded with a dictionary
"""
print(__doc__)
import matplotlib.pyplot as plt
import numpy as np
from sklearn.linear_model import OrthogonalM... | bsd-3-clause |
schets/scikit-learn | sklearn/setup.py | 224 | 2856 | 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 |
linsalrob/EdwardsLab | sra/study_types.py | 1 | 3096 | import sys
__author__ = 'Rob Edwards'
import sqlite3
import argparse
def get_cursor(database_file):
"""
Open the database and get the cursor
:param database_file:The sql lite database
:type database_file:str
:return:
:rtype:
"""
sql = sqlite3.connect(database_file)
return sql.cu... | mit |
pravsripad/mne-python | mne/tests/test_cov.py | 5 | 35977 | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD-3-Clause
import os.path as op
import itertools as itt
import sys
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_equal, assert_all... | bsd-3-clause |
pravsripad/mne-python | mne/decoding/tests/test_csp.py | 11 | 13481 | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Romain Trachel <trachelr@gmail.com>
# Alexandre Barachant <alexandre.barachant@gmail.com>
# Jean-Remi King <jeanremi.king@gmail.com>
#
# License: BSD-3-Clause
import os.path as op
import numpy as np
import pytest
from numpy.testing i... | bsd-3-clause |
sangwook236/general-development-and-testing | sw_dev/python/rnd/test/machine_learning/autokeras/autokeras_image.py | 2 | 1321 | #!/usr/bin/env python
import time
import numpy as np
import tensorflow as tf
import autokeras as ak
# REF [site] >> https://autokeras.com/start/
def mnist_example():
# Loads dataset.
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
x_train = x_train.reshape(x_train.shape + (1,))
x_test =... | gpl-2.0 |
pravsripad/mne-python | mne/forward/tests/test_make_forward.py | 2 | 25671 | from itertools import product
import os
import os.path as op
from pathlib import Path
import pytest
import numpy as np
from numpy.testing import assert_equal, assert_allclose, assert_array_equal
from mne.channels import make_standard_montage
from mne.datasets import testing
from mne.io import read_raw_fif, read_raw_k... | bsd-3-clause |
AtsushiSakai/jsk_visualization_packages | jsk_recognition_utils/python/jsk_recognition_utils/feature.py | 1 | 1203 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from sklearn.cluster import MiniBatchKMeans
from sklearn.neighbors import NearestNeighbors
class BagOfFeatures(object):
def __init__(self, hist_size=500):
self.nn = None
self.hist_size = hist_size
def fit(self, X):
"""F... | mit |
schets/scikit-learn | sklearn/tests/test_learning_curve.py | 224 | 10791 | # Author: Alexander Fabisch <afabisch@informatik.uni-bremen.de>
#
# License: BSD 3 clause
import sys
from sklearn.externals.six.moves import cStringIO as StringIO
import numpy as np
import warnings
from sklearn.base import BaseEstimator
from sklearn.learning_curve import learning_curve, validation_curve
from sklearn.u... | bsd-3-clause |
pravsripad/mne-python | mne/decoding/search_light.py | 7 | 25797 | # Author: Jean-Remi King <jeanremi.king@gmail.com>
#
# License: BSD-3-Clause
import numpy as np
from .mixin import TransformerMixin
from .base import BaseEstimator, _check_estimator
from ..fixes import _get_check_scoring
from ..parallel import parallel_func
from ..utils import (array_split_idx, ProgressBar,
... | bsd-3-clause |
keras-team/keras-io | examples/vision/consistency_training.py | 1 | 13728 | """
Title: Consistency training with supervision
Author: [Sayak Paul](https://twitter.com/RisingSayak)
Date created: 2021/04/13
Last modified: 2021/04/19
Description: Training with consistency regularization for robustness against data distribution shifts.
"""
"""
Deep learning models excel in many image recognition ta... | apache-2.0 |
herilalaina/scikit-learn | examples/ensemble/plot_gradient_boosting_regularization.py | 57 | 2848 | """
================================
Gradient Boosting regularization
================================
Illustration of the effect of different regularization strategies
for Gradient Boosting. The example is taken from Hastie et al 2009 [1]_.
The loss function used is binomial deviance. Regularization via
shrinkage (`... | bsd-3-clause |
herilalaina/scikit-learn | doc/conf.py | 4 | 9872 | # -*- coding: utf-8 -*-
#
# scikit-learn documentation build configuration file, created by
# sphinx-quickstart on Fri Jan 8 09:13:42 2010.
#
# This file is execfile()d with the current directory set to its containing
# dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.