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 |
|---|---|---|---|---|---|
manashmndl/scikit-learn | sklearn/tests/test_grid_search.py | 68 | 28778 | """
Testing for grid search module (sklearn.grid_search)
"""
from collections import Iterable, Sized
from sklearn.externals.six.moves import cStringIO as StringIO
from sklearn.externals.six.moves import xrange
from itertools import chain, product
import pickle
import sys
import numpy as np
import scipy.sparse as sp
... | bsd-3-clause |
tridesclous/tridesclous | setup.py | 1 | 1874 | from setuptools import setup
import os
d = {}
exec(open("tridesclous/version.py").read(), None, d)
version = d['version']
install_requires = [
'numpy',
'scipy',
'pandas',
'openpyxl',
'scikit-learn>=0.22.2',
... | mit |
marqh/iris | docs/iris/example_code/General/custom_file_loading.py | 5 | 12531 | """
Loading a cube from a custom file format
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This example shows how a custom text file can be loaded using the standard Iris
load mechanism.
The first stage in the process is to define an Iris :class:`FormatSpecification
<iris.io.format_picker.FormatSpecification>` for the fil... | lgpl-3.0 |
mkukielka/oddt | oddt/scoring/functions/PLECscore.py | 1 | 14458 | from __future__ import print_function
import sys
from os.path import dirname, isfile, join as path_join
from functools import partial
import json
import warnings
import numpy as np
import pandas as pd
from scipy.stats import pearsonr
from sklearn.metrics import r2_score
from sklearn import __version__ as sklearn_vers... | bsd-3-clause |
hvanhovell/spark | python/pyspark/sql/functions.py | 2 | 143764 | #
# 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 us... | apache-2.0 |
illusionww/docker-jupyter-nn-tools | jupyter_notebook_config.py | 2 | 21300 | # Configuration file for jupyter-notebook.
#------------------------------------------------------------------------------
# Configurable configuration
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Logg... | mit |
abhishekkrthakur/scikit-learn | sklearn/cluster/tests/test_spectral.py | 11 | 7958 | """Testing for Spectral Clustering methods"""
from sklearn.externals.six.moves import cPickle
dumps, loads = cPickle.dumps, cPickle.loads
import numpy as np
from scipy import sparse
from sklearn.utils import check_random_state
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_a... | bsd-3-clause |
roxyboy/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 |
jrbourbeau/cr-composition | plotting/plot_yearly_BDT_scores.py | 1 | 4376 | #!/usr/bin/env python
from __future__ import division, print_function
import argparse
import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import multiprocessing as mp
from sklearn.externals import joblib
import comptools as comp
import comptools.analysis.plotting as plo... | mit |
marcocaccin/scikit-learn | sklearn/linear_model/tests/test_ridge.py | 6 | 24655 | 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 |
spreg-git/pysal | pysal/contrib/spint/tests/test_gravity_stats.py | 8 | 12472 | """
Tests for statistics for gravity-style spatial interaction models
"""
__author__ = 'toshan'
import unittest
import numpy as np
import pandas as pd
import gravity as grav
import mle_stats as stats
class SingleParameter(unittest.TestCase):
"""Unit tests statistics when there is a single parameters estimated""... | bsd-3-clause |
RobertABT/heightmap | build/matplotlib/examples/pylab_examples/text_rotation_relative_to_line.py | 9 | 1229 | #!/usr/bin/env python
"""
Text objects in matplotlib are normally rotated with respect to the
screen coordinate system (i.e., 45 degrees rotation plots text along a
line that is in between horizontal and vertical no matter how the axes
are changed). However, at times one wants to rotate text with respect
to something ... | mit |
EVEprosper/ProsperWarehouse | setup.py | 1 | 3216 | """Wheel for ProsperWarehouse project"""
from os import path, listdir
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
HERE = path.abspath(path.dirname(__file__))
def hack_find_packages(include_str):
"""patches setuptools.find_packages issue
setuptools.find... | mit |
PSRCode/lttng-ci-1 | scripts/system-tests/parse-results.py | 2 | 3858 | #! /usr/bin/python3
from subprocess import call
from collections import defaultdict
import csv
import numpy as np
import pandas as pd
import sys
def test_case(df):
# Duration is in usec
# usecPecIter = Duration/(average number of iteration per thread)
df['usecperiter'] = (df['nbthreads'] * df['duration']) ... | gpl-2.0 |
judithfan/pix2svg | generative/tests/compare_test/train.py | 1 | 11171 | from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import os
import sys
import shutil
import numpy as np
from tqdm import tqdm
import torch
import torch.optim as optim
import torch.nn.functional as F
from torch.autograd import Variable
from sklearn.metrics imp... | mit |
dpgoetz/swift | swift/common/middleware/xprofile.py | 36 | 9905 | # Copyright (c) 2010-2012 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | apache-2.0 |
tomlof/scikit-learn | sklearn/decomposition/tests/test_nmf.py | 28 | 17934 | import numpy as np
import scipy.sparse as sp
import numbers
from scipy import linalg
from sklearn.decomposition import NMF, 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 sklearn.utils.te... | bsd-3-clause |
hdmetor/scikit-learn | sklearn/manifold/tests/test_spectral_embedding.py | 216 | 8091 | from nose.tools import assert_true
from nose.tools import assert_equal
from scipy.sparse import csr_matrix
from scipy.sparse import csc_matrix
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
from nose.tools import assert_raises
from nose.plugins.skip import SkipTest
from sk... | bsd-3-clause |
ftfarias/PySubsim | old/sound/peak_detection_1.py | 1 | 2435 | # from https://gist.github.com/endolith/250860
import sys
from numpy import NaN, Inf, arange, isscalar, asarray, array
def peakdet(v, delta, x = None):
"""
Converted from MATLAB script at http://billauer.co.il/peakdet.html
Returns two arrays
function [maxtab, mintab]=peakdet(v, delta, x)
%PEAKDE... | gpl-3.0 |
pradyu1993/scikit-learn | doc/sphinxext/numpy_ext/docscrape_sphinx.py | 52 | 8004 | import re
import inspect
import textwrap
import pydoc
import sphinx
from docscrape import NumpyDocString
from docscrape import FunctionDoc
from docscrape import ClassDoc
class SphinxDocString(NumpyDocString):
def __init__(self, docstring, config=None):
config = {} if config is None else config
sel... | bsd-3-clause |
openturns/otmorris | python/src/plot_sensitivity.py | 1 | 3391 | """
Plot Morris elementary effects
"""
import openturns as ot
import numpy as np
import matplotlib
import pylab as plt
import warnings
matplotlib.rc('text', usetex=True)
matplotlib.rcParams['text.latex.preamble'] = [r"\usepackage{amsmath}"]
class PlotEE(object):
"""
Plot elementary effects
--------------... | lgpl-3.0 |
spallavolu/scikit-learn | sklearn/utils/tests/test_seq_dataset.py | 93 | 2471 | # Author: Tom Dupre la Tour <tom.dupre-la-tour@m4x.org>
#
# License: BSD 3 clause
import numpy as np
import scipy.sparse as sp
from sklearn.utils.seq_dataset import ArrayDataset, CSRDataset
from sklearn.datasets import load_iris
from numpy.testing import assert_array_equal
from nose.tools import assert_equal
iris =... | bsd-3-clause |
kdebrab/pandas | pandas/tests/dtypes/test_common.py | 3 | 23804 | # -*- coding: utf-8 -*-
import pytest
import numpy as np
import pandas as pd
from pandas.core.dtypes.dtypes import (DatetimeTZDtype, PeriodDtype,
CategoricalDtype, IntervalDtype)
import pandas.core.dtypes.common as com
import pandas.util.testing as tm
import pandas.util._test_d... | bsd-3-clause |
memmett/PyWENO | examples/discontinuous.py | 1 | 1204 | """PyWENO smooth reconstruction example."""
import numpy as np
import pyweno.weno
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
def f(x):
r = np.zeros(x.shape)
i = x > 0
r[i] = np.cos(x[i])
i = x <= 0
r[i] = np.sin(x[i])
return r
def F(x):
r = np.zeros(x.shap... | bsd-3-clause |
Comflics/Exploring-OpenFOAM | laminarVortexShedding/strouhal.py | 3 | 1531 | #!/usr/bin/python
# Comflics: Exploring OpenFOAM
# Compute Strouhal Number of Laminar Vortex Shedding
# S. Huq, 13MAY17
#
import numpy as np
import scipy.signal as signal
import matplotlib.pyplot as plt
# # Read Results
data = np.loadtxt('./postProcessing/forceCoeffs/0/forceCoeffs.dat', skiprows=0)
L = 2 ... | gpl-2.0 |
ArcherSys/ArcherSys | Lib/site-packages/sphinx/ext/inheritance_diagram.py | 5 | 14183 | # -*- coding: utf-8 -*-
r"""
sphinx.ext.inheritance_diagram
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Defines a docutils directive for inserting inheritance diagrams.
Provide the directive with one or more classes or modules (separated
by whitespace). For modules, all of the classes in that module will
... | mit |
pythonvietnam/scikit-learn | sklearn/neighbors/tests/test_ball_tree.py | 159 | 10196 | import pickle
import numpy as np
from numpy.testing import assert_array_almost_equal
from sklearn.neighbors.ball_tree import (BallTree, NeighborsHeap,
simultaneous_sort, kernel_norm,
nodeheap_sort, DTYPE, ITYPE)
from sklearn.neighbors.dis... | bsd-3-clause |
runauto/cuda-convnet2 | shownet.py | 180 | 18206 | # Copyright 2014 Google Inc. 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 applicable law or... | apache-2.0 |
raghavrv/scikit-learn | examples/feature_selection/plot_f_test_vs_mi.py | 82 | 1671 | """
===========================================
Comparison of F-test and mutual information
===========================================
This example illustrates the differences between univariate F-test statistics
and mutual information.
We consider 3 features x_1, x_2, x_3 distributed uniformly over [0, 1], the
targ... | bsd-3-clause |
marcocaccin/scikit-learn | examples/classification/plot_classifier_comparison.py | 66 | 4895 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=====================
Classifier comparison
=====================
A comparison of a several classifiers in scikit-learn on synthetic datasets.
The point of this example is to illustrate the nature of decision boundaries
of different classifiers.
This should be taken with ... | bsd-3-clause |
WojciechMigda/KAGGLE-prudential-life-insurance-assessment | src/OptimizedOffsetRegressor.py | 1 | 10844 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
################################################################################
#
# Copyright (c) 2016 Wojciech Migda
# All rights reserved
# Distributed under the terms of the MIT license
#
##############################################################################... | mit |
ua-snap/downscale | snap_scripts/epscor_sc/older_epscor_sc_scripts_archive/seasonal_aggregations_annual_epscor_se_CLI.py | 1 | 10180 | def sort_files( files, split_on='_', elem_month=-2, elem_year=-1 ):
'''
sort a list of files properly using the month and year parsed
from the filename. This is useful with SNAP data since the standard
is to name files like '<prefix>_MM_YYYY.tif'. If sorted using base
Pythons sort/sorted functions, things will b... | mit |
mikecroucher/GPy | GPy/models/sparse_gplvm.py | 6 | 1890 | # Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import sys
from .sparse_gp_regression import SparseGPRegression
from ..core import Param
class SparseGPLVM(SparseGPRegression):
"""
Sparse Gaussian Process Latent Variable Model
:param Y: obs... | bsd-3-clause |
Myasuka/scikit-learn | sklearn/__check_build/__init__.py | 345 | 1671 | """ Module to give helpful messages to the user that did not
compile the scikit properly.
"""
import os
INPLACE_MSG = """
It appears that you are importing a local scikit-learn source tree. For
this, you need to have an inplace install. Maybe you are in the source
directory and you need to try from another location.""... | bsd-3-clause |
pratapvardhan/scikit-learn | sklearn/ensemble/tests/test_partial_dependence.py | 365 | 6996 | """
Testing for the partial dependence module.
"""
import numpy as np
from numpy.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import if_matplotlib
from sklearn.ensemble.partial_dependence import partial_dependence
from sklearn.ensemble.partial_dependence... | bsd-3-clause |
dvornikita/blitznet | training.py | 1 | 14424 | #!/usr/bin/env python3
from config import get_logging_config, args, train_dir
from config import config as net_config
import time
import os
import sys
import socket
import logging
import logging.config
import subprocess
import tensorflow as tf
import numpy as np
import matplotlib
matplotlib.use('Agg')
from vgg imp... | mit |
sumspr/scikit-learn | examples/covariance/plot_mahalanobis_distances.py | 348 | 6232 | r"""
================================================================
Robust covariance estimation and Mahalanobis distances relevance
================================================================
An example to show covariance estimation with the Mahalanobis
distances on Gaussian distributed data.
For Gaussian dis... | bsd-3-clause |
viveksck/langchangetrack | langchangetrack/tsconstruction/distributional/scripts/learn_map.py | 1 | 16046 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""Benchmark for the quality of the joint space"""
from argparse import ArgumentParser
import logging
import sys
from io import open
import os
from os import path
from time import time
from glob import glob
from collections import defaultdict
from copy import deepcopy
from ra... | bsd-3-clause |
wildux/moras | MORAS.py | 1 | 6894 | import cv2
import numpy as np
from matplotlib import pyplot as plt
_SIFT = 0
_SURF = 1
_ORB = 2
_BRISK = 3
_HARRIS = 5
_SHI_TOMASI = 6
_FAST = 7
_STAR = 8
_MSER = 9
_BRIEF = 5
_LATCH = 6
_FREAK = 7
_DAISY = 8
MIN_MATCH_COUNT = 10
#TODO: Make this local params
refPt = [] # List of reference points
cropping = Fals... | gpl-3.0 |
jpzk/evopy | evopy/examples/experiments/fitness_cmaessvc/setup.py | 1 | 4837 | '''
This file is part of evopy.
Copyright 2012 - 2013, Jendrik Poloczek
evopy 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 your
option) any later version.
evopy is di... | gpl-3.0 |
sgiavasis/nipype | nipype/algorithms/rapidart.py | 10 | 31087 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
The rapidart module provides routines for artifact detection and region of
interest analysis.
These functions include:
* ArtifactDetect: performs artifact detection on functional images
* Stimulu... | bsd-3-clause |
graphistry/pygraphistry | graphistry/tests/test_arrow_uploader.py | 1 | 5451 | # -*- coding: utf-8 -*-
import graphistry, mock, pandas as pd, pytest, unittest
from graphistry import ArrowUploader
#TODO mock requests for testing actual effectful code
class TestArrowUploader_Core(unittest.TestCase):
def test_au_init_plain(self):
au = ArrowUploader()
with pytest.raises(Except... | bsd-3-clause |
mfjb/scikit-learn | sklearn/neighbors/classification.py | 132 | 14388 | """Nearest Neighbor Classification"""
# Authors: Jake Vanderplas <vanderplas@astro.washington.edu>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Sparseness support by Lars Buitinck <L.J.Buitinck@uva.nl>
# Multi-output support by ... | bsd-3-clause |
GuessWhoSamFoo/pandas | pandas/core/indexes/timedeltas.py | 1 | 27500 | """ implement the TimedeltaIndex """
from datetime import datetime
import warnings
import numpy as np
from pandas._libs import (
NaT, Timedelta, index as libindex, join as libjoin, lib)
import pandas.compat as compat
from pandas.util._decorators import Appender, Substitution
from pandas.core.dtypes.common import... | bsd-3-clause |
google-research/google-research | graph_embedding/monet/shilling_experiment.py | 1 | 30570 | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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 applicab... | apache-2.0 |
JsNoNo/scikit-learn | examples/ensemble/plot_gradient_boosting_regularization.py | 355 | 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 |
combogenomics/DuctApe | ductape/kegg/kegg.py | 1 | 85620 | #!/usr/bin/env python
"""
Kegg
Kegg Library
Kegg data fetching
"""
import sys
if sys.version_info[0] < 3:
import Queue as queue
from urllib2 import quote
from urllib2 import urlopen
else:
from urllib.request import urlopen
from urllib.parse import quote
import queue
from ductape.common.commont... | bsd-2-clause |
fsbr/se3-path-planner | modularPlanner/vscm.py | 1 | 6595 |
# coding: utf-8
# In this file, I try yet again to make a very simple cusp model. After that, I will try to expand it. This cusp model will literally be the simplest model possible that also includes dipole tilt.
#
# $\phi_{cusp} = \phi_{0} + \psi$.
#
# Then, I'll build up the model a little bit more and a little... | mit |
jllanfranchi/pygeneric | pandasUtils.py | 1 | 3347 | # -*- coding: iso-8859-15 -*-
import numpy as np
import pandas as pd
import multiprocessing
import pathos.multiprocessing as multi
def pdSafe(s):
'''Transform name into Pandas-safe name (i.e., dot-notation-accessible).'''
s = s.translate(None, '\\/ ?!@#$%^&*()-+=\`~|][{}<>,')
s = s.replace('.', '_')
... | mit |
apdavison/python-neo | doc/source/images/generate_diagram.py | 3 | 7863 | """
This generate diagram in .png and .svg from neo.core
Author: sgarcia
"""
from datetime import datetime
import numpy as np
import quantities as pq
from matplotlib import pyplot
from matplotlib.patches import Rectangle, ArrowStyle, FancyArrowPatch
from matplotlib.font_manager import FontProperties
from neo.test.... | bsd-3-clause |
aestrivex/ielu | ielu/plotting_utils.py | 1 | 6230 |
import os
import numpy as np
import nibabel as nib
from traits.api import HasTraits, Float, Int, Tuple
from traitsui.api import View, Item, CSVListEditor
from .geometry import get_vox2rasxfm, apply_affine, get_std_orientation
from .utils import get_subjects_dir
def force_render( figure=None ):
from mayavi impor... | gpl-3.0 |
ankurankan/pgmpy | pgmpy/inference/bn_inference.py | 2 | 8890 | from pgmpy.inference import Inference
from pgmpy.models import BayesianNetwork
import pandas as pd
import numpy as np
import networkx as nx
import itertools
class BayesianModelInference(Inference):
"""
Inference class specific to Bayesian Models
"""
def __init__(self, model):
"""
Clas... | mit |
walterreade/scikit-learn | sklearn/linear_model/ridge.py | 7 | 49612 | """
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 |
lobnek/pyutil | test/test_portfolio/test_builder.py | 1 | 2535 | import pandas as pd
import pytest
from pyutil.portfolio.portfolio import Portfolio, merge
from test.config import read_pd
import pandas.testing as pt
@pytest.fixture(scope="module")
def portfolio():
return Portfolio(prices=read_pd("price.csv", parse_dates=True, index_col=0),
weights=read_pd(... | mit |
pnedunuri/scikit-learn | examples/ensemble/plot_ensemble_oob.py | 259 | 3265 | """
=============================
OOB Errors for Random Forests
=============================
The ``RandomForestClassifier`` is trained using *bootstrap aggregation*, where
each new tree is fit from a bootstrap sample of the training observations
:math:`z_i = (x_i, y_i)`. The *out-of-bag* (OOB) error is the average er... | bsd-3-clause |
pythonvietnam/scikit-learn | sklearn/feature_selection/tests/test_rfe.py | 209 | 11733 | """
Testing Recursive feature elimination
"""
import warnings
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
from nose.tools import assert_equal, assert_true
from scipy import sparse
from sklearn.feature_selection.rfe import RFE, RFECV
from sklearn.datasets import load_iris,... | bsd-3-clause |
GuessWhoSamFoo/pandas | pandas/core/dtypes/dtypes.py | 1 | 31325 | """ define extension dtypes """
import re
import warnings
import numpy as np
import pytz
from pandas._libs.interval import Interval
from pandas._libs.tslibs import NaT, Period, Timestamp, timezones
from pandas.core.dtypes.generic import ABCCategoricalIndex, ABCIndexClass
from pandas import compat
from .base import... | bsd-3-clause |
OpenPHDGuiding/phd2 | contributions/MPI_IS_gaussian_process/tools/plot_gp_data.py | 1 | 1589 | #!/usr/bin/env python
from numpy import genfromtxt
import matplotlib.pyplot as plt
def read_data():
measurement_data = genfromtxt('measurement_data.csv', delimiter=',') # read GP data from csv
measurement_data = measurement_data[1:,:] # strip first line to remove header text
location = measure... | bsd-3-clause |
equialgo/scikit-learn | sklearn/utils/setup.py | 77 | 2993 | 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 |
ycaihua/scikit-learn | examples/cross_decomposition/plot_compare_cross_decomposition.py | 142 | 4761 | """
===================================
Compare cross decomposition methods
===================================
Simple usage of various cross decomposition algorithms:
- PLSCanonical
- PLSRegression, with multivariate response, a.k.a. PLS2
- PLSRegression, with univariate response, a.k.a. PLS1
- CCA
Given 2 multivari... | bsd-3-clause |
rknLA/sms-tools | lectures/05-Sinusoidal-model/plots-code/sineModel-anal-synth.py | 24 | 1483 | import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import hamming, triang, blackmanharris
import sys, os, functools, time
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/'))
import sineModel as SM
import utilFunctions as UF
(fs, x) = UF.wavread(os.p... | agpl-3.0 |
yorkerlin/shogun | examples/undocumented/python_modular/graphical/inverse_covariance_estimation_demo.py | 26 | 2520 | #!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
from pylab import show, imshow
def simulate_data (n,p):
from modshogun import SparseInverseCovariance
import numpy as np
#create a random pxp covariance matrix
cov = np.random.normal(size=(p,p))
#generate data set with multivariate Gaussi... | gpl-3.0 |
DigasNikas/PyRecommender | recommender/content/description_based.py | 1 | 3536 | """
# By Diogo Nicolau
"""
import pandas as pd
import time
import sys
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import linear_kernel
from nltk.corpus import stopwords
import datetime
import re
clean_r = re.compile('<.*?>')
stops = set(stopwords.words("english"))
def ma... | mit |
IshankGulati/scikit-learn | sklearn/neighbors/__init__.py | 71 | 1025 | """
The :mod:`sklearn.neighbors` module implements the k-nearest neighbors
algorithm.
"""
from .ball_tree import BallTree
from .kd_tree import KDTree
from .dist_metrics import DistanceMetric
from .graph import kneighbors_graph, radius_neighbors_graph
from .unsupervised import NearestNeighbors
from .classification impo... | bsd-3-clause |
tjflexic/psb-adr | src/ensemble.py | 1 | 3468 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
from concept_matching import run_cm
from maxent_tfidf import run_tfidf
from maxent_nblcr import run_nblcr
from maxent_we import run_we
from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC
from sklearn.tree... | gpl-2.0 |
ElDeveloper/scikit-learn | examples/linear_model/plot_ridge_path.py | 254 | 1655 | """
===========================================================
Plot Ridge coefficients as a function of the regularization
===========================================================
Shows the effect of collinearity in the coefficients of an estimator.
.. currentmodule:: sklearn.linear_model
:class:`Ridge` Regressi... | bsd-3-clause |
nicproulx/mne-python | examples/inverse/plot_compute_mne_inverse_volume.py | 40 | 1748 | """
=======================================================================
Compute MNE-dSPM inverse solution on evoked data in volume source space
=======================================================================
Compute dSPM inverse solution on MNE evoked dataset in a volume source
space and stores the solutio... | bsd-3-clause |
fengzhyuan/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 |
ville-k/tensorflow | tensorflow/contrib/learn/python/learn/tests/dataframe/arithmetic_transform_test.py | 62 | 2343 | # 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 |
soulmachine/scikit-learn | sklearn/ensemble/tests/test_base.py | 28 | 1334 | """
Testing for the base module (sklearn.ensemble.base).
"""
# Authors: Gilles Louppe
# License: BSD 3 clause
from numpy.testing import assert_equal
from nose.tools import assert_true
from sklearn.utils.testing import assert_raise_message
from sklearn.datasets import load_iris
from sklearn.ensemble import BaggingCla... | bsd-3-clause |
wronk/mne-python | mne/viz/misc.py | 3 | 19647 | """Functions to make simple plots with M/EEG data
"""
from __future__ import print_function
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Eric Larson <larson.eric.d@gmail.com... | bsd-3-clause |
boomsbloom/dtm-fmri | DTM/for_gensim/lib/python2.7/site-packages/sklearn/neighbors/regression.py | 5 | 11000 | """Nearest Neighbor Regression"""
# Authors: Jake Vanderplas <vanderplas@astro.washington.edu>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Sparseness support by Lars Buitinck
# Multi-output support by Arnaud Joly <a.joly@ulg.ac... | mit |
RPGOne/Skynet | scikit-learn-c604ac39ad0e5b066d964df3e8f31ba7ebda1e0e/examples/applications/plot_model_complexity_influence.py | 25 | 6378 | """
==========================
Model Complexity Influence
==========================
Demonstrate how model complexity influences both prediction accuracy and
computational performance.
The dataset is the Boston Housing dataset (resp. 20 Newsgroups) for
regression (resp. classification).
For each class of models we m... | bsd-3-clause |
Dapid/scipy | doc/source/tutorial/examples/normdiscr_plot2.py | 84 | 1642 | import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
npoints = 20 # number of integer support points of the distribution minus 1
npointsh = npoints / 2
npointsf = float(npoints)
nbound = 4 #bounds for the truncated normal
normbound = (1 + 1 / npointsf) * nbound #actual bounds of truncated normal
... | bsd-3-clause |
APPIAN-PET/APPIAN | src/qc.py | 1 | 42641 | # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 mouse=a
import matplotlib
matplotlib.rcParams['figure.facecolor'] = '1.'
matplotlib.use('Agg')
import ants
import numpy as np
import pandas as pd
import os
import imageio
import nipype.pipeline.engine as pe
import nipype.interfaces.utility as niu
import nibabel as... | mit |
Vimos/scikit-learn | sklearn/_build_utils/__init__.py | 80 | 2644 | """
Utilities useful during the build.
"""
# author: Andy Mueller, Gael Varoquaux
# license: BSD
from __future__ import division, print_function, absolute_import
import os
from distutils.version import LooseVersion
from numpy.distutils.system_info import get_info
DEFAULT_ROOT = 'sklearn'
CYTHON_MIN_VERSION = '0.23... | bsd-3-clause |
impactlab/jps-handoff | webapp/viewer/models/datapoints.py | 1 | 3939 | from django.db import models
from django.conf import settings
from django.core.urlresolvers import reverse
from django.contrib.contenttypes import generic
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.core.signals import request_finished
import string, os, fnmatch, csv,... | mit |
JaviMerino/trappy | trappy/stats/grammar.py | 1 | 17033 | # Copyright 2015-2016 ARM Limited
#
# 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 w... | apache-2.0 |
zooniverse/aggregation | experimental/serengeti/IAAI/weight.py | 2 | 1437 | #!/usr/bin/env python
import csv
#ASG000pt52,merxator wildebeest
photos = {}
beta = 1
def weight(TP,TN,FP,FN):
if (TP+beta*TN + FP+FN) == 0:
return -1
return (TP+beta*TN)/float(TP+beta*TN + FP+FN)
searchFor = "zebra"
with open("/home/greg/Databases/goldMergedSerengeti.csv") as f:
reader = csv... | apache-2.0 |
simon-pepin/scikit-learn | sklearn/ensemble/gradient_boosting.py | 126 | 65552 | """Gradient Boosted Regression Trees
This module contains methods for fitting gradient boosted regression trees for
both classification and regression.
The module structure is the following:
- The ``BaseGradientBoosting`` base class implements a common ``fit`` method
for all the estimators in the module. Regressio... | bsd-3-clause |
synthicity/urbansim | urbansim/models/transition.py | 4 | 17258 | """
Use the ``TransitionModel`` class with the different transitioners to
add or remove agents based on growth rates or target totals.
"""
from __future__ import division
import logging
import numpy as np
import pandas as pd
from . import util
from ..utils.logutil import log_start_finish
from ..utils.sampling impor... | bsd-3-clause |
zhenv5/scikit-learn | examples/svm/plot_svm_scale_c.py | 223 | 5375 | """
==============================================
Scaling the regularization parameter for SVCs
==============================================
The following example illustrates the effect of scaling the
regularization parameter when using :ref:`svm` for
:ref:`classification <svm_classification>`.
For SVC classificati... | bsd-3-clause |
rohit21122012/DCASE2013 | runs/2016/dnn2016med_traps/traps39/src/dataset.py | 55 | 78980 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import locale
import socket
import tarfile
import urllib2
import zipfile
from sklearn.cross_validation import StratifiedShuffleSplit, KFold
from files import *
from general import *
from ui import *
class Dataset(object):
"""Dataset base class.
The specific da... | mit |
dinrker/Ray_FEM | Plots/python_scripts/paper2/ex1_NumRay_ConvRate.py | 1 | 2663 | import numpy as np
import math
omega = np.array([376.991118430775,
502.654824574367,
753.982236861550,
1005.30964914873,
1507.96447372310,
2010.61929829747,
3015.92894744620])
omega = omega/np.pi
err_NPW_4 = np.array([0.00270157770281540,
0.00219734201275802,
0.00170110076048316,
0.00141722055515402,
0.0011620660058... | mit |
cheral/orange3 | Orange/tests/test_linear_regression.py | 7 | 4736 | # Test methods with long descriptive names can omit docstrings
# pylint: disable=missing-docstring
import unittest
import numpy as np
from Orange.data import Table
from Orange.preprocess import *
from Orange.regression import (LinearRegressionLearner,
RidgeRegressionLearner,
... | bsd-2-clause |
pkruskal/scikit-learn | examples/linear_model/plot_logistic_l1_l2_sparsity.py | 384 | 2601 | """
==============================================
L1 Penalty and Sparsity in Logistic Regression
==============================================
Comparison of the sparsity (percentage of zero coefficients) of solutions when
L1 and L2 penalty are used for different values of C. We can see that large
values of C give mo... | bsd-3-clause |
MKridler/pyxley | examples/custom_react/project/app.py | 11 | 2196 | from flask import Flask
from flask import request, jsonify, render_template, make_response
import pandas as pd
import json
import sys
import glob
import numpy as np
import argparse
from react import jsx
from pyxley import UILayout
from pyxley.filters import SelectButton
from pyxley.charts import Chart
from collection... | mit |
erh3cq/hyperspy | hyperspy/drawing/_markers/vertical_line_segment.py | 4 | 3486 | # -*- coding: utf-8 -*-
# Copyright 2007-2020 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 |
boomsbloom/dtm-fmri | DTM/for_gensim/lib/python2.7/site-packages/matplotlib/_pylab_helpers.py | 8 | 4008 | """
Manage figures for pyplot interface.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from matplotlib.externals import six
import sys
import gc
import atexit
def error_msg(msg):
print(msg, file=sys.stderr)
class Gcf(object):
"""
Single... | mit |
jason-neal/equanimous-octo-tribble | Notebooks/Stride_testing.py | 1 | 6037 |
# coding: utf-8
# # Testing numpy Stride
# For snr calculation windowing
# In[21]:
from __future__ import division
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from astropy.io import fits
from numpy.lib import stride_tricks
get_ipython().magic('matplotlib inline')
... | mit |
cmorgan/zipline | tests/test_tradesimulation.py | 21 | 2735 | #
# Copyright 2014 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 |
flinz/nest-simulator | topology/doc/user_manual_scripts/connections.py | 3 | 18279 | # -*- 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 |
Zsailer/epistasis | epistasis/validate.py | 2 | 1868 | import numpy as np
import pandas as pd
from .stats import split_gpm, pearson
def k_fold(gpm, model, k=10):
"""Cross-validation using K-fold validation on a seer.
"""
# Get index.
idx = np.copy(gpm.index)
# Shuffle index
np.random.shuffle(idx)
# Get subsets.
subsets = np.array_split(i... | unlicense |
yonglehou/scikit-learn | sklearn/utils/extmath.py | 142 | 21102 | """
Extended math utilities.
"""
# Authors: Gael Varoquaux
# Alexandre Gramfort
# Alexandre T. Passos
# Olivier Grisel
# Lars Buitinck
# Stefan van der Walt
# Kyle Kastner
# License: BSD 3 clause
from __future__ import division
from functools import partial
import ... | bsd-3-clause |
Silmathoron/PyNeurActiv | doc/examples/analyzing_raters.py | 2 | 1210 | #!/usr/bin/env python
#-*- coding:utf-8 -*-
""" Using a custom recorder """
from pprint import pprint
import numpy as np
import nest
import nngt
from nngt.simulation import monitor_nodes
import PyNeurActiv as pna
import matplotlib.pyplot as plt
num_omp = 5
nest.SetKernelStatus({'local_num_threads': num_omp, 'ove... | gpl-3.0 |
fstagni/DIRAC | Core/Utilities/Graphs/GraphUtilities.py | 6 | 14279 | """ GraphUtilities is a a collection of utility functions and classes used
in the DIRAC Graphs package.
The DIRAC Graphs package is derived from the GraphTool plotting package of the
CMS/Phedex Project by ... <to be added>
"""
__RCSID__ = "$Id$"
import os
import time
import datetime
import calendar
impo... | gpl-3.0 |
elkingtonmcb/scikit-learn | examples/linear_model/plot_logistic.py | 312 | 1426 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Logit function
=========================================================
Show in the plot is how the logistic regression would, in this
synthetic dataset, classify values as either 0 or 1,
i.e. class one or two, u... | bsd-3-clause |
ibmsoe/tensorflow | tensorflow/python/estimator/inputs/queues/feeding_functions.py | 46 | 15782 | # 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 |
Vimos/scikit-learn | sklearn/utils/tests/test_testing.py | 29 | 7316 | import warnings
import unittest
import sys
from sklearn.utils.testing import (
assert_raises,
assert_less,
assert_greater,
assert_less_equal,
assert_greater_equal,
assert_warns,
assert_no_warnings,
assert_equal,
set_random_state,
assert_raise_message,
ignore_warnings)
from ... | bsd-3-clause |
bzero/statsmodels | tools/code_maintenance.py | 37 | 2307 | """
Code maintenance script modified from PyMC
"""
#!/usr/bin/env python
import sys
import os
# This is a function, not a test case, because it has to be run from inside
# the source tree to work well.
mod_strs = ['IPython', 'pylab', 'matplotlib', 'scipy','Pdb']
dep_files = {}
for mod_str in mod_strs:
dep_files... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.