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
deapplegate/wtgpipeline
CRNitschke/StarStripper.py
1
14983
#! /usr/bin/env python import sys ; sys.path.append('/u/ki/awright/InstallingSoftware/pythons/') import imagetools from import_tools import * import numpy numpy.warnings.filterwarnings('ignore') #adam-tmp# warnings.simplefilter("ignore", DeprecationWarning) fl=sys.argv[-1] ending="" #fl='/nfs/slac/g/ki/ki18/anja/SUBARU...
mit
pylayers/pylayers
pylayers/em/openems/nf2ff.py
3
1578
import h5py import numpy as np import matplotlib.pyplot as plt f = h5py.File('nf2ff.h5','r') hdf_mesh = f['Mesh'] r = np.array(hdf_mesh['r']) theta = np.array(hdf_mesh['theta']) phi = np.array(hdf_mesh['phi']) nf2ff = f['nf2ff'] attrs = nf2ff.attrs.items() freq = attrs[0][1] Prad = attrs[1][1] Dmax = attrs[2][1...
mit
akrherz/iem
htdocs/plotting/auto/scripts/p67.py
1
3664
"""Wind Speed by Temperature""" import datetime import calendar import matplotlib.patheffects as PathEffects import psycopg2.extras import pandas as pd from pyiem.util import get_autoplot_context, get_dbconn from pyiem.plot.use_agg import plt from pyiem.exceptions import NoDataFound def get_description(): """ Re...
mit
hlin117/scikit-learn
sklearn/tests/test_kernel_approximation.py
78
7586
import numpy as np from scipy.sparse import csr_matrix from sklearn.utils.testing import assert_array_equal, assert_equal, assert_true from sklearn.utils.testing import assert_not_equal from sklearn.utils.testing import assert_array_almost_equal, assert_raises from sklearn.utils.testing import assert_less_equal from ...
bsd-3-clause
stylianos-kampakis/scikit-learn
examples/bicluster/plot_spectral_biclustering.py
403
2011
""" ============================================= A demo of the Spectral Biclustering algorithm ============================================= This example demonstrates how to generate a checkerboard dataset and bicluster it using the Spectral Biclustering algorithm. The data is generated with the ``make_checkerboard`...
bsd-3-clause
squilter/MAVProxy
MAVProxy/modules/lib/live_graph.py
3
2920
#!/usr/bin/env python """ MAVProxy realtime graphing module, partly based on the wx graphing demo by Eli Bendersky (eliben@gmail.com) http://eli.thegreenplace.net/files/prog_code/wx_mpl_dynamic_graph.py.txt """ from MAVProxy.modules.lib import mp_util class LiveGraph(): ''' a live graph object using ...
gpl-3.0
mjzmjz/swift
swift/common/middleware/x_profile/html_viewer.py
25
21039
# 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
nowls/gnuradio
gr-digital/examples/example_costas.py
49
5316
#!/usr/bin/env python # # Copyright 2011-2013 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 optio...
gpl-3.0
xuleiboy1234/autoTitle
tensorflow/tensorflow/examples/learn/iris.py
29
2313
# 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
silgon/rlpy
rlpy/Representations/LocalBases.py
4
7162
""" Representations which use local bases function (e.g. kernels) distributed in the statespace according to some scheme (e.g. grid, random, on previous samples) """ from .Representation import Representation import numpy as np from rlpy.Tools.GeneralTools import addNewElementForAllActions import matplotlib.pyplot as p...
bsd-3-clause
mcanthony/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/offsetbox.py
69
17728
""" The OffsetBox is a simple container artist. The child artist are meant to be drawn at a relative position to its parent. The [VH]Packer, DrawingArea and TextArea are derived from the OffsetBox. The [VH]Packer automatically adjust the relative postisions of their children, which should be instances of the OffsetBo...
agpl-3.0
ahoyosid/scikit-learn
sklearn/tests/test_common.py
7
7677
""" General tests for all estimators in sklearn. """ # Authors: Andreas Mueller <amueller@ais.uni-bonn.de> # Gael Varoquaux gael.varoquaux@normalesup.org # License: BSD 3 clause from __future__ import print_function import os import warnings import sys import pkgutil from sklearn.externals.six import PY3 fr...
bsd-3-clause
rsivapr/scikit-learn
sklearn/neighbors/graph.py
10
2847
"""Nearest Neighbors graph functions""" # Author: Jake Vanderplas <vanderplas@astro.washington.edu> # # License: BSD 3 clause (C) INRIA, University of Amsterdam from .base import KNeighborsMixin, RadiusNeighborsMixin from .unsupervised import NearestNeighbors def kneighbors_graph(X, n_neighbors, mode='connectivity'...
bsd-3-clause
dsm054/pandas
asv_bench/benchmarks/plotting.py
3
1454
import numpy as np from pandas import DataFrame, Series, DatetimeIndex, date_range try: from pandas.plotting import andrews_curves except ImportError: from pandas.tools.plotting import andrews_curves import matplotlib matplotlib.use('Agg') class Plotting(object): def setup(self): self.s = Series(...
bsd-3-clause
yunque/librosa
librosa/core/spectrum.py
1
25275
#!/usr/bin/env python # -*- coding: utf-8 -*- '''Utilities for spectral processing''' import numpy as np import scipy.fftpack as fft import scipy import scipy.signal import six from . import time_frequency from .. import cache from .. import util from ..util.exceptions import ParameterError __all__ = ['stft', 'istft...
isc
preghenella/AliPhysics
PWGPP/FieldParam/fitsol.py
39
8343
#!/usr/bin/env python debug = True # enable trace def trace(x): global debug if debug: print(x) trace("loading...") from itertools import combinations, combinations_with_replacement from glob import glob from math import * import operator from os.path import basename import matplotlib.pyplot as plt import numpy as...
bsd-3-clause
AtsushiSakai/PythonRobotics
PathPlanning/AStar/a_star_searching_from_two_side.py
1
13901
""" A* algorithm Author: Weicent randomly generate obstacles, start and goal point searching path from start and end simultaneously """ import numpy as np import matplotlib.pyplot as plt import math show_animation = True class Node: """node with properties of g, h, coordinate and parent node""" def __init_...
mit
ricardobergamo/dataGAL
views/bmh.py
1
2726
#!/usr/bin/env python from flask import render_template from sqlalchemy import func import pandas as pd from manager import app from models.bmh import * from models.datagal import Regional, Laboratorio @app.route('/bmh/painel') def bmh_painel(): requisicao = Requisicao.get() exames = Exames.get() exame_s...
gpl-3.0
louispotok/pandas
pandas/tests/indexes/timedeltas/test_construction.py
3
3568
import pytest import numpy as np from datetime import timedelta import pandas as pd import pandas.util.testing as tm from pandas import TimedeltaIndex, timedelta_range, to_timedelta class TestTimedeltaIndex(object): def test_construction_base_constructor(self): arr = [pd.Timedelta('1 days'), pd.NaT, pd...
bsd-3-clause
openeemeter/eemeter
eemeter/visualization.py
1
4111
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright 2014-2019 OpenEEmeter contributors 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/LIC...
apache-2.0
michellab/Sire
wrapper/Tools/Plot.py
2
2857
import matplotlib matplotlib.use('TkAgg') from matplotlib import pyplot from Sire.Maths import Histogram, HistogramValue from Sire.Analysis import DataPoint def _plotHistogram(histogram): x = [] y = [] for value in list(histogram.values()): x.append(value.minimum()) y.append(0) x....
gpl-2.0
jrversteegh/softsailor
softsailor/polars.py
1
8539
""" Polars module Contains classes for dealing with boat polars """ __author__ = "J.R. Versteegh" __copyright__ = "Copyright 2011, J.R. Versteegh" __contact__ = "j.r.versteegh@gmail.com" __version__ = "0.1" __license__ = "GPLv3, No Warranty. See 'LICENSE'" import os import math import numpy as np from urllib2 import...
gpl-3.0
hennersz/pySpace
basemap/examples/plotsst.py
8
1770
from mpl_toolkits.basemap import Basemap from netCDF4 import Dataset, date2index import numpy as np import matplotlib.pyplot as plt from datetime import datetime date = datetime(2007,12,15,0) # date to plot. # open dataset. dataset = \ Dataset('http://www.ncdc.noaa.gov/thredds/dodsC/OISST-V2-AVHRR_agg') timevar = datas...
gpl-3.0
DSSG-paratransit/main_repo
Access_Analysis_Project/Scripts/4moDeadheadResultsToCsvParalleled.py
1
961533
import multiprocessing as mp import numpy as np import pandas as pd import os def findZeroes(row, numRows): os.system(['clear', 'cls'][os.name == 'nt']) print row print str(float(row.name) / numRows * 100) + '%' + ' done' busRun = data[(data['ServiceDate'] == row[0]) & (data['Run'] == row[1])] if ...
agpl-3.0
erdc-cm/air-water-vv
2d/numericalTanks/nonlinearWaves/postprocess_NLW.py
1
4065
import numpy as np import collections as cll import csv import os import matplotlib.pyplot as plt import nonlinear_waves as nlw from proteus import WaveTools as wt from AnalysisTools import signalFilter,zeroCrossing,reflStat #####################################################################################...
mit
lukebarnard1/bokeh
sphinx/source/docs/tutorials/solutions/stocks.py
23
2799
### ### NOTE: This exercise requires a network connection ### import numpy as np import pandas as pd from bokeh.plotting import figure, output_file, show, VBox # Here is some code to read in some stock data from the Yahoo Finance API AAPL = pd.read_csv( "http://ichart.yahoo.com/table.csv?s=AAPL&a=0&b=1&c=2000&d=...
bsd-3-clause
Myasuka/scikit-learn
examples/cluster/plot_adjusted_for_chance_measures.py
286
4353
""" ========================================================== Adjustment for chance in clustering performance evaluation ========================================================== The following plots demonstrate the impact of the number of clusters and number of samples on various clustering performance evaluation me...
bsd-3-clause
neozhangthe1/coverage_model
scripts/evaluate.py
1
2312
#!/usr/bin/env python import numpy import pandas import argparse import matplotlib import logging matplotlib.use("Agg") from matplotlib import pyplot logger = logging.getLogger() def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("--start", type=int, default=0, help="Start from this ite...
bsd-3-clause
Eric89GXL/mne-python
mne/viz/_brain/_brain.py
2
132116
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Eric Larson <larson.eric.d@gmail.com> # Oleh Kozynets <ok7mailbox@gmail.com> # Guillaume Favelier <guillaume.favelier@gmail.com> # jona-sassenhagen <jona.sassenhagen@gmail.com> # Joan Massich <mailsik@gmail.com> #...
bsd-3-clause
ibab/tensorflow
tensorflow/contrib/learn/__init__.py
4
1832
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
apache-2.0
jayflo/scikit-learn
examples/ensemble/plot_forest_importances.py
241
1761
""" ========================================= Feature importances with forests of trees ========================================= This examples shows the use of forests of trees to evaluate the importance of features on an artificial classification task. The red bars are the feature importances of the forest, along wi...
bsd-3-clause
ishanic/scikit-learn
sklearn/mixture/tests/test_gmm.py
200
17427
import unittest import copy import sys from nose.tools import assert_true import numpy as np from numpy.testing import (assert_array_equal, assert_array_almost_equal, assert_raises) from scipy import stats from sklearn import mixture from sklearn.datasets.samples_generator import make_spd_ma...
bsd-3-clause
Windy-Ground/scikit-learn
examples/cluster/plot_segmentation_toy.py
258
3336
""" =========================================== Spectral clustering for image segmentation =========================================== In this example, an image with connected circles is generated and spectral clustering is used to separate the circles. In these settings, the :ref:`spectral_clustering` approach solve...
bsd-3-clause
imbforge/NGSpipe2go
tools/piRNA/piRNABaseTerminalBases.py
1
10850
#!/usr/bin/env python # encoding: utf-8 usage = ''' Takes alignments, corresponding to piRNAs, and counts how often each nucleotide occurs in the boundaries (5' and 3') of the sequence. By default the it counts nucleotide frequency at positions -20 to +20. It also outputs results for sense and antisense piRNAs to a p...
gpl-3.0
chris-ch/omarket
python-lab/backtest.py
1
15929
import argparse import csv import logging import math import os from datetime import date import numpy import pandas from statsmodels.formula.api import OLS from matplotlib import pyplot from btplatform import PositionAdjuster, process_strategy, BacktestHistory from meanrevert import MeanReversionStrategy, PortfolioD...
apache-2.0
metaml/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/units.py
70
4810
""" The classes here provide support for using custom classes with matplotlib, eg those that do not expose the array interface but know how to converter themselves to arrays. It also supoprts classes with units and units conversion. Use cases include converters for custom objects, eg a list of datetime objects, as we...
agpl-3.0
RPGOne/scikit-learn
sklearn/covariance/tests/test_robust_covariance.py
77
3825
# 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
Fireblend/scikit-learn
sklearn/neighbors/tests/test_approximate.py
142
18692
""" Testing for the approximate neighbor search using Locality Sensitive Hashing Forest module (sklearn.neighbors.LSHForest). """ # Author: Maheshakya Wijewardena, Joel Nothman import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_a...
bsd-3-clause
espenhgn/nest-simulator
pynest/examples/brunel_alpha_nest.py
2
13724
# -*- coding: utf-8 -*- # # brunel_alpha_nest.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 Licen...
gpl-2.0
coufon/neon-distributed
examples/fast-rcnn/demo.py
2
5520
#!/usr/bin/env python # ---------------------------------------------------------------------------- # Copyright 2015 Nervana Systems 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 # # ...
apache-2.0
BlueBrain/NEST
examples/nest/Potjans_2014/spike_analysis.py
13
5601
# -*- 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
ANNarchy/ANNarchy
examples/multinetwork/MultiNetwork.py
2
2086
from ANNarchy import * # Create the whole population P = Population(geometry=1000, neuron=Izhikevich) # Create the excitatory population Exc = P[:800] re = np.random.random(800) Exc.noise = 5.0 Exc.a = 0.02 Exc.b = 0.2 Exc.c = -65.0 + 15.0 * re**2 Exc.d = 8.0 - 6.0 * re**2 Exc.v = -65.0 Exc.u = Exc.v * Exc.b # Creat...
gpl-2.0
doodnayr/pilaser
calibrate.py
1
4019
import numpy as np from picamera import PiCamera from picamera.array import PiRGBAnalysis from sklearn.cluster import DBSCAN from binascii import unhexlify, hexlify from scipy.interpolate import griddata import os from hipsterplot import plot scan = DBSCAN(eps=2, min_samples=3, metric='euclidean', algorithm='ball_tree...
mit
mrshirts/pymbar
pymbar/confidenceintervals.py
3
14155
############################################################################## # pymbar: A Python Library for MBAR # # Copyright 2016-2017 University of Colorado Boulder # Copyright 2010-2017 Memorial Sloan-Kettering Cancer Center # Portions of this software are Copyright 2010-2016 University of Virginia # # Authors: M...
mit
imito/odin
odin/networks/mixture_density_network.py
1
10035
from __future__ import absolute_import, division, print_function import collections import numpy as np import tensorflow as tf from sklearn.mixture import GaussianMixture from tensorflow.python import keras from tensorflow.python.framework import tensor_shape from tensorflow.python.keras.layers import Dense from tens...
mit
stylianos-kampakis/scikit-learn
sklearn/metrics/tests/test_regression.py
272
6066
from __future__ import division, print_function import numpy as np from itertools import product from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils....
bsd-3-clause
wright-group/WrightTools
setup.py
1
2118
#! /usr/bin/env python3 import os from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) def read(fname): return open(os.path.join(here, fname)).read() extra_files = { "WrightTools": [ "datasets", "datasets/*", "datasets/*/*", "datase...
mit
RPGOne/Skynet
scikit-learn-c604ac39ad0e5b066d964df3e8f31ba7ebda1e0e/examples/svm/plot_svm_scale_c.py
26
5353
""" ============================================== 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
awolfly9/jd_analysis
jd/management/commands/real_time_analysis.py
1
6783
#-*- coding: utf-8 -*- import logging import sys import matplotlib import time matplotlib.use('Agg') import os import config import utils import redis import markdown2 from scrapy.utils.log import configure_logging from django.core.management.base import BaseCommand from wordcloud import WordCloud from sqlhelper im...
lgpl-3.0
renatopp/liac
liac/plot.py
1
1988
# ============================================================================= # Federal University of Rio Grande do Sul (UFRGS) # Connectionist Artificial Intelligence Laboratory (LIAC) # Renato de Pontes Pereira - rppereira@inf.ufrgs.br # ============================================================================= ...
mit
arabenjamin/scikit-learn
examples/svm/plot_separating_hyperplane_unbalanced.py
329
1850
""" ================================================= SVM: Separating hyperplane for unbalanced classes ================================================= Find the optimal separating hyperplane using an SVC for classes that are unbalanced. We first find the separating plane with a plain SVC and then plot (dashed) the ...
bsd-3-clause
RachitKansal/scikit-learn
sklearn/kernel_approximation.py
258
17973
""" The :mod:`sklearn.kernel_approximation` module implements several approximate kernel feature maps base on Fourier transforms. """ # Author: Andreas Mueller <amueller@ais.uni-bonn.de> # # License: BSD 3 clause import warnings import numpy as np import scipy.sparse as sp from scipy.linalg import svd from .base im...
bsd-3-clause
JSLBen/KnowledgeTracing
reference_py/tf_RNN.py
1
15676
# tensorflow version: 1.0.0 import numpy as np import tensorflow as tf from numpy.random import permutation as perm import pandas as pd class tf_RNN(object): """ RNN classifier with LSTM cells with tensorflow """ def __init__(self, num_features, ...
mit
toobaz/pandas
pandas/core/indexes/api.py
2
8212
import textwrap import warnings from pandas._libs import NaT, lib import pandas.core.common as com from pandas.core.indexes.base import ( Index, _new_Index, ensure_index, ensure_index_from_sequences, ) from pandas.core.indexes.base import InvalidIndexError # noqa:F401 from pandas.core.indexes.categor...
bsd-3-clause
trondeau/gnuradio-old
gr-filter/examples/synth_filter.py
58
2552
#!/usr/bin/env python # # Copyright 2010,2012,2013 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 ...
gpl-3.0
automl/paramsklearn
ParamSklearn/components/classification/adaboost.py
1
3787
import numpy as np import sklearn.ensemble import sklearn.tree import sklearn.multiclass from ParamSklearn.implementations.MultilabelClassifier import MultilabelClassifier from HPOlibConfigSpace.configuration_space import ConfigurationSpace from HPOlibConfigSpace.hyperparameters import UniformFloatHyperparameter, \ ...
bsd-3-clause
sgraham/nope
chrome/test/nacl_test_injection/buildbot_chrome_nacl_stage.py
12
11594
#!/usr/bin/python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Do all the steps required to build and test against nacl.""" import optparse import os.path import re import shutil import subproc...
bsd-3-clause
xubenben/scikit-learn
examples/decomposition/plot_pca_vs_lda.py
182
1743
""" ======================================================= Comparison of LDA and PCA 2D projection of Iris dataset ======================================================= The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour and Virginica) with 4 attributes: sepal length, sepal width, petal length a...
bsd-3-clause
chanceraine/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
hlin117/scikit-learn
examples/cross_decomposition/plot_compare_cross_decomposition.py
19
4761
""" =================================== Compare cross decomposition methods =================================== Simple usage of various cross decomposition algorithms: - PLSCanonical - PLSRegression, with multivariate response, a.k.a. PLS2 - PLSRegression, with univariate response, a.k.a. PLS1 - CCA Given 2 multivari...
bsd-3-clause
timodonnell/pyopen
test/test_basics.py
1
2353
from nose.tools import eq_ from . import data_path, run_and_capture RUN_TESTS_REQUIRING_INTERNET = True SAMPLE_CSV_URL = "https://raw.githubusercontent.com/timodonnell/pyopen/master/test/data/SampleCSVFile_11kb.csv" def test_csv(): eq_( run_and_capture( "print(f1.shape)", [data_pa...
apache-2.0
murali-munna/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
ReservoirWebs/GrowChinook
Bioenergetics_dev.py
1
46105
#!/usr/bin/python import pylab import glob import time import os import numpy as np import sys from scipy.interpolate import interp1d from scipy.integrate import trapz from scipy.optimize import minimize, brute from csv import DictReader, QUOTE_NONNUMERIC from collections import defaultdict from matplotlib import pypl...
gpl-3.0
henrykironde/scikit-learn
examples/decomposition/plot_pca_3d.py
354
2432
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Principal components analysis (PCA) ========================================================= These figures aid in illustrating how a point cloud can be very flat in one direction--which is where PCA comes in to ch...
bsd-3-clause
cactusbin/nyt
matplotlib/examples/user_interfaces/embedding_in_qt4_wtoolbar.py
6
2033
from __future__ import print_function import sys import numpy as np from matplotlib.figure import Figure from matplotlib.backend_bases import key_press_handler from matplotlib.backends.backend_qt4agg import ( FigureCanvasQTAgg as FigureCanvas, NavigationToolbar2QTAgg as NavigationToolbar) from PyQt4.QtCore im...
unlicense
0/pathintmatmult
pathintmatmult/plotting.py
1
1228
""" Convenience functions for plotting the generated data. """ import matplotlib.pyplot as plt def plot2d(data: '[[X]]', x_range, y_range, out_path, *, x_label=None, y_label=None, colormap='jet', colorbar=True): """ Plot the data as a heat map. The resulting image is saved to out_path. Parameters: ...
mit
hainm/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
soulmachine/scikit-learn
examples/linear_model/plot_ols_3d.py
350
2040
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Sparsity Example: Fitting only features 1 and 2 ========================================================= Features 1 and 2 of the diabetes-dataset are fitted and plotted below. It illustrates that although feature...
bsd-3-clause
humdings/zipline
tests/calendars/test_nyse_calendar.py
5
9411
from unittest import TestCase import pandas as pd from .test_trading_calendar import ExchangeCalendarTestBase from zipline.utils.calendars.exchange_calendar_nyse import NYSEExchangeCalendar class NYSECalendarTestCase(ExchangeCalendarTestBase, TestCase): answer_key_filename = 'nyse' calendar_class = NYSEExch...
apache-2.0
semanticbits/survey_stats
src/survey_stats/etl/download.py
1
2410
import os import io import pandas as pd import boto3 from botocore import UNSIGNED from botocore.client import Config from boto3.s3.transfer import TransferConfig from botocore.vendored import requests import requests_cache from survey_stats import log SCRATCH_DIR = 'cache/' MAX_SOCRATA_FETCH = 2**32 TMP_API_KEY = 'Kn...
bsd-2-clause
rlowrance/python_lib
applied_data_science/dataframe.py
1
6093
'''function that operator on pandas DataFrame instances create_report_categorical(df, ...) create_report_numeric(df, ...) replace(df, old_name, new_name, new_value) Copyright 2017 Roy E. Lowrance Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the L...
apache-2.0
mindw/shapely
docs/code/skew.py
5
2513
from matplotlib import pyplot from shapely.wkt import loads as load_wkt from shapely import affinity from descartes.patch import PolygonPatch from figures import SIZE, BLUE, GRAY def add_origin(ax, geom, origin): x, y = xy = affinity.interpret_origin(geom, origin, 2) ax.plot(x, y, 'o', color=GRAY, zorder=1) ...
bsd-3-clause
jmetzen/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
konstantinstadler/pymrio
tests/test_math.py
1
18241
""" test cases for all mathematical functions """ import os import sys import numpy as np import numpy.testing as npt import pandas as pd import pandas.testing as pdt import pytest TESTPATH = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.join(TESTPATH, "..")) # the function which should be tes...
gpl-3.0
schae234/gingivere
tests/raw_data_clf.py
2
3422
from __future__ import print_function import numpy as np from sklearn.preprocessing import StandardScaler from sklearn.cross_validation import StratifiedKFold from sklearn.metrics import classification_report from sklearn.svm import SVC from sklearn.neighbors import KNeighborsClassifier from sklearn.decomposition impo...
mit
belltailjp/scikit-learn
sklearn/metrics/tests/test_pairwise.py
105
22788
import numpy as np from numpy import linalg from scipy.sparse import dok_matrix, csr_matrix, issparse from scipy.spatial.distance import cosine, cityblock, minkowski, wminkowski from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing impo...
bsd-3-clause
automl/paramsklearn
ParamSklearn/components/feature_preprocessing/kitchen_sinks.py
1
2564
import sklearn.kernel_approximation from HPOlibConfigSpace.configuration_space import ConfigurationSpace from HPOlibConfigSpace.hyperparameters import UniformFloatHyperparameter, \ UniformIntegerHyperparameter from ParamSklearn.components.base import ParamSklearnPreprocessingAlgorithm from ParamSklearn.constants ...
bsd-3-clause
sangwook236/sangwook-library
python/test/machine_learning/keras/run_simple_training.py
2
28208
#!/usr/bin/env python # -*- coding: UTF-8 -*- import sys sys.path.append('../../../src') import os, math, shutil, argparse, logging, logging.handlers, time, datetime import numpy as np import tensorflow as tf #import sklearn #import cv2 #import matplotlib.pyplot as plt import swl.machine_learning.util as swl_ml_util ...
gpl-2.0
frank-tancf/scikit-learn
examples/cluster/plot_face_segmentation.py
71
2839
""" =================================================== Segmenting the picture of a raccoon face in regions =================================================== This example uses :ref:`spectral_clustering` on a graph created from voxel-to-voxel difference on an image to break this image into multiple partly-homogeneous...
bsd-3-clause
cactusbin/nyt
matplotlib/lib/matplotlib/image.py
4
49269
""" The image module supports basic image loading, rescaling and display operations. """ from __future__ import division, print_function import os import warnings import math import numpy as np from numpy import ma from matplotlib import rcParams import matplotlib.artist as martist from matplotlib.artist import allo...
unlicense
ves-code/plumed2-ves
user-doc/tutorials/others/ves-lugano2017-kinetics/TRAJECTORIES-1700K/cdf-analysis.py
6
1134
#!/usr/bin/env python import numpy as np from scipy.stats import ks_2samp from scipy.optimize import curve_fit from statsmodels.distributions.empirical_distribution import ECDF import matplotlib.pyplot as plt f=open('fpt.dat','r') # define theoretical CDF def func(x,tau): return 1-np.exp(-x/tau) x = [] count=0 ...
lgpl-3.0
mehdidc/scikit-learn
examples/cluster/plot_cluster_comparison.py
12
4718
""" ========================================================= Comparing different clustering algorithms on toy datasets ========================================================= This example aims at showing characteristics of different clustering algorithms on datasets that are "interesting" but still in 2D. The last ...
bsd-3-clause
Jimmy-Morzaria/scikit-learn
examples/applications/plot_model_complexity_influence.py
323
6372
""" ========================== Model Complexity Influence ========================== Demonstrate how model complexity influences both prediction accuracy and computational performance. The dataset is the Boston Housing dataset (resp. 20 Newsgroups) for regression (resp. classification). For each class of models we m...
bsd-3-clause
FofanovLab/VaST
VaST/Pattern.py
1
13973
import copy import json import logging from functools import partial from itertools import combinations import numpy as np import pandas as pd from utils import cartesian_product, get_ambiguous_pattern class Patterns: def __init__(self): self._patterns = {} self._genomes = {} self._amp_2...
mit
Transkribus/TranskribusDU
TranskribusDU/tasks/TablePrototypes/DU_ABPTableRG41.py
1
38778
# -*- coding: utf-8 -*- """ DU task for ABP Table: doing jointly row BIESO and horizontal grid lines block2line edges do not cross another block. Here we make consistent label when any N grid lines have no block in-between each other. In that case, those N grid lines must have consistent...
bsd-3-clause
sniemi/EuclidVisibleInstrument
analysis/FlatfieldCalibration.py
1
27797
""" Flat Field Calibration ====================== This simple script can be used to study the number of flat fields required to meet the VIS calibration requirements. The following requirements related to the flat field calibration has been taken from GDPRD. R-GDP-CAL-054: The contribution of the residuals of VIS fl...
bsd-2-clause
kushalbhola/MyStuff
Practice/PythonApplication/env/Lib/site-packages/numpy/lib/histograms.py
4
39639
""" Histogram-related functions """ from __future__ import division, absolute_import, print_function import contextlib import functools import operator import warnings import numpy as np from numpy.compat.py3k import basestring from numpy.core import overrides __all__ = ['histogram', 'histogramdd', 'histogram_bin_ed...
apache-2.0
mikebenfield/scikit-learn
sklearn/linear_model/tests/test_passive_aggressive.py
42
10505
from sklearn.utils.testing import assert_true import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_array_almost_equal, assert_array_equal from sklearn.utils.testing import assert_almost_equal...
bsd-3-clause
lisa-1010/smart-tutor
code/test_control_problems.py
1
3012
# implementation based on https://github.com/lisa-1010/transfer_rl/blob/master/code/gym_pipeline.py import gym import matplotlib.pyplot as plt # TODO: import agents ENV_NAME = 'CartPole-v0' NUM_TEST_TRIALS = 100 class EnvWrapper(object): """ Wraps the Environment class from gym, so we can make environment...
mit
shoshber/fmriprep
fmriprep/workflows/confounds.py
2
12081
''' Workflow for discovering confounds. Calculates frame displacement, segment regressors, global regressor, dvars, aCompCor, tCompCor ''' from nipype.interfaces import utility, nilearn, fsl from nipype.algorithms import confounds from nipype.pipeline import engine as pe from niworkflows.interfaces.masks import ACompCo...
bsd-3-clause
ChanderG/scipy
scipy/stats/_binned_statistic.py
26
17723
from __future__ import division, print_function, absolute_import import warnings import numpy as np from scipy._lib.six import callable from collections import namedtuple __all__ = ['binned_statistic', 'binned_statistic_2d', 'binned_statistic_dd'] def binned_statistic(x, values, statistic='me...
bsd-3-clause
liganega/Gongsu-DataSci
previous/y2017/W11-pandas-intro/GongSu25_Statistics_Sampling_Distribution.py
2
5188
# coding: utf-8 # In[1]: from __future__ import print_function, division # #### ์ž๋ฃŒ ์•ˆ๋‚ด: ์—ฌ๊ธฐ์„œ ๋‹ค๋ฃจ๋Š” ๋‚ด์šฉ์€ ์•„๋ž˜ ์‚ฌ์ดํŠธ์˜ ๋‚ด์šฉ์„ ์ฐธ๊ณ ํ•˜์—ฌ ์ƒ์„ฑ๋˜์—ˆ์Œ. # # https://github.com/rouseguy/intro2stats # # ํ‘œ๋ณธ๋ถ„ํฌ์™€ ์‹ ๋ขฐ๊ตฌ๊ฐ„ # ## ์ฃผ์š”๋‚ด์šฉ # # ์•ž์„œ [GongSu22](https://github.com/liganega/Gongsu-DataSci/blob/master/Notes/W10/GongSu22_Statistics_Population_Varia...
gpl-3.0
nansencenter/DAPPER
examples/basic_2.py
1
2760
# ## Illustrate usage of DAPPER to benchmark multiple DA methods. # #### Imports # <b>NB:</b> If you're on <mark><b>Gooble Colab</b></mark>, # then replace `%matplotlib notebook` below by # `!python -m pip install git+https://github.com/nansencenter/DAPPER.git` . # Also note that liveplotting does not work on Colab. ...
mit
alvarofierroclavero/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
larsmans/scikit-learn
doc/conf.py
11
8021
# -*- coding: utf-8 -*- # # scikit-learn documentation build configuration file, created by # sphinx-quickstart on Fri Jan 8 09:13:42 2010. # # 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. ...
bsd-3-clause
justincassidy/scikit-learn
sklearn/datasets/tests/test_rcv1.py
322
2414
"""Test the rcv1 loader. Skipped if rcv1 is not already downloaded to data_home. """ import errno import scipy.sparse as sp import numpy as np from sklearn.datasets import fetch_rcv1 from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing i...
bsd-3-clause
kylerbrown/bark
bark/tools/labelview.py
1
21160
import os import sys import string import yaml import numpy as np from scipy.signal import spectrogram import matplotlib.pyplot as plt import bark from bark.io.eventops import (OpStack, write_stack, read_stack, Update, Merge, Split, Delete, New) import warnings warnings.filterwarnings('ign...
gpl-2.0
jblackburne/scikit-learn
examples/linear_model/plot_iris_logistic.py
119
1679
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Logistic Regression 3-class Classifier ========================================================= Show below is a logistic-regression classifiers decision boundaries on the `iris <https://en.wikipedia.org/wiki/Iris_...
bsd-3-clause
winklerand/pandas
pandas/errors/__init__.py
6
1697
# flake8: noqa """ Expose public exceptions & warnings """ from pandas._libs.tslib import OutOfBoundsDatetime class PerformanceWarning(Warning): """ Warning raised when there is a possible performance impact. """ class UnsupportedFunctionCall(ValueError): """ Exception raised when attemptin...
bsd-3-clause
KAPPS-/vincent
examples/stacked_area_examples.py
11
2281
# -*- coding: utf-8 -*- """ Vincent Stacked Area Examples """ #Build a Stacked Area Chart from scratch from vincent import * import pandas as pd import pandas.io.data as web all_data = {} for ticker in ['AAPL', 'GOOG', 'IBM', 'YHOO', 'MSFT']: all_data[ticker] = web.get_data_yahoo(ticker, '1/1/2010', '1/1/2013')...
mit