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 |
|---|---|---|---|---|---|
benoitsteiner/tensorflow-xsmm | tensorflow/examples/get_started/regression/imports85.py | 39 | 6589 | # 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 |
nightjean/Deep-Learning | tensorflow/contrib/data/python/kernel_tests/zip_dataset_op_test.py | 5 | 4387 | # 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 |
mxjl620/scikit-learn | sklearn/utils/tests/test_validation.py | 79 | 18547 | """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 |
ageron/tensorflow | tensorflow/python/compiler/tensorrt/test/quantization_mnist_test.py | 3 | 11029 | # 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 |
nickgentoo/scikit-learn-graph | skgraph/kernel/ODDSTGraphKernel.py | 1 | 28608 | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 24 12:44:02 2015
Copyright 2015 Nicolo' Navarin, Riccardo Tesselli
This file is part of scikit-learn-graph.
scikit-learn-graph 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 ... | gpl-3.0 |
rbrecheisen/arff-utils | arff_utils/arff_utils.py | 1 | 17913 | # -*- coding: utf-8 -*-
__author__ = 'Ralph'
import arff
import numpy as np
import pandas as pd
class ARFF(object):
@staticmethod
def read(file_name, missing=None):
"""
Loads ARFF file into data dictionary. Missing values indicated
by '?' are automatically converted to None. If you w... | apache-2.0 |
hyperspy/hyperspy | hyperspy/component.py | 2 | 50888 | # -*- coding: utf-8 -*-
# Copyright 2007-2022 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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 y... | gpl-3.0 |
adamtiger/tensorflow | tensorflow/examples/learn/iris_custom_model.py | 37 | 3651 | # 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 |
rahuldhote/scikit-learn | examples/feature_stacker.py | 245 | 1906 | """
=================================================
Concatenating multiple feature extraction methods
=================================================
In many real-world examples, there are many ways to extract features from a
dataset. Often it is beneficial to combine several methods to obtain good
performance. Th... | bsd-3-clause |
rahuldhote/scikit-learn | examples/linear_model/lasso_dense_vs_sparse_data.py | 345 | 1862 | """
==============================
Lasso on dense and sparse data
==============================
We show that linear_model.Lasso provides the same results for dense and sparse
data and that in the case of sparse data the speed is improved.
"""
print(__doc__)
from time import time
from scipy import sparse
from scipy ... | bsd-3-clause |
lucafon/ArtificialIntelligence | src/classification_sklearn/problem3_3.py | 1 | 7154 | '''
Created on Mar 7, 2017
@author: Luca Fontanili
'''
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.svm import SVC
from sklearn.model_selection import train_test_split, cross_val_score
from sklearn.model_selection import GridSearchCV
from sklearn.linear_model import LogisticRegressionCV
from sklear... | mit |
kearnsw/Twitt.IR | src/AnnotweetClassifier2.py | 1 | 4819 | from pymongo import MongoClient
from config import MONGO_URI
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.datasets import fetch_20newsgroups
from sklearn.naive_bayes import MultinomialNB
from sklearn import metrics
import sys
impor... | gpl-3.0 |
Ldpe2G/mxnet | example/svm_mnist/svm_mnist.py | 7 | 3545 |
#############################################################
## Please read the README.md document for better reference ##
#############################################################
from __future__ import print_function
import mxnet as mx
import numpy as np
from sklearn.datasets import fetch_mldata
from sklearn.de... | apache-2.0 |
jjardel/probablyPOTUS | model/src/_model.py | 2 | 5837 | # python STL
import re
import os
from datetime import datetime
# third party modules
from sklearn.preprocessing import MinMaxScaler
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.feature_extraction.text import TfidfVectorizer
from skl... | gpl-3.0 |
matthew-tucker/mne-python | examples/inverse/plot_gamma_map_inverse.py | 30 | 2316 | """
===============================================================================
Compute a sparse inverse solution using the Gamma-Map empirical Bayesian method
===============================================================================
See Wipf et al. "A unified Bayesian framework for MEG/EEG source imaging."
... | bsd-3-clause |
rahuldhote/scikit-learn | sklearn/covariance/tests/test_graph_lasso.py | 269 | 5245 | """ Test the graph_lasso module.
"""
import sys
import numpy as np
from scipy import linalg
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_array_less
from sklearn.covariance import (graph_lasso, GraphLasso, GraphLassoCV,
empirical_... | bsd-3-clause |
mr3bn/DAT210x | Module6/assignment1.py | 1 | 5224 | import matplotlib as mpl
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import time
#
# INFO: Your Parameters.
# You can adjust them after completing the lab
C = 1
kernel = 'linear'
iterations = 5000 # TODO: Change to 200000 once you get to Question#2
#
# INFO: You can set this to false ... | mit |
uber/pyro | examples/baseball.py | 1 | 16326 | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import argparse
import logging
import math
import pandas as pd
import torch
import pyro
from pyro.distributions import Beta, Binomial, HalfCauchy, Normal, Pareto, Uniform
from pyro.distributions.util import scalar_like
from pyro.... | apache-2.0 |
davidkunio/dedupe | tests/canonical_test.py | 3 | 3235 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
from future.utils import viewitems
from builtins import range
from itertools import combinations
import csv
import exampleIO
import dedupe
import os
import time
import optparse
import logging
optp = optparse.OptionParser()
optp.add_optio... | mit |
jpn--/larch | larch/prelearning.py | 1 | 11273 |
import logging
import numpy
import pandas
import os
from appdirs import user_cache_dir
import joblib
from typing import MutableMapping
from .general_precision import l4_float_dtype
from .log import logger_name
from .dataframes import DataFrames
def user_cache_file(filename, appname=None, appauthor=None, version=No... | gpl-3.0 |
uber/pyro | pyro/distributions/transforms/planar.py | 1 | 8881 | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import math
from functools import partial
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Transform, constraints
from pyro.nn import DenseNN
from ..conditional import Conditiona... | apache-2.0 |
matthiasdiener/spack | var/spack/repos/builtin/packages/r-gdsfmt/package.py | 3 | 2449 | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 |
uber/pyro | tests/contrib/test_util.py | 1 | 3036 | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
from collections import OrderedDict
import pytest
import torch
from pyro.contrib.util import (
get_indices,
lexpand,
rdiag,
rexpand,
rmv,
rtril,
rvv,
tensor_to_dict,
)
from tests.common import asse... | apache-2.0 |
matthew-tucker/mne-python | examples/inverse/plot_tf_lcmv.py | 14 | 5869 | """
=====================================
Time-frequency beamforming using LCMV
=====================================
Compute LCMV source power in a grid of time-frequency windows and display
results.
The original reference is:
Dalal et al. Five-dimensional neuroimaging: Localization of the time-frequency
dynamics of... | bsd-3-clause |
uber/pyro | pyro/infer/mcmc/nuts.py | 1 | 21893 | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
from collections import namedtuple
import pyro
import pyro.distributions as dist
from pyro.distributions.util import scalar_like
from pyro.infer.autoguide import init_to_uniform
from pyro.infer.mcmc.hmc import HMC
from pyro.ops.in... | apache-2.0 |
vitaly-krugl/nupic | examples/opf/experiments/multistep/base/description.py | 10 | 15963 | # ----------------------------------------------------------------------
# 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... | agpl-3.0 |
rahuldhote/scikit-learn | sklearn/datasets/species_distributions.py | 197 | 7923 | """
=============================
Species distribution dataset
=============================
This dataset represents the geographic distribution of species.
The dataset is provided by Phillips et. al. (2006).
The two species are:
- `"Bradypus variegatus"
<http://www.iucnredlist.org/apps/redlist/details/3038/0>`_... | bsd-3-clause |
vitaly-krugl/nupic | src/nupic/data/aggregator.py | 10 | 28894 | # ----------------------------------------------------------------------
# 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... | agpl-3.0 |
kod3r/keras | examples/imdb_cnn.py | 76 | 2878 | from __future__ import absolute_import
from __future__ import print_function
import numpy as np
np.random.seed(1337) # for reproducibility
from keras.preprocessing import sequence
from keras.optimizers import RMSprop
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
... | mit |
rahuldhote/scikit-learn | examples/applications/plot_species_distribution_modeling.py | 252 | 7434 | """
=============================
Species distribution modeling
=============================
Modeling species' geographic distributions is an important
problem in conservation biology. In this example we
model the geographic distribution of two south american
mammals given past observations and 14 environmental
varia... | bsd-3-clause |
BlazeLoader/BlazeLoader | util/apply_at.py | 3 | 2819 | """
This is a temporary and messy way to apply the AccessTransformer,
the installer will take care of it when it is ready.
"""
import sys
import os
import subprocess
import shlex
def get_cp_sep():
os_name = sys.platform
if os_name.startswith('win'):
return ';'
return ':'
mc_ver = '1.7.2'
mcp_dir = '../'
... | bsd-2-clause |
ron1818/Singaboat_RobotX2016 | robotx_nav/nodes/task1_nonprocess_1.py | 3 | 5759 | #!/usr/bin/env python
import rospy
import math
import time
import numpy as np
import os
import tf
from sklearn.cluster import KMeans
from nav_msgs.msg import Odometry
from geometry_msgs.msg import Point, Pose, Twist, Vector3
from visualization_msgs.msg import MarkerArray, Marker
from move_base_forward import Forward
f... | gpl-3.0 |
mcgachey/edx-platform | lms/djangoapps/course_blocks/transformers/tests/test_user_partitions.py | 26 | 17615 | # pylint: disable=attribute-defined-outside-init, protected-access
"""
Tests for UserPartitionTransformer.
"""
from collections import namedtuple
import ddt
from openedx.core.djangoapps.course_groups.partition_scheme import CohortPartitionScheme
from openedx.core.djangoapps.course_groups.tests.helpers import CohortFac... | agpl-3.0 |
vitaly-krugl/nupic | src/nupic/frameworks/opf/experiment_runner.py | 10 | 29504 | # ----------------------------------------------------------------------
# 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... | agpl-3.0 |
rahuldhote/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 |
sstober/deepthought | deepthought/datasets/rwanda2013rhythms/Preprocessor.py | 1 | 7638 | '''
Created on Apr 1, 2014
@author: sstober
'''
import os;
import glob;
import csv;
import math;
import logging;
log = logging.getLogger(__name__);
import numpy as np;
import theano;
from pylearn2.utils.timing import log_timing
from deepthought.util.fs_util import save, load;
from deepthought.datasets.rwanda2013rhy... | bsd-3-clause |
uber/pyro | examples/eight_schools/mcmc.py | 1 | 1818 | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import argparse
import logging
import data
import torch
import pyro
import pyro.distributions as dist
import pyro.poutine as poutine
from pyro.infer import MCMC, NUTS
logging.basicConfig(format="%(message)s", level=logging.INFO)... | apache-2.0 |
LamaHamadeh/Microsoft-DAT210x | Module 5/assignment5.py | 1 | 5381 | '''
author Lama Hamadeh
'''
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
from sklearn import preprocessing
from sklearn.decomposition import PCA
matplotlib.style.use('ggplot') # Look Pretty
#------------------------------------
def plotDecisionBoundary(model, X, y):
fig ... | mit |
jlcarmic/producthunt_simulator | venv/lib/python2.7/site-packages/scipy/stats/mstats_basic.py | 30 | 84684 | """
An extension of scipy.stats.stats to support masked arrays
"""
# Original author (2007): Pierre GF Gerard-Marchant
# TODO : f_value_wilks_lambda looks botched... what are dfnum & dfden for ?
# TODO : ttest_rel looks botched: what are x1,x2,v1,v2 for ?
# TODO : reimplement ksonesamp
from __future__ import divisi... | mit |
jhseu/tensorflow | tensorflow/python/tpu/datasets_test.py | 24 | 7572 | # 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 |
rahuldhote/scikit-learn | examples/cluster/plot_kmeans_assumptions.py | 267 | 2040 | """
====================================
Demonstration of k-means assumptions
====================================
This example is meant to illustrate situations where k-means will produce
unintuitive and possibly unexpected clusters. In the first three plots, the
input data does not conform to some implicit assumptio... | bsd-3-clause |
bmcfee/pescador | examples/frameworks/keras_example.py | 1 | 6232 | # -*- coding: utf-8 -*-
"""
===============
A Keras Example
===============
An example of how to use Pescador with Keras.
Original Code source:
https://github.com/fchollet/keras/blob/master/examples/mnist_cnn.py
"""
##############################################
# Setup and Definitions
##############################... | isc |
matthew-tucker/mne-python | setup.py | 3 | 5039 | #! /usr/bin/env python
#
# Copyright (C) 2011-2014 Alexandre Gramfort
# <alexandre.gramfort@telecom-paristech.fr>
import os
from os import path as op
import setuptools # noqa; we are using a setuptools namespace
from numpy.distutils.core import setup
# get the version (don't import mne here, so dependencies are no... | bsd-3-clause |
vitaly-krugl/nupic | examples/opf/experiments/opfrunexperiment_test/checkpoints/base.py | 10 | 14780 | # ----------------------------------------------------------------------
# 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... | agpl-3.0 |
QuLogic/iris | lib/iris/experimental/stratify.py | 5 | 7991 | # (C) British Crown Copyright 2017, Met Office
#
# This file is part of Iris.
#
# Iris 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 your option) any later ve... | gpl-3.0 |
rahuldhote/scikit-learn | sklearn/neighbors/base.py | 114 | 29783 | """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 |
elvandy/nltools | examples/01_DataOperations/plot_download.py | 3 | 5125 | """
Basic Data Operations
=====================
A simple example showing how to download a dataset from neurovault and perform
basic data operations. The bulk of the nltools toolbox is built around the
Brain_Data() class. This class represents imaging data as a vectorized
features by observations matrix. Each image... | mit |
avati/samba | lib/dnspython/dns/rrset.py | 98 | 5895 | # Copyright (C) 2003-2007, 2009-2011 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 "... | gpl-3.0 |
daiqing2009/CLS_chatlog | CN_dfidf.py | 1 | 2899 | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 28 17:40:42 2014
@author: david.dai
"""
import datetime
import sqlite3
import os
import codecs
import re
import jieba.posseg as pseg
from sklearn.pipeline import Pipeline
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text im... | mit |
rahuldhote/scikit-learn | sklearn/tests/test_base.py | 215 | 7045 | # Author: Gael Varoquaux
# License: BSD 3 clause
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing impo... | bsd-3-clause |
rahuldhote/scikit-learn | sklearn/svm/base.py | 155 | 36018 | from __future__ import print_function
import numpy as np
import scipy.sparse as sp
import warnings
from abc import ABCMeta, abstractmethod
from . import libsvm, liblinear
from . import libsvm_sparse
from ..base import BaseEstimator, ClassifierMixin, ChangedBehaviorWarning
from ..preprocessing import LabelEncoder
from... | bsd-3-clause |
yepengxj/nmt | nmt/nmt.py | 1 | 68062 | '''
Build a attention-based neural machine translation model
'''
import theano
import theano.tensor as tensor
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
import cPickle as pkl
import numpy
import copy
import os
import warnings
import sys
import time
from scipy import optimize, stats
from co... | bsd-3-clause |
rahuldhote/scikit-learn | sklearn/neighbors/graph.py | 207 | 7031 | """Nearest Neighbors graph functions"""
# Author: Jake Vanderplas <vanderplas@astro.washington.edu>
#
# License: BSD 3 clause (C) INRIA, University of Amsterdam
import warnings
from .base import KNeighborsMixin, RadiusNeighborsMixin
from .unsupervised import NearestNeighbors
def _check_params(X, metric, p, metric_... | bsd-3-clause |
hyperspy/hyperspy | hyperspy/_signals/eds.py | 2 | 47066 | # -*- coding: utf-8 -*-
# Copyright 2007-2022 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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 y... | gpl-3.0 |
Ldpe2G/mxnet | example/torch/torch_module.py | 15 | 1651 | # pylint: skip-file
from data import mnist_iterator
import mxnet as mx
import numpy as np
import logging
# define mlp
use_torch_criterion = False
data = mx.symbol.Variable('data')
fc1 = mx.symbol.TorchModule(data_0=data, lua_string='nn.Linear(784, 128)', num_data=1, num_params=2, num_outputs=1, name='fc1')
act1 = mx... | apache-2.0 |
Ldpe2G/mxnet | python/mxnet/__init__.py | 9 | 1519 | #!/usr/bin/env python
# coding: utf-8
"""MXNet: a concise, fast and flexible framework for deep learning."""
from __future__ import absolute_import
from .context import Context, current_context, cpu, gpu
from .base import MXNetError
from . import base
from . import contrib
from . import ndarray
from . import name
# us... | apache-2.0 |
justincassidy/scikit-learn | examples/linear_model/plot_robust_fit.py | 237 | 2414 | """
Robust linear estimator fitting
===============================
Here a sine function is fit with a polynomial of order 3, for values
close to zero.
Robust fitting is demoed in different situations:
- No measurement errors, only modelling errors (fitting a sine with a
polynomial)
- Measurement errors in X
- M... | bsd-3-clause |
QijunPan/ansible | lib/ansible/modules/storage/zfs/zfs_facts.py | 9 | 8678 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, Adam Števko <adam.stevko@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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 L... | gpl-3.0 |
fishcorn/pylearn2 | pylearn2/datasets/tests/test_mnistplus.py | 35 | 1978 | """
This file tests the MNISTPlus class. majorly concerning the X and y member
of the dataset and their corresponding sizes, data scales and topological
views.
"""
from pylearn2.datasets.mnistplus import MNISTPlus
from pylearn2.space import IndexSpace, VectorSpace
import unittest
from pylearn2.testing.skip import skip_... | bsd-3-clause |
quheng/scikit-learn | sklearn/datasets/tests/test_20news.py | 277 | 3045 | """Test the 20news downloader, if the data is available."""
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import SkipTest
from sklearn import datasets
def test_20news():
try:
data = dat... | bsd-3-clause |
fishcorn/pylearn2 | pylearn2/train_extensions/window_flip.py | 41 | 7218 | """ TrainExtensions for doing random spatial windowing and flipping of an
image dataset on every epoch. TODO: fill out properly."""
import warnings
import numpy
from . import TrainExtension
from pylearn2.datasets.preprocessing import CentralWindow
from pylearn2.utils.exc import reraise_as
from pylearn2.utils.rng i... | bsd-3-clause |
justincassidy/scikit-learn | benchmarks/bench_glmnet.py | 295 | 3848 | """
To run this, you'll need to have installed.
* glmnet-python
* scikit-learn (of course)
Does two benchmarks
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... | bsd-3-clause |
Lawrence-Liu/scikit-learn | examples/classification/plot_classification_probability.py | 241 | 2624 | """
===============================
Plot classification probability
===============================
Plot the classification probability for different classifiers. We use a 3
class dataset, and we classify it with a Support Vector classifier, L1
and L2 penalized logistic regression with either a One-Vs-Rest or multinom... | bsd-3-clause |
adammenges/statsmodels | docs/source/plots/graphics_gofplots_qqplot.py | 37 | 1911 | # -*- coding: utf-8 -*-
"""
Created on Sun May 06 05:32:15 2012
Author: Josef Perktold
editted by: Paul Hobson (2012-08-19)
"""
from scipy import stats
from matplotlib import pyplot as plt
import statsmodels.api as sm
#example from docstring
data = sm.datasets.longley.load()
data.exog = sm.add_constant(data.exog, pre... | bsd-3-clause |
ITA-Solar/helita | helita/io/sdf.py | 2 | 3207 | """
Set of tools to read SDF format.
First coded: 20111227 by Tiago Pereira (tiago.pereira@nasa.gov)
"""
import numpy as np
class SDFHeader:
def __init__(self, filename, verbose=False):
self.verbose = verbose
self.query(filename)
def query(self, filename, verbose=False):
''' Queries... | bsd-3-clause |
saurabh3949/mxnet | example/image-classification/symbols/resnext.py | 56 | 9928 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 |
nick-klingaman/ASoP | ASoP-Coherence/asop_coherence_example.py | 1 | 8365 | import asop_coherence as asop
import numpy as np
"""
Example use of ASoP Coherence package to compute
and plot diagnostics of the spatial and temporal
coherence of precipitation in a dataset.
This example uses TRMM 3B42v7A and CMORPH v1.0 data
for October 2009 - January 2010, as shown in
... | apache-2.0 |
zhangfengesri/MLPython | script/exercise_bmlsp_postclustering.py | 1 | 1790 | """
Exercise 2 - Posts<BMLSP>
Clustering Machine Learning Example
"""
# Author: Feng Zhang <fzhang@esri.com>
# License: Simplified BSD
import os
import sys
import numpy as np
import scipy as sp
import nltk.stem
import matplotlib.pyplot as plt
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.c... | bsd-2-clause |
pystruct/pystruct | benchmarks/random_tree_crf.py | 1 | 1467 | import numpy as np
from scipy import sparse
try:
from sklearn.model_selection import train_test_split
except ImportError:
from sklearn.cross_validation import train_test_split
from scipy.sparse.csgraph import minimum_spanning_tree
from pystruct.learners import SubgradientSSVM
from pystruct.models import Grap... | bsd-2-clause |
QijunPan/ansible | lib/ansible/modules/cloud/smartos/vmadm.py | 10 | 24627 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Jasper Lievisse Adriaanse <j@jasper.la>
#
# This file is part of Ansible
#
# Ansible 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 t... | gpl-3.0 |
letconex/MMT | src/decoder-neural/src/main/python/nmmt/torch_utils.py | 1 | 1144 | import torch
_torch_gpus = None
def torch_setup(gpus=None, random_seed=None):
global _torch_gpus
if torch.cuda.is_available():
if gpus is None:
gpus = range(torch.cuda.device_count()) if torch.cuda.is_available() else None
else:
# remove indexes of GPUs which are not ... | apache-2.0 |
gsig/srnn | srnn-pytorch/srnn.py | 1 | 2966 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
def tensorchoice(n, scores):
p = scores.detach().numpy()
p = p / p.sum()
return np.random.choice(n, p=p)
def tensormax(n, scores):
p = scores.detach().numpy()
return np.argmax(p)
def pick_probabilities(k, num... | gpl-3.0 |
Lawrence-Liu/scikit-learn | examples/neighbors/plot_regression.py | 346 | 1402 | """
============================
Nearest Neighbors regression
============================
Demonstrate the resolution of a regression problem
using a k-Nearest Neighbor and the interpolation of the
target using both barycenter and constant weights.
"""
print(__doc__)
# Author: Alexandre Gramfort <alexandre.gramfort@... | bsd-3-clause |
quheng/scikit-learn | examples/neighbors/plot_regression.py | 346 | 1402 | """
============================
Nearest Neighbors regression
============================
Demonstrate the resolution of a regression problem
using a k-Nearest Neighbor and the interpolation of the
target using both barycenter and constant weights.
"""
print(__doc__)
# Author: Alexandre Gramfort <alexandre.gramfort@... | bsd-3-clause |
edhuckle/statsmodels | statsmodels/robust/robust_linear_model.py | 27 | 25571 | """
Robust linear models with support for the M-estimators listed under
:ref:`norms <norms>`.
References
----------
PJ Huber. 'Robust Statistics' John Wiley and Sons, Inc., New York. 1981.
PJ Huber. 1973, 'The 1972 Wald Memorial Lectures: Robust Regression:
Asymptotics, Conjectures, and Monte Carlo.' The An... | bsd-3-clause |
maurofaccenda/ansible | lib/ansible/modules/cloud/smartos/imgadm.py | 68 | 10313 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, 2017 Jasper Lievisse Adriaanse <j@jasper.la>
#
# This file is part of Ansible
#
# Ansible 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... | gpl-3.0 |
google/learned_optimization | learned_optimization/research/hysteresis/data_in_state_tasks.py | 1 | 4624 | # coding=utf-8
# 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 ... | apache-2.0 |
justincassidy/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 |
quheng/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 |
LUTAN/tensorflow | tensorflow/contrib/learn/python/learn/datasets/mnist.py | 1 | 9594 | # 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 |
micadeyeye/Blongo | django/contrib/gis/tests/test_geoip.py | 290 | 4204 | import os, unittest
from django.db import settings
from django.contrib.gis.geos import GEOSGeometry
from django.contrib.gis.utils import GeoIP, GeoIPException
# Note: Requires use of both the GeoIP country and city datasets.
# The GEOIP_DATA path should be the only setting set (the directory
# should contain links or ... | bsd-3-clause |
ridfrustum/lettuce | tests/integration/lib/Django-1.2.5/django/contrib/gis/tests/test_geoip.py | 290 | 4204 | import os, unittest
from django.db import settings
from django.contrib.gis.geos import GEOSGeometry
from django.contrib.gis.utils import GeoIP, GeoIPException
# Note: Requires use of both the GeoIP country and city datasets.
# The GEOIP_DATA path should be the only setting set (the directory
# should contain links or ... | gpl-3.0 |
hankcs/HanLP | hanlp/layers/dropout.py | 1 | 5436 | # -*- coding:utf-8 -*-
# Date: 2020-06-05 17:47
from typing import List
import torch
import torch.nn as nn
class WordDropout(nn.Module):
def __init__(self, p: float, oov_token: int, exclude_tokens: List[int] = None) -> None:
super().__init__()
self.oov_token = oov_token
self.p = p
... | apache-2.0 |
mohamedkeid/Image-Captioning | eval.py | 1 | 2555 | import argparse
import etl
import helpers
import torch
import torchvision.models as models
from decoder import DecoderRNN
from language import Language
from torch.autograd import Variable
parser = argparse.ArgumentParser()
parser.add_argument('path')
args = parser.parse_args()
helpers.validate_path(args.path)
# Parse... | mit |
justincassidy/scikit-learn | sklearn/utils/tests/test_linear_assignment.py | 412 | 1349 | # Author: Brian M. Clapper, G Varoquaux
# License: BSD
import numpy as np
# XXX we should be testing the public API here
from sklearn.utils.linear_assignment_ import _hungarian
def test_hungarian():
matrices = [
# Square
([[400, 150, 400],
[400, 450, 600],
[300, 225, 300]],
... | bsd-3-clause |
Lawrence-Liu/scikit-learn | examples/applications/plot_species_distribution_modeling.py | 252 | 7434 | """
=============================
Species distribution modeling
=============================
Modeling species' geographic distributions is an important
problem in conservation biology. In this example we
model the geographic distribution of two south american
mammals given past observations and 14 environmental
varia... | bsd-3-clause |
justincassidy/scikit-learn | examples/applications/plot_species_distribution_modeling.py | 252 | 7434 | """
=============================
Species distribution modeling
=============================
Modeling species' geographic distributions is an important
problem in conservation biology. In this example we
model the geographic distribution of two south american
mammals given past observations and 14 environmental
varia... | bsd-3-clause |
justincassidy/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 |
edhuckle/statsmodels | examples/python/regression_diagnostics.py | 28 | 2876 |
## Regression diagnostics
# This example file shows how to use a few of the ``statsmodels`` regression diagnostic tests in a real-life context. You can learn about more tests and find out more information abou the tests here on the [Regression Diagnostics page.](http://statsmodels.sourceforge.net/stable/diagnostic.ht... | bsd-3-clause |
adammenges/statsmodels | examples/python/regression_diagnostics.py | 28 | 2876 |
## Regression diagnostics
# This example file shows how to use a few of the ``statsmodels`` regression diagnostic tests in a real-life context. You can learn about more tests and find out more information abou the tests here on the [Regression Diagnostics page.](http://statsmodels.sourceforge.net/stable/diagnostic.ht... | bsd-3-clause |
hankcs/HanLP | hanlp/datasets/qa/hotpotqa.py | 1 | 6170 | # -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2020-03-20 19:46
from enum import Enum, auto
import torch
import ujson
from torch.nn.utils.rnn import pad_sequence
from hanlp.common.dataset import TransformableDataset
from hanlp_common.util import merge_list_of_dict
HOTPOT_QA_TRAIN = 'http://curtis.ml.cmu.edu/dataset... | apache-2.0 |
augustoppimenta/crab | scikits/crab/datasets/book_crossing.py | 10 | 5317 | """Caching loader for the Book-Crossing Dataset
The description of the dataset is available on the official website at:
http://www.informatik.uni-freiburg.de/~cziegler/BX/
Quoting the introduction:
Collected by Cai-Nicolas Ziegler in a 4-week crawl
(August / September 2004) from the Book-Crossing commun... | bsd-3-clause |
harshaneelhg/scikit-learn | sklearn/cluster/birch.py | 206 | 22706 | # Authors: Manoj Kumar <manojkumarsivaraj334@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Joel Nothman <joel.nothman@gmail.com>
# License: BSD 3 clause
from __future__ import division
import warnings
import numpy as np
from scipy import sparse
from math import sqrt
fro... | bsd-3-clause |
tongwang01/tensorflow | tensorflow/contrib/learn/python/learn/estimators/linear_test.py | 4 | 59870 | # 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 |
edhuckle/statsmodels | tools/hash_funcs.py | 27 | 1305 | """
A collection of utilities to see if new ReST files need to be automatically
generated from certain files in the project (examples, datasets).
"""
import os
from statsmodels.compat import cPickle
file_path = os.path.dirname(__file__)
def get_hash(f):
"""
Gets hexadmecimal md5 hash of a string
"""
i... | bsd-3-clause |
harshaneelhg/scikit-learn | benchmarks/bench_covertype.py | 153 | 7296 | """
===========================
Covertype dataset benchmark
===========================
Benchmark stochastic gradient descent (SGD), Liblinear, and Naive Bayes, CART
(decision tree), RandomForest and Extra-Trees on the forest covertype dataset
of Blackard, Jock, and Dean [1]. The dataset comprises 581,012 samples. It ... | bsd-3-clause |
justincassidy/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 |
Lawrence-Liu/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 |
justincassidy/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 |
justincassidy/scikit-learn | examples/tree/plot_tree_regression_multioutput.py | 205 | 1800 | """
===================================================================
Multi-output Decision Tree Regression
===================================================================
An example to illustrate multi-output regression with decision tree.
The :ref:`decision trees <tree>`
is used to predict simultaneously the ... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.