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 |
|---|---|---|---|---|---|
justincassidy/scikit-learn | sklearn/tree/tests/test_export.py | 130 | 9950 | """
Testing for export functions of decision trees (sklearn.tree.export).
"""
from re import finditer
from numpy.testing import assert_equal
from nose.tools import assert_raises
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
from sklearn.ensemble import GradientBoostingClassifier
from sklearn... | bsd-3-clause |
justincassidy/scikit-learn | sklearn/utils/class_weight.py | 139 | 7206 | # Authors: Andreas Mueller
# Manoj Kumar
# License: BSD 3 clause
import warnings
import numpy as np
from ..externals import six
from ..utils.fixes import in1d
from .fixes import bincount
def compute_class_weight(class_weight, classes, y):
"""Estimate class weights for unbalanced datasets.
Paramete... | bsd-3-clause |
PiscesDream/Ideas | ML/co-evaluate/ann.py | 1 | 7314 | '''
update:
2014/09/03:
softmax in the last layer
special:
plot, plot_interval
'''
import theano
import theano.tensor as T
import gzip
import cPickle
import numpy
import time
class HiddenLayer(object):
def __init__(self, rng, input, n_in, n_out, W=None, b=None,
... | apache-2.0 |
y3ah/Sentiment_Categorization | source/feature_extraction.py | 1 | 2145 | #-*- coding: utf-8 -*-
#feature_extraction.py
import codecs
import numpy
numpy.set_printoptions(threshold=numpy.inf)
from sklearn.feature_extraction.text import CountVectorizer
#from sklearn.preprocessing import normalize
from sklearn.feature_extraction.text import TfidfTransformer
#从文件读入语料
def feature_... | mit |
rmaestre/SVM-mapreduce | SVM-training.py | 1 | 2742 | # -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
from sklearn import svm
from sklearn import cross_validation
import numpy as np
import matplotlib.pyplot as plt
# <codecell>
def array_to_file(vectors, filename):
f_out = open(filename, "w")
if len(vectors.shape) == 2:
for vector in vec... | apache-2.0 |
graingert/luigi | luigi/contrib/bigquery.py | 18 | 13975 | # -*- coding: utf-8 -*-
#
# Copyright 2015 Twitter Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | apache-2.0 |
weissercn/learningml | learningml/GoF/optimisation_and_evaluation/automatisation_gaussian_same_projection/automatisation_Gaussian_same_projection_optimisation_and_evaluation_euclidean.py | 1 | 3583 | import numpy as np
import math
import sys
import os
sys.path.insert(0,os.environ['learningml']+'/GoF/')
import classifier_eval
from classifier_eval import name_to_nclf, nclf, experiment, make_keras_model
from sklearn import tree
from sklearn.ensemble import AdaBoostClassifier
from sklearn.svm import SVC
from rep.estim... | mit |
msimacek/samba | third_party/dnspython/dns/zone.py | 47 | 32039 | # 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 |
Laurawly/tvm-1 | python/tvm/relay/frontend/pytorch.py | 1 | 148541 | # 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 |
Laurawly/tvm-1 | python/tvm/relay/frontend/onnx.py | 1 | 190047 | # 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 |
thientu/scikit-learn | benchmarks/bench_plot_parallel_pairwise.py | 295 | 1247 | # Author: Mathieu Blondel <mathieu@mblondel.org>
# License: BSD 3 clause
import time
import pylab as pl
from sklearn.utils import check_random_state
from sklearn.metrics.pairwise import pairwise_distances
from sklearn.metrics.pairwise import pairwise_kernels
def plot(func):
random_state = check_random_state(0)
... | bsd-3-clause |
szagoruyko/pyinn | test/benchmark.py | 1 | 1957 | import torch
import torch.nn.functional as F
from torch.autograd import Variable
from torch.nn.init import kaiming_normal
from pyinn import conv2d_depthwise
from torchnet.meter import TimeMeter
from torch.backends import cudnn
cudnn.benchmark = True
def mobilenet(depth, width, depthwise_function):
cfg = [64, (128... | mit |
Tatsh-ansible/ansible | lib/ansible/modules/system/beadm.py | 8 | 11657 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, Adam Števko <adam.stevko@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.0',
... | gpl-3.0 |
weinitom/robot | attention_tracker/dlib-18.18/python_examples/train_shape_predictor.py | 10 | 5998 | #!/usr/bin/python
# The contents of this file are in the public domain. See LICENSE_FOR_EXAMPLE_PROGRAMS.txt
#
# This example program shows how to use dlib's implementation of the paper:
# One Millisecond Face Alignment with an Ensemble of Regression Trees by
# Vahid Kazemi and Josephine Sullivan, CVPR 2014
#
# ... | bsd-3-clause |
Fireblend/scikit-learn | sklearn/preprocessing/__init__.py | 265 | 1319 | """
The :mod:`sklearn.preprocessing` module includes scaling, centering,
normalization, binarization and imputation methods.
"""
from ._function_transformer import FunctionTransformer
from .data import Binarizer
from .data import KernelCenterer
from .data import MinMaxScaler
from .data import MaxAbsScaler
from .data ... | bsd-3-clause |
thientu/scikit-learn | benchmarks/bench_lasso.py | 295 | 3305 | """
Benchmarks of Lasso vs LassoLars
First, we fix a training set and increase the number of
samples. Then we plot the computation time as function of
the number of samples.
In the second benchmark, we increase the number of dimensions of the
training set. Then we plot the computation time as function of
the number o... | bsd-3-clause |
ningchi/scikit-learn | benchmarks/bench_glm.py | 295 | 1493 | """
A comparison of different methods in GLM
Data comes from a random square matrix.
"""
from datetime import datetime
import numpy as np
from sklearn import linear_model
from sklearn.utils.bench import total_seconds
if __name__ == '__main__':
import pylab as pl
n_iter = 40
time_ridge = np.empty(n_it... | bsd-3-clause |
CenterForOpenScience/osf.io | addons/dataverse/routes.py | 25 | 2739 | from framework.routing import Rule, json_renderer
from . import views
api_routes = {
'rules': [
Rule(
'/settings/dataverse/',
'get',
views.dataverse_user_config_get,
json_renderer,
),
Rule(
'/settings/dataverse/accounts/',
... | apache-2.0 |
ningchi/scikit-learn | examples/text/document_clustering.py | 31 | 8036 | """
=======================================
Clustering text documents using k-means
=======================================
This is an example showing how the scikit-learn can be used to cluster
documents by topics using a bag-of-words approach. This example uses
a scipy.sparse matrix to store the features instead of ... | bsd-3-clause |
Fireblend/scikit-learn | examples/cluster/plot_mean_shift.py | 348 | 1793 | """
=============================================
A demo of the mean-shift clustering algorithm
=============================================
Reference:
Dorin Comaniciu and Peter Meer, "Mean Shift: A robust approach toward
feature space analysis". IEEE Transactions on Pattern Analysis and
Machine Intelligence. 2002. ... | bsd-3-clause |
Nehoroshiy/multi_classifier | recommender_test/recommend_test.py | 1 | 3816 | """
2015-2016 Constantine Belev const.belev@ya.ru
"""
import fileinput
import sys
from collections import namedtuple
import numpy as np
import pandas as pd
import scipy as sp
from pandas.io.common import ZipFile
from scipy import sparse
from manopt.approximator import cg
if sys.version_info[0] < 3:
pass
else:
... | mit |
DistrictDataLabs/yellowbrick | yellowbrick/datasets/signature.py | 1 | 1179 | # yellowbrick.datasets.signature
# Performs SHA 256 hashing of a file for dataset archive verification.
#
# Author: Benjamin Bengfort
# Created: Tue Jul 31 14:18:11 2018 -0400
#
# Copyright (C) 2018 The scikit-yb developers
# For license information, see LICENSE.txt
#
# ID: signature.py [7082742] benjamin@bengfort.com... | apache-2.0 |
woobe/h2o | py/testdir_multi_jvm/test_rf_libsvm_fvec.py | 1 | 3501 | import unittest
import random, sys, time, os
sys.path.extend(['.','..','py'])
import h2o, h2o_cmd, h2o_hosts, h2o_browse as h2b, h2o_import as h2i
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
global SEED, localhost
... | apache-2.0 |
siavooshpayandehazad/SoCDep2 | src/main/python/ConfigAndPackages/PackageFile.py | 2 | 2984 | # Copyright (C) 2015 Siavoosh Payandeh Azad
################################################
# Internal Variables
################################################
LoGDirectory = "LOGS"
################################################
# Turn Model Sets
################################################
F... | gpl-2.0 |
QianruZhou333/ASleep | my_importData_0_small.py | 2 | 1600 | import numpy as np
import pandas as pd
input_file = "0_floor.csv"
# comma delimited is the default
df = pd.read_csv(input_file, header = 0)
# for space delimited use:
# df = pd.read_csv(input_file, header = 0, delimiter = " ")
# for tab delimited use:
# df = pd.read_csv(input_file, header = 0, delimiter = "\t")
# ... | apache-2.0 |
Akshay0724/scikit-learn | examples/plot_multioutput_face_completion.py | 73 | 2986 | """
==============================================
Face completion with a multi-output estimators
==============================================
This example shows the use of multi-output estimator to complete images.
The goal is to predict the lower half of a face given its upper half.
The first column of images sho... | bsd-3-clause |
jmargeta/scikit-learn | examples/applications/wikipedia_principal_eigenvector.py | 4 | 7744 | """
===============================
Wikipedia principal eigenvector
===============================
A classical way to assert the relative importance of vertices in a
graph is to compute the principal eigenvector of the adjacency matrix
so as to assign to each vertex the values of the components of the first
eigenvect... | bsd-3-clause |
Akshay0724/scikit-learn | sklearn/tests/test_pipeline.py | 13 | 31148 | """
Test the pipeline module.
"""
from tempfile import mkdtemp
import shutil
import time
import numpy as np
from scipy import sparse
from sklearn.externals.six.moves import zip
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_raises_regex
from sklearn.utils.testing import asse... | bsd-3-clause |
thientu/scikit-learn | examples/preprocessing/plot_robust_scaling.py | 220 | 2702 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Robust Scaling on Toy Data
=========================================================
Making sure that each Feature has approximately the same scale can be a
crucial preprocessing step. However, when data contains o... | bsd-3-clause |
ningchi/scikit-learn | examples/decomposition/plot_incremental_pca.py | 243 | 1878 | """
===============
Incremental PCA
===============
Incremental principal component analysis (IPCA) is typically used as a
replacement for principal component analysis (PCA) when the dataset to be
decomposed is too large to fit in memory. IPCA builds a low-rank approximation
for the input data using an amount of memo... | bsd-3-clause |
Fireblend/scikit-learn | examples/preprocessing/plot_robust_scaling.py | 220 | 2702 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Robust Scaling on Toy Data
=========================================================
Making sure that each Feature has approximately the same scale can be a
crucial preprocessing step. However, when data contains o... | bsd-3-clause |
abinit/abinit | scripts/post_processing/phondisp2abi.py | 1 | 4163 | #! /usr/bin/python
# Copyright (C) 2010-2021 ABINIT group
#
# Written by Matthieu Verstraete in python (compatible v1.9).
# This is free software, and you are welcome to redistribute it
# under certain conditions (GNU General Public License,
# see ~abinit/COPYING or http://www.gnu.org/copyleft/gpl.txt).... | gpl-3.0 |
thientu/scikit-learn | sklearn/linear_model/ridge.py | 60 | 44642 | """
Ridge regression
"""
# Author: Mathieu Blondel <mathieu@mblondel.org>
# Reuben Fletcher-Costin <reuben.fletchercostin@gmail.com>
# Fabian Pedregosa <fabian@fseoane.net>
# Michael Eickenberg <michael.eickenberg@nsup.org>
# License: BSD 3 clause
from abc import ABCMeta, abstractmethod
impor... | bsd-3-clause |
Akshay0724/scikit-learn | sklearn/grid_search.py | 16 | 40213 | """
The :mod:`sklearn.grid_search` includes utilities to fine-tune the parameters
of an estimator.
"""
from __future__ import print_function
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>,
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# ... | bsd-3-clause |
Akshay0724/scikit-learn | examples/ensemble/plot_gradient_boosting_regularization.py | 352 | 2843 | """
================================
Gradient Boosting regularization
================================
Illustration of the effect of different regularization strategies
for Gradient Boosting. The example is taken from Hastie et al 2009.
The loss function used is binomial deviance. Regularization via
shrinkage (``lear... | bsd-3-clause |
thientu/scikit-learn | examples/ensemble/plot_gradient_boosting_regularization.py | 352 | 2843 | """
================================
Gradient Boosting regularization
================================
Illustration of the effect of different regularization strategies
for Gradient Boosting. The example is taken from Hastie et al 2009.
The loss function used is binomial deviance. Regularization via
shrinkage (``lear... | bsd-3-clause |
thientu/scikit-learn | sklearn/tests/test_kernel_approximation.py | 242 | 7588 | import numpy as np
from scipy.sparse import csr_matrix
from sklearn.utils.testing import assert_array_equal, assert_equal, assert_true
from sklearn.utils.testing import assert_not_equal
from sklearn.utils.testing import assert_array_almost_equal, assert_raises
from sklearn.utils.testing import assert_less_equal
from ... | bsd-3-clause |
RecipeML/Recipe | recipe/preprocessors/selectFdr.py | 1 | 1286 | # -*- coding: utf-8 -*-
"""
Copyright 2016 Walter José and Alex de Sá
This file is part of the RECIPE Algorithm.
The RECIPE 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 (a... | gpl-3.0 |
DistrictDataLabs/yellowbrick | setup.py | 1 | 5534 | #!/usr/bin/env python
# setup
# Setup script for installing yellowbrick
#
# Author: Benjamin Bengfort
# Created: Wed May 18 14:33:26 2016 -0400
#
# Copyright (C) 2016 The scikit-yb developers
# For license information, see LICENSE.txt and NOTICE.md
#
# ID: setup.py [c4f3ba7] benjamin@bengfort.com $
"""
Setup script... | apache-2.0 |
gem-pasteur/macsyfinder | macsypy/scripts/macsyfinder.py | 1 | 57734 | #########################################################################
# MacSyFinder - Detection of macromolecular systems in protein dataset #
# using systems modelling and similarity search. #
# Authors: Sophie Abby, Bertrand Neron #
# Copyright (c) 2014-202... | gpl-3.0 |
NickC1/skCCM | skccm/paper.py | 2 | 9583 | #
# Data for analyzing causality.
# By Nick Cortale
#
# Classes:
# ccm
# embed
#
# Paper:
# Detecting Causality in Complex Ecosystems
# George Sugihara et al. 2012
#
# Thanks to Kenneth Ells and Dylan McNamara
#
# Notes:
# Originally I thought this can be made way faster by only calculting the
# distances once and t... | mit |
laszlocsomor/tensorflow | tensorflow/contrib/data/python/kernel_tests/sequence_dataset_op_test.py | 17 | 11073 | # 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 |
scr4t/rep | rep/report/regression.py | 3 | 5566 | """
This file contains report class for regression estimators. Report includes:
* features scatter plots, correlations
* learning curve
* feature importance
* feature importance by shuffling the feature column
All methods return objects, which can have plot method (details see in :class:`rep.plotting`... | apache-2.0 |
Y-oHr-N/DocumentFilter | gbssl/laplacian_rls.py | 2 | 3601 | import numpy as np
import scipy.sparse as sp
import scipy.linalg as LA
from sklearn.base import BaseEstimator
from sklearn.metrics.pairwise import rbf_kernel
from .base import MRBinaryClassifierMixin
from .multiclass import SemiSupervisedOneVsRestClassifier
class Bi... | mit |
thientu/scikit-learn | examples/model_selection/plot_roc.py | 96 | 4487 | """
=======================================
Receiver Operating Characteristic (ROC)
=======================================
Example of Receiver Operating Characteristic (ROC) metric to evaluate
classifier output quality.
ROC curves typically feature true positive rate on the Y axis, and false
positive rate on the X a... | bsd-3-clause |
Fireblend/scikit-learn | examples/model_selection/plot_roc.py | 96 | 4487 | """
=======================================
Receiver Operating Characteristic (ROC)
=======================================
Example of Receiver Operating Characteristic (ROC) metric to evaluate
classifier output quality.
ROC curves typically feature true positive rate on the Y axis, and false
positive rate on the X a... | bsd-3-clause |
teknix/namebench | nb_third_party/dns/rrset.py | 215 | 5866 | # Copyright (C) 2003-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 |
jmargeta/scikit-learn | examples/cluster/plot_lena_compress.py | 4 | 2193 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Vector Quantization Example
=========================================================
The classic image processing example, Lena, an 8-bit grayscale
bit-depth, 512 x 512 sized image, is used here to illustrate
how `... | bsd-3-clause |
woobe/h2o | R/tests/autoGen/makeTestTasks.py | 11 | 2537 | ##
# Create the 'tasks' file
# Each line of tasks contains parameters for building the RUnit
##
import json
from GenUtils import *
def genTasks():
jsondata = open('./smalldata.json')
data = json.load(jsondata)
jsondata.close()
tasks = open('./tasks', 'wb')
for FU in ['[','<','<=','>','>=... | apache-2.0 |
thientu/scikit-learn | sklearn/metrics/tests/test_pairwise.py | 71 | 25104 | import numpy as np
from numpy import linalg
from scipy.sparse import dok_matrix, csr_matrix, issparse
from scipy.spatial.distance import cosine, cityblock, minkowski, wminkowski
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing impo... | bsd-3-clause |
jmargeta/scikit-learn | sklearn/cluster/tests/test_dbscan.py | 6 | 2901 | """
Tests for DBSCAN clustering algorithm
"""
import pickle
import numpy as np
from scipy.spatial import distance
from sklearn.utils.testing import assert_equal
from sklearn.cluster.dbscan_ import DBSCAN, dbscan
from .common import generate_clustered_data
n_clusters = 3
X = generate_clustered_data(n_clusters=n_clu... | bsd-3-clause |
axbaretto/beam | sdks/python/.tox/lint/lib/python2.7/site-packages/unit_tests/test_client.py | 4 | 22674 | # Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 |
jmargeta/scikit-learn | sklearn/linear_model/tests/test_passive_aggressive.py | 31 | 6147 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_array_almost_equal, assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.base import ClassifierMixin
from skle... | bsd-3-clause |
thientu/scikit-learn | examples/cluster/plot_feature_agglomeration_vs_univariate_selection.py | 217 | 3893 | """
==============================================
Feature agglomeration vs. univariate selection
==============================================
This example compares 2 dimensionality reduction strategies:
- univariate feature selection with Anova
- feature agglomeration with Ward hierarchical clustering
Both metho... | bsd-3-clause |
ningchi/scikit-learn | sklearn/metrics/cluster/bicluster.py | 25 | 2741 | from __future__ import division
import numpy as np
from sklearn.utils.linear_assignment_ import linear_assignment
from sklearn.utils.validation import check_consistent_length, check_array
__all__ = ["consensus_score"]
def _check_rows_and_columns(a, b):
"""Unpacks the row and column arrays and checks their shap... | bsd-3-clause |
laszlocsomor/tensorflow | tensorflow/examples/tutorials/estimators/abalone.py | 73 | 6176 | # 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 |
DistrictDataLabs/yellowbrick | tests/test_regressor/test_prediction_error.py | 1 | 11623 | # tests.test_regressor.test_prediction_error
# Ensure that the regressor prediction error visualization works.
#
# Author: Rebecca Bilbro
# Author: Benjamin Bengfort
# Created: Sat Oct 8 16:30:39 2016 -0400
#
# Copyright (C) 2016 The scikit-yb developers
# For license information, see LICENSE.txt
#
# ID: test_pred... | apache-2.0 |
PeterPetrik/QGIS | python/plugins/processing/algs/gdal/translate.py | 35 | 7382 | # -*- coding: utf-8 -*-
"""
***************************************************************************
translate.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*****************************... | gpl-2.0 |
MasX/kille | src/kille.py | 1 | 20357 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
import rospy
import sys
import cv2
import cv2.cv as cv
from sensor_msgs.msg import Image
from std_msgs.msg import String
from cv_bridge import CvBridge, CvBridgeError
import numpy as np
import codecs
import collections
import random
from sklearn import svm, featur... | bsd-2-clause |
ningchi/scikit-learn | sklearn/svm/base.py | 12 | 33517 | 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
from ..preprocessing import LabelEncoder
from ..utils import check_ar... | bsd-3-clause |
DistrictDataLabs/yellowbrick | yellowbrick/datasets/path.py | 1 | 7888 | # yellowbrick.datasets.path
# Helper functions for looking up dataset paths.
#
# Author: Benjamin Bengfort
# Created: Thu Jul 26 14:10:51 2018 -0400
#
# Copyright (C) 2018 The scikit-yb developers
# For license information, see LICENSE.txt
#
# ID: path.py [7082742] benjamin@bengfort.com $
"""
Helper functions for loo... | apache-2.0 |
openconnectome/ndio | ndio/remote/metadata.py | 2 | 7027 | from __future__ import absolute_import
import ndio
import requests
import os
import numpy
from io import BytesIO
import zlib
import tempfile
import blosc
import h5py
from .remote_utils import remote_utils
from .Remote import Remote
from .errors import *
import ndio.ramon as ramon
from six.moves import range
import six... | apache-2.0 |
ivankreso/stereo-vision | scripts/run_sgm_batch_sunando_sengupta.py | 1 | 3239 | #!/usr/bin/python
import os
import subprocess
from os.path import isfile, join
# KITTI 02
#start_num = 0
#stop_num = 4660
#frame_step = 1
#left_prefix = "/image_0/"
#right_prefix = "/image_1/"
#left_suffix = ".png"
#right_suffix = ".png"
#out_fname = "kitti_02_lst.xml"
#start_num = 0
##stop_num = 1100
#frame_step = 1... | bsd-3-clause |
thientu/scikit-learn | examples/svm/plot_iris.py | 223 | 3252 | """
==================================================
Plot different SVM classifiers in the iris dataset
==================================================
Comparison of different linear SVM classifiers on a 2D projection of the iris
dataset. We only consider the first 2 features of this dataset:
- Sepal length
- Se... | bsd-3-clause |
Fireblend/scikit-learn | examples/svm/plot_iris.py | 223 | 3252 | """
==================================================
Plot different SVM classifiers in the iris dataset
==================================================
Comparison of different linear SVM classifiers on a 2D projection of the iris
dataset. We only consider the first 2 features of this dataset:
- Sepal length
- Se... | bsd-3-clause |
thientu/scikit-learn | examples/linear_model/plot_sgd_penalties.py | 248 | 1563 | """
==============
SGD: Penalties
==============
Plot the contours of the three penalties.
All of the above are supported by
:class:`sklearn.linear_model.stochastic_gradient`.
"""
from __future__ import division
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
def l1(xs):
return np.array([np.... | bsd-3-clause |
thientu/scikit-learn | examples/model_selection/plot_confusion_matrix.py | 243 | 2496 | """
================
Confusion matrix
================
Example of confusion matrix usage to evaluate the quality
of the output of a classifier on the iris data set. The
diagonal elements represent the number of points for which
the predicted label is equal to the true label, while
off-diagonal elements are those that ... | bsd-3-clause |
ningchi/scikit-learn | sklearn/linear_model/tests/test_ridge.py | 14 | 20805 | import numpy as np
import scipy.sparse as sp
from scipy import linalg
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_a... | bsd-3-clause |
siavooshpayandehazad/SoCDep2 | src/main/python/SystemHealthMonitoring/FaultClassifier/ML.py | 2 | 6439 | # Copyright (C) 2015 Rene Pihlak
# import numpy as np
import collections
import matplotlib.pyplot as plt
from sklearn import svm
from sklearn.neighbors import KNeighborsClassifier
from sklearn.tree import DecisionTreeClassifier
import matplotlib.animation as animation
def updatefig(*args):
global index, new_data... | gpl-2.0 |
woobe/h2o | py/testdir_multi_jvm/test_rf_mnist_fvec.py | 1 | 6526 | import unittest
import random, sys, time, re
sys.path.extend(['.','..','py'])
import h2o, h2o_cmd, h2o_hosts, h2o_browse as h2b, h2o_import as h2i, h2o_glm, h2o_util, h2o_rf, h2o_jobs
DO_POLL = False
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
de... | apache-2.0 |
otadmor/Open-Knesset | laws/tags/build_important_keyword_html.py | 1 | 8719 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import numpy
import numpy as np
import re
from functools import partial
from sklearn.externals import joblib
import cPickle as pickle
from collections import defaultdict
lb = pickle.load(open("classifier_data/label_binarizer.pkl", "rb"))
keywords, data = pickle.load(open('histo... | bsd-3-clause |
RecipeML/Recipe | recipe/preprocessors/percentile.py | 1 | 1328 | # -*- coding: utf-8 -*-
"""
Copyright 2016 Walter José and Alex de Sá
This file is part of the RECIPE Algorithm.
The RECIPE 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 (a... | gpl-3.0 |
jmargeta/scikit-learn | examples/svm/plot_custom_kernel.py | 4 | 1524 | """
======================
SVM with custom kernel
======================
Simple usage of Support Vector Machines to classify a sample. It will
plot the decision surface and the support vectors.
"""
print(__doc__)
import numpy as np
import pylab as pl
from sklearn import svm, datasets
# import some data to play with... | bsd-3-clause |
fizz-ml/policybandit | trainer.py | 1 | 3859 | import torch as t
from torch.autograd import Variable as V
from torch import FloatTensor as FT
import numpy as np
from bayestorch.hmc import HMCSampler
class SimpleTrainer:
def __init__(self, env,critic,hallucinator,policy_buffer,policy_c, noise_dim):
self.env = env
self.hallucinator = hallucinator... | mit |
laszlocsomor/tensorflow | tensorflow/contrib/learn/python/learn/datasets/text_datasets.py | 122 | 2703 | # 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 |
ningchi/scikit-learn | examples/neighbors/plot_approximate_nearest_neighbors_hyperparameters.py | 226 | 5170 | """
=================================================
Hyper-parameters of Approximate Nearest Neighbors
=================================================
This example demonstrates the behaviour of the
accuracy of the nearest neighbor queries of Locality Sensitive Hashing
Forest as the number of candidates and the numb... | bsd-3-clause |
Fireblend/scikit-learn | examples/neighbors/plot_approximate_nearest_neighbors_hyperparameters.py | 226 | 5170 | """
=================================================
Hyper-parameters of Approximate Nearest Neighbors
=================================================
This example demonstrates the behaviour of the
accuracy of the nearest neighbor queries of Locality Sensitive Hashing
Forest as the number of candidates and the numb... | bsd-3-clause |
jmargeta/scikit-learn | sklearn/decomposition/tests/test_dict_learning.py | 8 | 7108 | import numpy as np
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import SkipTest
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_less
from ... | bsd-3-clause |
DistrictDataLabs/yellowbrick | tests/test_model_selection/test_rfecv.py | 1 | 6509 | # tests.test_model_selection.test_rfecv
# Tests for the RFECV visualizer
#
# Author: Benjamin Bengfort
# Created: Tue Apr 03 17:35:16 2018 -0400
#
# Copyright (C) 2018 The scikit-yb developers
# For license information, see LICENSE.txt
#
# ID: test_rfecv.py [a4599db] rebeccabilbro@users.noreply.github.com $
"""
Tests... | apache-2.0 |
DistrictDataLabs/yellowbrick | yellowbrick/pipeline.py | 1 | 4075 | # yellowbrick.pipeline
# Implements a visual pipeline that subclasses Scikit-Learn pipelines.
#
# Author: Benjamin Bengfort
# Created: Fri Oct 07 21:41:06 2016 -0400
#
# Copyright (C) 2016 The sckit-yb developers
# For license information, see LICENSE.txt
#
# ID: pipeline.py [1efae1f] benjamin@bengfort.com $
"""
Im... | apache-2.0 |
linrio/WhetherOrNotMe | testme.py | 1 | 2028 | # -*- coding utf-8 -*-
import cv2
import os
import numpy as np
from sklearn.model_selection import train_test_split
import random
import tensorflow as tf
def read_data(img_path, image_h = 64, image_w = 64):
image_data = []
label_data = []
image = cv2.imread(img_path)
#cv2.namedWindow("Image... | apache-2.0 |
msimacek/samba | third_party/dnspython/examples/zonediff.py | 79 | 10711 | #!/usr/bin/env python
#
# Small library and commandline tool to do logical diffs of zonefiles
# ./zonediff -h gives you help output
#
# Requires dnspython to do all the heavy lifting
#
# (c)2009 Dennis Kaarsemaker <dennis@kaarsemaker.net>
#
# Permission to use, copy, modify, and distribute this software and its
# docu... | gpl-3.0 |
woobe/h2o | py/testdir_ec2/test_rf_covtype.py | 2 | 2590 | import unittest, time, sys
sys.path.extend(['.','..','py'])
import h2o, h2o_cmd, h2o_hosts, h2o_rf
# RF train parameters
paramsTrainRF = {
'ntree' : 100,
'depth' : 300,
'bin_limit' : 20000,
'stat_type' : 'ENTROPY',
'out_of_bag_error_estimate': 1... | apache-2.0 |
woobe/h2o | py/testdir_single_jvm/test_quant_cols.py | 2 | 6079 | import unittest, random, sys, time, re, getpass
sys.path.extend(['.','..','py'])
import h2o, h2o_cmd, h2o_hosts, h2o_browse as h2b, h2o_import as h2i, h2o_glm, h2o_util
import h2o_print as h2p, h2o_gbm, h2o_summ
DO_PLOT = getpass.getuser()=='kevin'
DO_MEDIAN = False
MAX_QBINS = 1000
MULTI_PASS = 1
class Basic(unittes... | apache-2.0 |
anonymous-ijcai/dsw-ont-ijcai | dswont/util.py | 1 | 3961 | import json
import nltk
import numpy as np
import os
import re
import shutil
from sklearn import metrics
def resource(filename):
"""Returns the absolute path to the resource file."""
current_dir = os.path.join(os.getcwd(), 'dswont')
resource_dir = os.path.join(current_dir, "resources")
return os.path.... | gpl-3.0 |
ningchi/scikit-learn | sklearn/ensemble/tests/test_forest.py | 14 | 34860 | """
Testing for the forest module (sklearn.ensemble.forest).
"""
# Authors: Gilles Louppe,
# Brian Holt,
# Andreas Mueller,
# Arnaud Joly
# License: BSD 3 clause
import pickle
from collections import defaultdict
from itertools import product
import numpy as np
from scipy.sparse import csr_... | bsd-3-clause |
FreekingDean/home-assistant | homeassistant/components/android_ip_webcam/switch.py | 22 | 2732 | """Support for Android IP Webcam settings."""
from homeassistant.components.switch import SwitchEntity
from . import (
CONF_HOST,
CONF_NAME,
CONF_SWITCHES,
DATA_IP_WEBCAM,
ICON_MAP,
KEY_MAP,
AndroidIPCamEntity,
)
async def async_setup_platform(hass, config, async_add_entities, discovery_i... | apache-2.0 |
ai-ku/uwsd | run/mapping.py | 1 | 5901 | #! /usr/bin/python
# -*- coding: utf-8 -*-
__author__ = "Osman Baskaya"
import sys
from collections import defaultdict as dd
import numpy as np
import random
from sklearn.preprocessing import normalize
random.seed(42)
def chunks(l, n):
""" Yield successive n-sized chunks from l. """
for i in xrange(0, len(... | mit |
neurospin/pylearn-epac | epac/sklearn_plugins/estimators.py | 1 | 11147 | """
Estimator wrap ML procedure into EPAC Node. To be EPAC compatible, one should
inherit from BaseNode and implement the "transform" method.
InternalEstimator and LeafEstimator aim to provide automatic wrapper to objects
that implement fit and predict methods.
@author: edouard.duchesnay@cea.fr
@author: jinpeng.li@ce... | bsd-3-clause |
thientu/scikit-learn | sklearn/linear_model/__init__.py | 268 | 3096 | """
The :mod:`sklearn.linear_model` module implements generalized linear models. It
includes Ridge regression, Bayesian Regression, Lasso and Elastic Net
estimators computed with Least Angle Regression and coordinate descent. It also
implements Stochastic Gradient Descent related algorithms.
"""
# See http://scikit-le... | bsd-3-clause |
solashirai/edx-platform | openedx/core/lib/block_structure/tests/test_transformers.py | 7 | 2822 | """
Tests for transformers.py
"""
from mock import MagicMock, patch
from nose.plugins.attrib import attr
from unittest import TestCase
from ..block_structure import BlockStructureModulestoreData
from ..exceptions import TransformerException
from ..transformers import BlockStructureTransformers
from .helpers import (
... | agpl-3.0 |
solashirai/edx-platform | openedx/core/lib/block_structure/tests/test_transformer_registry.py | 14 | 1575 | """
Tests for transformer_registry.py
"""
import ddt
from nose.plugins.attrib import attr
from unittest import TestCase
from ..transformer_registry import TransformerRegistry
from .helpers import MockTransformer, mock_registered_transformers
class TestTransformer1(MockTransformer):
"""
1st test instance of ... | agpl-3.0 |
Akshay0724/scikit-learn | sklearn/feature_selection/tests/test_feature_select.py | 43 | 26651 | """
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 numpy.testing import run_module_suite
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from... | bsd-3-clause |
Akshay0724/scikit-learn | sklearn/model_selection/tests/test_split.py | 12 | 47658 | """Test the split module"""
from __future__ import division
import warnings
import numpy as np
from scipy.sparse import coo_matrix, csc_matrix, csr_matrix
from scipy import stats
from scipy.misc import comb
from itertools import combinations
from itertools import combinations_with_replacement
from sklearn.utils.testi... | bsd-3-clause |
ales-erjavec/orange | Orange/OrangeWidgets/Regression/OWRegressionTreeViewer2D.py | 6 | 13173 | """
<name> Regression Tree Graph</name>
<description>Regression tree viewer (graph view).</description>
<icon>icons/RegressionTreeGraph.svg</icon>
<contact>Ales Erjavec (ales.erjavec(@at@)fri.uni-lj.si)</contact>
<priority>2110</priority>
"""
from OWTreeViewer2D import *
import re
import Orange
class RegressionTreeNo... | gpl-3.0 |
thientu/scikit-learn | sklearn/feature_extraction/text.py | 110 | 50157 | # -*- coding: utf-8 -*-
# Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Lars Buitinck <L.J.Buitinck@uva.nl>
# Robert Layton <robertlayton@gmail.com>
# Jochen Wersdörfer <jochen@wersdoerfer.de>
# Roman Sinayev <roman.sinayev@gma... | bsd-3-clause |
thientu/scikit-learn | sklearn/linear_model/tests/test_sgd.py | 68 | 43439 | import pickle
import unittest
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing ... | bsd-3-clause |
woobe/h2o | py/testdir_multi_jvm/test_import_covtype_parse_3jvm_fvec.py | 1 | 1632 | import unittest, sys, random, time
sys.path.extend(['.','..','py'])
import h2o, h2o_browse as h2b, h2o_import as h2i, h2o_hosts
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
pass
print "Will build clouds with in... | apache-2.0 |
ningchi/scikit-learn | sklearn/kernel_approximation.py | 18 | 17705 | """
The :mod:`sklearn.kernel_approximation` module implements several
approximate kernel feature maps base on Fourier transforms.
"""
# Author: Andreas Mueller <amueller@ais.uni-bonn.de>
#
# License: BSD 3 clause
import warnings
import numpy as np
import scipy.sparse as sp
from scipy.linalg import svd
from .base im... | bsd-3-clause |
ningchi/scikit-learn | examples/cluster/plot_color_quantization.py | 295 | 3443 | # -*- coding: utf-8 -*-
"""
==================================
Color Quantization using K-Means
==================================
Performs a pixel-wise Vector Quantization (VQ) of an image of the summer palace
(China), reducing the number of colors required to show the image from 96,615
unique colors to 64, while pre... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.