repo_name stringlengths 6 112 | path stringlengths 4 204 | copies stringlengths 1 3 | size stringlengths 4 6 | content stringlengths 714 810k | license stringclasses 15
values |
|---|---|---|---|---|---|
dhruv13J/scikit-learn | sklearn/tests/test_multiclass.py | 72 | 24581 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.testing ... | bsd-3-clause |
bzcheeseman/phys211 | Alex/Compton Scattering/plotter.py | 1 | 2439 | from scipy import optimize
import numpy as np
import matplotlib.pyplot as plt
def read_data():
datafile = r'data/data.csv'
data = np.genfromtxt(datafile, delimiter=',', skiprows=1)
return data
data = read_data()
def linear(p, x):
return p[0] * x + p[1]
def residual(p, x, y, err):
return (lin... | lgpl-3.0 |
rxa254/MoodCube | Plotting/randomNoiseAnimation.py | 1 | 1571 |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from scipy import ndimage
# Update the matplotlib configuration parameters:
plt.rcParams.update({'font.size': 20,
'font.family': 'serif',
'figure.figsize': (10, 8),
... | bsd-3-clause |
rs2/pandas | pandas/tests/indexes/multi/test_missing.py | 2 | 3378 | import numpy as np
import pytest
import pandas as pd
from pandas import MultiIndex
import pandas._testing as tm
def test_fillna(idx):
# GH 11343
msg = "isna is not defined for MultiIndex"
with pytest.raises(NotImplementedError, match=msg):
idx.fillna(idx[0])
def test_dropna():
# GH 6194
... | bsd-3-clause |
balister/GNU-Radio | gr-filter/examples/fir_filter_fff.py | 5 | 3225 | #!/usr/bin/env python
from gnuradio import gr, filter
from gnuradio import analog
from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
try:
import scipy
except ImportError:
print "Error: could not import scipy (http://www.sc... | gpl-3.0 |
anubhavvardhan/qutip | qutip/tomography.py | 9 | 7107 | # This file is part of QuTiP: Quantum Toolbox in Python.
#
# Copyright (c) 2011 and later, Paul D. Nation and Robert J. Johansson.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
... | bsd-3-clause |
kernc/scikit-learn | examples/manifold/plot_swissroll.py | 330 | 1446 | """
===================================
Swiss Roll reduction with LLE
===================================
An illustration of Swiss Roll reduction
with locally linear embedding
"""
# Author: Fabian Pedregosa -- <fabian.pedregosa@inria.fr>
# License: BSD 3 clause (C) INRIA 2011
print(__doc__)
import matplotlib.pyplot... | bsd-3-clause |
martimy/SANDProject | sand/add.py | 1 | 8333 | #!/usr/bin/python3
# Copyright (c) 2017 Maen Artimy
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, mer... | mit |
tapomayukh/projects_in_python | classification/Classification_with_HMM/Single_Contact_Classification/multivariate_gaussian_emissions/test_crossvalidation_force_motion_10_states.py | 1 | 16532 | # Hidden Markov Model Implementation
import pylab as pyl
import numpy as np
import matplotlib.pyplot as pp
#from enthought.mayavi import mlab
import scipy as scp
import scipy.ndimage as ni
import roslib; roslib.load_manifest('sandbox_tapo_darpa_m3')
import rospy
#import hrl_lib.mayavi2_util as mu
import hrl_lib.viz ... | mit |
mengxn/tensorflow | tensorflow/examples/learn/mnist.py | 45 | 3999 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | apache-2.0 |
SamStudio8/scikit-bio | skbio/stats/distance/tests/test_bioenv.py | 13 | 9972 | # ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | bsd-3-clause |
yl565/statsmodels | statsmodels/sandbox/nonparametric/dgp_examples.py | 37 | 6008 | # -*- coding: utf-8 -*-
"""Examples of non-linear functions for non-parametric regression
Created on Sat Jan 05 20:21:22 2013
Author: Josef Perktold
"""
import numpy as np
## Functions
def fg1(x):
'''Fan and Gijbels example function 1
'''
return x + 2 * np.exp(-16 * x**2)
def fg1eu(x):
'''Eubank ... | bsd-3-clause |
mmottahedi/neuralnilm_prototype | scripts/e200.py | 2 | 6685 | from __future__ import print_function, division
import matplotlib
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import Net, RealApplianceSource, BLSTMLayer, DimshuffleLayer
from lasagne.nonlinearities import sigmoid, rectify
from lasagne.objectives import crossentropy, mse... | mit |
rexshihaoren/scikit-learn | sklearn/datasets/tests/test_samples_generator.py | 67 | 14842 | from __future__ import division
from collections import defaultdict
from functools import partial
import numpy as np
from sklearn.externals.six.moves import zip
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_almost_equal
fr... | bsd-3-clause |
smartscheduling/scikit-learn-categorical-tree | sklearn/manifold/tests/test_t_sne.py | 6 | 9770 | import sys
from sklearn.externals.six.moves import cStringIO as StringIO
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_raises_regexp
... | bsd-3-clause |
eramirem/astroML | book_figures/chapter3/fig_kurtosis_skew.py | 3 | 2902 | r"""
Kurtosis and Skew
-----------------
Figure 3.6.
An example of distributions with different skewness
:math:`\Sigma` (top panel) and kurtosis K (bottom panel). The modified
Gaussian in the upper panel is a normal distribution multiplied by a
Gram-Charlier series (see eq. 4.70), with a0 = 2, a1 = 1, and a2 = 0.5.
Th... | bsd-2-clause |
sanjayankur31/nest-simulator | pynest/examples/spatial/grid_iaf_irr.py | 20 | 1453 | # -*- coding: utf-8 -*-
#
# grid_iaf_irr.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, o... | gpl-2.0 |
tjlaboss/openmc | openmc/data/photon.py | 8 | 44955 | from collections import OrderedDict
from collections.abc import Mapping, Callable
from copy import deepcopy
from io import StringIO
from math import pi
from numbers import Integral, Real
import os
import h5py
import numpy as np
import pandas as pd
from scipy.interpolate import CubicSpline
import openmc.checkvalue as ... | mit |
flightgong/scikit-learn | sklearn/datasets/mlcomp.py | 5 | 3805 | # Copyright (c) 2010 Olivier Grisel <olivier.grisel@ensta.org>
# License: BSD 3 clause
"""Glue code to load http://mlcomp.org data as a scikit.learn dataset"""
import os
import numbers
from sklearn.datasets.base import load_files
def _load_document_classification(dataset_path, metadata, set_=None, **kwargs):
if ... | bsd-3-clause |
fw1121/luigi | examples/pyspark_wc.py | 56 | 3361 | # -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | apache-2.0 |
nelango/ViralityAnalysis | model/lib/pandas/core/api.py | 9 | 1318 |
# pylint: disable=W0614,W0401,W0611
import numpy as np
from pandas.core.algorithms import factorize, match, unique, value_counts
from pandas.core.common import isnull, notnull
from pandas.core.categorical import Categorical
from pandas.core.groupby import Grouper
from pandas.core.format import set_eng_float_format
f... | mit |
Leguark/pynoddy | pynoddy/Copy of history.py | 3 | 46835 | '''Noddy history file wrapper
Created on 24/03/2014
@author: Florian Wellmann
'''
import time # for header in model generation
import numpy as np
# import numpy as np
# import matplotlib.pyplot as plt
import events
class NoddyHistory():
"""Class container for Noddy history files"""
def __init__(self, ... | gpl-2.0 |
idlead/scikit-learn | sklearn/preprocessing/tests/test_imputation.py | 47 | 12381 |
import numpy as np
from scipy import sparse
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_true
from sklearn.preprocessing.imput... | bsd-3-clause |
wwf5067/statsmodels | docs/sphinxext/ipython_directive.py | 30 | 27623 | # -*- coding: utf-8 -*-
"""Sphinx directive to support embedded IPython code.
This directive allows pasting of entire interactive IPython sessions, prompts
and all, and their code will actually get re-executed at doc build time, with
all prompts renumbered sequentially. It also allows you to input code as a pure
pytho... | bsd-3-clause |
konraddysput/BioDocumentAnalysis | vocabularytester/similarity.py | 1 | 2444 | from abc import ABCMeta, abstractmethod
import pandas as pd
from typing import List, Dict
import numpy as np
from scipy import spatial
class SimRegression(metaclass=ABCMeta):
@abstractmethod
def calculate_similarity(self, vector_a: np.ndarray, vector_b: np.ndarray) -> float:
...
class EuclideanSim... | mit |
theislab/scanpy_usage | 170503_zheng17/html/compile_profiling_info.py | 1 | 6040 | import re
from glob import glob
import pandas as pd
import numpy as np
from matplotlib import pyplot as pl
from natsort import natsorted
import seaborn as sns
from matplotlib import rcParams
# dictionary to init dataframe that stores all the information
df = {}
df['toolkit'] = []
df['n cells'] = []
df['step'] = []
df[... | bsd-3-clause |
spxtr/test-infra | mungegithub/issue_labeler/simple_app.py | 6 | 4947 | #!/usr/bin/env python
# Copyright 2016 The Kubernetes 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 appli... | apache-2.0 |
VEVO/hidi | hidi/inout.py | 1 | 2636 | import numpy as np
import pandas as pd
from hidi.transform import Transform
class ReadTransform(Transform):
"""
Read input csv data from disk.
Input data should be a csv file formatted with three
columns: :code:`link_id`, :code:`item_id`, and
:code:`score`. If score is not provided, it we be
... | apache-2.0 |
sommerc/cellcognition_explorer_cedl | cedl_cmd/cedl.py | 1 | 18798 | #!/usr/bin/env python
'''
CellCognition Explorer - deep learning command-line extension
'''
import os
import sys
import cellh5
import h5py
import numpy
from numpy.lib.recfunctions import merge_arrays
import pandas
import logging
logger = logging.getLogger(__name__)
from autoencoders import Autoencoder, AdaGradTrain... | gpl-3.0 |
BigDataforYou/movie_recommendation_workshop_1 | big_data_4_you_demo_1/venv/lib/python2.7/site-packages/pandas/io/tests/test_packers.py | 1 | 30648 | import nose
import 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
from pandas import (Series, DataFrame, Panel, MultiIndex, bdate_range,
date_range, period_range, Index, Categorical)
... | mit |
aabadie/scikit-learn | sklearn/manifold/setup.py | 24 | 1279 | import os
from os.path import join
import numpy
from numpy.distutils.misc_util import Configuration
from sklearn._build_utils import get_blas_info
def configuration(parent_package="", top_path=None):
config = Configuration("manifold", parent_package, top_path)
libraries = []
if os.name == 'posix':
... | bsd-3-clause |
songeater/SONGSHTR | sampler.py | 1 | 5535 | '''
https://github.com/MattVitelli/GRUV
'''
from __future__ import print_function
from keras.models import Sequential, load_model, Model
from keras.layers import Dense, Lambda, Dropout, TimeDistributed, LSTM, Input
from keras import backend as K
from keras import objectives
from keras.optimizers import RMSpro... | agpl-3.0 |
ptrendx/mxnet | example/rcnn/symdata/vis.py | 11 | 1559 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 |
ShawnMurd/MetPy | examples/plots/surface_declarative.py | 6 | 2177 | # Copyright (c) 2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""
=========================================
Surface Analysis using Declarative Syntax
=========================================
The MetPy declarative syntax allows for a simplifie... | bsd-3-clause |
chrisburr/scikit-learn | examples/mixture/plot_gmm_classifier.py | 22 | 4015 | """
==================
GMM classification
==================
Demonstration of Gaussian mixture models for classification.
See :ref:`gmm` for more information on the estimator.
Plots predicted labels on both training and held out test data using a
variety of GMM classifiers on the iris dataset.
Compares GMMs with sp... | bsd-3-clause |
larsoner/mne-python | mne/source_estimate.py | 2 | 127983 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Matti Hämäläinen <msh@nmr.mgh.harvard.edu>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Mads Jensen <mje.mads@gmail.com>
#
# License: BSD (3-clause)
import contextlib
import copy
import os.path as op
from types import Generator... | bsd-3-clause |
kashif/scikit-learn | sklearn/linear_model/tests/test_sag.py | 33 | 28228 | # Authors: Danny Sullivan <dbsullivan23@gmail.com>
# Tom Dupre la Tour <tom.dupre-la-tour@m4x.org>
#
# Licence: BSD 3 clause
import math
import numpy as np
import scipy.sparse as sp
from sklearn.linear_model.sag import get_auto_step_size
from sklearn.linear_model.sag_fast import _multinomial_grad_loss_all_sa... | bsd-3-clause |
zertan/Menace | menace/bin/addStrainCoverage.py | 2 | 3094 | #!/usr/bin/env python
import numpy as np
import pandas
import xmltodict
import os
import sys
#import time
def chunks(l, n):
"""Yield successive n-sized chunks from l."""
for i in range(0, len(l), n):
yield l[i:i+n]
def binData(x,binSize):
l=np.ceil((len(x)/binSize))
out=np.zeros(l+1)
tmp=chunks(x,binSize)
for... | gpl-2.0 |
RachitKansal/scikit-learn | sklearn/feature_extraction/hashing.py | 183 | 6155 | # Author: Lars Buitinck <L.J.Buitinck@uva.nl>
# License: BSD 3 clause
import numbers
import numpy as np
import scipy.sparse as sp
from . import _hashing
from ..base import BaseEstimator, TransformerMixin
def _iteritems(d):
"""Like d.iteritems, but accepts any collections.Mapping."""
return d.iteritems() if... | bsd-3-clause |
JsNoNo/scikit-learn | benchmarks/bench_covertype.py | 120 | 7381 | """
===========================
Covertype dataset benchmark
===========================
Benchmark stochastic gradient descent (SGD), Liblinear, and Naive Bayes, CART
(decision tree), RandomForest and Extra-Trees on the forest covertype dataset
of Blackard, Jock, and Dean [1]. The dataset comprises 581,012 samples. It ... | bsd-3-clause |
Obus/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 |
dieterich-lab/rp-bp | rpbp/analysis/rpbp_predictions/create_bf_rpkm_scatter_plot.py | 1 | 6309 | #! /usr/bin/env python3
import matplotlib
matplotlib.use('agg')
import argparse
import logging
import os
import yaml
import matplotlib.pyplot as plt
import numpy as np
import pbio.utils.bio as bio
import pbio.misc.utils as utils
import pbio.ribo.ribo_filenames as filenames
import pbio.ribo.ribo_utils as ribo_utils
... | mit |
ahoyosid/scikit-learn | sklearn/linear_model/tests/test_ridge.py | 14 | 20805 | import numpy as np
import scipy.sparse as sp
from scipy import linalg
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_a... | bsd-3-clause |
villalonreina/dipy | dipy/tests/test_scripts.py | 7 | 5119 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
""" Test scripts
Run scripts and check outputs
"""
'''
from __future__ import division, print_function, absolute_import
import glob
import os
import shutil
from os.path import (dirname, join as pjoin, ab... | bsd-3-clause |
rlowrance/re-avm | chart-03.py | 1 | 8395 | '''create charts showing results of rfval.py
INVOCATION
python chart-03.py [--data] [--test]
INPUT FILES
INPUT/rfval/YYYYMM.pickle
OUTPUT FILES
WORKING/chart-03/[test-]data.pickle
WORKING/chart-03/[test-]VAR-YYYY[-MM].pdf
where
VAR in {max_depth | max_features}
YYYY in {2004 | 2005 | 2006 | 2007 | 2008 | 200... | bsd-3-clause |
florentchandelier/zipline | zipline/utils/calendars/exchange_calendar_cme.py | 7 | 3143 | #
# Copyright 2016 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 |
laurentgo/arrow | dev/archery/archery/lang/python.py | 3 | 7570 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 |
larsmans/scikit-learn | doc/tutorial/text_analytics/skeletons/exercise_02_sentiment.py | 256 | 2406 | """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 |
yavalvas/yav_com | build/matplotlib/examples/pylab_examples/image_interp.py | 6 | 1925 | #!/usr/bin/env python
"""
The same (small) array, interpolated with three different
interpolation methods.
The center of the pixel at A[i,j] is plotted at i+0.5, i+0.5. If you
are using interpolation='nearest', the region bounded by (i,j) and
(i+1,j+1) will have the same color. If you are using interpolation,
the pi... | mit |
MJuddBooth/pandas | pandas/tests/indexes/interval/test_interval.py | 1 | 52262 | from __future__ import division
from itertools import permutations
import re
import numpy as np
import pytest
from pandas.compat import lzip
import pandas as pd
from pandas import (
Index, Interval, IntervalIndex, Timedelta, Timestamp, date_range,
interval_range, isna, notna, timedelta_range)
import pandas.... | bsd-3-clause |
vshtanko/scikit-learn | examples/applications/plot_species_distribution_modeling.py | 254 | 7434 | """
=============================
Species distribution modeling
=============================
Modeling species' geographic distributions is an important
problem in conservation biology. In this example we
model the geographic distribution of two south american
mammals given past observations and 14 environmental
varia... | bsd-3-clause |
smrjan/seldon-server | python/seldon/pipeline/auto_transforms.py | 2 | 14874 | from sklearn import preprocessing
from dateutil.parser import parse
import datetime
from collections import defaultdict
import numpy as np
import pandas as pd
import math
import itertools
from sklearn.base import BaseEstimator,TransformerMixin
import logging
from seldon.util import DeprecationHelper
logger = logging.g... | apache-2.0 |
kjung/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 |
petosegan/scikit-learn | sklearn/decomposition/tests/test_factor_analysis.py | 222 | 3055 | # Author: Christian Osendorfer <osendorf@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Licence: BSD3
import numpy as np
from sklearn.utils.testing import assert_warns
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing im... | bsd-3-clause |
samuel1208/scikit-learn | examples/feature_selection/plot_feature_selection.py | 249 | 2827 | """
===============================
Univariate Feature Selection
===============================
An example showing univariate feature selection.
Noisy (non informative) features are added to the iris data and
univariate feature selection is applied. For each feature, we plot the
p-values for the univariate feature s... | bsd-3-clause |
rohanp/scikit-learn | examples/applications/svm_gui.py | 287 | 11161 | """
==========
Libsvm GUI
==========
A simple graphical frontend for Libsvm mainly intended for didactic
purposes. You can create data points by point and click and visualize
the decision region induced by different kernels and parameter settings.
To create positive examples click the left mouse button; to create
neg... | bsd-3-clause |
ryanraaum/african-mtdna | popdata_sources/batai2013/process.py | 1 | 1598 | from oldowan.mtconvert import seq2sites, sites2seq, str2sites
from string import translate
import pandas as pd
import numpy as np
import sys
sys.path.append('../../scripts')
from utils import *
## load metadata
metadata = pd.read_csv('metadata.csv', index_col=0)
region = range2region(metadata.ix[0,'SeqRange'])
with ... | cc0-1.0 |
ammarkhann/FinalSeniorCode | lib/python2.7/site-packages/scipy/stats/_multivariate.py | 12 | 112182 | #
# Author: Joris Vankerschaver 2013
#
from __future__ import division, print_function, absolute_import
import math
import numpy as np
import scipy.linalg
from scipy.misc import doccer
from scipy.special import gammaln, psi, multigammaln, xlogy, entr
from scipy._lib._util import check_random_state
from scipy.linalg.bl... | mit |
zorroblue/scikit-learn | sklearn/feature_extraction/hashing.py | 29 | 6866 | # Author: Lars Buitinck
# License: BSD 3 clause
import numbers
import warnings
import numpy as np
import scipy.sparse as sp
from . import _hashing
from ..base import BaseEstimator, TransformerMixin
def _iteritems(d):
"""Like d.iteritems, but accepts any collections.Mapping."""
return d.iteritems() if hasat... | bsd-3-clause |
lavakyan/mstm-spectrum | mstm_studio/mie_theory.py | 1 | 6127 | """
code from nanophotonics/npmie repository
url: https://github.com/nanophotonics/npmie
code by Alan Sanders
modified to use in MSTM-studio by L.Aavakyan
"""
import numpy as np
from mstm_studio.mstm_spectrum import Material
try:
from scipy.special import sph_jnyn
except:
from scipy.special import sp... | gpl-3.0 |
lisette-espin/mrqap | libs/profiling.py | 1 | 4473 | __author__ = 'espin'
#######################################################################################
### Dependences
### Reference:
### http://fa.bianp.net/blog/2013/different-ways-to-get-memory-consumption-or-lessons-learned-from-memory_profiler/
###############################################################... | cc0-1.0 |
potash/scikit-learn | sklearn/tests/test_dummy.py | 186 | 17778 | from __future__ import division
import numpy as np
import scipy.sparse as sp
from sklearn.base import clone
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_almost_eq... | bsd-3-clause |
PatrickChrist/scikit-learn | examples/text/document_classification_20newsgroups.py | 222 | 10500 | """
======================================================
Classification of text documents using sparse features
======================================================
This is an example showing how scikit-learn can be used to classify documents
by topics using a bag-of-words approach. This example uses a scipy.spars... | bsd-3-clause |
tum-ens/rivus | rivus/utils/pandaspyomo.py | 2 | 7016 | """ pandaspyomo: read data from coopr.pyomo models to pandas DataFrames
Pyomo is a GAMS-like model description language for mathematical
optimization problems. This module provides functions to read data from
Pyomo model instances and result objects. Use list_entities to get a list
of all entities (sets, params, vari... | gpl-3.0 |
mdanielwork/intellij-community | python/helpers/pydev/pydev_ipython/matplotlibtools.py | 15 | 6107 |
import sys
backends = {'tk': 'TkAgg',
'gtk': 'GTKAgg',
'wx': 'WXAgg',
'qt': 'Qt4Agg', # qt3 not supported
'qt4': 'Qt4Agg',
'qt5': 'Qt5Agg',
'osx': 'MacOSX'}
# We also need a reverse backends2guis mapping that will properly choose which
# GUI sup... | apache-2.0 |
alexandrebarachant/Grasp-and-lift-EEG-challenge | ensembling/XGB.py | 4 | 3853 | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 15 21:19:51 2015.
@author: rc, alex
"""
import numpy as np
from sklearn.base import BaseEstimator, ClassifierMixin
from progressbar import Bar, ETA, Percentage, ProgressBar, RotatingMarker
from preprocessing.aux import delay_preds
import xgboost as xgb
class XGB(Base... | bsd-3-clause |
shirtsgroup/pygo | analysis/figure_generation/Tab2_plot.py | 1 | 1101 | import numpy
import matplotlib
import matplotlib.pyplot as plt
def main():
plt.rc('text',usetex=True)
matplotlib.rc('font', family = 'serif')
font = {'family' : 'serif',
'size' : 'larger'}
adsorbed = numpy.load('adsorbed_rate.out.npy')
desorbed = numpy.load('desorbed_rate.out.npy')
... | gpl-2.0 |
SmartCheckCentrale/Fatigue | Code/main.py | 1 | 8706 | # -*- coding: utf-8 -*-
"""
Created on Tue May 2 02:23:37 2017
@author: Houssam
"""
import sys
import matplotlib.pyplot as plt
from PyQt5 import uic
from matplotlib.figure import Figure
from PyQt5.QtWidgets import QApplication, QMainWindow, QSizePolicy, QWidget
from matplotlib.backends.backend_qt5agg ... | mit |
Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/IPython/core/tests/test_completer.py | 3 | 24991 | # encoding: utf-8
"""Tests for the IPython tab-completion machinery."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import os
import sys
import unittest
from contextlib import contextmanager
import nose.tools as nt
from traitlets.config.loader import Config
... | artistic-2.0 |
jamesblunt/sympy | sympy/external/tests/test_importtools.py | 91 | 1215 | from sympy.external import import_module
# fixes issue that arose in addressing issue 6533
def test_no_stdlib_collections():
'''
make sure we get the right collections when it is not part of a
larger list
'''
import collections
matplotlib = import_module('matplotlib',
__import__kwargs={... | bsd-3-clause |
vortex-ape/scikit-learn | sklearn/tests/test_isotonic.py | 31 | 15103 | import warnings
import numpy as np
import pickle
import copy
from sklearn.isotonic import (check_increasing, isotonic_regression,
IsotonicRegression)
from sklearn.utils.testing import (assert_raises, assert_array_equal,
assert_true, assert_false, assert... | bsd-3-clause |
BeiLuoShiMen/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_qt.py | 69 | 16846 | from __future__ import division
import math
import os
import sys
import matplotlib
from matplotlib import verbose
from matplotlib.cbook import is_string_like, onetrue
from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \
FigureManagerBase, FigureCanvasBase, NavigationToolbar2, cursors
from mat... | agpl-3.0 |
jreback/pandas | pandas/tests/io/pytables/common.py | 4 | 2054 | from contextlib import contextmanager
import os
import tempfile
import pytest
from pandas.io.pytables import HDFStore
tables = pytest.importorskip("tables")
# set these parameters so we don't have file sharing
tables.parameters.MAX_NUMEXPR_THREADS = 1
tables.parameters.MAX_BLOSC_THREADS = 1
tables.parameters.MAX_THR... | bsd-3-clause |
dankolbman/NumericalAnalysis | Homeworks/HW2/Problem5ii.py | 1 | 3007 | import math
import scipy.interpolate as intrp
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
## for Palatino and other serif fonts use:
#rc('font',**{'family':'serif','serif':['Palatino']})
rc('text', usetex=True)
font = {'fa... | mit |
samueljackson92/NDImage | ndimage/gui/mpl_canvas.py | 1 | 2950 | from __future__ import unicode_literals
from PyQt4 import QtGui
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt4agg import (
FigureCanvasQTAgg as FigureCanvas,
NavigationToolbar2QT as NavigationToolbar)
from matplotlib.figure import Figure
class PandasMplWidget(QtGui.QW... | mit |
natashabatalha/PandExo | pandexo/engine/create_input.py | 1 | 18989 | import numpy as np
import pickle
import pandas as pd
from sqlalchemy import *
import astropy.units as u
import astropy.constants as c
import os
from astropy.modeling import blackbody as bb
import warnings
with warnings.catch_warnings():
warnings.filterwarnings("ignore")
import pysynphot as psyn
def ... | gpl-3.0 |
X-martin/robot_quant | frame/filter_method.py | 1 | 1740 | import pandas as pd
from datetime import datetime
from datetime import timedelta
def cross(factor_list, stock_list, date, args):
dt = timedelta(days=1)
df1 = factor_list[0].get_val(stock_list, date)
df2 = factor_list[1].get_val(stock_list, date)
df1_0 = factor_list[0].get_val(stock_list, date - dt)
... | mit |
valexandersaulys/airbnb_kaggle_contest | venv/lib/python3.4/site-packages/pandas/tseries/plotting.py | 9 | 9293 | """
Period formatters and locators adapted from scikits.timeseries by
Pierre GF Gerard-Marchant & Matt Knox
"""
#!!! TODO: Use the fact that axis can have units to simplify the process
import numpy as np
from matplotlib import pylab
from pandas.tseries.period import Period
from pandas.tseries.offsets import DateOffs... | gpl-2.0 |
Rossonero/bmlswp | ch06/02_tuning.py | 22 | 5484 | # 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 trains tries to tweak hyperparameters to improve P/R AUC
#
import time
start_time = ti... | mit |
xubenben/scikit-learn | examples/ensemble/plot_forest_importances_faces.py | 403 | 1519 | """
=================================================
Pixel importances with a parallel forest of trees
=================================================
This example shows the use of forests of trees to evaluate the importance
of the pixels in an image classification task (faces). The hotter the pixel,
the more impor... | bsd-3-clause |
samuel1208/scikit-learn | benchmarks/bench_tree.py | 297 | 3617 | """
To run this, you'll need to have installed.
* scikit-learn
Does two benchmarks
First, we fix a training set, increase the number of
samples to classify and plot number of classified samples as a
function of time.
In the second benchmark, we increase the number of dimensions of the
training set, classify a sam... | bsd-3-clause |
blackecho/Deep-Belief-Network | yadlt/core/unsupervised_model.py | 2 | 4251 | """Unsupervised Model scheleton."""
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from yadlt.core.model import Model
from yadlt.utils import tf_utils
class UnsupervisedModel(Model):
"""Unsupervised Model scheleton class.
The interface of the class is sklearn... | apache-2.0 |
braghiere/JULESv4.6_clump | examples/us-me2/output/plot_gpp_anomaly_boreas.py | 1 | 11326 | import os
import matplotlib.pyplot as plt
import numpy as np
import sys
from matplotlib.font_manager import FontProperties
from matplotlib.ticker import MultipleLocator
import matplotlib.patches as mpatches # for mask legend
from matplotlib.font_manager import FontProperties
from matplotlib import cm
import pan... | gpl-2.0 |
braghiere/JULESv4.6_clump | examples/boreas_4.6/output/plotfapar_cosz.py | 1 | 7233 | import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
from matplotlib import dates as d
import datetime as dt
import numpy as np
# CODE FROM http://nipunbatra.github.io/2015/06/timeseries/
plt.style.use('ggplot')
SIZE = 32
plt.rc('font', size=SIZE) # controls default text sizes
plt.rc('axes', titles... | gpl-2.0 |
toobaz/pandas | scripts/download_wheels.py | 1 | 1173 | #!/usr/bin/env python
"""Fetch wheels from wheels.scipy.org for a pandas version."""
import argparse
import pathlib
import sys
import urllib.parse
import urllib.request
from lxml import html
def parse_args(args=None):
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("version", type=s... | bsd-3-clause |
spinellic/Mission-Planner | Lib/site-packages/numpy/doc/creation.py | 94 | 5411 | """
==============
Array Creation
==============
Introduction
============
There are 5 general mechanisms for creating arrays:
1) Conversion from other Python structures (e.g., lists, tuples)
2) Intrinsic numpy array array creation objects (e.g., arange, ones, zeros,
etc.)
3) Reading arrays from disk, either from... | gpl-3.0 |
yslib/SGMMCluster | SGMM/TrainBlockGMM.py | 1 | 7987 | import numpy as np
from multiprocessing import Process
from sklearn import mixture
import time
import os
import sys
import logging
# counts = [0]*256
# path1 = "d:/count.txt"
# path2 = "d:/gaussian.txt"
# def save_count(path,count):
# file = open(path,'w')
# for i in range(len(count)):
# file.write(s... | mit |
khkaminska/scikit-learn | examples/cluster/plot_ward_structured_vs_unstructured.py | 320 | 3369 | """
===========================================================
Hierarchical clustering: structured vs unstructured ward
===========================================================
Example builds a swiss roll dataset and runs
hierarchical clustering on their position.
For more information, see :ref:`hierarchical_clus... | bsd-3-clause |
siutanwong/scikit-learn | sklearn/feature_selection/tests/test_from_model.py | 244 | 1593 | import numpy as np
import scipy.sparse as sp
from nose.tools import assert_raises, assert_true
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_greater
from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
from sklearn.linear_model import SGD... | bsd-3-clause |
Srisai85/scikit-learn | sklearn/utils/tests/test_utils.py | 215 | 8100 | import warnings
import numpy as np
import scipy.sparse as sp
from scipy.linalg import pinv2
from itertools import chain
from sklearn.utils.testing import (assert_equal, assert_raises, assert_true,
assert_almost_equal, assert_array_equal,
SkipTest, ... | bsd-3-clause |
neuropower/neuropower | neuropower/apps/neuropowertoolbox/neuropowercore/cluster.py | 2 | 1826 | import numpy as np
import pandas as pd
""" Extract local maxima from a spm, return a csv file with variables:
- x coordinate
- y coordinate
- z coordinate
- peak height """
def PeakTable(spm,exc,mask):
# make a new array with an extra row/column/plane around the original array
spm_newdim = tuple(map(lambda x: x+2,s... | mit |
BhallaLab/moose-full | moose-core/python/moose/recording.py | 2 | 4617 | from . import moose as _moose
_tick = 8
_base = '/_utils'
_path = _base + '/y{0}'
_counter = 0
_plots = []
_moose.Neutral( _base )
_defaultFields = {
_moose.Compartment : 'Vm',
_moose.ZombieCompartment : 'Vm',
_moose.HHChannel: 'Gk',
_moose.ZombieHHChannel: 'Gk',
_moose.HHChannel2D: 'Gk',
_moose.SynChan:... | gpl-2.0 |
Achuth17/scikit-learn | benchmarks/bench_plot_lasso_path.py | 301 | 4003 | """Benchmarks of Lasso regularization path computation using Lars and CD
The input data is mostly low rank but is a fat infinite tail.
"""
from __future__ import print_function
from collections import defaultdict
import gc
import sys
from time import time
import numpy as np
from sklearn.linear_model import lars_pat... | bsd-3-clause |
EntilZha/qb | guesser/classify/learn_classifiers.py | 1 | 2269 | from numpy import *
import nltk.classify.util
from util.math_util import *
from nltk.classify.scikitlearn import SklearnClassifier
from sklearn.linear_model import LogisticRegression
from scipy import stats
from collections import Counter
import cPickle, csv, random, argparse
# trains a classifier, saves it to disk, a... | mit |
bowenliu16/deepchem | deepchem/utils/save.py | 1 | 4968 | """
Simple utils to save and load from disk.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
# TODO(rbharath): Use standard joblib once old-data has been regenerated.
import joblib
from sklearn.externals import joblib as old_joblib
import gzip
import pi... | gpl-3.0 |
cwhanse/pvlib-python | pvlib/tests/iotools/test_psm3.py | 2 | 6112 | """
test iotools for PSM3
"""
import os
from pvlib.iotools import psm3
from ..conftest import DATA_DIR, RERUNS, RERUNS_DELAY
import numpy as np
import pandas as pd
import pytest
from requests import HTTPError
from io import StringIO
import warnings
TMY_TEST_DATA = DATA_DIR / 'test_psm3_tmy-2017.csv'
YEAR_TEST_DATA = ... | bsd-3-clause |
georgetown-analytics/machine-learning | archive/text_analytics/solutions/exercise_02_sentiment.py | 254 | 2795 | """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 ... | mit |
CompPhysics/MachineLearning | doc/src/Regression/fit.py | 1 | 2660 | # Common imports
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression, Ridge, Lasso
from sklearn.model_selection import train_test_split
from sklearn.utils import resample
from sklearn.metrics import mean_squared_error
# Where to save the fig... | cc0-1.0 |
lmallin/coverage_test | python_venv/lib/python2.7/site-packages/pandas/tests/test_algos.py | 3 | 57570 | # -*- coding: utf-8 -*-
import numpy as np
import pytest
from numpy.random import RandomState
from numpy import nan
from datetime import datetime
from itertools import permutations
from pandas import (Series, Categorical, CategoricalIndex,
Timestamp, DatetimeIndex,
Index, Inter... | mit |
quantumlib/ReCirq | recirq/otoc/parallel_xeb.py | 1 | 31044 | # Copyright 2020 Google
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.