repo_name
stringlengths
6
67
path
stringlengths
5
185
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
1.02k
962k
license
stringclasses
15 values
crazy-cat/incubator-mxnet
example/autoencoder/data.py
27
1272
# 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
ssaeger/scikit-learn
examples/neural_networks/plot_mnist_filters.py
57
2195
""" ===================================== Visualization of MLP weights on MNIST ===================================== Sometimes looking at the learned coefficients of a neural network can provide insight into the learning behavior. For example if weights look unstructured, maybe some were not used at all, or if very l...
bsd-3-clause
flightgong/scikit-learn
sklearn/gaussian_process/tests/test_gaussian_process.py
3
5073
""" Testing for Gaussian Process module (sklearn.gaussian_process) """ # Author: Vincent Dubourg <vincent.dubourg@gmail.com> # Licence: BSD 3 clause from nose.tools import raises from nose.tools import assert_true import numpy as np from sklearn.gaussian_process import GaussianProcess from sklearn.gaussian_process ...
bsd-3-clause
siou83/trading-with-python
spreadApp/makeDist.py
77
1720
from distutils.core import setup import py2exe manifest_template = ''' <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity version="5.0.0.0" processorArchitecture="x86" name="%(prog)s" type="win32"...
bsd-3-clause
ChristophSchranz/ecg_via_raspberrypi
basic-ecg.py
1
3093
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import time # import the module called "time" # import the grafic-module as plt import matplotlib.pyplot as plt import RPi.GPIO as GPIO # import GPIO to use the Pins # set the sample rate (measurements per seconds) # and its duration sample_rate = 200 duration = 3 ...
gpl-3.0
tammoippen/nest-simulator
topology/doc/user_manual_scripts/connections.py
8
18562
# -*- coding: utf-8 -*- # # connections.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or...
gpl-2.0
murali-munna/scikit-learn
examples/plot_kernel_ridge_regression.py
230
6222
""" ============================================= Comparison of kernel ridge regression and SVR ============================================= Both kernel ridge regression (KRR) and SVR learn a non-linear function by employing the kernel trick, i.e., they learn a linear function in the space induced by the respective k...
bsd-3-clause
strongh/GPy
GPy/core/parameterization/priors.py
2
26352
# Copyright (c) 2012 - 2014, GPy authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) import numpy as np from scipy.special import gammaln, digamma from ...util.linalg import pdinv from domains import _REAL, _POSITIVE import warnings import weakref class Prior(object): domain =...
bsd-3-clause
basilfx/RIOT
tests/pkg_tensorflow-lite/mnist/generate_digit.py
19
1164
#!/usr/bin/env python3 """Generate a binary file from a sample image of the MNIST dataset. Pixel of the sample are stored as float32, images have size 28x28. """ import os import argparse import numpy as np import matplotlib.pyplot as plt from tensorflow.keras.datasets import mnist SCRIPT_DIR = os.path.dirname(os....
lgpl-2.1
clemkoa/scikit-learn
sklearn/ensemble/tests/test_voting_classifier.py
15
17696
"""Testing for the VotingClassifier""" import numpy as np from sklearn.utils.testing import assert_almost_equal, assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal, assert_true, assert_false from sklearn.utils.testing import assert_raise_messag...
bsd-3-clause
pratapvardhan/scikit-learn
examples/cluster/plot_mean_shift.py
351
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
ecrc/girih
scripts/sisc/paper_plot_thread_scaling_naive_out_cache.py
2
6303
#!/usr/bin/env python def main(): import sys raw_data = load_csv(sys.argv[1]) k_l = set() for k in raw_data: k_l.add(get_stencil_num(k)) k_l = list(k_l) # for ts in ['Naive', 'Dynamic-Intra-Diamond'] for k in k_l: for is_dp in [1]: plot_lines(raw_data, k, is_d...
bsd-3-clause
annayqho/TheCannon
code/lamost/tutorial/run_tutorial.py
1
4224
import numpy as np from astropy.table import Table from TheCannon.lamost import load_spectra import matplotlib.pyplot as plt from TheCannon import dataset from TheCannon import model labdir = "/Users/annaho/Github_Repositories/TheCannon/docs/source" data = Table.read("%s/lamost_labels.fits" %labdir) print(data.colname...
mit
fzalkow/scikit-learn
examples/tree/plot_iris.py
271
2186
""" ================================================================ Plot the decision surface of a decision tree on the iris dataset ================================================================ Plot the decision surface of a decision tree trained on pairs of features of the iris dataset. See :ref:`decision tree ...
bsd-3-clause
blueburningcoder/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/projections/geo.py
69
19738
import math import numpy as np import numpy.ma as ma import matplotlib rcParams = matplotlib.rcParams from matplotlib.artist import kwdocd from matplotlib.axes import Axes from matplotlib import cbook from matplotlib.patches import Circle from matplotlib.path import Path from matplotlib.ticker import Formatter, Locat...
agpl-3.0
snurk/meta-strains
scripts/accuracy.py
1
5070
import pandas as pd import numpy as np from collections import Counter from itertools import permutations import networkx as nx def print_edges(edges): print(','.join([str(e) for e in edges])) # Считываем граф # Oставляем только большую компоненту связности G = nx.DiGraph() with open("assembly/K127/prelim_gra...
mit
larsmans/scikit-learn
examples/decomposition/plot_pca_vs_lda.py
182
1743
""" ======================================================= Comparison of LDA and PCA 2D projection of Iris dataset ======================================================= The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour and Virginica) with 4 attributes: sepal length, sepal width, petal length a...
bsd-3-clause
eg-zhang/scikit-learn
benchmarks/bench_plot_lasso_path.py
301
4003
"""Benchmarks of Lasso regularization path computation using Lars and CD The input data is mostly low rank but is a fat infinite tail. """ from __future__ import print_function from collections import defaultdict import gc import sys from time import time import numpy as np from sklearn.linear_model import lars_pat...
bsd-3-clause
arabenjamin/scikit-learn
sklearn/feature_extraction/tests/test_text.py
110
34127
from __future__ import unicode_literals import warnings from sklearn.feature_extraction.text import strip_tags from sklearn.feature_extraction.text import strip_accents_unicode from sklearn.feature_extraction.text import strip_accents_ascii from sklearn.feature_extraction.text import HashingVectorizer from sklearn.fe...
bsd-3-clause
pratapvardhan/scikit-learn
examples/applications/wikipedia_principal_eigenvector.py
16
7821
""" =============================== 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
SpaceKatt/CSPLN
apps/scaffolding/mac/web2py/web2py.app/Contents/Resources/lib/python2.7/matplotlib/axis.py
2
72371
""" Classes for the ticks and x and y axis """ from __future__ import division from matplotlib import rcParams import matplotlib.artist as artist from matplotlib.artist import allow_rasterization import matplotlib.cbook as cbook import matplotlib.font_manager as font_manager import matplotlib.lines as mlines import m...
gpl-3.0
bollu/sandhi
modules/gr36/gr-filter/examples/interpolate.py
13
8584
#!/usr/bin/env python # # Copyright 2009,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio 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, or (at your optio...
gpl-3.0
boomsbloom/dtm-fmri
DTM/for_gensim/lib/python2.7/site-packages/sklearn/learning_curve.py
35
15441
"""Utilities to evaluate models with respect to a variable """ # Author: Alexander Fabisch <afabisch@informatik.uni-bremen.de> # # License: BSD 3 clause import warnings import numpy as np from .base import is_classifier, clone from .cross_validation import check_cv from .externals.joblib import Parallel, delayed fro...
mit
CalebBell/thermo
tests/test_datasheet.py
1
8705
# -*- coding: utf-8 -*- '''Chemical Engineering Design Library (ChEDL). Utilities for process modeling. Copyright (C) 2016, Caleb Bell <Caleb.Andrew.Bell@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal...
mit
readevalprint/zipline
tests/finance/test_slippage.py
3
16080
# # Copyright 2013 Quantopian, 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 wr...
apache-2.0
MPIBGC-TEE/CompartmentalSystems
src/CompartmentalSystems/bins/TsMassFieldsPerTimeStep.py
1
3427
# vim: set ff=unix expandtab ts=4 sw=4: import numpy as np from sympy import latex from .FieldsPerTimeStep import FieldsPerTimeStep from matplotlib import cm import matplotlib.pyplot as plt class TsMassFieldsPerTimeStep(FieldsPerTimeStep): @property def max_number_of_Ts_entries(self): return(max([v.num...
mit
anntzer/scikit-learn
asv_benchmarks/benchmarks/model_selection.py
12
2511
from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import GridSearchCV, cross_val_score from .common import Benchmark, Estimator, Predictor from .datasets import _synth_classification_dataset from .utils import make_gen_classif_scorers class CrossValidationBenchmark(Benchmark): """ ...
bsd-3-clause
jorik041/scikit-learn
examples/mixture/plot_gmm_sin.py
248
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
costypetrisor/scikit-learn
sklearn/cluster/spectral.py
18
18027
# -*- coding: utf-8 -*- """Algorithms for spectral clustering""" # Author: Gael Varoquaux gael.varoquaux@normalesup.org # Brian Cheung # Wei LI <kuantkid@gmail.com> # License: BSD 3 clause import warnings import numpy as np from ..base import BaseEstimator, ClusterMixin from ..utils import check_rand...
bsd-3-clause
johnbachman/ras_model
gxp_exchange.py
6
2587
from rasmodel.scenarios.default import model import numpy as np from matplotlib import pyplot as plt from pysb.integrate import Solver from pysb import * from tbidbaxlipo.util import fitting # Zero out all initial conditions for ic in model.initial_conditions: ic[1].value = 0 KRAS = model.monomers['KRAS'] GDP =...
mit
bsipocz/ginga
ginga/mplw/MplHelp.py
2
2894
# # MplHelp.py -- help classes for Matplotlib drawing # # Eric Jeschke (eric@naoj.org) # # Copyright (c) Eric R. Jeschke. All rights reserved. # This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. from ginga import colors import matplotlib.textpath as textpath ...
bsd-3-clause
tornadoalert/Retinet
models/basic_model.py
1
17510
import os import numpy as np import pandas as p import theano.tensor as T import lasagne as nn from lasagne.layers import dnn from lasagne.nonlinearities import LeakyRectify from layers import ApplyNonlinearity from utils import (oversample_set, get_img_ids_from_dir, softmax, ...
mit
ytsvetko/adjective_supersense_classifier
src/classify.py
1
9656
#!/usr/bin/env python2.7 from __future__ import division from itertools import izip_longest import sys import codecs import argparse import json from sklearn import svm from sklearn import cross_validation from sklearn import ensemble from collections import Counter import numpy as np parser = argparse.ArgumentParser...
gpl-2.0
AkademieOlympia/sympy
sympy/interactive/session.py
43
15119
"""Tools for setting up interactive sessions. """ from __future__ import print_function, division from distutils.version import LooseVersion as V from sympy.core.compatibility import range from sympy.external import import_module from sympy.interactive.printing import init_printing preexec_source = """\ from __futu...
bsd-3-clause
egorburlakov/CrisisModelingPython
Main.py
1
11779
import pandas as pd import numpy as np from os import listdir from os.path import isfile, join import matplotlib.pyplot as plt ################ #Pars ################ dat_types = {"SigCaught" : np.float32, "NSigs" : np.uint8, "NMissedSigs" : np.uint8, "NDecMade" : np.uint8, "CrT" : np.uint16, "NTp" : np.uint8, "NBr" :...
gpl-2.0
lux-jwang/goodoos
drawnetwork.py
1
2393
#! /usr/bin/env python # We probably will need some things from several places import sys # We need to import the graph_tool module itself import numpy as np import matplotlib.pyplot as plt import matplotlib from graph_tool.all import * sys.path.append("./src") from dataset import get_friends_data_index def draw_edge...
mit
koobonil/Boss2D
Boss2D/addon/tensorflow-1.2.1_for_boss/tensorflow/contrib/learn/python/learn/estimators/estimators_test.py
37
5114
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
mit
JohnKendrick/PDielec
PDielec/GUI/AnalysisTab.py
1
21560
import math import numpy as np import PDielec.Calculator as Calculator from PyQt5.QtWidgets import QWidget, QApplication from PyQt5.QtWidgets import QComboBox, QLabel, QLineEdit from PyQt5.QtWidgets import QVBoxLayout, QHBoxLayout, QFormLayout from PyQt5.QtWidgets import QSpinBox, QDoubleSpinBox from PyQt5.QtWi...
mit
rexshihaoren/scikit-learn
sklearn/metrics/scorer.py
211
13141
""" The :mod:`sklearn.metrics.scorer` submodule implements a flexible interface for model selection and evaluation using arbitrary score functions. A scorer object is a callable that can be passed to :class:`sklearn.grid_search.GridSearchCV` or :func:`sklearn.cross_validation.cross_val_score` as the ``scoring`` parame...
bsd-3-clause
yyjiang/scikit-learn
sklearn/decomposition/tests/test_truncated_svd.py
240
6055
"""Test truncated SVD transformer.""" import numpy as np import scipy.sparse as sp from sklearn.decomposition import TruncatedSVD from sklearn.utils import check_random_state from sklearn.utils.testing import (assert_array_almost_equal, assert_equal, assert_raises, assert_greater, ...
bsd-3-clause
daviddesancho/BestMSM
bestmsm/visual_lib.py
1
3173
import sys import math import itertools import numpy as np import networkx as nx import matplotlib.pyplot as plt # Much indebted to Randal Olson (http://www.randalolson.com/) # These are the "Tableau 20" colors as RGB. tableau20 = [(31, 119, 180), (174, 199, 232), (255, 127, 14), (255, 187, 120), (44...
gpl-2.0
eqcorrscan/ci.testing
eqcorrscan/utils/despike.py
1
7758
""" Functions for despiking seismic data. .. warning:: Despike functions are in beta, they do not work that well. .. todo:: Deconvolve spike to remove it, find peaks in the f-domain. :copyright: EQcorrscan developers. :license: GNU Lesser General Public License, Version 3 (https://www.gnu.org/copyleft/l...
lgpl-3.0
0todd0000/spm1d
spm1d/rft1d/examples/paper/fig11_val_cluster.py
1
2030
import numpy as np from scipy import stats from matplotlib import pyplot from spm1d import rft1d eps = np.finfo(float).eps #smallest float ### EPS production preliminaries: fig_width_mm = 100 fig_height_mm = 80 mm2in = 1/25.4 fig_width = fig_width_mm*mm2in # width in inches fig_height = fig_height_m...
gpl-3.0
poryfly/scikit-learn
benchmarks/bench_plot_svd.py
325
2899
"""Benchmarks of Singular Value Decomposition (Exact and Approximate) The data is mostly low rank but is a fat infinite tail. """ import gc from time import time import numpy as np from collections import defaultdict from scipy.linalg import svd from sklearn.utils.extmath import randomized_svd from sklearn.datasets.s...
bsd-3-clause
bmcfee/pescador
docs/conf.py
1
10180
# -*- coding: utf-8 -*- # # pescador documentation build configuration file, created by # sphinx-quickstart on Fri Apr 3 10:03:34 2015. # # 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. # # ...
isc
annapowellsmith/openpresc
openprescribing/frontend/tests/commands/test_import_ppu_savings.py
1
5252
from datetime import date import os from gcutils.bigquery import Client from django.test import TestCase import pandas as pd from mock import patch from frontend import bq_schemas from frontend.management.commands import import_ppu_savings from frontend.models import PPUSaving, PCT, Practice, Chemical class Bigque...
mit
jundongl/scikit-feast
skfeature/function/sparse_learning_based/MCFS.py
3
2089
import scipy import numpy as np from sklearn import linear_model from skfeature.utility.construct_W import construct_W def mcfs(X, n_selected_features, **kwargs): """ This function implements unsupervised feature selection for multi-cluster data. Input ----- X: {numpy array}, shape (n_samples, n_...
gpl-2.0
Zhenxingzhang/kaggle-cdiscount-classification
src/inference/inference_inception_v3_ft.py
1
6742
import os import numpy as np import pandas as pd import tensorflow as tf import csv from src.common import consts from src.data_preparation import dataset from src.models import denseNN from src.common import paths import argparse import yaml from src.training.train_model import neural_model from tensorflow.contrib.sl...
apache-2.0
vidartf/hyperspy
hyperspy/drawing/signal1d.py
1
14204
# -*- coding: utf-8 -*- # Copyright 2007-2016 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...
gpl-3.0
BNIA/tidyall
src/modules/tidydate.py
2
2523
#!/usr/bin/env python # -*- coding: utf-8 -*- """tidydate This file declares and implements the TidyDate class for TidyAll. TidyDate converts and formats valid date columns into ISO 8601 (yyyy-mm-dd). """ import sys from dateutil import parser as date_parser import numpy as np import pandas as pd from .settings im...
mit
atantet/transferLorenz
plot/plotEigValRho.py
1
6587
import os import numpy as np import matplotlib.pyplot as plt import pylibconfig2 import ergoPlot configFile = '../cfg/Lorenz63.cfg' compName1 = 'x' compName2 = 'y' compName3 = 'z' #readSpec = ergoPlot.readSpectrum readSpec = ergoPlot.readSpectrumCompressed cfg = pylibconfig2.Config() cfg.read_file(configFile) L = cf...
gpl-3.0
nomadcube/scikit-learn
sklearn/covariance/tests/test_robust_covariance.py
213
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
jougs/nest-simulator
pynest/examples/BrodyHopfield.py
7
4218
# -*- coding: utf-8 -*- # # BrodyHopfield.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, ...
gpl-2.0
blaisb/cfdemUtilities
graph/contour_demo.py
14
3478
#!/usr/bin/env python """ Illustrate simple contour plotting, contours on an image with a colorbar for the contours, and labelled contours. See also contour_image.py. """ import matplotlib import numpy as np import matplotlib.cm as cm import matplotlib.mlab as mlab import matplotlib.pyplot as plt matplotlib.rcParams[...
lgpl-3.0
jgurtowski/ectools
lengthhist.py
1
1997
#!/usr/bin/env python import sys from operator import attrgetter, itemgetter from itertools import imap import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages import numpy as np from nucio import lineRecordIterator, M4Record, M4RecordTypes, lineI...
bsd-3-clause
blink1073/oct2py
setup.py
1
2074
"""Setup script for oct2py package. """ import glob DISTNAME = 'oct2py' DESCRIPTION = 'Python to GNU Octave bridge --> run m-files from python.' LONG_DESCRIPTION = open('README.rst', 'rb').read().decode('utf-8') MAINTAINER = 'Steven Silvester' MAINTAINER_EMAIL = 'steven.silvester@ieee.org' URL = 'http://githu...
mit
huzq/scikit-learn
examples/ensemble/plot_adaboost_hastie_10_2.py
71
3578
""" ============================= Discrete versus Real AdaBoost ============================= This example is based on Figure 10.2 from Hastie et al 2009 [1]_ and illustrates the difference in performance between the discrete SAMME [2]_ boosting algorithm and real SAMME.R boosting algorithm. Both algorithms are evalua...
bsd-3-clause
tosolveit/scikit-learn
sklearn/metrics/tests/test_classification.py
53
49781
from __future__ import division, print_function import numpy as np from scipy import linalg from functools import partial from itertools import product import warnings from sklearn import datasets from sklearn import svm from sklearn.datasets import make_multilabel_classification from sklearn.preprocessing import la...
bsd-3-clause
hakyimlab/MetaXcan-Postprocess
source/ProcessMetaXcanResultsFolder.py
1
3889
#! /usr/bin/env python __author__ = 'heroico' import os import re import logging import numpy import Gencode import Logging import Utilities import pandas import rpy2.robjects as robjects from rpy2.robjects.packages import importr dplyr = importr('dplyr', on_conflict="warn") #import rpy2.robjects.lib.dplyr as dplyr r...
mit
rneher/FitnessInference
flu/figure_scripts/flu_examples_fig4ab_polarizer.py
1
3665
#!/ebio/ag-neher/share/programs/bin/python2.7 # #makes figure 3ab consisting of 2 trees of year 2007 colored with the prediction #for the external nodes. It also produces a joint tree with the following season #to illustrates the prediction. In the actual figure, the trees are rotated by 90degrees #but without changing...
mit
lail3344/sms-tools
lectures/08-Sound-transformations/plots-code/hps-morph.py
24
2691
# function for doing a morph between two sounds using the hpsModel import numpy as np import matplotlib.pyplot as plt from scipy.signal import get_window import sys, os sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../models/')) sys.path.append(os.path.join(os.path.dirname(os.path.re...
agpl-3.0
fmfn/BayesianOptimization
tests/test_util.py
1
4503
import pytest import numpy as np from bayes_opt import BayesianOptimization from bayes_opt.util import UtilityFunction, Colours from bayes_opt.util import acq_max, load_logs, ensure_rng from sklearn.gaussian_process.kernels import Matern from sklearn.gaussian_process import GaussianProcessRegressor def get_globals(...
mit
ElDeveloper/scikit-learn
examples/svm/plot_weighted_samples.py
95
1943
""" ===================== SVM: Weighted samples ===================== Plot decision function of a weighted dataset, where the size of points is proportional to its weight. The sample weighting rescales the C parameter, which means that the classifier puts more emphasis on getting these points right. The effect might ...
bsd-3-clause
ndingwall/scikit-learn
sklearn/linear_model/tests/test_huber.py
12
7600
# Authors: Manoj Kumar mks542@nyu.edu # License: BSD 3 clause import numpy as np from scipy import optimize, sparse from sklearn.utils._testing import assert_almost_equal from sklearn.utils._testing import assert_array_equal from sklearn.utils._testing import assert_array_almost_equal from sklearn.datasets import ma...
bsd-3-clause
rs2/pandas
pandas/tests/frame/conftest.py
2
8855
from itertools import product import numpy as np import pytest from pandas import DataFrame, NaT, date_range import pandas._testing as tm @pytest.fixture(params=product([True, False], [True, False])) def close_open_fixture(request): return request.param @pytest.fixture def float_frame_with_na(): """ F...
bsd-3-clause
ajribeiro/rtapp
data/ml.py
1
5670
import cPickle import mysql.connector import dbUtils import os import hashlib from sklearn.feature_extraction import FeatureHasher, DictVectorizer def classify(title): with open('data/perceptron.pkl', 'rb') as fid: clf = cPickle.load(fid) (user,pas) = dbUtils.get_user_pass() mydb = dbUtils.db_acc...
mit
ilayn/scipy
scipy/optimize/_lsq/least_squares.py
12
39190
"""Generic interface for least-squares minimization.""" from warnings import warn import numpy as np from numpy.linalg import norm from scipy.sparse import issparse, csr_matrix from scipy.sparse.linalg import LinearOperator from scipy.optimize import _minpack, OptimizeResult from scipy.optimize._numdiff import approx...
bsd-3-clause
florian-f/sklearn
examples/feature_stacker.py
8
1941
""" ================================================= Concatenating multiple feature extraction methods ================================================= In many real-world examples, there are many ways to extract features from a dataset. Often it is benefitial to combine several methods to obtain good performance. Th...
bsd-3-clause
booya-at/paraBEM
examples/openglider/shape_cl_cd.py
2
4070
from copy import deepcopy import numpy as np import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt # from openglider.glider.parametric import ParametricGlider from openglider.jsonify import dump, load from openglider.glider.in_out.export_3d import parabem_Panels from openglider.utils.distributio...
gpl-3.0
dingocuster/scikit-learn
examples/decomposition/plot_ica_blind_source_separation.py
349
2228
""" ===================================== Blind source separation using FastICA ===================================== An example of estimating sources from noisy data. :ref:`ICA` is used to estimate sources given noisy measurements. Imagine 3 instruments playing simultaneously and 3 microphones recording the mixed si...
bsd-3-clause
rmcdermo/macfp-db
Extinction/FM_Burner/Computational_Results/2021/UWuppertal/UWuppertal_FM_Burner_plot_results.py
1
2510
#!/usr/bin/env python3 # McDermott # Feb 2021 # first, make sure the macfp module directory is in your path # if not, uncomment the lines below and replace <path to macfp-db> # with the path (absolute or relative) to your macfp-db repository #===========================================================================...
mit
cybernet14/scikit-learn
sklearn/decomposition/tests/test_pca.py
199
10949
import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_rai...
bsd-3-clause
mahajrod/MACE
scripts/windows_boxplots.py
1
12032
#!/usr/bin/env python __author__ = 'Sergei F. Kliver' import os import argparse import pandas as pd import matplotlib.pyplot as plt from _collections import OrderedDict from RouToolPa.Collections.General import SynDict, IdList from MACE.Routines import Visualization, StatsVCF parser = argparse.ArgumentParser() parse...
apache-2.0
ali-abdullah/nlp
bag-of-words.py
1
3849
import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import sklearn as sk import re BOW_df = pd.DataFrame(columns=['1','2','3','4','5']) df = pd.read_csv("Reviews.csv") words_set = {'.'} #print(BOW_df.head()) def prepare_data(df): # This function should ...
mit
yuanagain/seniorthesis
venv/lib/python2.7/site-packages/matplotlib/testing/noseclasses.py
8
2186
from __future__ import (absolute_import, division, print_function, unicode_literals) from matplotlib.externals import six import os from nose.plugins.errorclass import ErrorClass, ErrorClassPlugin from matplotlib.testing.exceptions import (KnownFailureTest, ...
mit
bjornsturmberg/EMUstack
docs/source/conf.py
2
8976
# -*- coding: utf-8 -*- # # EMUstack documentation build configuration file, created by # sphinx-quickstart on Sat Jun 14 14:17:22 2014. # # 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. # # ...
gpl-3.0
makelove/OpenCV-Python-Tutorial
ch46-机器学习-K近邻/2-英文字母的OCR.py
1
1291
# -*- coding: utf-8 -*- # @Time : 2017/7/13 下午7:35 # @Author : play4fun # @File : 2-英文字母的OCR.py # @Software: PyCharm """ 2-英文字母的OCR.py: """ import cv2 import numpy as np import matplotlib.pyplot as plt # Load the data, converters convert the letter to a number data = np.loadtxt('../data/letter-recognition.dat...
mit
mjudsp/Tsallis
examples/neighbors/plot_classification.py
58
1790
""" ================================ Nearest Neighbors Classification ================================ Sample usage of Nearest Neighbors classification. It will plot the decision boundaries for each class. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColorm...
bsd-3-clause
kingsBSD/MobileMinerPlugin
ckanext-mobileminer/ckanext/mobileminer/st_cluster.py
1
5541
# Licensed under the Apache License Version 2.0: http://www.apache.org/licenses/LICENSE-2.0.txt __author__ = 'Giles Richard Greenway' import dateutil.parser import time #import numpy as np from itertools import tee, izip #from sklearn import preprocessing #from sklearn.cluster import KMeans import requests def vecto...
apache-2.0
schets/scikit-learn
examples/cluster/plot_kmeans_silhouette_analysis.py
242
5885
""" =============================================================================== Selecting the number of clusters with silhouette analysis on KMeans clustering =============================================================================== Silhouette analysis can be used to study the separation distance between the...
bsd-3-clause
jkarnows/scikit-learn
benchmarks/bench_multilabel_metrics.py
86
7286
#!/usr/bin/env python """ A comparison of multilabel target formats and metrics over them """ from __future__ import division from __future__ import print_function from timeit import timeit from functools import partial import itertools import argparse import sys import matplotlib.pyplot as plt import scipy.sparse as...
bsd-3-clause
arkadoel/AprendiendoPython
Udacity_tutorial/p5.py
1
2164
from pandas import DataFrame, Series ################# # Syntax Reminder: # # The following code would create a two-column pandas DataFrame # named df with columns labeled 'name' and 'age': # # people = ['Sarah', 'Mike', 'Chrisna'] # ages = [28, 32, 25] # df = DataFrame({'name' : Series(people), # 'a...
gpl-3.0
sgenoud/scikit-learn
sklearn/naive_bayes.py
1
15049
# -*- coding: utf-8 -*- """ The :mod:`sklearn.naive_bayes` module implements Naive Bayes algorithms. These are supervised learning methods based on applying Bayes' theorem with strong (naive) feature independence assumptions. """ # Author: Vincent Michel <vincent.michel@inria.fr> # Minor fixes by Fabian Pedre...
bsd-3-clause
Obus/scikit-learn
sklearn/metrics/cluster/tests/test_bicluster.py
394
1770
"""Testing for bicluster metrics module""" import numpy as np from sklearn.utils.testing import assert_equal, assert_almost_equal from sklearn.metrics.cluster.bicluster import _jaccard from sklearn.metrics import consensus_score def test_jaccard(): a1 = np.array([True, True, False, False]) a2 = np.array([T...
bsd-3-clause
rbaravalle/imfractal
tests/testcomparison.py
1
8144
""" Copyright (c) 2013 Rodrigo Baravalle All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following...
bsd-3-clause
RachitKansal/scikit-learn
sklearn/metrics/cluster/supervised.py
207
27395
"""Utilities to evaluate the clustering performance of models Functions named as *_score return a scalar value to maximize: the higher the better. """ # Authors: Olivier Grisel <olivier.grisel@ensta.org> # Wei LI <kuantkid@gmail.com> # Diego Molla <dmolla-aliod@gmail.com> # License: BSD 3 clause fr...
bsd-3-clause
jakobworldpeace/scikit-learn
examples/tree/plot_tree_regression.py
95
1516
""" =================================================================== Decision Tree Regression =================================================================== A 1D regression with decision tree. The :ref:`decision trees <tree>` is used to fit a sine curve with addition noisy observation. As a result, it learns ...
bsd-3-clause
vascotenner/holoviews
holoviews/core/data/pandas.py
1
8030
from __future__ import absolute_import from distutils.version import LooseVersion try: import itertools.izip as zip except ImportError: pass import numpy as np import pandas as pd from .interface import Interface from ..dimension import Dimension from ..element import Element, NdElement from ..dimension imp...
bsd-3-clause
naturali/tensorflow
tensorflow/contrib/learn/python/learn/tests/dataframe/feeding_functions_test.py
30
4777
# 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
MatthieuBizien/scikit-learn
sklearn/decomposition/tests/test_factor_analysis.py
112
3203
# Author: Christian Osendorfer <osendorf@gmail.com> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD3 import numpy as np from sklearn.utils.testing import assert_warns from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_greater from sklearn.utils.testing im...
bsd-3-clause
ElDeveloper/scikit-learn
sklearn/tests/test_pipeline.py
29
15239
""" Test the pipeline module. """ import numpy as np from scipy import sparse from sklearn.externals.six.moves import zip from sklearn.utils.testing import assert_raises, assert_raises_regex, assert_raise_message from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_false from sklearn...
bsd-3-clause
AIML/scikit-learn
sklearn/ensemble/tests/test_forest.py
57
35265
""" 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
rrohan/scikit-learn
sklearn/metrics/cluster/tests/test_bicluster.py
394
1770
"""Testing for bicluster metrics module""" import numpy as np from sklearn.utils.testing import assert_equal, assert_almost_equal from sklearn.metrics.cluster.bicluster import _jaccard from sklearn.metrics import consensus_score def test_jaccard(): a1 = np.array([True, True, False, False]) a2 = np.array([T...
bsd-3-clause
linebp/pandas
pandas/tests/io/formats/test_to_latex.py
1
12983
from datetime import datetime import pytest import pandas as pd from pandas import DataFrame, compat, Series from pandas.util import testing as tm from pandas.compat import u import codecs @pytest.fixture def frame(): return DataFrame(tm.getSeriesData()) class TestToLatex(object): def test_to_latex_filen...
bsd-3-clause
EtienneCmb/tensorpac
examples/misc/plot_frequency_vectors.py
1
1758
""" ======================== Define frequency vectors ======================== In Tensorpac, you can define your phase and amplitude vectors in sevral ways : * Manually define one band (ex : [2, 4]) * Define multiple bands using a list/tuple/array (ex : [[2, 4], [5, 7]]) * Using a (start, stop width step) definition....
bsd-3-clause
emotrix/Emotrix
emotrix/emotrix.py
1
10735
# -*- coding: utf-8 -*- # ********************************************************************************************************************** # Archivo: emotrix.py # Proposito: Este archivo es el encargado de gestionar todas las llamadas al API, para trabajar con EMOTRIX # Autor: Henzer Garcia 12538...
bsd-2-clause
linksuccess/linksuccess
parsingframework/HypTrails.py
1
6551
# further implementations can be found: # Python: https://github.com/psinger/hyptrails # Java: https://bitbucket.org/florian_lemmerich/hyptrails4j # Apache spark: http://dmir.org/sparktrails/ # also see: http://www.philippsinger.info/hyptrails/ from __future__ import division import itertools from scipy.sparse import...
mit
hitszxp/scikit-learn
sklearn/linear_model/tests/test_base.py
13
10412
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # # License: BSD 3 clause import numpy as np from scipy import sparse from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.linear_model....
bsd-3-clause
AtsushiSakai/PythonRobotics
PathPlanning/WavefrontCPP/wavefront_coverage_path_planner.py
1
6924
""" Distance/Path Transform Wavefront Coverage Path Planner author: Todd Tang paper: Planning paths of complete coverage of an unstructured environment by a mobile robot - Zelinsky et.al. link: http://pinkwink.kr/attachment/cfile3.uf@1354654A4E8945BD13FE77.pdf """ import os import sys import matplotlib.pypl...
mit
fabioticconi/scikit-learn
sklearn/datasets/tests/test_20news.py
280
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