repo_name
stringlengths
7
90
path
stringlengths
5
191
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
976
581k
license
stringclasses
15 values
aetilley/scikit-learn
examples/linear_model/plot_iris_logistic.py
283
1678
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Logistic Regression 3-class Classifier ========================================================= Show below is a logistic-regression classifiers decision boundaries on the `iris <http://en.wikipedia.org/wiki/Iris_f...
bsd-3-clause
ryfeus/lambda-packs
Sklearn_scipy_numpy/source/scipy/interpolate/tests/test_rbf.py
45
4626
#!/usr/bin/env python # Created by John Travers, Robert Hetland, 2007 """ Test functions for rbf module """ from __future__ import division, print_function, absolute_import import numpy as np from numpy.testing import (assert_, assert_array_almost_equal, assert_almost_equal, run_module_suit...
mit
netodeolino/TCC
TCC 01/Extração/extrairMuitas.py
1
8071
# -*- coding: UTF-8 -*- import numpy as np import pandas # - Variáveis globais ENTIDADE_NAO_ENCOTRADA = -1 ENTIDADE_VAZIA = "NÃO POSSUI ESSA INFORMAÇÃO" entidades = [ "LOCAL:", "SUSPEITO:", "VEÍCULO:", "VÍTIMA:", "VÍTIMAS:", "VÍTIMA FATAL:", "ARMA APREENDIDA:", "MATERIAL APREENDIDO:", "PLACA:", "VÍTIMAS LESI...
mit
kwailamchan/programming-languages
python/sklearn/examples/general/restricted_boltzmann_machine_features_for_digit_classification.py
3
4757
#---------------------------------------------------------------# # Project: Restricted Boltzmann Machine features for digit classification # Author: Kelly Chan # Date: Apr 24 2014 #---------------------------------------------------------------# from __future__ import print_function print(__doc__) import numpy as ...
mit
kingjr/jr-tools
jr/gat/scorers.py
1
3617
# Author: Jean-Remi King <jeanremi.king@gmail.com> # # License: BSD (3-clause) from nose.tools import assert_true import numpy as np from numpy.testing import assert_array_equal from jr.stats import fast_mannwhitneyu def _parallel_scorer(y_true, y_pred, func, n_jobs=1): from nose.tools import assert_true fro...
bsd-2-clause
cellnopt/cellnopt
cno/io/midas_normalisation.py
1
18714
# -*- python -*- # # This file is part of cellnopt.core software # # Copyright (c) 2011-2013 - EBI-EMBL # # File author(s): Thomas Cokelaer <cokelaer@ebi.ac.uk> # # Distributed under the GPLv3 License. # See accompanying file LICENSE.txt or copy at # http://www.gnu.org/licenses/gpl-3.0.html # # website: www....
bsd-2-clause
jalabort/alabortcvpr2015
alabortcvpr2015/clm/classifier.py
1
5842
from __future__ import division import numpy as np from numpy.fft import fft2, ifft2, fftshift from sklearn import svm from sklearn import linear_model class MCF(object): r""" Multi-channel Correlation Filter """ def __init__(self, X, Y, l=0, cosine_mask=False): if (X[0].shape[0],) + X[0].sha...
bsd-2-clause
maminian/skewtools
scripts/animate_duct_flow_mc_projs_byframe.py
1
5038
#!/usr/bin/python import numpy as np import pylab from numpy import transpose,size,sqrt import sys import matplotlib.pyplot as pyplot from matplotlib.pyplot import cla,hold import matplotlib.animation as anim import h5py from matplotlib.colors import LogNorm from mpl_toolkits.mplot3d import Axes3D from matplotlib ...
gpl-3.0
AlessandroCorsi/fibermodes
scripts/oscilloscope.py
2
2071
import numpy from matplotlib import pyplot from datetime import datetime def parseDate(dstr): return datetime.strptime(dstr, '%d %b %Y').date() def parseTime(dstr): return datetime.strptime(dstr, '%H:%M:%S:%f').time() TR = { 'Type': str, 'Points': int, 'Count': int, 'XInc': float, 'XO...
gpl-3.0
endolith/scikit-image
skimage/io/tests/test_mpl_imshow.py
1
3275
from __future__ import division import numpy as np from skimage import io from skimage._shared._warnings import expected_warnings import matplotlib.pyplot as plt def setup(): io.reset_plugins() # test images. Note that they don't have their full range for their dtype, # but we still expect the display range to ...
bsd-3-clause
apark263/tensorflow
tensorflow/python/kernel_tests/constant_op_eager_test.py
33
21448
# Copyright 2015 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
zihua/scikit-learn
sklearn/utils/estimator_checks.py
4
56697
from __future__ import print_function import types import warnings import sys import traceback import pickle from copy import deepcopy import numpy as np from scipy import sparse import struct from sklearn.externals.six.moves import zip from sklearn.externals.joblib import hash, Memory from sklearn.utils.testing imp...
bsd-3-clause
justincassidy/scikit-learn
benchmarks/bench_plot_neighbors.py
287
6433
""" Plot the scaling of the nearest neighbors algorithms with k, D, and N """ from time import time import numpy as np import pylab as pl from matplotlib import ticker from sklearn import neighbors, datasets def get_data(N, D, dataset='dense'): if dataset == 'dense': np.random.seed(0) return np....
bsd-3-clause
saiwing-yeung/scikit-learn
sklearn/neighbors/tests/test_nearest_centroid.py
305
4121
""" Testing for the nearest centroid module. """ import numpy as np from scipy import sparse as sp from numpy.testing import assert_array_equal from numpy.testing import assert_equal from sklearn.neighbors import NearestCentroid from sklearn import datasets from sklearn.metrics.pairwise import pairwise_distances # t...
bsd-3-clause
chunweiyuan/xarray
xarray/tests/test_dataarray.py
1
161580
import pickle import warnings from collections import OrderedDict from copy import deepcopy from textwrap import dedent import sys import numpy as np import pandas as pd import pytest import xarray as xr from xarray import ( DataArray, Dataset, IndexVariable, Variable, align, broadcast) from xarray.coding.times i...
apache-2.0
mkraemer67/pylearn2
pylearn2/models/tests/test_s3c_inference.py
44
14386
from __future__ import print_function from pylearn2.models.s3c import S3C from pylearn2.models.s3c import E_Step_Scan from pylearn2.models.s3c import Grad_M_Step from pylearn2.models.s3c import E_Step from pylearn2.utils import contains_nan from theano import function import numpy as np from theano.compat.six.moves im...
bsd-3-clause
JosephKJ/SDD-RFCN-python
lib/objectness/utils.py
1
5070
import scipy import os import cv2 import numpy as np from map import HeatMap from sklearn.metrics import jaccard_similarity_score from timer import Timer from gc_executor import GC_executor def generate_objectness_map(heatMapObj, image, hr_method='interpolation', use_gradcam=True): """ Generates the objectnes...
mit
DANA-Laboratory/CoolProp
dev/TTSE/validate_TTSE.py
5
5859
import matplotlib matplotlib.use('WXAgg') import CoolProp from CoolProp.Plots import Ph from CoolProp.Plots.Plots import Trho,Ps,PT,Prho import CoolProp.CoolProp as CP import matplotlib.pyplot as plt from matplotlib.colors import LogNorm import random import numpy as np from math import log,exp random.seed() def check...
mit
larsmans/scikit-learn
sklearn/tests/test_base.py
19
6858
# 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 imp...
bsd-3-clause
jeremander/AttrVN
nominate.py
1
9874
"""After obtaining all the desired embeddings, stacks them and applies supervised learning to nominate nodes whose nomination_attr_type value is unknown. Optionally uses leave-one-out cross-validation to nominate the known nodes as well. Usage: python3 nominate.py [path] The directory [path] must include a fi...
apache-2.0
crslab/Inverse-Reinforcement-Learning
examples/lp_gridworld.py
1
1234
""" Run linear programming inverse reinforcement learning on the gridworld MDP. Matthew Alger, 2015 matthew.alger@anu.edu.au """ import numpy as np import matplotlib.pyplot as plt import irl.linear_irl as linear_irl import irl.mdp.gridworld as gridworld def main(grid_size, discount): """ Run ...
mit
poryfly/scikit-learn
sklearn/tree/tests/test_tree.py
57
47417
""" Testing for the tree module (sklearn.tree). """ import pickle from functools import partial from itertools import product import platform import numpy as np from scipy.sparse import csc_matrix from scipy.sparse import csr_matrix from scipy.sparse import coo_matrix from sklearn.random_projection import sparse_rand...
bsd-3-clause
victorbergelin/scikit-learn
examples/covariance/plot_robust_vs_empirical_covariance.py
248
6359
r""" ======================================= Robust vs Empirical covariance estimate ======================================= The usual covariance maximum likelihood estimate is very sensitive to the presence of outliers in the data set. In such a case, it would be better to use a robust estimator of covariance to guar...
bsd-3-clause
sandeepkrjha/pgmpy
pgmpy/tests/test_estimators/test_ConstraintBasedEstimator.py
6
6515
import unittest import pandas as pd import numpy as np from pgmpy.estimators import ConstraintBasedEstimator from pgmpy.independencies import Independencies from pgmpy.models import BayesianModel from pgmpy.base import DirectedGraph, UndirectedGraph class TestConstraintBasedEstimator(unittest.TestCase): def tes...
mit
TNT-Samuel/Coding-Projects
DNS Server/Source - Copy/Lib/site-packages/dask/dataframe/tseries/tests/test_resample.py
2
2864
from itertools import product import pandas as pd import pytest from dask.dataframe.utils import assert_eq import dask.dataframe as dd def resample(df, freq, how='mean', **kwargs): return getattr(df.resample(freq, **kwargs), how)() @pytest.mark.parametrize(['obj', 'method', 'npartitions', 'freq', 'closed', 'l...
gpl-3.0
valexandersaulys/prudential_insurance_kaggle
venv/lib/python2.7/site-packages/pandas/tests/test_config.py
13
16910
#!/usr/bin/python # -*- coding: utf-8 -*- import pandas as pd import unittest import warnings import nose class TestConfig(unittest.TestCase): _multiprocess_can_split_ = True def __init__(self, *args): super(TestConfig, self).__init__(*args) from copy import deepcopy self.cf = pd.cor...
gpl-2.0
bblais/Classy
debug/2020-11-09 - Debug NumpyNet MNIST.py
2
4638
#!/usr/bin/env python # coding: utf-8 # In[1]: get_ipython().magic('pylab inline') # In[2]: ''' Little example on how to use the Network class to create a model and perform a basic classification of the MNIST dataset ''' #from NumPyNet.layers.input_layer import Input_layer from NumPyNet.layers.connected_layer i...
mit
GaZ3ll3/scikit-image
doc/examples/applications/plot_morphology.py
18
8229
""" ======================= Morphological Filtering ======================= Morphological image processing is a collection of non-linear operations related to the shape or morphology of features in an image, such as boundaries, skeletons, etc. In any given technique, we probe an image with a small shape or template ca...
bsd-3-clause
dmargala/tpcorr
examples/plugmap.py
1
12679
#!/usr/bin/env python import matplotlib.pyplot as plt import numpy as np import sys,os import string import math import argparse def read_plugmap(filename): debug=False file=open(filename,"r") doc={} intypedef=False indices={} indices["HOLETYPE"]=8 indices["OBJECT"]=21 indices["ra"]=9...
mit
rasbt/python-machine-learning-book
code/optional-py-scripts/ch11.py
4
11413
# Sebastian Raschka, 2015 (http://sebastianraschka.com) # Python Machine Learning - Code Examples # # Chapter 11 - Working with Unlabeled Data – Clustering Analysis # # S. Raschka. Python Machine Learning. Packt Publishing Ltd., 2015. # GitHub Repo: https://github.com/rasbt/python-machine-learning-book # # License: MIT...
mit
rexshihaoren/scikit-learn
examples/model_selection/plot_roc_crossval.py
247
3253
""" ============================================================= Receiver Operating Characteristic (ROC) with cross validation ============================================================= Example of Receiver Operating Characteristic (ROC) metric to evaluate classifier output quality using cross-validation. ROC curv...
bsd-3-clause
willettk/decals
python/decals_dr2_tread_download.py
1
5032
from __future__ import division from astropy.io import fits from astropy.table import Table from matplotlib import pyplot as plt import numpy as np from decals_dr2 import dstn_rgb import progressbar as pb import os,urllib from multiprocessing.dummy import Pool as ThreadPool from multiprocessing import Value, Lock wid...
mit
kdebrab/pandas
pandas/tests/test_errors.py
3
2022
# -*- coding: utf-8 -*- import pytest from warnings import catch_warnings import pandas # noqa import pandas as pd from pandas.errors import AbstractMethodError import pandas.util.testing as tm @pytest.mark.parametrize( "exc", ['UnsupportedFunctionCall', 'UnsortedIndexError', 'OutOfBoundsDatetime', ...
bsd-3-clause
petosegan/scikit-learn
sklearn/datasets/base.py
196
18554
""" Base IO code for all datasets """ # Copyright (c) 2007 David Cournapeau <cournape@gmail.com> # 2010 Fabian Pedregosa <fabian.pedregosa@inria.fr> # 2010 Olivier Grisel <olivier.grisel@ensta.org> # License: BSD 3 clause import os import csv import shutil from os import environ from os.pa...
bsd-3-clause
depet/scikit-learn
sklearn/linear_model/tests/test_logistic.py
16
5067
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_raises from sklearn.util...
bsd-3-clause
krzysztof/pykep
PyKEP/examples/_ex3.py
5
8429
try: from PyGMO.problem import base as PyGMO_problem """ This example constructs, using PyGMO for optimization, an interplanetary low-thrust optimization problem that can then be solved using one of the available PyGMO solvers. The problem is a non-linear constrained problem that uses the Sims-Flan...
gpl-3.0
mramire8/structured
utilities/datautils.py
1
18593
from sklearn.datasets import load_files from sklearn.datasets import fetch_20newsgroups from sklearn.datasets import base as bunch import numpy as np class StemTokenizer(object): def __init__(self): from nltk import RegexpTokenizer from nltk.stem import PorterStemmer self.wnl = PorterStem...
apache-2.0
frank-tancf/scikit-learn
doc/datasets/mldata_fixture.py
367
1183
"""Fixture module to skip the datasets loading when offline Mock urllib2 access to mldata.org and create a temporary data folder. """ from os import makedirs from os.path import join import numpy as np import tempfile import shutil from sklearn import datasets from sklearn.utils.testing import install_mldata_mock fr...
bsd-3-clause
eubr-bigsea/tahiti
migrations/versions/54147db30380_fixing_some_sklearn_operations.py
1
8064
"""fixing some sklearn operations. Revision ID: 54147db30380 Revises: 29ecca388884 Create Date: 2020-01-23 12:51:44.638796 """ from alembic import context from alembic import op from sqlalchemy import String, Integer, Text from sqlalchemy.orm import sessionmaker from sqlalchemy.sql import table, column # revision i...
apache-2.0
eddowh/nyc-green-taxi-map-visualization
src/utils.py
1
4086
# -*- coding: utf-8 -*- import pandas as pd from functools import reduce def reduce_taxi_df_memory_usage(df): """ Reduce memory footprint of the taxi data. Parameters ---------- df : pandas.DataFrame The dataframe that will have its memory footprint reduced. Returns ------- ...
mit
trevstanhope/agri-vision
test/camera.py
1
1766
import cv, cv2 from matplotlib import pyplot as plt import numpy CAMERA_INDEX = 0 HUE_MIN = 30 HUE_MAX = 120 PIXEL_WIDTH = 320 PIXEL_HEIGHT = 240 THRESHOLD_PERCENTILE = 95 camera = cv2.VideoCapture(CAMERA_INDEX) camera.set(cv.CV_CAP_PROP_FRAME_WIDTH, PIXEL_WIDTH) camera.set(cv.CV_CAP_PROP_FRAME_HEIGHT, PIXEL_HEIGHT) ...
mit
massmutual/scikit-learn
sklearn/linear_model/tests/test_theil_sen.py
234
9928
""" Testing for Theil-Sen module (sklearn.linear_model.theil_sen) """ # Author: Florian Wilhelm <florian.wilhelm@gmail.com> # License: BSD 3 clause from __future__ import division, print_function, absolute_import import os import sys from contextlib import contextmanager import numpy as np from numpy.testing import ...
bsd-3-clause
dylanGeng/BuildingMachineLearningSystemsWithPython
ch12/image-classification.py
21
3109
# This code is supporting material for the book # Building Machine Learning Systems with Python # by Willi Richert and Luis Pedro Coelho # published by PACKT Publishing # # It is made available under the MIT License import mahotas as mh import numpy as np from glob import glob from jug import TaskGenerator # We need ...
mit
mjbrodzik/ipython_notebooks
charis/dehra_dun/racovite_ablation_model.py
1
3272
#!/usr/bin/env python import hypsometry import pandas as pd import numpy as np class racovite_ablation_modelError( Exception ): pass def run( clean_ice_km2, ela_m, ablation_gradient_m_per_100m, verbose=False ): """ Run the ablation gradient melt model as described by: Racoviteanu et al., 2014, Evalua...
apache-2.0
FerranGarcia/shape_learning
scripts/set_optimal_letter.py
3
5133
#!/usr/bin/env python # coding: utf-8 ''' This script just writes the shape of the letter the user draws at the top of the database. This top-letter will be used as the optimal reference letter. We want childs to learn this letter by playing with the robot. ''' from shape_learning.shape_learner_manager import ShapeL...
isc
temmeand/scikit-rf
qtapps/skrf_qtwidgets/qt.py
6
10005
from __future__ import print_function import os import time import sys import traceback import platform import ctypes import sip from . import cfg # must import cfg before qtpy to properly parse qt-bindings from qtpy import QtCore, QtWidgets, QtGui class QHLine(QtWidgets.QFrame): def __init__(self): su...
bsd-3-clause
OpringaoDoTurno/airflow
airflow/hooks/hive_hooks.py
3
28594
# -*- coding: utf-8 -*- # # 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, software ...
apache-2.0
asteca/ASteCA
packages/out/make_B2_plot.py
1
3711
import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from os.path import join from . import mp_data_analysis from . import add_version_plot from . import prep_plots from . prep_plots import figsize_x, figsize_y, grid_x, grid_y def main( npd, cld_i, pd, err_lst, cl_region_c, cl_region_rjct_c, st...
gpl-3.0
aterrel/blaze
blaze/compute/tests/test_pandas.py
1
8386
from __future__ import absolute_import, division, print_function import pandas as pd import numpy as np from pandas import DataFrame, Series from blaze.compute.pandas import * from blaze.expr.table import * from blaze.compatibility import builtins t = TableSymbol('t', '{name: string, amount: int, id: int}') df = D...
bsd-3-clause
aabadie/scikit-learn
sklearn/decomposition/tests/test_nmf.py
23
9736
import numpy as np from scipy import linalg from sklearn.decomposition import (NMF, ProjectedGradientNMF, non_negative_factorization) from sklearn.decomposition import nmf # For testing internals from scipy.sparse import csc_matrix from sklearn.utils.testing import assert_true from...
bsd-3-clause
dvro/imbalanced-learn
imblearn/over_sampling/tests/test_smote.py
2
12097
"""Test the module SMOTE.""" from __future__ import print_function import os import numpy as np from numpy.testing import assert_raises from numpy.testing import assert_equal from numpy.testing import assert_array_equal from numpy.testing import assert_array_almost_equal from numpy.testing import assert_warns from s...
mit
ramansbach/cluster_analysis
clustering/scripts/analyze_length.py
1
2968
""" Created on Fri Oct 13 07:55:15 2017 @author: Rachael Mansbach Script to run after analyze_clusters_serial.py, which computes the distribution of lengths of contact and optical clusters, where "length" means the longest distance between the COMs of two molecules in a cluster unwrapped over the periodic boundary co...
mit
lpsinger/astropy
astropy/io/misc/pandas/connect.py
5
3378
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This file connects the readers/writers to the astropy.table.Table class import functools from astropy.table import Table import astropy.io.registry as io_registry __all__ = ['PANDAS_FMTS'] # Astropy users normally expect to not have an index, so defa...
bsd-3-clause
mandli/multilayer-examples
1d/setplot_drystate.py
1
9573
#!/usr/bin/env python """ Set up the plot figures, axes, and items to be done for each frame. This module is imported by the plotting routines and then the function setplot is called to set the plot parameters. """ import os import numpy as np # Plot customization import matplotlib # Markers and line widths...
mit
r-mart/scikit-learn
sklearn/neighbors/nearest_centroid.py
199
7249
# -*- coding: utf-8 -*- """ Nearest Centroid Classification """ # Author: Robert Layton <robertlayton@gmail.com> # Olivier Grisel <olivier.grisel@ensta.org> # # License: BSD 3 clause import warnings import numpy as np from scipy import sparse as sp from ..base import BaseEstimator, ClassifierMixin from ..met...
bsd-3-clause
carrillo/scikit-learn
examples/ensemble/plot_gradient_boosting_regression.py
227
2520
""" ============================ Gradient Boosting regression ============================ Demonstrate Gradient Boosting on the Boston housing dataset. This example fits a Gradient Boosting model with least squares loss and 500 regression trees of depth 4. """ print(__doc__) # Author: Peter Prettenhofer <peter.prett...
bsd-3-clause
boomsbloom/dtm-fmri
DTM/for_gensim/lib/python2.7/site-packages/matplotlib/type1font.py
8
12515
""" This module contains a class representing a Type 1 font. This version reads pfa and pfb files and splits them for embedding in pdf files. It also supports SlantFont and ExtendFont transformations, similarly to pdfTeX and friends. There is no support yet for subsetting. Usage:: >>> font = Type1Font(filename) ...
mit
robbymeals/scikit-learn
sklearn/utils/setup.py
296
2884
import os from os.path import join from sklearn._build_utils import get_blas_info def configuration(parent_package='', top_path=None): import numpy from numpy.distutils.misc_util import Configuration config = Configuration('utils', parent_package, top_path) config.add_subpackage('sparsetools') ...
bsd-3-clause
Akshay0724/scikit-learn
sklearn/gaussian_process/tests/test_gpc.py
49
6016
"""Testing for Gaussian process classification """ # Author: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de> # License: BSD 3 clause import numpy as np from scipy.optimize import approx_fprime from sklearn.gaussian_process import GaussianProcessClassifier from sklearn.gaussian_process.kernels import RBF, Constant...
bsd-3-clause
derrowap/MA490-MachineLearning-FinalProject
skParity_error.py
1
1809
from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys import time import multiprocessing import numpy as np from sklearn import cross_validation, metrics from sklearn import preprocessing from sklearn.metrics import accuracy_score from tensorflow.contr...
mit
abimannans/scikit-learn
sklearn/utils/tests/test_estimator_checks.py
202
3757
import scipy.sparse as sp import numpy as np import sys from sklearn.externals.six.moves import cStringIO as StringIO from sklearn.base import BaseEstimator, ClassifierMixin from sklearn.utils.testing import assert_raises_regex, assert_true from sklearn.utils.estimator_checks import check_estimator from sklearn.utils....
bsd-3-clause
winklerand/pandas
pandas/tests/io/test_packers.py
1
32230
import pytest from warnings import catch_warnings import os import datetime import numpy as np import sys from distutils.version import LooseVersion from pandas import compat from pandas.compat import u, PY3 from pandas import (Series, DataFrame, Panel, MultiIndex, bdate_range, date_range, period_...
bsd-3-clause
kipohl/ncanda-data-integration
scripts/redcap/scoring/casq/__init__.py
2
2583
#!/usr/bin/env python ## ## See COPYING file distributed along with the ncanda-data-integration package ## for the copyright and license terms ## import pandas import Rwrapper # # Variables from surveys needed for CASQ # # LimeSurvey field names lime_fields = [ "casq_set1 [casq1]", "casq_set1 [casq2]", "casq_se...
bsd-3-clause
radiasoft/radtrack
experimental/laserHeater/laserHeaterBenchmarkEnsemble.py
1
3917
""" Test for the laser heater infrastructure using the Gauss-Hermite laser mode and a planar undulator. This test just checks a gaussian mode with the parameters of the LCLS laser heater. moduleauthor:: Stephen Webb <swebb@radiasoft.net> Copyright (c) 2014 RadiaBeam Technologies. All rights reserved """ __author__ = ...
apache-2.0
aabadie/scikit-learn
doc/tutorial/text_analytics/skeletons/exercise_02_sentiment.py
157
2409
"""Build a sentiment analysis / polarity model Sentiment analysis can be casted as a binary text classification problem, that is fitting a linear classifier on features extracted from the text of the user messages so as to guess wether the opinion of the author is positive or negative. In this examples we will use a ...
bsd-3-clause
dsquareindia/scikit-learn
sklearn/setup.py
69
3201
import os from os.path import join import warnings from sklearn._build_utils import maybe_cythonize_extensions def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info, BlasNotFoundError import numpy lib...
bsd-3-clause
olilarkin/faust
tools/physicalModeling/ir2dsp/ir2dsp.py
1
3883
#!/usr/bin/env python # id2dsp.py # Copyright Pierre-Amaury Grumiaux, Pierre Jouvelot, Emilio Jesus Gallego Arias, # and Romain Michon from __future__ import division import math import numpy as np import matplotlib.pyplot as plt from sys import argv import subprocess from scipy.io.wavfile import read import peakutils...
gpl-2.0
net-titech/VidSum
src/packages/aistats-flid/code/ranking.py
1
8310
from __future__ import division, print_function from matplotlib import pyplot as plt import numpy as np import IPython from itertools import product from itertools import chain, combinations import ujson import pickle from amazon_utils import load_amazon_ranking_data_dpp from amazon_experiment_specifications import da...
mit
massmutual/scikit-learn
examples/decomposition/plot_faces_decomposition.py
103
4394
""" ============================ Faces dataset decompositions ============================ This example applies to :ref:`olivetti_faces` different unsupervised matrix decomposition (dimension reduction) methods from the module :py:mod:`sklearn.decomposition` (see the documentation chapter :ref:`decompositions`) . """...
bsd-3-clause
phdowling/scikit-learn
examples/ensemble/plot_voting_probas.py
316
2824
""" =========================================================== Plot class probabilities calculated by the VotingClassifier =========================================================== Plot the class probabilities of the first sample in a toy dataset predicted by three different classifiers and averaged by the `VotingC...
bsd-3-clause
robintw/scikit-image
doc/examples/plot_tinting_grayscale_images.py
14
5336
""" ========================= Tinting gray-scale images ========================= It can be useful to artificially tint an image with some color, either to highlight particular regions of an image or maybe just to liven up a grayscale image. This example demonstrates image-tinting by scaling RGB values and by adjustin...
bsd-3-clause
matousc89/padasip
padasip/filters/gngd.py
1
6607
""" .. versionadded:: 0.2 .. versionchanged:: 1.0.0 The generalized normalized gradient descent (GNGD) adaptive filter :cite:`mandic2004generalized` is an extension of the NLMS adaptive filter (:ref:`filter-nlms-label`). The GNGD filter can be created as follows >>> import padasip as pa >>> pa.filters.Filter...
mit
crichardson17/starburst_atlas
Low_resolution_sims/DustFree_LowRes/Geneva_Rot_cont/Geneva_Rot_cont_age2/Optical2.py
33
7437
import csv import matplotlib.pyplot as plt from numpy import * import scipy.interpolate import math from pylab import * from matplotlib.ticker import MultipleLocator, FormatStrFormatter import matplotlib.patches as patches from matplotlib.path import Path import os # --------------------------------------------------...
gpl-2.0
napjon/moocs_solution
ml-udacity/choose_your_own/your_algorithm.py
6
1405
#!/usr/bin/python import matplotlib.pyplot as plt from prep_terrain_data import makeTerrainData from class_vis import prettyPicture features_train, labels_train, features_test, labels_test = makeTerrainData() ### the training data (features_train, labels_train) have both "fast" and "slow" points mixed ### in togeth...
mit
jackwong95/MMURandomStuff
TDS2101 - Intro To DS/Assignment/Data Cleaning and Exploratory Analysis/Source/execute.py
1
19190
import pandas as pd import numpy as np import os.path import datetime as dt import matplotlib.cm as cmx import matplotlib.colors as colors import matplotlib.pyplot as plt import plotly.offline as offline from matplotlib import style # Global variables outputDirPrefix = "../Plots/" outputDirExtras = outputDirPrefix + ...
apache-2.0
shakamunyi/tensorflow
tensorflow/contrib/learn/python/learn/estimators/base.py
7
19731
# 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
mfjb/scikit-learn
examples/linear_model/plot_sgd_weighted_samples.py
344
1458
""" ===================== SGD: Weighted samples ===================== Plot decision function of a weighted dataset, where the size of points is proportional to its weight. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from sklearn import linear_model # we create 20 points np.random.seed(0) X ...
bsd-3-clause
suyashbire1/pyhton_scripts_mom6
plot_cont_budget.py
1
5476
import sys import readParams_moreoptions as rdp1 import matplotlib.pyplot as plt from mom_plot1 import m6plot, xdegtokm import numpy as np from netCDF4 import MFDataset as mfdset, Dataset as dset import time from pym6 import Domain, Variable, Plotter import importlib importlib.reload(Domain) importlib.reload(Variable) ...
gpl-3.0
dpaiton/OpenPV
pv-core/analysis/python/plot_amoeba_response.py
1
4052
""" Make a histogram of normally distributed random numbers and plot the analytic PDF over it """ import sys import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as mlab import matplotlib.cm as cm import matplotlib.image as mpimg import PVReadWeights as rw import PVReadSparse as rs import math """...
epl-1.0
jakirkham/bokeh
examples/models/file/anscombe.py
5
3286
from __future__ import print_function import numpy as np import pandas as pd from bokeh.util.browser import view from bokeh.document import Document from bokeh.embed import file_html from bokeh.layouts import column, gridplot from bokeh.models import Circle, ColumnDataSource, Div, Grid, Line, LinearAxis, Plot, Range1...
bsd-3-clause
jadsonjs/DataScience
statistics/avg-stddev.py
1
1785
# # This program is distributed without any warranty and it # can be freely redistributed for research, classes or private studies, # since the copyright notices are not removed. # # This file was used to calc the average and std deviation of the results of # ensembles generated by the software weka. # The weka saves ...
apache-2.0
zorroblue/scikit-learn
examples/feature_selection/plot_select_from_model_boston.py
146
1527
""" =================================================== Feature selection using SelectFromModel and LassoCV =================================================== Use SelectFromModel meta-transformer along with Lasso to select the best couple of features from the Boston dataset. """ # Author: Manoj Kumar <mks542@nyu.edu>...
bsd-3-clause
bert9bert/statsmodels
statsmodels/iolib/tests/test_summary.py
31
1535
'''examples to check summary, not converted to tests yet ''' from __future__ import print_function if __name__ == '__main__': from statsmodels.regression.tests.test_regression import TestOLS #def mytest(): aregression = TestOLS() TestOLS.setupClass() results = aregression.res1 r_summary = s...
bsd-3-clause
mr-cloud/deep-learning-udacity
ocr.py
1
24391
import numpy as np from scipy import ndimage import pickle import tensorflow as tf from matplotlib import pyplot as plt import sys # 64 x 64, 95.64% at 98% # architect: 8 convs + 3 FCL(LR, ReLU). maxout, channels: [48, 64, 128, 160], 192, 3072. dropout. # conv: 5 x 5 zero padding, maxpooling 2 x 2, stride 2 # predict...
mit
pystockhub/book
ch18/day04/Kiwoom.py
2
8383
import sys from PyQt5.QtWidgets import * from PyQt5.QAxContainer import * from PyQt5.QtCore import * import time import pandas as pd import sqlite3 TR_REQ_TIME_INTERVAL = 0.2 class Kiwoom(QAxWidget): def __init__(self): super().__init__() self._create_kiwoom_instance() self._set_signal_sl...
mit
cfobel/thrust-timing
thrust_timing/path_timing.py
1
6935
import cythrust.device_vector as dv from cythrust import DeviceDataFrame from cythrust import DeviceVectorCollection from thrust_timing.SORT_TIMING import (look_up_delay, step1, step2, step8, step9, step10) from thrust_timing.sort_timing import (compute_arrival_times, ...
gpl-2.0
bavardage/statsmodels
statsmodels/graphics/tests/test_regressionplots.py
5
4406
'''Tests for regressionplots, entire module is skipped ''' import numpy as np import nose import statsmodels.api as sm from statsmodels.graphics.regressionplots import (plot_fit, plot_ccpr, plot_partregress, plot_regress_exog, abline_plot, plot_partregress_grid, plot_ccpr_grid, ad...
bsd-3-clause
jorisvandenbossche/geopandas
geopandas/tests/test_sindex.py
1
4517
import sys from shapely.geometry import Polygon, Point from geopandas import GeoSeries, GeoDataFrame, base, read_file from geopandas.tests.util import unittest, download_nybb @unittest.skipIf(sys.platform.startswith("win"), "fails on AppVeyor") @unittest.skipIf(not base.HAS_SINDEX, 'Rtree absent, skipping') class T...
bsd-3-clause
brendancsmith/cohort-facebook
lib/word_cloud-master/doc/sphinxext/gen_rst.py
17
33207
""" Example generation for the python wordcloud project. Stolen from scikit-learn with modifications from PyStruct. Generate the rst files for the examples by iterating over the python example files. Hacked to plot every example (not only those that start with 'plot'). """ from time import time import os import shuti...
mit
nokute78/fluent-bit
plugins/out_kafka/librdkafka-1.6.0/tests/performance_plot.py
3
2902
#!/usr/bin/env python3 # import sys, json import numpy as np import matplotlib.pyplot as plt from collections import defaultdict def semver2int (semver): if semver == 'trunk': semver = '0.10.0.0' vi = 0 i = 0 for v in reversed(semver.split('.')): vi += int(v) * (i * 10) i += 1...
apache-2.0
yonglehou/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
rkube/blob_tracking
blobtrail.py
1
8352
#!/opt/local/bin/python # -*- Encoding: UTF-8 -*- """ ========= blobtrail ========= .. codeauthor :: Ralph Kube <ralphkube@gmail.com> A class that defines a blob event in a sequence of frames from 2d turbulence imaging """ import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as mpatches fro...
mit
macks22/gensim
gensim/test/test_keras_integration.py
1
6627
import unittest import os import numpy as np from gensim.models import word2vec try: from sklearn.datasets import fetch_20newsgroups except ImportError: raise unittest.SkipTest("Test requires sklearn to be installed, which is not available") try: import keras from keras.engine import Input from ke...
lgpl-2.1
kidaa/pySDC
examples/acoustic_2d_imex/playground.py
1
2831
from pySDC import CollocationClasses as collclass import numpy as np from ProblemClass import acoustic_2d_imex #from examples.sharpclaw_burgers1d.TransferClass import mesh_to_mesh_1d from examples.acoustic_2d_imex.HookClass import plot_solution from pySDC.datatype_classes.mesh import mesh, rhs_imex_mesh from pySDC....
bsd-2-clause
sinhrks/darkcore
darkcore/components/tests/test_image.py
1
1048
import pandas as pd import pandas.util.testing as tm import darkcore class TestImage(tm.TestCase): def test_image_detection(self): df = pd.DataFrame({'A':[1, 2, 3]}) ax = df.plot() self.assertTrue(darkcore.Image._maybe_image(ax)) self.assertTrue(darkcore.Image._maybe_image(ax.g...
bsd-3-clause
petosegan/scikit-learn
sklearn/linear_model/tests/test_ransac.py
216
13290
import numpy as np from numpy.testing import assert_equal, assert_raises from numpy.testing import assert_array_almost_equal from sklearn.utils.testing import assert_raises_regexp from scipy import sparse from sklearn.utils.testing import assert_less from sklearn.linear_model import LinearRegression, RANSACRegressor f...
bsd-3-clause
sonnyhu/scikit-learn
sklearn/externals/joblib/__init__.py
4
5100
""" Joblib is a set of tools to provide **lightweight pipelining in Python**. In particular, joblib offers: 1. transparent disk-caching of the output values and lazy re-evaluation (memoize pattern) 2. easy simple parallel computing 3. logging and tracing of the execution Joblib is optimized to be **fast*...
bsd-3-clause
biocore-ntnu/pyranges
pyranges/methods/coverage.py
1
2032
import numpy as np import pandas as pd from ncls import NCLS def _number_overlapping(scdf, ocdf, **kwargs): keep_nonoverlapping = kwargs.get("keep_nonoverlapping", True) column_name = kwargs.get("overlap_col", True) if scdf.empty: return None if ocdf.empty: if keep_nonoverlapping: ...
mit
Rambatino/Kruskals
Kruskals/__main__.py
1
1129
""" This package provides a python implementation of Kruskals Algorithm """ import argparse import savReaderWriter as spss import pandas as pd from .kruskals import Kruskals def main(): """Entry point when module is run from command line""" parser = argparse.ArgumentParser(description='Run Kruskal\'s Algorith...
mit
r-mart/scikit-learn
sklearn/feature_selection/rfe.py
64
17509
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Vincent Michel <vincent.michel@inria.fr> # Gilles Louppe <g.louppe@gmail.com> # # License: BSD 3 clause """Recursive feature elimination for feature ranking""" import warnings import numpy as np from ..utils import check_X_y, safe_sqr fro...
bsd-3-clause