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
bovee/Aston
aston/tracefile/__init__.py
1
7942
''' Classes that can open chromatographic files and return info from them or Traces/Chromatograms. ''' import re import struct import numpy as np from aston.trace import Chromatogram, Trace from aston.tracefile.mime import get_mimetype, tfclasses def find_offset(f, search_str, hint=None): if hint is None: ...
bsd-3-clause
rajat1994/scikit-learn
sklearn/linear_model/tests/test_coordinate_descent.py
114
25281
# Authors: Olivier Grisel <olivier.grisel@ensta.org> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD 3 clause from sys import version_info import numpy as np from scipy import interpolate, sparse from copy import deepcopy from sklearn.datasets import load_boston from sklearn.utils.testing ...
bsd-3-clause
andim/scipydirect
examples/SH.py
1
1031
#!/usr/bin/python """ Solve the 2D Shubert function. """ from __future__ import division from scipydirect import minimize import numpy as np from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot as plt from matplotlib import cm def obj(x): """Two Dimensional Shubert Function""" j = np.arange(1...
mit
samyachour/EKG_Analysis
wave.py
1
19645
import pywt import numpy as np import pandas as pd import scipy.io as sio from biosppy.signals import ecg import scipy from detect_peaks import detect_peaks as detect_peaks_orig def getRPeaks(data, sampling_rate=300.): """ R peak detection in 1 dimensional ECG wave Parameters ---------- data : arr...
gpl-3.0
glennq/scikit-learn
sklearn/linear_model/passive_aggressive.py
28
11542
# Authors: Rob Zinkov, Mathieu Blondel # License: BSD 3 clause from .stochastic_gradient import BaseSGDClassifier from .stochastic_gradient import BaseSGDRegressor from .stochastic_gradient import DEFAULT_EPSILON class PassiveAggressiveClassifier(BaseSGDClassifier): """Passive Aggressive Classifier Read mor...
bsd-3-clause
thomaslima/PySpice
PySpice/Probe/Plot.py
1
1745
#################################################################################################### # # PySpice - A Spice Package for Python # Copyright (C) 2014 Fabrice Salvaire # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published...
gpl-3.0
RobertABT/heightmap
build/matplotlib/examples/event_handling/poly_editor.py
6
5377
""" This is an example to show how to build cross-GUI applications using matplotlib event handling to interact with objects on the canvas """ import numpy as np from matplotlib.lines import Line2D from matplotlib.artist import Artist from matplotlib.mlab import dist_point_to_segment class PolygonInteractor: """ ...
mit
chetan51/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/ticker.py
69
37420
""" Tick locating and formatting ============================ This module contains classes to support completely configurable tick locating and formatting. Although the locators know nothing about major or minor ticks, they are used by the Axis class to support major and minor tick locating and formatting. Generic t...
gpl-3.0
BonexGu/Blik2D-SDK
Blik2D/addon/tensorflow-1.2.1_for_blik/tensorflow/examples/tutorials/input_fn/boston.py
51
2709
# 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...
mit
tjhunter/karps
python/karps/row.py
1
8926
""" Utilities to express rows of data with Karps. """ import pandas as pd from .proto import types_pb2 from .proto import row_pb2 from .types import * __all__ = ['CellWithType', 'as_cell', 'as_python_object', 'as_pandas_object'] class CellWithType(object): """ A cell of data, with its type information. This is ...
apache-2.0
timsnyder/bokeh
bokeh/models/tests/test_mappers.py
1
4293
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #-------------------------------------------------------------------...
bsd-3-clause
cogeorg/BlackRhino
examples/firesales_simple/networkx/readwrite/tests/test_gml.py
35
3099
#!/usr/bin/env python import io from nose.tools import * from nose import SkipTest import networkx class TestGraph(object): @classmethod def setupClass(cls): global pyparsing try: import pyparsing except ImportError: try: import matplotlib.pyparsi...
gpl-3.0
DougBurke/astropy
astropy/visualization/wcsaxes/grid_paths.py
2
3885
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from matplotlib.lines import Path from ...coordinates.angle_utilities import angular_separation # Tolerance for WCS round-tripping ROUND_TRIP_TOL = 1e-1 # Tolerance for discontinuities relative to the median DISCONT_FACTOR = 10. ...
bsd-3-clause
EtienneCmb/tensorpac
tensorpac/utils.py
1
29055
"""Utility functions.""" import logging import numpy as np from scipy.signal import periodogram from tensorpac.methods.meth_pac import _kl_hr from tensorpac.pac import _PacObj, _PacVisual from tensorpac.io import set_log_level from matplotlib.gridspec import GridSpec import matplotlib.pyplot as plt logger = logging...
bsd-3-clause
yunfeilu/scikit-learn
sklearn/datasets/tests/test_samples_generator.py
181
15664
from __future__ import division from collections import defaultdict from functools import partial import numpy as np import scipy.sparse as sp 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 imp...
bsd-3-clause
mverzett/rootpy
docs/sphinxext/numpydoc/plot_directive.py
5
19693
""" A special directive for generating a matplotlib plot. .. warning:: This is a hacked version of plot_directive.py from Matplotlib. It's very much subject to change! Usage ----- Can be used like this:: .. plot:: examples/example.py .. plot:: import matplotlib.pyplot as plt plt.plot...
gpl-3.0
tswast/google-cloud-python
language/docs/conf.py
2
11912
# -*- coding: utf-8 -*- # # google-cloud-language documentation build configuration file # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values ...
apache-2.0
qifeigit/scikit-learn
examples/linear_model/plot_ransac.py
250
1673
""" =========================================== Robust linear model estimation using RANSAC =========================================== In this example we see how to robustly fit a linear model to faulty data using the RANSAC algorithm. """ import numpy as np from matplotlib import pyplot as plt from sklearn import ...
bsd-3-clause
toastedcornflakes/scikit-learn
sklearn/linear_model/tests/test_least_angle.py
42
20925
from nose.tools import assert_equal import numpy as np from scipy import linalg from sklearn.model_selection import train_test_split from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_less from sklearn.utils.testing import...
bsd-3-clause
pierrelb/RMG-Py
rmgpy/tools/plot.py
2
18806
import matplotlib as mpl # Force matplotlib to not use any Xwindows backend. # This must be called before pylab, matplotlib.pyplot, or matplotlib.backends is imported mpl.use('Agg') import matplotlib.pyplot as plt from rmgpy.tools.data import GenericData def parseCSVData(csvFile): """ This function par...
mit
cuiwei0322/cost_analysis
tall_building_zero_attack_angle_cost_analysis/Result/peak_ng.py
1
2728
import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib from matplotlib import cm from matplotlib import pyplot as plt from itertools import product, combinations from matplotlib import rc from matplotlib.font_manager import FontProperties font_size = 8 rc('font',**{'family':'serif','serif':['Times...
apache-2.0
TariqAHassan/BioVida
biovida/images/models/template_matching.py
1
13537
# coding: utf-8 """ Template Matching ~~~~~~~~~~~~~~~~~ """ import numpy as np from scipy.misc import imread from scipy.misc import imresize from skimage.feature import match_template # Notes: # See: http://scikit-image.org/docs/dev/api/skimage.feature.html#skimage.feature.match_template. # Here, t...
bsd-3-clause
eusoubrasileiro/fatiando_seismic
cookbook/seismic_wavefd_love_wave.py
9
2602
""" Seismic: 2D finite difference simulation of elastic SH wave propagation in a medium with a discontinuity (i.e., Moho), generating Love waves. """ import numpy as np from matplotlib import animation from fatiando import gridder from fatiando.seismic import wavefd from fatiando.vis import mpl # Set the parameters of...
bsd-3-clause
freeman-lab/dask
dask/dataframe/utils.py
1
3562
import pandas as pd import numpy as np from collections import Iterator import toolz def shard_df_on_index(df, divisions): """ Shard a DataFrame by ranges on its index Example ------- >>> df = pd.DataFrame({'a': [0, 10, 20, 30, 40], 'b': [5, 4 ,3, 2, 1]}) >>> df a b 0 0 5 1 ...
bsd-3-clause
JsNoNo/scikit-learn
sklearn/metrics/pairwise.py
49
44088
# -*- coding: utf-8 -*- # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Mathieu Blondel <mathieu@mblondel.org> # Robert Layton <robertlayton@gmail.com> # Andreas Mueller <amueller@ais.uni-bonn.de> # Philippe Gervais <philippe.gervais@inria.fr> # Lars Buitinck ...
bsd-3-clause
loli/sklearn-ensembletrees
examples/manifold/plot_manifold_sphere.py
1
4619
#!/usr/bin/python # -*- coding: utf-8 -*- """ ============================================= Manifold Learning methods on a severed sphere ============================================= An application of the different :ref:`manifold` techniques on a spherical data-set. Here one can see the use of dimensionality reducti...
bsd-3-clause
calico/basenji
bin/basenji_data.py
1
31215
#!/usr/bin/env python # Copyright 2017 Calico 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 # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agr...
apache-2.0
OshynSong/scikit-learn
examples/manifold/plot_manifold_sphere.py
258
5101
#!/usr/bin/python # -*- coding: utf-8 -*- """ ============================================= Manifold Learning methods on a severed sphere ============================================= An application of the different :ref:`manifold` techniques on a spherical data-set. Here one can see the use of dimensionality reducti...
bsd-3-clause
sarmstr5/kaggle_intel_mobleODT_cervix_classification
src/starting_with_keras.py
1
5420
from PIL import ImageFilter, ImageStat, Image, ImageDraw from multiprocessing import Pool, cpu_count from sklearn.preprocessing import LabelEncoder import pandas as pd import numpy as np import glob import cv2 import processing_images from keras.wrappers.scikit_learn import KerasClassifier from keras.models import Seq...
mit
xdnian/pyml
code/optional-py-scripts/ch07.py
4
19178
# Sebastian Raschka, 2015 (http://sebastianraschka.com) # Python Machine Learning - Code Examples # # Chapter 7 - Combining Different Models for Ensemble Learning # # S. Raschka. Python Machine Learning. Packt Publishing Ltd., 2015. # GitHub Repo: https://github.com/rasbt/python-machine-learning-book # # License: MIT #...
mit
anirudhjayaraman/scikit-learn
sklearn/tests/test_multiclass.py
136
23649
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
mrshu/scikit-learn
sklearn/tests/test_grid_search.py
2
8915
""" Testing for grid search module (sklearn.grid_search) """ from cStringIO import StringIO import sys import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_true from sklearn.utils.testing ...
bsd-3-clause
paalge/scikit-image
doc/examples/segmentation/plot_rag_draw.py
7
1031
""" ====================================== Drawing Region Adjacency Graphs (RAGs) ====================================== This example constructs a Region Adjacency Graph (RAG) and draws it with the `rag_draw` method. """ from skimage import data, segmentation from skimage.future import graph from matplotlib import py...
bsd-3-clause
ahaberlie/MetPy
examples/calculations/Smoothing.py
5
2418
# Copyright (c) 2015-2018 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """ Smoothing ========= Using MetPy's smoothing functions. This example demonstrates the various ways that MetPy's smoothing function can be utilized. While this example utili...
bsd-3-clause
bzero/arctic
tests/integration/store/test_version_store_audit.py
4
8283
from bson import ObjectId from datetime import datetime as dt from mock import patch from pandas.util.testing import assert_frame_equal from pymongo.errors import OperationFailure import pytest from arctic.store.audit import ArcticTransaction from arctic.exceptions import ConcurrentModificationException, NoDataFoundEx...
lgpl-2.1
Winand/pandas
pandas/tests/test_algos.py
2
56095
# -*- 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...
bsd-3-clause
IshankGulati/scikit-learn
examples/classification/plot_digits_classification.py
82
2414
""" ================================ Recognizing hand-written digits ================================ An example showing how the scikit-learn can be used to recognize images of hand-written digits. This example is commented in the :ref:`tutorial section of the user manual <introduction>`. """ print(__doc__) # Autho...
bsd-3-clause
xiaoxiamii/scikit-learn
sklearn/metrics/cluster/unsupervised.py
230
8281
""" Unsupervised evaluation metrics. """ # Authors: Robert Layton <robertlayton@gmail.com> # # License: BSD 3 clause import numpy as np from ...utils import check_random_state from ..pairwise import pairwise_distances def silhouette_score(X, labels, metric='euclidean', sample_size=None, random...
bsd-3-clause
robin-lai/scikit-learn
sklearn/covariance/tests/test_covariance.py
69
11116
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Gael Varoquaux <gael.varoquaux@normalesup.org> # Virgile Fritsch <virgile.fritsch@inria.fr> # # License: BSD 3 clause import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_alm...
bsd-3-clause
makersauce/stocks
strategy1.py
1
4415
##Stragegy File import datetime from stock import Stock, piggy from sys import argv if __name__ == "__main__": if len(argv) > 1: if argv[1] == '--simulate': if len(argv) < 3: print 'Please specify symbol' exit() symbol = argv[2] stock = S...
mit
leewujung/ooi_sonar
during_incubator/concat_raw.py
1
8982
import glob, os, sys import datetime as dt # quick fix to avoid datetime and datetime.datetime confusion from matplotlib.dates import date2num, num2date from calendar import monthrange import h5py import matplotlib.pylab as plt # from modest_image import imshow # import numpy as np # already imported in zplsc_b sy...
apache-2.0
rseubert/scikit-learn
sklearn/neighbors/tests/test_dist_metrics.py
48
4949
import itertools import numpy as np from numpy.testing import assert_array_almost_equal import scipy from scipy.spatial.distance import cdist from sklearn.neighbors.dist_metrics import DistanceMetric from nose import SkipTest def cmp_version(version1, version2): version1 = tuple(map(int, version1.split('.')[:2]...
bsd-3-clause
google-research/google-research
talk_about_random_splits/probing/split_with_cross_validation_main.py
1
4750
# 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
zuku1985/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
tayebzaidi/HonorsThesisTZ
ThesisCode/DES_Pipeline/gen_lightcurves/visualizeLCurves.py
1
3137
#!/usr/bin/env python import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import json import os import sys import numpy as np import math import pickle def main(): path = "./des_sn.p" output_lightcurves_file = 'selectedLightcurves' output_lightcurves = [] with open(path, 'rb') as f:...
gpl-3.0
lancezlin/ml_template_py
lib/python2.7/site-packages/sklearn/mixture/tests/test_dpgmm.py
84
7866
# Important note for the deprecation cleaning of 0.20 : # All the function and classes of this file have been deprecated in 0.18. # When you remove this file please also remove the related files # - 'sklearn/mixture/dpgmm.py' # - 'sklearn/mixture/gmm.py' # - 'sklearn/mixture/test_gmm.py' import unittest import sys imp...
mit
anurag313/scikit-learn
sklearn/metrics/setup.py
299
1024
import os import os.path 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("metrics", parent_package, top_path) cblas_libs, blas_info = get_blas_info() if os.name ==...
bsd-3-clause
spallavolu/scikit-learn
examples/plot_isotonic_regression.py
303
1767
""" =================== Isotonic Regression =================== An illustration of the isotonic regression on generated data. The isotonic regression finds a non-decreasing approximation of a function while minimizing the mean squared error on the training data. The benefit of such a model is that it does not assume a...
bsd-3-clause
renhaocui/activityExtractor
trainFullModel.py
1
22297
from keras.preprocessing.text import Tokenizer from keras.models import Sequential from keras.layers import Dense, LSTM, Dropout, Merge, Input, concatenate, Lambda from keras.layers.embeddings import Embedding from keras.models import Model from keras.preprocessing import sequence from keras.utils import np_utils from ...
mit
bthirion/scikit-learn
examples/cluster/plot_dict_face_patches.py
337
2747
""" Online learning of a dictionary of parts of faces ================================================== This example uses a large dataset of faces to learn a set of 20 x 20 images patches that constitute faces. From the programming standpoint, it is interesting because it shows how to use the online API of the sciki...
bsd-3-clause
UNR-AERIAL/scikit-learn
examples/model_selection/plot_precision_recall.py
249
6150
""" ================ Precision-Recall ================ Example of Precision-Recall metric to evaluate classifier output quality. In information retrieval, precision is a measure of result relevancy, while recall is a measure of how many truly relevant results are returned. A high area under the curve represents both ...
bsd-3-clause
Flaviolib/dx
dx/dx_portfolio.py
5
14390
# # DX Analytics Portfolio # dx_portfolio.py # # (c) Dr. Yves J. Hilpisch # The Python Quants GmbH # You are not allowed to copy or distribute the dx library. # Rights are only granted for a limited period of time to # test the library in connection with the Python Quant Platform. # See also the terms and conditions un...
agpl-3.0
zuku1985/scikit-learn
sklearn/utils/tests/test_metaestimators.py
86
2304
from sklearn.utils.testing import assert_true, assert_false from sklearn.utils.metaestimators import if_delegate_has_method class Prefix(object): def func(self): pass class MockMetaEstimator(object): """This is a mock meta estimator""" a_prefix = Prefix() @if_delegate_has_method(delegate="a...
bsd-3-clause
jj-umn/tools-iuc
tools/vsnp/vsnp_add_zero_coverage.py
12
6321
#!/usr/bin/env python import argparse import os import re import shutil import pandas import pysam from Bio import SeqIO def get_sample_name(file_path): base_file_name = os.path.basename(file_path) if base_file_name.find(".") > 0: # Eliminate the extension. return os.path.splitext(base_file_...
mit
mkoledoye/mds_examples
experiments/evaluation.py
2
1384
import numpy as np from matplotlib import pyplot as plt COLORS = iter(['blue', 'red', 'green', 'magenta']) def rmse(computed, real): return np.sqrt(((computed - real)**2).mean()) def first_third_quartile_and_median(data): first_quartile = np.percentile(data, 25, axis=1) third_quartile = np.percentile(data, 75, ...
mit
marktrovinger/Fremont-Bike-Data
jupyterworkflow/data.py
1
1025
import os from urllib.request import urlretrieve import pandas as pd FREMONT_URL = 'https://data.seattle.gov/api/views/65db-xm6k/rows.csv?accessType=DOWNLOAD' def get_fremont_data(filename='Fremont.csv', url=FREMONT_URL, force_download=False): ''''Download and cache Fremont data Parameters ----------- ...
mit
joakim-hove/ert
python/python/ert_gui/plottery/plots/histogram.py
4
5535
from math import sqrt, ceil, floor, log10 from matplotlib.patches import Rectangle import numpy from .plot_tools import PlotTools import pandas as pd def plotHistogram(plot_context): """ @type plot_context: ert_gui.plottery.PlotContext """ ert = plot_context.ert() key = plot_context.key() config = plot...
gpl-3.0
jlegendary/scikit-learn
examples/model_selection/plot_underfitting_overfitting.py
230
2649
""" ============================ Underfitting vs. Overfitting ============================ This example demonstrates the problems of underfitting and overfitting and how we can use linear regression with polynomial features to approximate nonlinear functions. The plot shows the function that we want to approximate, wh...
bsd-3-clause
mblondel/scikit-learn
examples/model_selection/randomized_search.py
57
3208
""" ========================================================================= 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
ccasotto/rmtk
rmtk/parsers/vulnerability_model_converter.py
3
7101
#!/usr/bin/env python # LICENSE # # Copyright (c) 2014, GEM Foundation, Anirudh Rao # # The rmtk is free software: you can redistribute # it and/or modify it under the terms of the GNU Affero General Public # License as published by the Free Software Foundation, either version # 3 of the License, or (at your option) an...
agpl-3.0
BlueBrain/NEST
topology/pynest/tests/test_plotting.py
13
4111
# -*- coding: utf-8 -*- # # test_plotting.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
mirkix/ardupilot
Tools/scripts/tempcal_IMU.py
16
20088
#!/usr/bin/env python ''' Create temperature calibration parameters for IMUs based on log data. ''' from argparse import ArgumentParser parser = ArgumentParser(description=__doc__) parser.add_argument("--outfile", default="tcal.parm", help='set output file') parser.add_argument("--no-graph", action='store_true', defau...
gpl-3.0
yonglehou/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
ocefpaf/python-oceans
oceans/sw_extras/sw_extras.py
2
29692
from copy import copy import numpy as np import seawater as sw from seawater.constants import OMEGA, earth_radius def sigma_t(s, t, p): """ :math:`\\sigma_{t}` is the remainder of subtracting 1000 kg m :sup:`-3` from the density of a sea water sample at atmospheric pressure. Parameters ---------...
bsd-3-clause
aewhatley/scikit-learn
sklearn/datasets/mlcomp.py
289
3855
# 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
trachelr/mne-python
mne/inverse_sparse/mxne_optim.py
13
37011
from __future__ import print_function # Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Daniel Strohmeier <daniel.strohmeier@gmail.com> # # License: Simplified BSD from copy import deepcopy import warnings from math import sqrt, ceil import numpy as np from scipy import linalg from .mxn...
bsd-3-clause
zhengfaxiang/Runge-Kutta-Fehlberg
src/hill_surf.py
1
4678
#!/usr/bin/env python """ Script to plot Hill surface. """ import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.mplot3d import Axes3D def Hill_Surf(n, Miu, Cj): """Implicit equation of Hill surface.""" def hill_surf(x, y, z): r1 = ((x + Miu)**2 + y**2 + z**2)**0.5 r2 = ((x + ...
mit
gpospelov/BornAgain
Examples/varia/MaterialProfileWithParticles.py
1
1734
""" Example for producing a profile of SLD of a multilayer with particles and slicing. """ import bornagain as ba from bornagain import deg, angstrom, nm import numpy as np import matplotlib.pyplot as plt def get_sample(): """ Defines sample and returns it """ # creating materials m_ambient = ba...
gpl-3.0
dennisobrien/bokeh
sphinx/source/conf.py
3
9540
# -*- coding: utf-8 -*- from __future__ import unicode_literals from os.path import abspath, dirname, join # # Bokeh documentation build configuration file, created by # sphinx-quickstart on Sat Oct 12 23:43:03 2013. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not a...
bsd-3-clause
datapythonista/pandas
pandas/tests/frame/indexing/test_insert.py
3
2888
""" test_insert is specifically for the DataFrame.insert method; not to be confused with tests with "insert" in their names that are really testing __setitem__. """ import numpy as np import pytest from pandas.errors import PerformanceWarning from pandas import ( DataFrame, Index, ) import pandas._testing as ...
bsd-3-clause
jklenzing/pysat
pysat/instruments/pysat_testing_xarray.py
2
8837
# -*- coding: utf-8 -*- """ Produces fake instrument data for testing. """ from __future__ import print_function from __future__ import absolute_import import os import numpy as np import pandas as pds import xarray import pysat from pysat.instruments.methods import testing as test # pysat required parameters platfo...
bsd-3-clause
AlexanderFabisch/scikit-learn
sklearn/linear_model/tests/test_omp.py
272
7752
# Author: Vlad Niculae # Licence: BSD 3 clause import numpy as np from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equa...
bsd-3-clause
dchabot/bluesky
bluesky/testing/noseclasses.py
4
4638
######################################################################## # This file contains code from numpy and matplotlib (noted in the code)# # which is (c) the respective projects. # # # # Modifications and original...
bsd-3-clause
plissonf/scikit-learn
sklearn/datasets/__init__.py
176
3671
""" The :mod:`sklearn.datasets` module includes utilities to load datasets, including methods to load and fetch popular reference datasets. It also features some artificial data generators. """ from .base import load_diabetes from .base import load_digits from .base import load_files from .base import load_iris from ....
bsd-3-clause
cheral/orange3
Orange/preprocess/score.py
2
12309
from collections import defaultdict from itertools import chain import numpy as np from sklearn import feature_selection as skl_fss from Orange.misc.wrapper_meta import WrapperMeta from Orange.statistics import contingency, distribution from Orange.data import Domain, Variable, DiscreteVariable, ContinuousVariable fr...
bsd-2-clause
kenshay/ImageScripter
ProgramData/SystemFiles/Python/Lib/site-packages/pandas/tests/test_common.py
7
5050
# -*- coding: utf-8 -*- import nose import numpy as np from pandas import Series, Timestamp from pandas.compat import range, lmap import pandas.core.common as com import pandas.util.testing as tm _multiprocess_can_split_ = True def test_mut_exclusive(): msg = "mutually exclusive arguments: '[ab]' and '[ab]'" ...
gpl-3.0
claesenm/HPOlib
HPOlib/Plotting/plotTraceWithStd_perTime.py
4
9873
#!/usr/bin/env python ## # wrapping: A program making it easy to use hyperparameter # optimization software. # Copyright (C) 2013 Katharina Eggensperger and Matthias Feurer # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # ...
gpl-3.0
kdebrab/pandas
pandas/tests/sparse/series/test_indexing.py
4
3127
import pytest import numpy as np from pandas import SparseSeries, Series from pandas.util import testing as tm pytestmark = pytest.mark.skip("Wrong SparseBlock initialization (GH 17386)") @pytest.mark.parametrize('data', [ [1, 1, 2, 2, 3, 3, 4, 4, 0, 0], [1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, np.nan, np.n...
bsd-3-clause
Eric89GXL/scikit-learn
examples/applications/plot_hmm_stock_analysis.py
12
2783
""" ========================== Gaussian HMM of stock data ========================== This script shows how to use Gaussian HMM. It uses stock price data, which can be obtained from yahoo finance. For more information on how to get stock prices with matplotlib, please refer to date_demo1.py of matplotlib. """ from __f...
bsd-3-clause
stonebig/winpython_afterdoc
docs/minesweeper.py
2
7264
""" Matplotlib Minesweeper ---------------------- A simple Minesweeper implementation in matplotlib. Author: Jake Vanderplas <vanderplas@astro.washington.edu>, Dec. 2012 License: BSD """ import numpy as np from itertools import product from scipy.signal import convolve2d import matplotlib.pyplot as plt from matplotlib...
mit
rohanp/scikit-learn
examples/gaussian_process/plot_gpc_iris.py
81
2231
""" ===================================================== Gaussian process classification (GPC) on iris dataset ===================================================== This example illustrates the predicted probability of GPC for an isotropic and anisotropic RBF kernel on a two-dimensional version for the iris-dataset. ...
bsd-3-clause
uglyboxer/linear_neuron
net-p3/lib/python3.5/site-packages/sklearn/tests/test_random_projection.py
1
14003
from __future__ import division import numpy as np import scipy.sparse as sp from sklearn.metrics import euclidean_distances from sklearn.random_projection import johnson_lindenstrauss_min_dim from sklearn.random_projection import gaussian_random_matrix from sklearn.random_projection import sparse_random_matrix from...
mit
asteca/ASteCA
packages/out/make_A2_plot.py
1
2412
import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from os.path import join from . import mp_cent_dens from . import add_version_plot from . import prep_plots from . prep_plots import grid_x, grid_y, figsize_x, figsize_y def main(npd, cld_i, pd, clp): """ Make A2 block plots. """ ...
gpl-3.0
JohnGBaker/ptmcmc
python/corner_with_covar.py
1
27157
# -*- coding: utf-8 -*- #This code is adaped from # https://github.com/dfm/corner.py # git hash 5c2cd63 on May 25 # Modifications by John Baker NASA-GSFC (2016-18) #Copyright (c) 2013-2016 Daniel Foreman-Mackey #All rights reserved. # #Redistribution and use in source and binary forms, with or without #modification, a...
apache-2.0
rs2/pandas
pandas/core/groupby/groupby.py
1
95861
""" Provide the groupby split-apply-combine paradigm. Define the GroupBy class providing the base-class of operations. The SeriesGroupBy and DataFrameGroupBy sub-class (defined in pandas.core.groupby.generic) expose these user-facing objects to provide specific functionality. """ from contextlib import contextmanager...
bsd-3-clause
xiaoxiamii/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
HrWangChengdu/CS231n
assignment1/cs231n/features.py
30
4807
import matplotlib import numpy as np from scipy.ndimage import uniform_filter def extract_features(imgs, feature_fns, verbose=False): """ Given pixel data for images and several feature functions that can operate on single images, apply all feature functions to all images, concatenating the feature vectors fo...
mit
USStateDept/FPA_Core
openspending/lib/apihelper.py
2
26540
import logging import urlparse from dateutil import parser # import pandas as pd # import numpy as np from flask import current_app,request, Response from openspending.core import db from openspending.lib.helpers import get_dataset from openspending.lib.cubes_util import get_cubes_breaks log = logging.getLogger(...
agpl-3.0
stylianos-kampakis/scikit-learn
examples/svm/plot_custom_kernel.py
171
1546
""" ====================== SVM with custom kernel ====================== Simple usage of Support Vector Machines to classify a sample. It will plot the decision surface and the support vectors. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from sklearn import svm, datasets # import some data...
bsd-3-clause
yejingfu/samples
tensorflow/gene_sample.py
1
2963
#!/usr/bin/env python3 #%matplotlib inline import numpy as np import pandas as pd from scipy import stats import matplotlib.pyplot as plt plt.style.use('/Users/jeff/code/elegant-scipy/style/elegant.mplstyle') def reduceXaxisLabels(ax, factor): plt.setp(ax.xaxis.get_ticklabels(), visible = False) for l in ax.xa...
mit
allthroughthenight/aces
python/drivers/wave_forces.py
1
17366
import math import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches import sys sys.path.append('../functions') from base_driver import BaseDriver from helper_objects import BaseField from helper_objects import ComplexUtil import USER_INPUT from ERRSTP import ERRSTP from ERRWAVBRK1 impor...
gpl-3.0
numenta/htmresearch
projects/thalamus/run_experiment.py
2
9869
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2019, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This progra...
agpl-3.0
huangziwei/MorphoPy
tests/test_utils.py
1
3616
import numpy as np import sys sys.path.append('..') #### TEST GET_ANGLE ##### from morphopy._utils.summarize import get_angle def test_get_angle_with_orthogonal_vectors(): v0 = np.array([0, 0, 1]) v1 = np.array([0, 1, 0]) r, d = get_angle(v0, v1) assert(r == 90*np.pi/180), "returned angle should be...
mit
manipopopo/tensorflow
tensorflow/contrib/factorization/python/ops/gmm_test.py
41
8716
# 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
mattilyra/scikit-learn
sklearn/externals/joblib/testing.py
45
2720
""" Helper for testing. """ import sys import warnings import os.path import re import subprocess import threading from sklearn.externals.joblib._compat import PY3_OR_LATER def warnings_to_stdout(): """ Redirect all warnings to stdout. """ showwarning_orig = warnings.showwarning def showwarning(msg...
bsd-3-clause
mrgloom/python-topic-model
ptm/whdsp.py
3
20653
import numpy as np import time import utils from scipy.special import gammaln, psi #epsilon eps = 1e-100 class hdsp: """ hierarchical dirichlet scaling process (hdsp) """ def __init__(self, num_topics, num_words, num_labels, dir_prior=0.5): self.K = num_topics # number of topics ...
apache-2.0
duane-edgington/stoqs
stoqs/contrib/analysis/crossproduct_biplots.py
3
8932
#!/usr/bin/env python ''' Script to create biplots of a cross product of all Parameters in a database. Mike McCann MBARI 10 February 2014 ''' import os import sys if 'DJANGO_SETTINGS_MODULE' not in os.environ: os.environ['DJANGO_SETTINGS_MODULE']='settings' sys.path.insert(0, os.path.join(os.path.dirname(__file__...
gpl-3.0
dphang/sage
dota/learner/learner.py
1
1348
""" Uses scikit-learn to train a knn classifier on a set of labeled replay data, in JSON format. We can then use this classifier to classify similar important events in future replays. Events have a few labels: farm: hero is simply hitting creeps to gain experience and gold. This will be the default event should ther...
mit
arabenjamin/scikit-learn
sklearn/preprocessing/tests/test_imputation.py
213
11911
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.imputa...
bsd-3-clause
jorge2703/scikit-learn
sklearn/datasets/tests/test_samples_generator.py
181
15664
from __future__ import division from collections import defaultdict from functools import partial import numpy as np import scipy.sparse as sp 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 imp...
bsd-3-clause