repo_name
stringlengths
7
90
path
stringlengths
5
191
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
976
581k
license
stringclasses
15 values
ocelot-collab/ocelot
ocelot/gui/sr_plot.py
1
5482
__author__ = 'Sergey Tomin' import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import matplotlib from matplotlib import cm def show_flux(screen, show='Total', xlim=(0,0), ylim =(0,0), file_name=None, unit="mm", title=None, nfig=1, grid=True, xlog=False, ylog=Fals...
gpl-3.0
jzt5132/scikit-learn
sklearn/linear_model/tests/test_passive_aggressive.py
169
8809
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 from sklearn.utils.testing import assert_rais...
bsd-3-clause
mugizico/scikit-learn
examples/cluster/plot_digits_linkage.py
369
2959
""" ============================================================================= Various Agglomerative Clustering on a 2D embedding of digits ============================================================================= An illustration of various linkage option for agglomerative clustering on a 2D embedding of the di...
bsd-3-clause
NunoEdgarGub1/scikit-learn
sklearn/linear_model/tests/test_perceptron.py
378
1815
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_raises from sklearn.utils import check_random_state from sklearn.datasets import load_iris from sklearn.linear_model import Pe...
bsd-3-clause
rhyolight/nupic.research
projects/sequence_prediction/continuous_sequence/swarm_runner.py
10
7442
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2015, 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...
gpl-3.0
joyxu/autotest
utils/external_packages.py
4
28633
# Please keep this code python 2.4 compatible and stand alone. # pylint: disable=E0611 import distutils.version import logging import os import shutil import sys import tempfile import time import urllib2 import subprocess import re from autotest.client.shared import utils _READ_SIZE = 64 * 1024 _MAX_PACKAGE_SIZE = 1...
gpl-2.0
HaebinShin/tensorflow
tensorflow/examples/skflow/digits.py
4
2380
# 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
cmoutard/mne-python
mne/viz/_3d.py
1
36481
"""Functions to make 3D plots with M/EEG data """ from __future__ import print_function # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Denis Engemann <denis.engemann@gmail.com> # Martin Luessi <mluessi@nmr.mgh.harvard.edu> # Eric Larson <larson.eric.d@gmail.com> # ...
bsd-3-clause
SusanJL/iris
docs/iris/example_code/General/custom_aggregation.py
6
3397
""" Calculating a custom statistic ============================== This example shows how to define and use a custom :class:`iris.analysis.Aggregator`, that provides a new statistical operator for use with cube aggregation functions such as :meth:`~iris.cube.Cube.collapsed`, :meth:`~iris.cube.Cube.aggregated_by` or :me...
gpl-3.0
camallen/aggregation
experimental/plankton/cluster.py
2
3575
#!/usr/bin/env python __author__ = 'greghines' import numpy as np import matplotlib.pyplot as plt import csv import sys import os import pymongo import matplotlib.cbook as cbook import random import bisect if os.path.exists("/home/ggdhines"): sys.path.append("/home/ggdhines/PycharmProjects/reduction/experimental/c...
apache-2.0
google-research/google-research
ipagnn/workflows/analysis_workflows.py
1
13612
# 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
rhattersley/iris
lib/iris/tests/system_test.py
8
3910
# (C) British Crown Copyright 2010 - 2015, Met Office # # This file is part of Iris. # # Iris is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option) any l...
lgpl-3.0
altairpearl/scikit-learn
sklearn/gaussian_process/gpc.py
42
31571
"""Gaussian processes classification.""" # Authors: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de> # # License: BSD 3 clause import warnings from operator import itemgetter import numpy as np from scipy.linalg import cholesky, cho_solve, solve from scipy.optimize import fmin_l_bfgs_b from scipy.special import erf...
bsd-3-clause
akrherz/iem
scripts/hads/compute_hads_pday.py
1
3548
"""Attempt at totalling up DCP data Run from `RUN_12Z.sh` for previous day Run from `RUN_20_AFTER.sh` for current day """ import datetime import sys import pytz import numpy as np from pandas.io.sql import read_sql from pyiem.util import get_dbconn, utc, logger LOG = logger() def workflow(date): """Do...
mit
kjung/scikit-learn
sklearn/feature_extraction/tests/test_image.py
12
11173
# Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org> # Gael Varoquaux <gael.varoquaux@normalesup.org> # License: BSD 3 clause import numpy as np import scipy as sp from scipy import ndimage from scipy import misc from nose.tools import assert_equal, assert_true from numpy.testing import asse...
bsd-3-clause
cmoutard/mne-python
mne/viz/epochs.py
1
62694
"""Functions to plot epochs data """ # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Denis Engemann <denis.engemann@gmail.com> # Martin Luessi <mluessi@nmr.mgh.harvard.edu> # Eric Larson <larson.eric.d@gmail.com> # Jaakko Leppakangas <jaeilepp@student.jyu.f...
bsd-3-clause
low-sky/pyspeckit
pyspeckit/spectrum/baseline.py
2
30565
from __future__ import print_function import numpy as np import matplotlib from ..config import ConfigDescriptor as cfgdec from .. import specwarnings from .. import mpfit from . import interactive from . import history from . import models from astropy import log import copy interactive_help_message = """ (1) Left-cl...
mit
debugger22/sympy
sympy/plotting/tests/test_plot.py
43
8577
from sympy import (pi, sin, cos, Symbol, Integral, summation, sqrt, log, oo, LambertW, I, meijerg, exp_polar, Max, Piecewise) from sympy.plotting import (plot, plot_parametric, plot3d_parametric_line, plot3d, plot3d_parametric_surface) from sympy.plotting.plot import unset...
bsd-3-clause
pombreda/nmrglue
doc/_build/html/examples/el/plotting/1d_spectrum/plot_1d_pipe_freq.py
10
1137
#! /usr/bin/env python # Create a 1D plot of NMRPipe data import nmrglue as ng import matplotlib.pyplot as plt import numpy as np # read in the data from a NMRPipe file dic,data = ng.pipe.read("../../common_data/1d_pipe/test.ft") # create a unit conversion object for the axis uc = ng.pipe.make_uc(dic,data) # plot t...
bsd-3-clause
eaton-lab/toytree
toytree/utils.py
1
22118
#!/usr/bin/env python from __future__ import print_function, division, absolute_import import re import os from copy import deepcopy import numpy as np import toytree import toyplot ####################################################### # Exception Classes ####################################################### c...
gpl-3.0
rabipanda/tensorflow
tensorflow/contrib/learn/python/learn/learn_io/io_test.py
137
5063
# 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
wolfsonliu/littletools
ColorTools/colortools.py
1
1646
# -*-coding:utf-8-*- # import matplotlib as mpl # mpl.use('Gtk3Agg') import matplotlib.pyplot as plt import matplotlib.colors as colors cmaps = { 'Perceptually Uniform Sequential': [ 'viridis', 'plasma', 'inferno', 'magma' ], 'Sequential': [ 'Greys', 'Purples', 'Blues', 'Greens', 'Oranges',...
gpl-3.0
jwkvam/bowtie
bowtie/_component.py
1
10337
"""Bowtie abstract component classes. All visual and control components inherit these. """ from typing import Any, Callable, Optional, ClassVar, Tuple # pylint: disable=unused-import from abc import ABCMeta, abstractmethod import string from functools import wraps import json from datetime import datetime, date, tim...
mit
jblackburne/scikit-learn
sklearn/kernel_ridge.py
31
6552
"""Module :mod:`sklearn.kernel_ridge` implements kernel ridge regression.""" # Authors: Mathieu Blondel <mathieu@mblondel.org> # Jan Hendrik Metzen <jhm@informatik.uni-bremen.de> # License: BSD 3 clause import numpy as np from .base import BaseEstimator, RegressorMixin from .metrics.pairwise import pairwise...
bsd-3-clause
karoraw1/GLM_Wrapper
OTU_Time_Series/rarefy.py
1
1197
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Wed Apr 12 11:38:23 2017 @author: login """ import pandas as pd import numpy as np def abund_vec_to_list(sp_ser): sp_list = [] for idx in sp_ser.index: sp_count = sp_ser.ix[idx] for cnt in range(int(sp_count)): sp_list....
mit
hsiaoyi0504/scikit-learn
sklearn/utils/tests/test_linear_assignment.py
421
1349
# Author: Brian M. Clapper, G Varoquaux # License: BSD import numpy as np # XXX we should be testing the public API here from sklearn.utils.linear_assignment_ import _hungarian def test_hungarian(): matrices = [ # Square ([[400, 150, 400], [400, 450, 600], [300, 225, 300]], ...
bsd-3-clause
lthurlow/Network-Grapher
proj/external/matplotlib-1.2.1/build/lib.linux-i686-2.7/matplotlib/backends/backend_wxagg.py
2
6311
""" backend_wxagg.py A wxPython backend for Agg. This uses the GUI widgets written by Jeremy O'Donoghue (jeremy@o-donoghue.com) and the Agg backend by John Hunter (jdhunter@ace.bsd.uchicago.edu) Copyright (C) 2003-5 Jeremy O'Donoghue, John Hunter, Illinois Institute of Technology License: This work is lice...
mit
google-research/google-research
ebp/ebp/experiments/main.py
1
7793
# 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
ktaneishi/deepchem
contrib/pubchem_dataset/create_smiles_mapping.py
6
2008
import pandas as pd import os from rdkit import Chem import time import gzip import pickle import deepchem def main(): print("Processing PubChem FTP Download") data_dir = deepchem.utils.get_data_dir() sdf_dir = os.path.join(data_dir, "SDF") compound_read_count = 0 keys = list() values = list() overall...
mit
davidgbe/scikit-learn
sklearn/manifold/isomap.py
229
7169
"""Isomap for manifold learning""" # Author: Jake Vanderplas -- <vanderplas@astro.washington.edu> # License: BSD 3 clause (C) 2011 import numpy as np from ..base import BaseEstimator, TransformerMixin from ..neighbors import NearestNeighbors, kneighbors_graph from ..utils import check_array from ..utils.graph import...
bsd-3-clause
mrm-xiefan/lunania-ai
flowers/01_job/utils.py
3
1860
import os import config import logging import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from luna import LunaExcepion logger = logging.getLogger() def preprocess_images(images): # 'RGB'->'BGR' images = images[:, :, ::-1] # Zero-center by mean pixel images[:, :, 0] -= 103.939 ...
mit
PanDAWMS/panda-server
pandaserver/test/esPreemption.py
1
4461
import datetime from pandaserver.taskbuffer.TaskBuffer import taskBuffer from pandacommon.pandalogger.PandaLogger import PandaLogger from pandacommon.pandalogger.LogWrapper import LogWrapper from pandaserver.brokerage.SiteMapper import SiteMapper from pandaserver.taskbuffer import ErrorCode # password from pandaserver...
apache-2.0
t-g-williams/seattle_hackathon
code/aggregate_scores.py
1
5982
import geopandas as gpd import pandas as pd import numpy as np import sqlite3 import logging logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) # user variables: scores = ['score0_49', 'score50_69','score70_89','score90_100'] demographics = ['pop_total', 'pop_over_65', 'pop_below_10','pop_fe...
mit
jmmease/pandas
pandas/tests/indexes/test_category.py
3
41440
# -*- coding: utf-8 -*- import pytest import pandas.util.testing as tm from pandas.core.indexes.api import Index, CategoricalIndex from .common import Base from pandas.compat import range, PY3 import numpy as np from pandas import Categorical, IntervalIndex, compat, notna from pandas.util.testing import assert_alm...
bsd-3-clause
mkomeichi/BuildingMLSystemsWithPython
ch01/analyze_webstats.py
23
5113
# 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 import os from utils import DATA_DIR, CHART_DIR import scipy as sp import matplotlib.pyplot as plt sp....
mit
pauliacomi/pyGAPS
setup.py
1
3326
# -*- encoding: utf-8 -*- import re from pathlib import Path from setuptools import find_packages from setuptools import setup def read(name, **kwargs): """Read and return file contents.""" with open( Path(__file__).parent / name, encoding=kwargs.get('encoding', 'utf8'), ) as fh: ...
mit
Achuth17/scikit-bio
skbio/stats/ordination/__init__.py
3
3899
r""" Ordination methods (:mod:`skbio.stats.ordination`) ================================================== .. currentmodule:: skbio.stats.ordination This module contains several ordination methods, including Principal Coordinate Analysis, Correspondence Analysis, Redundancy Analysis and Canonical Correspondence Analy...
bsd-3-clause
frank-tancf/scikit-learn
benchmarks/bench_plot_fastkmeans.py
294
4676
from __future__ import print_function from collections import defaultdict from time import time import numpy as np from numpy import random as nr from sklearn.cluster.k_means_ import KMeans, MiniBatchKMeans def compute_bench(samples_range, features_range): it = 0 results = defaultdict(lambda: []) chun...
bsd-3-clause
webmasterraj/FogOrNot
flask/lib/python2.7/site-packages/pandas/tests/test_base.py
2
27482
# -*- coding: utf-8 -*- from __future__ import print_function import re from datetime import datetime, timedelta import numpy as np import pandas.compat as compat import pandas as pd from pandas.compat import u, StringIO from pandas.core.base import FrozenList, FrozenNDArray, PandasDelegate from pandas.tseries.base imp...
gpl-2.0
flaviostutz/datascience-snippets
kaggle-lung-cancer-approach1/modules/lungprepare.py
1
10866
import numpy as np from modules.utils import Timer from modules.logging import logger import modules.utils as utils import os import dicom import scipy.ndimage import matplotlib.pyplot as plt import matplotlib.patches as patches import scipy.ndimage as ndimage from scipy.ndimage.interpolation import rotate from scipy.n...
mit
avishek-r-kumar/dfitools
MD_DFI_analysis/TakeAvg.py
1
2266
#!/usr/bin/env python """ Take Averages ------------- ./TakeAvg.py title """ import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns import dfi import glob import sys if __name__ == "__main__": if len(sys.argv) < 2: print __doc__ exit() title = sys.argv...
bsd-3-clause
garaud/ezhc
ezhc/series.py
2
3823
import pandas as pd def series(df, options, *args, **kwargs): idx = df.index col = df.columns data = df.values assert(isinstance(idx, pd.core.index.Index)) series = [] for k, c in enumerate(col): if df[c].dtype.kind in 'fib': v = data[:, k] sec = c in kwa...
mit
Dapid/GPy
GPy/core/parameterization/priors.py
8
45900
# Copyright (c) 2012 - 2014, GPy authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) import numpy as np from scipy.special import gammaln, digamma from ...util.linalg import pdinv from .domains import _REAL, _POSITIVE import warnings import weakref class Prior(object): domain ...
bsd-3-clause
pratapvardhan/pandas
pandas/tests/indexes/timedeltas/test_scalar_compat.py
4
2421
# -*- coding: utf-8 -*- """ Tests for TimedeltaIndex methods behaving like their Timedelta counterparts """ import numpy as np import pandas as pd import pandas.util.testing as tm from pandas import timedelta_range, Timedelta, TimedeltaIndex, Index, Series class TestVectorizedTimedelta(object): def test_tdi_tot...
bsd-3-clause
alvarofierroclavero/scikit-learn
examples/linear_model/plot_sgd_weighted_samples.py
344
1458
""" ===================== SGD: Weighted samples ===================== Plot decision function of a weighted dataset, where the size of points is proportional to its weight. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from sklearn import linear_model # we create 20 points np.random.seed(0) X ...
bsd-3-clause
SanPen/GridCal
src/GridCal/Engine/Devices/bus.py
1
25409
# This file is part of GridCal. # # GridCal is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # GridCal is distributed in the hope that...
gpl-3.0
evgchz/scikit-learn
examples/feature_stacker.py
246
1906
""" ================================================= Concatenating multiple feature extraction methods ================================================= In many real-world examples, there are many ways to extract features from a dataset. Often it is beneficial to combine several methods to obtain good performance. Th...
bsd-3-clause
meghana1995/sympy
examples/intermediate/mplot3d.py
93
1252
#!/usr/bin/env python """Matplotlib 3D plotting example Demonstrates plotting with matplotlib. """ import sys from sample import sample from sympy import sin, Symbol from sympy.external import import_module def mplot3d(f, var1, var2, show=True): """ Plot a 3d function using matplotlib/Tk. """ im...
bsd-3-clause
daniestevez/jupyter_notebooks
dslwp/vlbi.py
1
3474
#!/usr/bin/env python3 import numpy as np import matplotlib.pyplot as plt import scipy.signal import scipy.io import scipy.optimize import sys c = 299792458 fs = 40000 doppler_correction = -200 num_args = 7 def usage(): print("Usage {}: freq file0.raw file1.raw file0_utc file1_utc doppler_file output_folder"....
gpl-3.0
florian-f/sklearn
sklearn/utils/fixes.py
4
6523
"""Compatibility fixes for older version of python, numpy and scipy If you add content to this file, please give the version of the package at which the fixe is no longer needed. """ # Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org> # Gael Varoquaux <gael.varoquaux@normalesup.org> # ...
bsd-3-clause
DGrady/pandas
asv_bench/benchmarks/index_object.py
4
5469
from .pandas_vb_common import * class SetOperations(object): goal_time = 0.2 def setup(self): self.rng = date_range('1/1/2000', periods=10000, freq='T') self.rng2 = self.rng[:(-1)] # object index with datetime values if (self.rng.dtype == object): self.idx_rng = s...
bsd-3-clause
huzq/scikit-learn
sklearn/covariance/tests/test_robust_covariance.py
16
6304
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Gael Varoquaux <gael.varoquaux@normalesup.org> # Virgile Fritsch <virgile.fritsch@inria.fr> # # License: BSD 3 clause import itertools import numpy as np from sklearn.utils._testing import assert_array_almost_equal from sklearn.utils._testi...
bsd-3-clause
arahuja/scikit-learn
sklearn/neighbors/graph.py
19
6904
"""Nearest Neighbors graph functions""" # Author: Jake Vanderplas <vanderplas@astro.washington.edu> # # License: BSD 3 clause (C) INRIA, University of Amsterdam import warnings from .base import KNeighborsMixin, RadiusNeighborsMixin from .unsupervised import NearestNeighbors def _check_params(X, metric, p, metric_p...
bsd-3-clause
arkem/plotpcap
plotpcap.py
1
3718
from dpkt.ethernet import Ethernet from dpkt.ip import IP import dpkt.tcp import pcap import struct import sys from matplotlib import pyplot #TODO: Proper argument parsing def usage(): print "python plotpcap.py [filename] [x_axis] [y_axis] [tcpdump filter]" print "filename: pcap file to plot" print...
bsd-2-clause
kevalds51/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
poryfly/scikit-learn
sklearn/feature_extraction/text.py
110
50157
# -*- coding: utf-8 -*- # Authors: Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Lars Buitinck <L.J.Buitinck@uva.nl> # Robert Layton <robertlayton@gmail.com> # Jochen Wersdörfer <jochen@wersdoerfer.de> # Roman Sinayev <roman.sinayev@gma...
bsd-3-clause
Haleyo/spark-tk
regression-tests/sparktkregtests/testcases/dicom/save_load_dicom_test.py
13
4193
# vim: set encoding=utf-8 # Copyright (c) 2016 Intel Corporation  # # 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 require...
apache-2.0
manipopopo/tensorflow
tensorflow/contrib/learn/python/learn/estimators/estimators_test.py
46
6682
# 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
shunw/pythonML_code
ch_7_example.py
1
15803
from itertools import product import matplotlib.pyplot as plt import math import numpy as np import operator import pandas as pd from scipy.misc import comb from sklearn import datasets from sklearn.base import BaseEstimator from sklearn.base import ClassifierMixin from sklearn.base import clone from sklearn.cross_va...
mit
CommerceDataService/recordtagger
exploration/rstag.py
1
4989
# rstag.py # # # # Title: Mapping records to LDA-generated clusters # Author: Rebecca Bilbro + Star Ying # Date: 1/20/16 # Organization: Commerce Data Service, U.S. Department of Commerce ##################################################################### # Imports ##############################...
mit
geoalchimista/chflux
chflux/chflux.py
1
3524
""" PyChamberFlux main script A package for calculating trace gas fluxes from chamber measurements """ import copy import argparse import datetime import timeit import importlib import pkg_resources from chflux.default_config import default_config from chflux.io.readers import read_yaml, update_dict class ChFluxPro...
bsd-3-clause
yanlend/scikit-learn
sklearn/cluster/bicluster.py
211
19443
"""Spectral biclustering algorithms. Authors : Kemal Eren License: BSD 3 clause """ from abc import ABCMeta, abstractmethod import numpy as np from scipy.sparse import dia_matrix from scipy.sparse import issparse from . import KMeans, MiniBatchKMeans from ..base import BaseEstimator, BiclusterMixin from ..external...
bsd-3-clause
1mace1/render_function_graphs
main.py
1
1626
import matplotlib.pyplot as plt import numpy as np from FormatInput.FormatInputClass import FormatInputClass from config import shape_of_x_range, x_step def render_func_graph(formula_range_list_dict): try: ## Set the settings to display graph fig = plt.figure('Function graph') ax = fig.add...
mit
taknevski/tensorflow-xsmm
tensorflow/contrib/learn/python/learn/learn_io/__init__.py
37
2375
# 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
jolevq/odoopub
addons/resource/faces/timescale.py
170
3902
############################################################################ # Copyright (C) 2005 by Reithinger GmbH # mreithinger@web.de # # This file is part of faces. # # faces is free software; you can redistribute it and/or modify # ...
agpl-3.0
rs2/pandas
pandas/tests/frame/methods/test_reset_index.py
1
12506
from datetime import datetime import numpy as np import pytest import pandas as pd from pandas import ( DataFrame, Index, IntervalIndex, MultiIndex, RangeIndex, Series, Timestamp, date_range, ) import pandas._testing as tm class TestResetIndex: def test_reset_index_tz(self, tz_aw...
bsd-3-clause
ChakriCherukuri/bqplot
tests/binary_serialization_test.py
3
4801
import bqplot import numpy as np import pandas as pd from bqplot.traits import array_to_json, array_from_json import pytest def test_binary_serialize_1d(figure): x = np.arange(10, dtype=np.float64) y = (x**2).astype(np.int32) scatter = bqplot.Scatter(x=x, y=y) state = scatter.get_state() assert s...
apache-2.0
chatcannon/numpy
numpy/doc/creation.py
52
5507
""" ============== 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...
bsd-3-clause
soulmachine/scikit-learn
sklearn/covariance/tests/test_robust_covariance.py
31
3340
# 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
timothydmorton/bokeh
sphinx/source/docs/tutorials/solutions/boxplot.py
22
3003
import numpy as np import pandas as pd from bokeh.plotting import figure, output_file, show # Generate some synthetic time series for six different categories cats = list("abcdef") score = np.random.randn(2000) g = np.random.choice(cats, 2000) for i, l in enumerate(cats): score[g == l] += i // 2 df = pd.DataFrame...
bsd-3-clause
nelson-liu/scikit-learn
examples/cluster/plot_kmeans_assumptions.py
270
2040
""" ==================================== Demonstration of k-means assumptions ==================================== This example is meant to illustrate situations where k-means will produce unintuitive and possibly unexpected clusters. In the first three plots, the input data does not conform to some implicit assumptio...
bsd-3-clause
avistous/QSTK
qstkfeat/featutil.py
1
22714
''' (c) 2011, 2012 Georgia Tech Research Corporation This source code is released under the New BSD license. Please see http://wiki.quantsoftware.org/index.php?title=QSTK_License for license details. Created on Nov 7, 2011 @author: John Cornwell @contact: JohnWCornwellV@gmail.com @summary: Contains utility functions...
bsd-3-clause
StephenChusang/py-faster-rcnn-tracker
lib/roi_data_layer/minibatch.py
4
8169
# -------------------------------------------------------- # Fast R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick # -------------------------------------------------------- """Compute minibatch blobs for training a Fast R-CNN network.""" impor...
mit
mxjl620/scikit-learn
sklearn/cluster/tests/test_bicluster.py
226
9457
"""Testing for Spectral Biclustering methods""" import numpy as np from scipy.sparse import csr_matrix, issparse from sklearn.grid_search import ParameterGrid from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from...
bsd-3-clause
ZENGXH/scikit-learn
sklearn/neighbors/tests/test_ball_tree.py
129
10192
import pickle import numpy as np from numpy.testing import assert_array_almost_equal from sklearn.neighbors.ball_tree import (BallTree, NeighborsHeap, simultaneous_sort, kernel_norm, nodeheap_sort, DTYPE, ITYPE) from sklearn.neighbors.dis...
bsd-3-clause
arjoly/scikit-learn
examples/cluster/plot_mean_shift.py
351
1793
""" ============================================= A demo of the mean-shift clustering algorithm ============================================= Reference: Dorin Comaniciu and Peter Meer, "Mean Shift: A robust approach toward feature space analysis". IEEE Transactions on Pattern Analysis and Machine Intelligence. 2002. ...
bsd-3-clause
gcarq/freqtrade
freqtrade/optimize/hyperopt_loss_sortino.py
1
1560
""" SortinoHyperOptLoss This module defines the alternative HyperOptLoss class which can be used for Hyperoptimization. """ from datetime import datetime import numpy as np from pandas import DataFrame from freqtrade.optimize.hyperopt import IHyperOptLoss class SortinoHyperOptLoss(IHyperOptLoss): """ Defin...
gpl-3.0
abalckin/cwavenet
examples/WNvsPWN/show_speed.py
3
2485
#! /usr/bin/python3 import pylab as plb import numpy as np from matplotlib import rc rc('text', usetex=True) rc('text.latex', unicode=True) rc('text.latex', preamble=r'\usepackage[russian]{babel}') #rc('text.latex', preamble=r'\usepackage[lmodern]') #rc('font',**{'family':'sans-serif','sans-serif':['Times']}) rc('font...
gpl-2.0
Ialong/shogun
examples/undocumented/python_modular/graphical/group_lasso.py
26
7792
#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt from numpy.random import rand, randn, permutation, multivariate_normal from modshogun import BinaryLabels, RealFeatures, IndexBlock, IndexBlockGroup, FeatureBlockLogisticRegression def generate_synthetic_logistic_data(n, p, L, blk_nnz, gcov, nstd)...
gpl-3.0
nigroup/nideep
nideep/eval/test_accuracy.py
2
3985
from nose.tools import assert_equals import nideep.eval.accuracy as accuracy import numpy as np class TestHammingAccuracy: def test_ideal_situation(self): """ Ideal case with accuracy 1 """ for n in range(2, 100): y_true = np.identity(n) y_pred = np.identity(...
bsd-2-clause
gef756/statsmodels
statsmodels/distributions/empirical_distribution.py
11
5045
""" Empirical CDF Functions """ import numpy as np from scipy.interpolate import interp1d def _conf_set(F, alpha=.05): r""" Constructs a Dvoretzky-Kiefer-Wolfowitz confidence band for the eCDF. Parameters ---------- F : array-like The empirical distributions alpha : float Set a...
bsd-3-clause
thisisev/ThinkStats2
code/regression.py
62
9652
"""This file contains code used in "Think Stats", by Allen B. Downey, available from greenteapress.com Copyright 2010 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ from __future__ import print_function, division import math import pandas import random import numpy as np import statsmode...
gpl-3.0
NextThought/pypy-numpy
numpy/lib/function_base.py
2
124014
from __future__ import division, absolute_import, print_function import warnings import sys import collections import operator import numpy as np import numpy.core.numeric as _nx from numpy.core import linspace, atleast_1d, atleast_2d from numpy.core.numeric import ( ones, zeros, arange, concatenate, array, asarr...
bsd-3-clause
dfm/aas
cluster.py
2
1340
# coding: utf-8 """ Run a sparse PCA on AAS abstract word counts """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import os, sys import json import time # Third-party import numpy as np import sklearn from sklearn.cluster import KMeans, MiniBatchK...
mit
yutiansut/QUANTAXIS
QUANTAXIS/QAData/QADataStruct.py
2
44972
# coding:utf-8 # # The MIT License (MIT) # # Copyright (c) 2016-2021 yutiansut/QUANTAXIS # # 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 th...
mit
marcocaccin/scikit-learn
sklearn/manifold/t_sne.py
6
34808
# Author: Alexander Fabisch -- <afabisch@informatik.uni-bremen.de> # Author: Christopher Moody <chrisemoody@gmail.com> # Author: Nick Travers <nickt@squareup.com> # License: BSD 3 clause (C) 2014 # This is the exact and Barnes-Hut t-SNE implementation. There are other # modifications of the algorithm: # * Fast Optimi...
bsd-3-clause
RP7/R7-OCM
src/host/python/GSMTimingSync.py
2
1162
import numpy as np from ctypes import * import time import GSM from sptools import findFreq from GSMSync import GSMSync import matplotlib.pyplot as plt class GSMTimingSync(GSMSync): def __init__(self,f,url='http://192.168.1.110:8080/'): GSMSync.__init__(self,f,url) self.sb = GSM.SB() self.osr = self.fc/GSM.sy...
apache-2.0
stylianos-kampakis/scikit-learn
examples/cluster/plot_agglomerative_clustering_metrics.py
402
4492
""" Agglomerative clustering with different metrics =============================================== Demonstrates the effect of different metrics on the hierarchical clustering. The example is engineered to show the effect of the choice of different metrics. It is applied to waveforms, which can be seen as high-dimens...
bsd-3-clause
ml-lab/pylearn2
pylearn2/cross_validation/dataset_iterators.py
4
19415
""" Cross-validation dataset iterators. """ __author__ = "Steven Kearnes" __copyright__ = "Copyright 2014, Stanford University" __license__ = "3-clause BSD" __maintainer__ = "Steven Kearnes" import numpy as np import warnings try: from sklearn.cross_validation import (KFold, StratifiedKFold, ShuffleSplit, ...
bsd-3-clause
rfabila/Pyscholar
pyscholar/scopus.py
1
62065
import ConfigParser import os import time import Queue import threading import itertools as it import math import pickle import requests #import networkx as nx import pandas as pd #import matplotlib.pyplot as plt class Quota_Exceeded(Exception): def __str__(self): return "You have exceeded the quotas on a...
gpl-2.0
jreback/pandas
pandas/core/arrays/timedeltas.py
1
35525
from datetime import timedelta from typing import List, Optional, Union import numpy as np from pandas._libs import lib, tslibs from pandas._libs.tslibs import ( BaseOffset, NaT, NaTType, Period, Tick, Timedelta, Timestamp, iNaT, to_offset, ) from pandas._libs.tslibs.conversion imp...
bsd-3-clause
umuzungu/zipline
tests/test_tradesimulation.py
2
3266
# # Copyright 2014 Quantopian, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
apache-2.0
Khushmeet/char-conv-classification
helper.py
1
1549
import numpy as np import string import pandas as pd from keras.preprocessing.sequence import pad_sequences char_limit = 1014 def get_data(path): labels = [] inputs = [] df = pd.read_csv(path, names=['one','second','third']) df = df.drop('second', axis=1) data = df.values for label,text in da...
mit
ywcui1990/nupic.research
projects/sequence_prediction/discrete_sequences/plotMultiplePredictionWithErrBar.py
12
6799
#!/usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2015, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions ...
agpl-3.0
baifan-wang/structural-bioinformatics_in_python
SBio/Plot.py
1
5817
#!/usr/bin/env python3.5 # -*- coding: utf-8 -*- import numpy as np import matplotlib as mpl import sys,os import time def plot_torsion_wheel(angles, title, filename='1.png', abz=True, show = False): if show ==True: import matplotlib.pyplot as plt else: mpl.use('Agg') import matplotlib....
gpl-3.0
unnikrishnankgs/va
venv/lib/python3.5/site-packages/matplotlib/tests/test_offsetbox.py
12
2817
from __future__ import (absolute_import, division, print_function, unicode_literals) import nose from nose.tools import assert_true, assert_false from matplotlib.testing.decorators import image_comparison, cleanup import matplotlib.pyplot as plt import matplotlib.patches as mpatches import matp...
bsd-2-clause
ryfeus/lambda-packs
LightGBM_sklearn_scipy_numpy/source/sklearn/metrics/tests/test_score_objects.py
5
21280
import pickle import tempfile import shutil import os import numbers import numpy as np from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing i...
mit
brainstorm/bcbio-nextgen-vm
setup.py
2
2841
#!/usr/bin/env python import os import shutil import sys from setuptools import setup, find_packages version = "0.1.0a" def write_version_py(): version_py = os.path.join(os.path.dirname(__file__), "bcbiovm", "version.py") try: import subprocess p = subprocess.Popen(["git", "rev-parse", "--shor...
mit
gfyoung/pandas
pandas/tests/arrays/boolean/test_construction.py
6
12857
import numpy as np import pytest import pandas as pd import pandas._testing as tm from pandas.arrays import BooleanArray from pandas.core.arrays.boolean import coerce_to_array def test_boolean_array_constructor(): values = np.array([True, False, True, False], dtype="bool") mask = np.array([False, False, Fals...
bsd-3-clause
rroart/stockstat
python/cli/myutils.py
1
1573
import pandas as pd import numpy as np import math import myconfig as cf def fixzero(v): print(type(v)) return [ None if x == 0 else x for x in v ] def fixzero2(v): return v.replace(0, np.nan) def fixna(v, interpolation): #print(type(v)) if cf.nafix == 1: return(v.dropna()) if interp...
agpl-3.0