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 |
|---|---|---|---|---|---|
hamogu/doc | source/figures/schematic_pileup.py | 2 | 1265 | '''Generate schematic of a pile-up event
use: python schematic_pileup.py figurename.png
'''
import sys
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D # import required for projection='3d'
from figurescripts import savefig
event1 = np.array([[0.0, 0.0, 0.0],
... | gpl-2.0 |
zakkum42/Bosch | src/04-model/bosch_full_autoencoder_from_dir_with_fit_x.py | 1 | 20637 | import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import pickle
import os
import math
import glob
from sklearn.metrics import mean_squared_error
from include.dataset_fnames import generate_station_data_fname, generate_data_fname, generate_response_data_fname, train_categoric... | apache-2.0 |
potash/scikit-learn | sklearn/linear_model/sag.py | 14 | 11269 | """Solvers for Ridge and LogisticRegression using SAG algorithm"""
# Authors: Tom Dupre la Tour <tom.dupre-la-tour@m4x.org>
#
# License: BSD 3 clause
import numpy as np
import warnings
from ..exceptions import ConvergenceWarning
from ..utils import check_array
from ..utils.extmath import row_norms
from .base import ... | bsd-3-clause |
r9y9/librosa | librosa/decompose.py | 2 | 18417 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Spectrogram decomposition
=========================
.. autosummary::
:toctree: generated/
decompose
hpss
nn_filter
"""
import numpy as np
import scipy.sparse
from scipy.ndimage import median_filter
import sklearn.decomposition
from . import core
fro... | isc |
flag0010/pop_gen_cnn | tajimas_D/generic_tajD.py | 2 | 3383 | from common import *
from itertools import izip
def tajD(N,S,k):
'''N is the number of indv
S is the number of seg. sites
k is the (ave number of pairwise nuc. diffs), e.g. total number of pairwise diffs divided by choose(N,2)
so:
i1 AT|T|GGCG|A|CAG|T
i2 AT|G|GGCG|C|CAG|A
... | gpl-3.0 |
darioizzo/pykep | pykep/trajopt/_pl2pl_N_impulses.py | 2 | 11321 | from pykep.core import epoch, DAY2SEC, lambert_problem, propagate_lagrangian, SEC2DAY, AU, ic2par
from pykep.planet import jpl_lp
from math import pi, cos, sin, log, acos
from scipy.linalg import norm
class pl2pl_N_impulses(object):
"""
This class is a pygmo (http://esa.github.io/pygmo/) problem representing ... | gpl-3.0 |
ilo10/scikit-learn | sklearn/utils/tests/test_sparsefuncs.py | 157 | 13799 | import numpy as np
import scipy.sparse as sp
from scipy import linalg
from numpy.testing import assert_array_almost_equal, assert_array_equal
from sklearn.datasets import make_classification
from sklearn.utils.sparsefuncs import (mean_variance_axis,
inplace_column_scale,
... | bsd-3-clause |
zuku1985/scikit-learn | examples/linear_model/plot_ols_ridge_variance.py | 387 | 2060 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Ordinary Least Squares and Ridge Regression Variance
=========================================================
Due to the few points in each dimension and the straight
line that linear regression uses to follow thes... | bsd-3-clause |
sposs/DIRAC | Core/Utilities/Graphs/BarGraph.py | 10 | 6337 | ########################################################################
# $HeadURL$
########################################################################
""" BarGraph represents bar graphs with vertical bars both simple
and stacked.
The DIRAC Graphs package is derived from the GraphTool plotting pack... | gpl-3.0 |
nitikayad96/chandra_suli | chandra_suli/check_hot_pixel_revised.py | 1 | 8674 | #!/usr/bin/env python
"""
Check to see if candidate transients are actually hot pixels
"""
import argparse
import glob
import os
import sys
import astropy.io.fits as pyfits
import numpy as np
from sklearn.cluster import DBSCAN
from sklearn.metrics.pairwise import euclidean_distances
from chandra_suli import logging... | bsd-3-clause |
ScienceStacks/SciSheets | mysite/scisheets/plugins/exportTableToExcel.py | 2 | 1394 | """
Exports an Excel file
"""
import openpyxl
import pandas as pd
def _exportDataframeToExcel(df, filepath, worksheet=None):
"""
Export the specified columns to the excel file.
The existing worksheet is overwritten.
:param str filepath: full path to CSV file
:param pandas.DataFrame df:
:param str workshe... | apache-2.0 |
jlegendary/scikit-learn | sklearn/decomposition/tests/test_incremental_pca.py | 297 | 8265 | """Tests for Incremental PCA."""
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_raises
from sklearn import datasets
from sklearn.decomposition import PCA, IncrementalPCA
iris = datasets.load... | bsd-3-clause |
nickcdryan/hep_ml | setup.py | 3 | 1554 | from setuptools import setup
import codecs
with codecs.open('README.rst', encoding='utf-8') as readme_file:
long_description = readme_file.read()
setup(
name="hep_ml",
version='0.3.0',
description="Machine Learning for High Energy Physics",
long_description=long_description,
url='https://git... | apache-2.0 |
goyalankit/po-compiler | object_files/networkx-1.8.1/examples/drawing/sampson.py | 40 | 1379 | #!/usr/bin/env python
"""
Sampson's monastery data.
Shows how to read data from a zip file and plot multiple frames.
"""
__author__ = """Aric Hagberg (hagberg@lanl.gov)"""
# Copyright (C) 2010 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# Al... | apache-2.0 |
carthach/essentia | src/examples/python/musicbricks-tutorials/2-sinemodel_analsynth.py | 1 | 2076 |
import essentia
import essentia.streaming as es
# import matplotlib for plotting
import matplotlib.pyplot as plt
import numpy as np
import sys
# algorithm parameters
params = { 'frameSize': 2048, 'hopSize': 512, 'startFromZero': False, 'sampleRate': 44100,'maxnSines': 100,'magnitudeThreshold': -74,'minSineDur': 0.02... | agpl-3.0 |
afrachioni/umbrella | tools/plot_pmf.py | 1 | 1619 | #!/usr/bin/env python
import matplotlib
matplotlib.use('Agg')
import pylab
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import numpy
def rescale(arr):
min = 1e20
for x in arr:
if x < min:
min = x
for i in range(len(arr)):
arr[i] = (arr[i] - min) # / something
def flatten(arr):
for elem i... | gpl-3.0 |
sumspr/scikit-learn | sklearn/tests/test_metaestimators.py | 226 | 4954 | """Common tests for metaestimators"""
import functools
import numpy as np
from sklearn.base import BaseEstimator
from sklearn.externals.six import iterkeys
from sklearn.datasets import make_classification
from sklearn.utils.testing import assert_true, assert_false, assert_raises
from sklearn.pipeline import Pipeline... | bsd-3-clause |
huobaowangxi/scikit-learn | examples/decomposition/plot_ica_vs_pca.py | 306 | 3329 | """
==========================
FastICA on 2D point clouds
==========================
This example illustrates visually in the feature space a comparison by
results using two different component analysis techniques.
:ref:`ICA` vs :ref:`PCA`.
Representing ICA in the feature space gives the view of 'geometric ICA':
ICA... | bsd-3-clause |
DuCorey/bokeh | bokeh/core/json_encoder.py | 5 | 7177 | ''' Provide a functions and classes to implement a custom JSON encoder for
serializing objects for BokehJS.
The primary interface is provided by the |serialize_json| function, which
uses the custom |BokehJSONEncoder| to produce JSON output.
In general, functions in this module convert values in the following way:
* ... | bsd-3-clause |
GuessWhoSamFoo/pandas | asv_bench/benchmarks/io/json.py | 5 | 4937 | import numpy as np
import pandas.util.testing as tm
from pandas import DataFrame, date_range, timedelta_range, concat, read_json
from ..pandas_vb_common import BaseIO
class ReadJSON(BaseIO):
fname = "__test__.json"
params = (['split', 'index', 'records'], ['int', 'datetime'])
param_names = ['orient', 'i... | bsd-3-clause |
themrmax/scikit-learn | examples/linear_model/plot_lasso_model_selection.py | 39 | 5425 | """
===================================================
Lasso model selection: Cross-Validation / AIC / BIC
===================================================
Use the Akaike information criterion (AIC), the Bayes Information
criterion (BIC) and cross-validation to select an optimal value
of the regularization paramet... | bsd-3-clause |
yyjiang/scikit-learn | examples/cluster/plot_digits_agglomeration.py | 377 | 1694 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Feature agglomeration
=========================================================
These images how similar features are merged together using
feature agglomeration.
"""
print(__doc__)
# Code source: Gaël Varoquaux
#... | bsd-3-clause |
jshiv/turntable | test/lib/python2.7/site-packages/numpy/fft/fftpack.py | 35 | 42179 | """
Discrete Fourier Transforms
Routines in this module:
fft(a, n=None, axis=-1)
ifft(a, n=None, axis=-1)
rfft(a, n=None, axis=-1)
irfft(a, n=None, axis=-1)
hfft(a, n=None, axis=-1)
ihfft(a, n=None, axis=-1)
fftn(a, s=None, axes=None)
ifftn(a, s=None, axes=None)
rfftn(a, s=None, axes=None)
irfftn(a, s=None, axes=None... | mit |
arnavd96/Cinemiezer | myvenv/lib/python3.4/site-packages/moviepy/video/io/sliders.py | 16 | 2196 | import matplotlib.pyplot as plt
from matplotlib.widgets import Slider, Button
def sliders(f, sliders_properties, wait_for_validation = False):
""" A light GUI to manually explore and tune the outputs of
a function.
slider_properties is a list of dicts (arguments for Slider )
def v... | mit |
cmohl2013/permutation_test | permutation_test/functions.py | 1 | 14269 | #import pandas as pd
import numpy as np
import random
import permutation_test.ap as ap
#import warnings
from operator import mul
from fractions import Fraction
import functools
from operator import itemgetter
import collections
from numpy.random import normal
def permutationtest(data, ref_data, detailed=False, n_c... | mit |
samzhang111/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 |
anirudhjayaraman/scikit-learn | sklearn/preprocessing/tests/test_function_transformer.py | 176 | 2169 | from nose.tools import assert_equal
import numpy as np
from sklearn.preprocessing import FunctionTransformer
def _make_func(args_store, kwargs_store, func=lambda X, *a, **k: X):
def _func(X, *args, **kwargs):
args_store.append(X)
args_store.extend(args)
kwargs_store.update(kwargs)
... | bsd-3-clause |
bthirion/scikit-learn | sklearn/gaussian_process/gaussian_process.py | 17 | 34869 | # -*- coding: utf-8 -*-
# Author: Vincent Dubourg <vincent.dubourg@gmail.com>
# (mostly translation, see implementation details)
# License: BSD 3 clause
from __future__ import print_function
import numpy as np
from scipy import linalg, optimize
from ..base import BaseEstimator, RegressorMixin
from ..metrics... | bsd-3-clause |
PythonCharmers/bokeh | bokeh/compat/mplexporter/tools.py | 75 | 1732 | """
Tools for matplotlib plot exporting
"""
def ipynb_vega_init():
"""Initialize the IPython notebook display elements
This function borrows heavily from the excellent vincent package:
http://github.com/wrobstory/vincent
"""
try:
from IPython.core.display import display, HTML
except I... | bsd-3-clause |
prheenan/BioModel | BellZhurkov/Python/TestExamples/TestUtil/Bell_Test_Data.py | 1 | 2506 | # force floating point division. Can still use integer with //
from __future__ import division
# This file is used for importing the common utilities classes.
import numpy as np
import matplotlib.pyplot as plt
import sys
class BellData:
def __init__(self,forces,RatesFold,RatesUnfold=None):
self.Forces = fo... | gpl-2.0 |
sgenoud/scikit-learn | examples/svm/plot_svm_nonlinear.py | 5 | 1067 | """
==============
Non-linear SVM
==============
Perform binary classification using non-linear SVC
with RBF kernel. The target to predict is a XOR of the
inputs.
The color map illustrates the decision function learn by the SVC.
"""
print __doc__
import numpy as np
import pylab as pl
from sklearn import svm
xx, yy ... | bsd-3-clause |
gpospelov/BornAgain | devtools/mpi/pytests/mpi_cpp_test.py | 3 | 2236 | # Mixture of cylinders and prisms without interference
from mpi4py import MPI # this line has to be first
import numpy
import matplotlib
import pylab
from libBornAgainCore import *
comm = MPI.COMM_WORLD
world_size = comm.Get_size()
world_rank = comm.Get_rank()
def get_sample():
"""
Build and return the samp... | gpl-3.0 |
mardom/GalSim | devel/external/test_cf/test_cf.py | 1 | 3573 | # Copyright 2012, 2013 The GalSim developers:
# https://github.com/GalSim-developers
#
# This file is part of GalSim: The modular galaxy image simulation toolkit.
#
# GalSim is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software... | gpl-3.0 |
akshayparopkari/phylotoast | bin/LDA.py | 2 | 11875 | #!/usr/bin/env python
"""
Abstract: This script calculates and returns LDA plots based on normalized relative
abundances or distance matrices (for e.g. unifrac distance matrix).
"""
import sys
import argparse
from itertools import cycle
from phylotoast import util, biom_calc as bc, graph_util as gu
errors = ... | mit |
gengliangwang/spark | python/pyspark/pandas/internal.py | 1 | 57972 | #
# 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 |
ah-anssi/SecuML | SecuML/core/ActiveLearning/QueryStrategies/AnnotationQueries/AladinAnnotationQueries.py | 1 | 12484 | # SecuML
# Copyright (C) 2016-2017 ANSSI
#
# SecuML 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
# (at your option) any later version.
#
# SecuML is distributed in the h... | gpl-2.0 |
jpn--/larch | tests/test_nnnl.py | 1 | 3786 | from larch.model import Model
import numpy
from pytest import approx
import pandas
from larch.data_services.examples import ITINERARY_RAW
from larch.data_services import H5PodCE
from larch import DataService, Model
from larch.util.common_functions import fourier_series, piecewise_linear
import pytest
@pytest.mark.ski... | gpl-3.0 |
ngoix/OCRF | sklearn/feature_selection/tests/test_chi2.py | 56 | 2400 | """
Tests for chi2, currently the only feature selection function designed
specifically to work with sparse matrices.
"""
import numpy as np
from scipy.sparse import coo_matrix, csr_matrix
import scipy.stats
from sklearn.feature_selection import SelectKBest, chi2
from sklearn.feature_selection.univariate_selection im... | bsd-3-clause |
eg-zhang/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 |
mhdella/ThinkStats2 | code/timeseries.py | 66 | 18035 | """This file contains code for use with "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2014 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function
import pandas
import numpy as np
import statsmodels.formula.api as smf
import st... | gpl-3.0 |
NunoEdgarGub1/scikit-learn | examples/model_selection/randomized_search.py | 201 | 3214 | """
=========================================================================
Comparing randomized search and grid search for hyperparameter estimation
=========================================================================
Compare randomized search and grid search for optimizing hyperparameters of a
random forest.
... | bsd-3-clause |
syedjafri/ThinkStats2 | code/scatter.py | 69 | 4281 | """This file contains code for use with "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2010 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function
import sys
import numpy as np
import math
import brfss
import thinkplot
import ... | gpl-3.0 |
kjung/scikit-learn | sklearn/ensemble/tests/test_gradient_boosting.py | 43 | 39945 | """
Testing for the gradient boosting module (sklearn.ensemble.gradient_boosting).
"""
import warnings
import numpy as np
from itertools import product
from scipy.sparse import csr_matrix
from scipy.sparse import csc_matrix
from scipy.sparse import coo_matrix
from sklearn import datasets
from sklearn.base import clo... | bsd-3-clause |
ilyes14/scikit-learn | sklearn/ensemble/forest.py | 176 | 62555 | """Forest of trees-based ensemble methods
Those methods include random forests and extremely randomized trees.
The module structure is the following:
- The ``BaseForest`` base class implements a common ``fit`` method for all
the estimators in the module. The ``fit`` method of the base ``Forest``
class calls the ... | bsd-3-clause |
belltailjp/scikit-learn | sklearn/svm/tests/test_sparse.py | 95 | 12156 | from nose.tools import assert_raises, assert_true, assert_false
import numpy as np
from scipy import sparse
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_equal)
from sklearn import datasets, svm, linear_model, base
from sklearn.datasets import make_classif... | bsd-3-clause |
KarlTDebiec/myplotspec | manage_output.py | 1 | 4072 | # -*- coding: utf-8 -*-
# myplotspec.manage_output.py
#
# Copyright (C) 2015-2017 Karl T Debiec
# All rights reserved.
#
# This software may be modified and distributed under the terms of the
# BSD license. See the LICENSE file for details.
"""
Decorator to manage the output of matplotlib figures.
"""
#######... | bsd-3-clause |
cloudera/ibis | ibis/tests/expr/test_window_functions.py | 2 | 9929 | # Copyright 2014 Cloudera Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | apache-2.0 |
0x0all/scikit-learn | examples/datasets/plot_iris_dataset.py | 283 | 1928 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
The Iris Dataset
=========================================================
This data sets consists of 3 different types of irises'
(Setosa, Versicolour, and Virginica) petal and sepal
length, stored in a 150x4 numpy... | bsd-3-clause |
zuku1985/scikit-learn | sklearn/utils/extmath.py | 19 | 27505 | """
Extended math utilities.
"""
# Authors: Gael Varoquaux
# Alexandre Gramfort
# Alexandre T. Passos
# Olivier Grisel
# Lars Buitinck
# Stefan van der Walt
# Kyle Kastner
# Giorgio Patrini
# License: BSD 3 clause
from __future__ import division
from funct... | bsd-3-clause |
hesam-setareh/nest-simulator | examples/nest/Potjans_2014/spike_analysis.py | 15 | 6288 | # -*- coding: utf-8 -*-
#
# spike_analysis.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 |
theoryno3/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 |
ndingwall/scikit-learn | benchmarks/bench_mnist.py | 23 | 6874 | """
=======================
MNIST dataset benchmark
=======================
Benchmark on the MNIST dataset. The dataset comprises 70,000 samples
and 784 features. Here, we consider the task of predicting
10 classes - digits from 0 to 9 from their raw images. By contrast to the
covertype dataset, the feature space is... | bsd-3-clause |
maciekcc/tensorflow | tensorflow/contrib/learn/__init__.py | 25 | 2458 | # 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 |
zhuolinho/linphone | submodules/mswebrtc/webrtc/webrtc/modules/remote_bitrate_estimator/test/plot_dynamics.py | 11 | 4681 | #!/usr/bin/env python
# Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All c... | gpl-2.0 |
kushalbhola/MyStuff | Practice/PythonApplication/env/Lib/site-packages/numpy/linalg/linalg.py | 1 | 86449 | """Lite version of scipy.linalg.
Notes
-----
This module is a lite version of the linalg.py module in SciPy which
contains high-level Python interface to the LAPACK library. The lite
version only accesses the following LAPACK functions: dgesv, zgesv,
dgeev, zgeev, dgesdd, zgesdd, dgelsd, zgelsd, dsyevd, zheevd, dgetr... | apache-2.0 |
TiKeil/Master-thesis-LOD | python_files/generate_figures/7.2_Perturbations.py | 1 | 3613 | # This file is part of the master thesis "Variational crimes in the Localized orthogonal decomposition method":
# https://github.com/TiKeil/Masterthesis-LOD.git
# Copyright holder: Tim Keil
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
import numpy as np
import buildcoef2d
import m... | apache-2.0 |
hobson/pug-invest | setup.py | 1 | 4803 | # setup.py for PUG (PDX Python User Group) package
# the parent name (perhaps a namespace package) you'd import
__namespace_package__ = 'pug'
# the subpackage that this installer is providing that you'd import like __import__(__namespace_package__ + '.' + '__subpackage__')
__subpackage__ = 'invest'
# the name as it wil... | mit |
gandalfcode/gandalf | tests/dust_tests/plot_dustywave.py | 1 | 2178 | #==============================================================================
# plot_dustywave.py
# Plot the gas and dust velocity for the final snapshot in the DUSTWAVE
# problem.
#
# This file is part of GANDALF :
# Graphical Astrophysics code for N-body Dynamics And Lagrangian Fluids
# https://github.com/gan... | gpl-2.0 |
liangz0707/scikit-learn | sklearn/utils/metaestimators.py | 283 | 2353 | """Utilities for meta-estimators"""
# Author: Joel Nothman
# Andreas Mueller
# Licence: BSD
from operator import attrgetter
from functools import update_wrapper
__all__ = ['if_delegate_has_method']
class _IffHasAttrDescriptor(object):
"""Implements a conditional property using the descriptor protocol.
... | bsd-3-clause |
ahnqirage/spark | python/pyspark/serializers.py | 4 | 26207 | #
# 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 |
uglyboxer/linear_neuron | net-p3/lib/python3.5/site-packages/sklearn/cross_decomposition/cca_.py | 23 | 3087 | from .pls_ import _PLS
__all__ = ['CCA']
class CCA(_PLS):
"""CCA Canonical Correlation Analysis.
CCA inherits from PLS with mode="B" and deflation_mode="canonical".
Parameters
----------
n_components : int, (default 2).
number of components to keep.
scale : boolean, (default True)
... | mit |
f3r/scikit-learn | examples/linear_model/plot_ols.py | 220 | 1940 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Linear Regression Example
=========================================================
This example uses the only the first feature of the `diabetes` dataset, in
order to illustrate a two-dimensional plot of this regre... | bsd-3-clause |
diorcety/intellij-community | python/helpers/pydev/pydev_ipython/qt_for_kernel.py | 67 | 2337 | """ Import Qt in a manner suitable for an IPython kernel.
This is the import used for the `gui=qt` or `matplotlib=qt` initialization.
Import Priority:
if Qt4 has been imported anywhere else:
use that
if matplotlib has been imported and doesn't support v2 (<= 1.0.1):
use PyQt4 @v1
Next, ask ETS' QT_API env v... | apache-2.0 |
fivejjs/pgmult | experiments/ctm.py | 1 | 15557 | """
Correlated topic model (LDA) test
"""
from __future__ import division
from __future__ import print_function
import os, re, gzip, time, operator, inspect, hashlib, random
import cPickle as pickle
from collections import namedtuple
from functools import wraps
import scipy.sparse
from scipy.sparse import csr_matrix, ... | mit |
Chuban/moose | test/tests/time_integrators/scalar/run_stiff.py | 8 | 5672 | #!/usr/bin/env python
import subprocess
import sys
import csv
import matplotlib.pyplot as plt
import numpy as np
# Use fonts that match LaTeX
from matplotlib import rcParams
rcParams['font.family'] = 'serif'
rcParams['font.size'] = 17
rcParams['font.serif'] = ['Computer Modern Roman']
rcParams['text.usetex'] = True
#... | lgpl-2.1 |
glouppe/scikit-learn | sklearn/decomposition/truncated_svd.py | 30 | 7896 | """Truncated SVD for sparse matrices, aka latent semantic analysis (LSA).
"""
# Author: Lars Buitinck <L.J.Buitinck@uva.nl>
# Olivier Grisel <olivier.grisel@ensta.org>
# Michael Becker <mike@beckerfuffle.com>
# License: 3-clause BSD.
import numpy as np
import scipy.sparse as sp
try:
from scipy.sp... | bsd-3-clause |
bashkirtsevich/autocode | text_preprocessing/tools/w2v_trainer.py | 1 | 1651 | class my_sentences(object):
def __init__(self, data_path, separator, fields):
import pandas as pd
self._df = pd.read_csv(data_path, sep=separator, engine="python", names=fields)
def __iter__(self):
for i in range(self._df.shape[0]):
yield " ".join([self._df["f1"].loc[i], se... | gpl-3.0 |
AnasGhrab/scikit-learn | benchmarks/bench_plot_nmf.py | 206 | 5890 | """
Benchmarks of Non-Negative Matrix Factorization
"""
from __future__ import print_function
from collections import defaultdict
import gc
from time import time
import numpy as np
from scipy.linalg import norm
from sklearn.decomposition.nmf import NMF, _initialize_nmf
from sklearn.datasets.samples_generator import... | bsd-3-clause |
kambysese/mne-python | mne/parallel.py | 14 | 6545 | """Parallel util function."""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: Simplified BSD
import logging
import os
from . import get_config
from .utils import logger, verbose, warn, ProgressBar
from .utils.check import int_like
from .fixes import _get_args
if 'MNE_FORCE_SERIAL' in os.envi... | bsd-3-clause |
roxyboy/scikit-learn | sklearn/semi_supervised/tests/test_label_propagation.py | 307 | 1974 | """ test the label propagation module """
import nose
import numpy as np
from sklearn.semi_supervised import label_propagation
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_array_equal
ESTIMATORS = [
(label_propagation.LabelPropagation, {'kernel': 'rbf'}),
(label_propa... | bsd-3-clause |
bigdataelephants/scikit-learn | examples/bicluster/plot_spectral_coclustering.py | 276 | 1736 | """
==============================================
A demo of the Spectral Co-Clustering algorithm
==============================================
This example demonstrates how to generate a dataset and bicluster it
using the the Spectral Co-Clustering algorithm.
The dataset is generated using the ``make_biclusters`` f... | bsd-3-clause |
dustalov/watlink | eval/pathwise.py | 1 | 5020 | #!/usr/bin/env python3
import argparse
import csv
import itertools
import warnings
from collections import defaultdict
from concurrent.futures import ProcessPoolExecutor
import networkx as nx
from scipy.stats import wilcoxon
from sklearn.exceptions import UndefinedMetricWarning
from sklearn.metrics import confusion_m... | mit |
revoer/keystone-8.0.0 | swift/common/middleware/xprofile.py | 8 | 9623 | # 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 |
djpine/pyman | Book/chap8/Supporting Materials/FitOscDecay.py | 3 | 2239 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec # for unequal plot boxes
import scipy.optimize
# define function to calculate reduced chi-squared
def RedChiSqr(func, x, y, dy, params):
resids = y - func(x, *params)
chisq = ((resids/dy)**2).sum()
return chisq/float... | cc0-1.0 |
snfactory/extract-star | scripts/pySNIFS_special.py | 1 | 10568 | from matplotlib.mlab import linspace, dist
from matplotlib.patches import Circle, Rectangle
from matplotlib.lines import Line2D
from matplotlib.numerix import array
from matplotlib.transforms import blend_xy_sep_transform
from scipy.special import sqrt
import thread
import pylab
class Cursor:
"""
A horizonta... | mit |
shenzebang/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 |
neuroidss/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/pylab.py | 70 | 10245 | """
This is a procedural interface to the matplotlib object-oriented
plotting library.
The following plotting commands are provided; the majority have
Matlab(TM) analogs and similar argument.
_Plotting commands
acorr - plot the autocorrelation function
annotate - annotate something in the figure
arrow ... | agpl-3.0 |
hsiaoyi0504/scikit-learn | sklearn/ensemble/tests/test_base.py | 284 | 1328 | """
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 |
abhishekgahlot/scikit-learn | sklearn/decomposition/base.py | 12 | 5524 | """Principal Component Analysis Base Classes"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Denis A. Engemann <d.engemann@fz-juelich.de>
# Kyle Kastner <kastnerkyle@gmail.com>
#
# Licen... | bsd-3-clause |
wegamekinglc/Finance-Python | PyFin/tests/Analysis/testCrossSectionValueHolders.py | 2 | 22232 | # -*- coding: utf-8 -*-
u"""
Created on 2017-1-6
@author: cheng.li
"""
import unittest
import numpy as np
import pandas as pd
from PyFin.Enums import Factors
from PyFin.Analysis.SecurityValueHolders import SecurityLatestValueHolder
from PyFin.Analysis.CrossSectionValueHolders import CSRankedSecurityValueHolder
from P... | mit |
yunfeilu/scikit-learn | examples/svm/plot_svm_regression.py | 249 | 1451 | """
===================================================================
Support Vector Regression (SVR) using linear and non-linear kernels
===================================================================
Toy example of 1D regression using linear, polynomial and RBF kernels.
"""
print(__doc__)
import numpy as np
... | bsd-3-clause |
AIML/scikit-learn | sklearn/utils/validation.py | 67 | 24013 | """Utilities for input validation"""
# Authors: Olivier Grisel
# Gael Varoquaux
# Andreas Mueller
# Lars Buitinck
# Alexandre Gramfort
# Nicolas Tresegnie
# License: BSD 3 clause
import warnings
import numbers
import numpy as np
import scipy.sparse as sp
from ..externals i... | bsd-3-clause |
Mushirahmed/gnuradio | gr-utils/src/python/plot_data.py | 17 | 5768 | #
# Copyright 2007,2008,2011 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 option)
# any later ve... | gpl-3.0 |
rstoneback/pysat | pysat/instruments/templates/netcdf_pandas.py | 2 | 7632 | # -*- coding: utf-8 -*-
"""
Generic module for loading netCDF4 files into the pandas format within pysat.
This file may be used as a template for adding pysat support for a new dataset
based upon netCDF4 files, or other file types (with modification).
This routine may also be used to add quick local support for a net... | bsd-3-clause |
pythonvietnam/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 |
sinhrks/seaborn | examples/many_facets.py | 26 | 1062 | """
Plotting on a large number of facets
====================================
"""
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(style="ticks")
# Create a dataset with many short random walks
rs = np.random.RandomState(4)
pos = rs.randint(-1, 2, (20, 5)).cumsum(ax... | bsd-3-clause |
courtarro/gnuradio | gr-fec/python/fec/polar/decoder.py | 24 | 10396 | #!/usr/bin/env python
#
# Copyright 2015 Free Software Foundation, Inc.
#
# 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 option)
# any later version.
#
# GNU Radio is... | gpl-3.0 |
snowdj/research_public | drafts/kelly/kelly_kalman_pairs.py | 3 | 11530 | """
Pairs Trading with Kalman Filters
Author: David Edwards
This algorithm extends the Kalman Filtering pairs trading algorithm from a
previous lecture to support multiple pairs. In order to extend the idea,
the previous algorithm was factored into a class so several instances can be
created with different assets.
... | apache-2.0 |
JoostVisser/ml-assignment2 | mglearn/plot_knn_regression.py | 1 | 1210 | import numpy as np
import matplotlib.pyplot as plt
from sklearn.neighbors import KNeighborsRegressor
from sklearn.metrics import euclidean_distances
from mglearn.datasets import make_wave
def plot_knn_regression(n_neighbors=1):
X, y = make_wave(n_samples=40)
X_test = np.array([[-1.5], [0.9], [1.5]])
di... | mit |
klingebj/regreg | doc/source/sphinxext/docscrape_sphinx.py | 2 | 7817 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import re, inspect, textwrap, pydoc
import sphinx
from docscrape import NumpyDocString, FunctionDoc, ClassDoc
class SphinxDocString(NumpyDocString):
def __init__(self, docstring, config={}):
se... | bsd-3-clause |
Eric89GXL/scikit-learn | sklearn/feature_selection/variance_threshold.py | 7 | 2438 | # Author: Lars Buitinck <L.J.Buitinck@uva.nl>
# License: 3-clause BSD
import numpy as np
from ..base import BaseEstimator
from .base import SelectorMixin
from ..utils import atleast2d_or_csr
from ..utils.sparsefuncs import csr_mean_variance_axis0
class VarianceThreshold(BaseEstimator, SelectorMixin):
"""Feature ... | bsd-3-clause |
schets/scikit-learn | examples/feature_stacker.py | 246 | 1906 | """
=================================================
Concatenating multiple feature extraction methods
=================================================
In many real-world examples, there are many ways to extract features from a
dataset. Often it is beneficial to combine several methods to obtain good
performance. Th... | bsd-3-clause |
tcm129/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 |
gladk/trunk | doc/sphinx/tutorial/06-periodic-triaxial-test.py | 4 | 3492 | # encoding: utf-8
# periodic triaxial test simulation
#
# The initial packing is either
#
# 1. random cloud with uniform distribution, or
# 2. cloud with specified granulometry (radii and percentages), or
# 3. cloud of clumps, i.e. rigid aggregates of several particles
#
# The triaxial consists of 2 stages:
#
# 1. iso... | gpl-2.0 |
ManuSchmi88/landlab | drivers/runfile_combined_soil.py | 1 | 20706 | """Landlab Driver for running Landscape Evolution Experiments with
- Soil weathering
- Soil diffusion
- Detachment-limited river erosion
- tectonic uplift
- vegetation modulation of erosion effects
Created by: Manuel Schmid, University of Tuebingen, 07.04.2017
"""
## Import necessary Python and La... | mit |
sourabhdattawad/BuildingMachineLearningSystemsWithPython | ch07/boston1.py | 22 | 1147 | # 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
# This script shows an example of simple (ordinary) linear regression
# The first edition of the book ... | mit |
kushalbhola/MyStuff | Practice/PythonApplication/env/Lib/site-packages/pandas/tests/frame/test_explode.py | 2 | 3212 | import numpy as np
import pytest
import pandas as pd
from pandas.util import testing as tm
def test_error():
df = pd.DataFrame(
{"A": pd.Series([[0, 1, 2], np.nan, [], (3, 4)], index=list("abcd")), "B": 1}
)
with pytest.raises(ValueError):
df.explode(list("AA"))
df.columns = list("AA... | apache-2.0 |
OshynSong/scikit-learn | sklearn/manifold/tests/test_isomap.py | 226 | 3941 | from itertools import product
import numpy as np
from numpy.testing import assert_almost_equal, assert_array_almost_equal
from sklearn import datasets
from sklearn import manifold
from sklearn import neighbors
from sklearn import pipeline
from sklearn import preprocessing
from sklearn.utils.testing import assert_less
... | bsd-3-clause |
xavierwu/scikit-learn | examples/gaussian_process/plot_gp_probabilistic_classification_after_regression.py | 252 | 3490 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
==============================================================================
Gaussian Processes classification example: exploiting the probabilistic output
==============================================================================
A two-dimensional regression exerci... | bsd-3-clause |
loli/semisupervisedforests | examples/plot_digits_pipe.py | 250 | 1809 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Pipelining: chaining a PCA and a logistic regression
=========================================================
The PCA does an unsupervised dimensionality reduction, while the logistic
regression does the predictio... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.