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
wolfram74/numerical_methods_iserles_notes
venv/lib/python2.7/site-packages/IPython/qt/console/qtconsoleapp.py
4
13971
""" A minimal application using the Qt console-style IPython frontend. This is not a complete console app, as subprocess will not be able to receive input, there is no real readline support, among other limitations. """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD Licens...
mit
schets/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
rseubert/scikit-learn
examples/linear_model/plot_sgd_separating_hyperplane.py
260
1219
""" ========================================= SGD: Maximum margin separating hyperplane ========================================= Plot the maximum margin separating hyperplane within a two-class separable dataset using a linear Support Vector Machines classifier trained using SGD. """ print(__doc__) import numpy as n...
bsd-3-clause
TomAugspurger/pandas
scripts/validate_unwanted_patterns.py
1
11283
#!/usr/bin/env python3 """ Unwanted patterns test cases. The reason this file exist despite the fact we already have `ci/code_checks.sh`, (see https://github.com/pandas-dev/pandas/blob/master/ci/code_checks.sh) is that some of the test cases are more complex/imposible to validate via regex. So this file is somewhat a...
bsd-3-clause
jplourenco/bokeh
bokeh/_legacy_charts/builder/tests/test_histogram_builder.py
6
4247
""" This is the Bokeh charts testing interface. """ #----------------------------------------------------------------------------- # Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved. # # Powered by the Bokeh Development Team. # # The full license is in the file LICENSE.txt, distributed with thi...
bsd-3-clause
PatrickChrist/scikit-learn
sklearn/feature_extraction/dict_vectorizer.py
234
12267
# Authors: Lars Buitinck # Dan Blanchard <dblanchard@ets.org> # License: BSD 3 clause from array import array from collections import Mapping from operator import itemgetter import numpy as np import scipy.sparse as sp from ..base import BaseEstimator, TransformerMixin from ..externals import six from ..ext...
bsd-3-clause
iandriver/RNA-sequence-tools
RNA_Seq_analysis/cluster_1.py
2
39669
import pickle as pickle import numpy as np import pandas as pd import os from subprocess import call import matplotlib matplotlib.use('QT5Agg') import matplotlib.pyplot as plt from matplotlib.ticker import LinearLocator import scipy import json from sklearn.decomposition import PCA as skPCA from scipy.spatial.distance ...
mit
roryyorke/python-control
examples/type2_type3.py
3
1677
# type2_type3.py - demonstration for type2 versus type3 control comparing # tracking and disturbance rejection for two proposed controllers # Gunnar Ristroph, 15 January 2010 import os import matplotlib.pyplot as plt # Grab MATLAB plotting functions from control.matlab import * # MATLAB-like functions from scip...
bsd-3-clause
apache/beam
sdks/python/apache_beam/dataframe/expressions_test.py
6
4866
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
apache-2.0
JohanComparat/nbody-npt-functions
bin/bin_SMHMr/plot_ObscurationLaw.py
1
1071
import numpy as n from scipy.stats import norm from scipy.integrate import quad from scipy.interpolate import interp1d import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as p import glob import astropy.io.fits as fits import os import time import numpy as n import sys data=n.loadtxt("/data17s/darksim/so...
cc0-1.0
HeraclesHX/scikit-learn
sklearn/feature_extraction/tests/test_text.py
110
34127
from __future__ import unicode_literals import warnings from sklearn.feature_extraction.text import strip_tags from sklearn.feature_extraction.text import strip_accents_unicode from sklearn.feature_extraction.text import strip_accents_ascii from sklearn.feature_extraction.text import HashingVectorizer from sklearn.fe...
bsd-3-clause
arlewis/arl_galbase
extract_stamp_good.py
2
24946
import astropy.io.fits as pyfits from astropy.io import ascii from astropy.table import Table, Column import astropy.wcs as pywcs import os import numpy as np import montage_wrapper as montage import shutil import sys import glob import time from matplotlib.path import Path from scipy.ndimage import zoom from pdb impor...
mit
fdft/ml
ch06/utils.py
22
6937
# 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 import sys import collections import csv import json from matplotlib import pylab import num...
mit
timpalpant/KaggleTSTextClassification
scripts/practice/predict.3.py
1
1789
#!/usr/bin/env python ''' Make predictions for the test data 3. Use naive Bayes, on just the boolean features, with a separate classifier for each label. ''' import argparse from common import * from scipy.stats import itemfreq from sklearn.naive_bayes import GaussianNB def prepare_features(data): return dat...
gpl-3.0
nsdf/nsdf
graphviz/figure1_twocells.py
1
30501
# This script was written by Chaitanya Chintaluri c.chinaluri@nencki.gov.pl # This software is available under GNU GPL3 License. # Uses pygraphviz to illustrate the inner structure of NSDF file format # This is to use in the NSDF paper and to generate machine readable file structure # for the convenience of the user. ...
gpl-3.0
gwpy/gwpy.github.io
docs/latest/plotter/colors-1.py
7
1123
from __future__ import division import numpy from matplotlib import (pyplot, rcParams) from matplotlib.colors import to_hex from gwpy.plotter import colors rcParams.update({ 'text.usetex': False, 'font.size': 15 }) th = numpy.linspace(0, 2*numpy.pi, 512) names = [ 'gwpy:geo600', 'gwpy:kagra', '...
gpl-3.0
EvoML/EvoML
evoml/subsampling/test_auto_segmentEG_FEMPO.py
2
1315
import pandas as pd from sklearn.datasets import load_boston from sklearn.linear_model import LinearRegression from sklearn.tree import DecisionTreeRegressor from sklearn.cross_validation import train_test_split from sklearn.metrics import mean_squared_error from .auto_segment_FEMPO import BasicSegmenter_FEMPO def d...
gpl-3.0
cyberphox/MissionPlanner
Lib/site-packages/numpy/lib/recfunctions.py
58
34495
""" Collection of utilities to manipulate structured arrays. Most of these functions were initially implemented by John Hunter for matplotlib. They have been rewritten and extended for convenience. """ import sys import itertools import numpy as np import numpy.ma as ma from numpy import ndarray, recarray from nump...
gpl-3.0
KarchinLab/2020plus
src/utils/python/p_value.py
1
6214
import numpy as np import pandas as pd import bisect # genes to be removed from MLFC calc mlfc_remove_genes = set([ 'PLCG1', 'CRLF2', 'SMARCD1', 'SH2B3', 'STK11', 'MEN1', 'IKBKB', 'AKT1', 'B2M', 'MLH1', 'USP28', 'TSHR', 'FGFR4', 'GPS2', 'CDC73', 'PIK3CA', 'MAP3K1', 'CACNA1D', 'FGFR3', 'TSC1', 'ZC3H13', 'CB...
apache-2.0
hongliuuuu/Results_Dis
ndR4.py
1
15791
from sklearn.kernel_approximation import (RBFSampler,Nystroem) from sklearn.ensemble import RandomForestClassifier import pandas import numpy as np import random from sklearn.svm import SVC from sklearn.metrics.pairwise import rbf_kernel,laplacian_kernel,chi2_kernel,linear_kernel,polynomial_kernel,cosine_similarity fro...
apache-2.0
vitordouzi/sigtrec_eval
sigtrec_eval_old.py
1
9270
# -*- coding: utf-8 -*- """ Created on Mon Out 1 10:07:00 2017 @author: Vítor Mangaravite """ import sys import os import subprocess import argparse import numpy as np import pandas as pd import multiprocessing from sklearn.model_selection import KFold from scipy.stats.mstats import ttest_rel from scipy.stats import t...
mit
aflaxman/scikit-learn
sklearn/feature_selection/tests/test_chi2.py
49
3080
""" Tests for chi2, currently the only feature selection function designed specifically to work with sparse matrices. """ import warnings import numpy as np from scipy.sparse import coo_matrix, csr_matrix import scipy.stats from sklearn.feature_selection import SelectKBest, chi2 from sklearn.feature_selection.univar...
bsd-3-clause
jhmatthews/cobra
source/plot_emissiv.py
1
2033
#! /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python ''' University of Southampton -- JM -- 30 September 2013 plot_emissiv.py Synopsis: Plot macro atom level emissivities and other information from diag file Usage: Arguments: ''' import matplotlib.pyplot ...
gpl-2.0
gsmaxwell/phase_offset_rx
gnuradio-core/src/examples/volk_benchmark/volk_plot.py
78
6117
#!/usr/bin/env python import sys, math import argparse from volk_test_funcs import * try: import matplotlib import matplotlib.pyplot as plt except ImportError: sys.stderr.write("Could not import Matplotlib (http://matplotlib.sourceforge.net/)\n") sys.exit(1) def main(): desc='Plot Volk performanc...
gpl-3.0
Winand/pandas
pandas/_version.py
5
15765
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains th...
bsd-3-clause
buguen/pylayers
pylayers/signal/device.py
2
6088
#!/usr/bin/python # -*- coding: utf-8 -*- # """ .. currentmodule:: pylayers.signal.device This module describes the radio devices to be used for electromagentic simulations Device Class ============ .. autosummary:: :toctree: generated/ Device.__init__ """ import doctest import numpy as np import matplot...
lgpl-3.0
jasonabele/gnuradio
gr-msdd6000/src/python-examples/ofdm/gr_plot_ofdm.py
8
10704
#!/usr/bin/env python # # Copyright 2007 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) ...
gpl-3.0
bjodah/chemreac
examples/steady_state.py
2
4970
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from math import log import argh import numpy as np from chemreac import ReactionDiffusion from chemreac.integrate import run from chemreac.util.plotting import plot_solver_linear_error def efield_cb(x, ...
bsd-2-clause
zaxtax/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
walterst/qiime
scripts/make_distance_boxplots.py
15
13899
#!/usr/bin/env python from __future__ import division __author__ = "Jai Ram Rideout" __copyright__ = "Copyright 2011, The QIIME project" __credits__ = ["Jai Ram Rideout"] __license__ = "GPL" __version__ = "1.9.1-dev" __maintainer__ = "Jai Ram Rideout" __email__ = "jai.rideout@gmail.com" from os.path import join from ...
gpl-2.0
bobwalker99/Pydev
plugins/org.python.pydev/pysrc/pydevd.py
1
61172
''' Entry point module (keep at root): This module starts the debugger. ''' from __future__ import nested_scopes # Jython 2.1 support import atexit import os import sys import traceback from _pydevd_bundle.pydevd_constants import IS_JYTH_LESS25, IS_PY3K, IS_PY34_OLDER, get_thread_id, dict_keys, dict_pop, dict_conta...
epl-1.0
isomerase/mozziesniff
lorentz_animation.py
2
2375
import numpy as np from scipy import integrate from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib.colors import cnames from matplotlib import animation N_trajectories = 20 def lorentz_deriv((x, y, z), t0, sigma=10., beta=8./3, rho=28.0): """Compute the time-derivative o...
mit
btabibian/scikit-learn
examples/ensemble/plot_forest_iris.py
18
6190
""" ==================================================================== Plot the decision surfaces of ensembles of trees on the iris dataset ==================================================================== Plot the decision surfaces of forests of randomized trees trained on pairs of features of the iris dataset. ...
bsd-3-clause
DSLituiev/scikit-learn
sklearn/linear_model/stochastic_gradient.py
34
50761
# Authors: Peter Prettenhofer <peter.prettenhofer@gmail.com> (main author) # Mathieu Blondel (partial_fit support) # # License: BSD 3 clause """Classification and regression using Stochastic Gradient Descent (SGD).""" import numpy as np from abc import ABCMeta, abstractmethod from ..externals.joblib import ...
bsd-3-clause
Midnighter/pyorganism
scripts/control_analysis.py
1
32278
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import (division, print_function) import sys import os import logging import argparse import json import codecs import shelve import pickle import numpy as np import pyorganism as pyorg import pyorganism.regulation as pyreg import pyorganism.io.microar...
bsd-3-clause
jasper-chen/ThinkStats2
code/thinkstats2.py
68
68825
"""This file contains code for use with "Think Stats" and "Think Bayes", both by Allen B. Downey, available from greenteapress.com Copyright 2014 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ from __future__ import print_function, division """This file contains class definitions for: H...
gpl-3.0
JavierAntonioGonzalezTrejo/SCAZAC
scripts/temporaryInsertDataScazac.py
1
2293
# Register of change # Modification 20170721: use of the make_aware function to make a proper treatment to the DateTimeField # Modification 20170807: Dates will be naive on the TimeZone from random import randint from django.core.wsgi import get_wsgi_application # To run the webserver from django.utils.timezone import ...
gpl-3.0
jonyroda97/redbot-amigosprovaveis
lib/matplotlib/tests/test_cycles.py
2
7995
import warnings from matplotlib.testing.decorators import image_comparison from matplotlib.cbook import MatplotlibDeprecationWarning import matplotlib.pyplot as plt import numpy as np import pytest from cycler import cycler @image_comparison(baseline_images=['color_cycle_basic'], remove_text=True, ...
gpl-3.0
Obus/scikit-learn
sklearn/feature_selection/__init__.py
244
1088
""" The :mod:`sklearn.feature_selection` module implements feature selection algorithms. It currently includes univariate filter selection methods and the recursive feature elimination algorithm. """ from .univariate_selection import chi2 from .univariate_selection import f_classif from .univariate_selection import f_...
bsd-3-clause
polyanskiy/refractiveindex.info-scripts
scripts/Rakic 1998 - Ti (BB model).py
1
2588
# -*- coding: utf-8 -*- # Author: Mikhail Polyanskiy # Last modified: 2017-04-02 # Original data: Rakić et al. 1998, https://doi.org/10.1364/AO.37.005271 import numpy as np import matplotlib.pyplot as plt from scipy.special import wofz as w π = np.pi # Brendel-Bormann (BB) model parameters ωp = 7.29 #eV f0 = 0.126 Γ...
gpl-3.0
khushhallchandra/Deep-Learning
kaggle/fbPrediction/src/timePlot.py
1
1744
import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) # Input data files are available in the "../input/" directory. # For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory import matplotlib.pyplot as plt df...
mit
Anmol-Singh-Jaggi/Machine-Learning
svm/demo.py
294
1273
""" ========================================= SVM: Maximum margin separating hyperplane ========================================= Plot the maximum margin separating hyperplane within a two-class separable dataset using a Support Vector Machine classifier with linear kernel. """ print(__doc__) import numpy as np impor...
mit
hdmetor/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
harshaneelhg/scikit-learn
sklearn/tests/test_calibration.py
213
12219
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # License: BSD 3 clause import numpy as np from scipy import sparse from sklearn.utils.testing import (assert_array_almost_equal, assert_equal, assert_greater, assert_almost_equal, ...
bsd-3-clause
ycaihua/scikit-learn
sklearn/ensemble/partial_dependence.py
36
14909
"""Partial dependence plots for tree ensembles. """ # Authors: Peter Prettenhofer # License: BSD 3 clause from itertools import count import numbers import numpy as np from scipy.stats.mstats import mquantiles from ..utils.extmath import cartesian from ..externals.joblib import Parallel, delayed from ..externals im...
bsd-3-clause
jereze/scikit-learn
sklearn/cluster/tests/test_mean_shift.py
150
3651
""" Testing for mean shift clustering methods """ import numpy as np import warnings from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_false from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import asser...
bsd-3-clause
ningchi/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
micahhausler/pandashells
pandashells/lib/arg_lib.py
7
6681
from pandashells.lib import config_lib def _check_for_recognized_args(*args): """ Raise an error if unrecognized argset is specified """ allowed_arg_set = set([ 'io_in', 'io_out', 'example', 'xy_plotting', 'decorating', ]) in_arg_set = set(args) unr...
bsd-2-clause
wxgeo/geophar
wxgeometrie/sympy/physics/quantum/state.py
4
29157
"""Dirac notation for states.""" from __future__ import print_function, division from sympy import (cacheit, conjugate, Expr, Function, integrate, oo, sqrt, Tuple) from sympy.core.compatibility import range from sympy.printing.pretty.stringpict import stringPict from sympy.physics.quantum.qexpr imp...
gpl-2.0
Danie1Johnson/research
bg_anim_test.py
1
4065
import numpy as np import matplotlib.pyplot as plt from time import time import matplotlib.animation as animation import bga_4_0 as bga import manifold_reflected_brownian_motion as mrbm bga = reload(bga) mrbm = reload(mrbm) def face_position(bg_int, face_num, faces, dim=3): """Return the current and last positio...
mit
ch3ll0v3k/scikit-learn
sklearn/utils/tests/test_sparsefuncs.py
157
13799
import numpy as np import scipy.sparse as sp from scipy import linalg from numpy.testing import assert_array_almost_equal, assert_array_equal from sklearn.datasets import make_classification from sklearn.utils.sparsefuncs import (mean_variance_axis, inplace_column_scale, ...
bsd-3-clause
nmartensen/pandas
asv_bench/benchmarks/reshape.py
7
4225
from .pandas_vb_common import * from pandas import melt, wide_to_long class melt_dataframe(object): goal_time = 0.2 def setup(self): self.index = MultiIndex.from_arrays([np.arange(100).repeat(100), np.roll(np.tile(np.arange(100), 100), 25)]) self.df = DataFrame(np.random.randn(10000, 4), inde...
bsd-3-clause
mardom/GalSim
devel/external/test_cf/test_cf.py
1
3573
# Copyright 2012, 2013 The GalSim developers: # https://github.com/GalSim-developers # # This file is part of GalSim: The modular galaxy image simulation toolkit. # # GalSim is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software...
gpl-3.0
lucidfrontier45/scikit-learn
sklearn/tests/test_cross_validation.py
1
18705
"""Test the cross_validation module""" import numpy as np import warnings from scipy.sparse import coo_matrix from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_greater from sklearn.utils...
bsd-3-clause
nikitasingh981/scikit-learn
sklearn/linear_model/stochastic_gradient.py
9
51137
# Authors: Peter Prettenhofer <peter.prettenhofer@gmail.com> (main author) # Mathieu Blondel (partial_fit support) # # License: BSD 3 clause """Classification and regression using Stochastic Gradient Descent (SGD).""" import numpy as np from abc import ABCMeta, abstractmethod from ..externals.joblib import ...
bsd-3-clause
qPCR4vir/orange3
Orange/clustering/dbscan.py
9
1770
import sklearn.cluster as skl_cluster from Orange.data import Table, DiscreteVariable, Domain, Instance from Orange.projection import SklProjector, Projection from numpy import atleast_2d, ndarray, where __all__ = ["DBSCAN"] class DBSCAN(SklProjector): __wraps__ = skl_cluster.DBSCAN def __init__(self, eps=0...
bsd-2-clause
nicovince/mche
mche.py
1
64134
#!/usr/bin/env python import os import sys import re import logging import itertools import argparse import nbt from io import BytesIO import zlib import gzip from binascii import hexlify from binascii import unhexlify import matplotlib #matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np from ruam...
gpl-3.0
bzero/arctic
tests/util.py
2
1376
from contextlib import contextmanager from cStringIO import StringIO from dateutil.rrule import rrule, DAILY import dateutil from datetime import datetime as dt import pandas import numpy as np import sys def read_str_as_pandas(ts_str): labels = [x.strip() for x in ts_str.split('\n')[0].split('|')] pd = panda...
lgpl-2.1
mortada/scipy
scipy/signal/wavelets.py
23
10483
from __future__ import division, print_function, absolute_import import numpy as np from numpy.dual import eig from scipy.special import comb from scipy import linspace, pi, exp from scipy.signal import convolve __all__ = ['daub', 'qmf', 'cascade', 'morlet', 'ricker', 'cwt'] def daub(p): """ The coefficient...
bsd-3-clause
henridwyer/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
rustychris/stompy
stompy/grid/rebay.py
1
12410
""" Pure python implementation of Rebay frontal delaunay method """ import heapq from itertools import chain import matplotlib.pyplot as plt import numpy as np from . import unstructured_grid, front, exact_delaunay from ..spatial import field from .. import utils DELETED=-1 UNSET=0 EXT=1 WAITING=2 ACTIVE=3 DONE=4 ...
mit
DSLituiev/scikit-learn
examples/classification/plot_digits_classification.py
289
2397
""" ================================ 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
CrazyGuo/bokeh
bokeh/compat/mpl.py
32
2834
"Supporting objects and functions to convert Matplotlib objects into Bokeh." #----------------------------------------------------------------------------- # Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved. # # Powered by the Bokeh Development Team. # # The full license is in the file LICENSE.t...
bsd-3-clause
hail-is/hail
benchmark/python/benchmark_hail/compare/compare.py
2
3215
import json import os import sys from scipy.stats.mstats import gmean, hmean import numpy as np def load_file(path): if path.endswith('.json'): with open(path, 'r') as f: js_data = json.load(f) elif path.endswith('.tsv'): import pandas as pd js_data = pd.read_table(path).t...
mit
HerdOfBears/Learning_Machine_Learning
Reinforcement Learning/double_DQN_cartpole.py
1
7804
""" Author: Jyler Menard Purpose implement a Deep Q Network that uses a double DQN inspired by van Hasselt in 'Deep Reinforcement Learning with Double Q-Learning'. Q-learning can easily overestimate the value of an action from a state, resulting in overoptimistic value estimates. Double Q-learning decouples the action...
mit
ysasaki6023/NeuralNetworkStudy
cifar02/train_DropTest.py
8
9985
#!/usr/bin/env python import argparse import time import numpy as np import six import os import shutil import chainer from chainer import computational_graph from chainer import cuda import chainer.links as L import chainer.functions as F from chainer import optimizers from chainer import serializers from chainer.ut...
mit
cloud-fan/spark
python/pyspark/sql/tests/test_pandas_udf_scalar.py
22
53224
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
apache-2.0
shyamalschandra/scikit-learn
sklearn/linear_model/passive_aggressive.py
60
10566
# 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
saiwing-yeung/scikit-learn
sklearn/feature_selection/tests/test_mutual_info.py
56
6268
from __future__ import division import numpy as np from numpy.testing import run_module_suite from scipy.sparse import csr_matrix from sklearn.utils.testing import (assert_array_equal, assert_almost_equal, assert_false, assert_raises, assert_equal) from sklearn.feature_selection.mut...
bsd-3-clause
thientu/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
rameshvs/nipype
nipype/pipeline/utils.py
5
46302
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Utility routines for workflow graphs """ from copy import deepcopy from glob import glob from collections import defaultdict import os import pwd import re from uuid import uuid1 import numpy as np fro...
bsd-3-clause
passiweinberger/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/mathtext.py
69
101723
r""" :mod:`~matplotlib.mathtext` is a module for parsing a subset of the TeX math syntax and drawing them to a matplotlib backend. For a tutorial of its usage see :ref:`mathtext-tutorial`. This document is primarily concerned with implementation details. The module uses pyparsing_ to parse the TeX expression. .. _p...
agpl-3.0
treverhines/RBF
docs/scripts/gproc.j.py
1
4852
''' Use Gaussian process regression to perform 2-D interpolation of scattered data and then differentiate the interpolant. ''' import matplotlib.pyplot as plt import numpy as np from rbf.basis import spwen32 from rbf.gproc import gpiso, gppoly # get a verbose log of what is going on import logging logging.basicConfig...
mit
l2xBrain/chineseocr
finger.py
1
1356
# coding: utf-8 from __future__ import print_function import cv2 import numpy as np from PIL import Image import matplotlib.pyplot as plt import os def identity(filename): """ :param filename: :return: """ is_figure = False img = cv2.imread(filename) for i in range(img.shape[0]): for j in range(img.sha...
mit
asalomatov/variants
variants/work/train_script.py
1
6042
import sys sys.path.insert(0, '/mnt/xfs1/home/asalomatov/projects/variants/variants') import ped import variants import func import pandas import numpy import os import features from multiprocessing import Pool from sklearn.cross_validation import train_test_split from sklearn.ensemble import GradientBoostingClassifier...
mit
GaryLv/GaryLv.github.io
codes/Logistic Regression/LRNB.py
1
2115
# -*- coding: utf-8 -*- """ LR 非线性边界分类 """ import numpy as np import matplotlib.pyplot as plt def loadDataSet(): x = []; y = []; fr = open('ex2data2.txt') for line in fr.readlines(): lineArr = line.strip().split(',') x.append([1.0, float(lineArr[0]), float(lineArr[1])]) y.append(f...
apache-2.0
duncanmmacleod/gwpy
gwpy/timeseries/statevector.py
3
35849
# -*- coding: utf-8 -*- # Copyright (C) Duncan Macleod (2014-2020) # # This file is part of GWpy. # # GWpy 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)...
gpl-3.0
darshanthaker/nupic
examples/opf/tools/MirrorImageViz/mirrorImageViz.py
50
7221
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, 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
buguen/pylayers
pylayers/antprop/examples/ex_antenna51.py
3
2027
from pylayers.antprop.antenna import * from pylayers.antprop.antvsh import * import matplotlib.pylab as plt from numpy import * import pdb """ This test : 1 : loads a measured antenna 2 : applies an electrical delay obtained from data with getdelay method 3 : evaluate the antenna vsh coefficient with a down...
lgpl-3.0
xuleiboy1234/autoTitle
tensorflow/tensorflow/examples/get_started/regression/test.py
8
3181
# 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...
mit
mfittere/SixDeskDB
old/danilo/DA_FullStat_public.py
2
6452
#!/usr/bin/python # python re-implementation of read10b.f done by Danilo Banfi (danilo.banfi@cern.ch) # This compute DA starting from the local .db produced by CreateDB.py # Below are indicated thing that need to be edited by hand. # You only have to provide the name of the study <study_name> like # python CreateDB...
lgpl-2.1
JoanThibault/DAGaml
extra/script_dagaml_vs_abc_on_cnf_uf75.py
1
3733
import sys import math import lib #read inputs file_csv = sys.argv[1] file_out = sys.argv[2] #read csv FILE = open(sys.argv[1]) T = FILE.read().split('\n') FILE.close() <<<<<<< HEAD M = [line.split(' ') for line in T if line!=''] K = M[0] print('keys: ('+' '.join(K)+')') ======= M = [line.split(', ') for line in T i...
mpl-2.0
jreback/pandas
pandas/tests/reshape/test_util.py
3
2846
import numpy as np import pytest from pandas import Index, date_range import pandas._testing as tm from pandas.core.reshape.util import cartesian_product class TestCartesianProduct: def test_simple(self): x, y = list("ABC"), [1, 22] result1, result2 = cartesian_product([x, y]) expected1 =...
bsd-3-clause
xysmas/microsoft_malware_challenge
src/models/random_forest/model.py
2
6659
""" Template code to be used in the Microsoft Malware Classification challenge. """ __authors__ = 'Aaron Gonzales, Andres Ruiz' __licence__ = 'Apache' __email__ = 'afruizc@cs.unm.edu' import sys import numpy as np import pymongo import joblib from sklearn.pipeline import Pipeline from sklearn.feature_extraction.tex...
apache-2.0
INM-6/nest-git-migration
topology/examples/test_3d_gauss.py
13
2641
# -*- coding: utf-8 -*- # # test_3d_gauss.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
matthieudumont/dipy
scratch/very_scratch/simulation_comparisons.py
20
12707
import nibabel import os import numpy as np import dipy as dp #import dipy.core.generalized_q_sampling as dgqs#dipy. import dipy.reconst.gqi as dgqs import dipy.io.pickles as pkl import scipy as sp from matplotlib.mlab import find #import dipy.core.sphere_plots as splots import dipy.core.sphere_stats as sphats import d...
bsd-3-clause
jneer/knifedge
knifedge/tracing.py
1
6788
# -*- coding: utf-8 -*- import numpy as np from scipy.optimize import curve_fit import attr import matplotlib.pyplot as plt import matplotlib import yaml matplotlib.rc('font', family='DejaVu Sans') #TODO: use ODR instead of curve_fit to include z-error: http://stackoverflow.com/questions/26058792/correct-fitting-wit...
mit
davek44/Basset
src/dna_io.py
1
13190
#!/usr/bin/env python from __future__ import print_function import pdb import random import sys from collections import OrderedDict import numpy as np import numpy.random as npr from sklearn import preprocessing ################################################################################ # dna_io.py # # Methods t...
mit
aetilley/scikit-learn
examples/cluster/plot_lena_segmentation.py
271
2444
""" ========================================= Segmenting the picture of Lena 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 regions. This procedure (spe...
bsd-3-clause
MatthieuBizien/scikit-learn
sklearn/neighbors/graph.py
14
6663
"""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_...
bsd-3-clause
holmes/intellij-community
python/helpers/pydev/pydevconsole.py
41
15763
from _pydev_imps._pydev_thread import start_new_thread try: from code import InteractiveConsole except ImportError: from pydevconsole_code_for_ironpython import InteractiveConsole from code import compile_command from code import InteractiveInterpreter import os import sys import _pydev_threading as threadi...
apache-2.0
apache/incubator-superset
tests/fixtures/energy_dashboard.py
1
5318
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
apache-2.0
TakayukiSakai/tensorflow
tensorflow/python/client/notebook.py
33
4608
# Copyright 2015 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
petercable/xray
xray/core/dataset.py
1
79004
import functools import warnings from collections import Mapping from numbers import Number import numpy as np import pandas as pd from . import ops from . import utils from . import common from . import groupby from . import indexing from . import alignment from . import formatting from .. import conventions from .a...
apache-2.0
FRESNA/vresutils
vresutils/reatlas.py
1
9656
# -*- coding: utf-8 -*- ## Copyright 2015-2017 Frankfurt Institute for Advanced Studies ## 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 the Free Software Foundation; either version 3 of the ## License, or (at your optio...
gpl-3.0
datapythonista/pandas
pandas/core/arrays/interval.py
1
54425
from __future__ import annotations import operator from operator import ( le, lt, ) import textwrap from typing import ( Sequence, TypeVar, cast, ) import numpy as np from pandas._config import get_option from pandas._libs import NaT from pandas._libs.interval import ( VALID_CLOSED, Inte...
bsd-3-clause
hanteng/pyCHNadm1
pyCHNadm1/_examples/matplotlib_IPop_GDP_2004-2013.py
1
3786
# -*- coding: utf-8 -*- #歧視無邊,回頭是岸。鍵起鍵落,情真情幻。 ## Loading datasets import pyCHNadm1 as CHN ## Loading seaborn and other scientific analysis and visualization modules ## More: http://stanford.edu/~mwaskom/software/seaborn/tutorial/axis_grids.html import numpy as np import pandas as pd import seaborn as sns from scipy i...
gpl-3.0
ec-geolink/d1lod
d1lod/d1lod/people/graph/graph.py
1
12622
#!/usr/bin/python # -*- coding: utf-8 -*- """ create_graph.py Creates an RDF graph from a JSON dump. """ import os import sys import json import RDF import uuid import pandas import unicodecsv as csv def addStatement(model, s, p, o): # Assume subject is a URI string if it is not an RDF.Node if type(s)...
apache-2.0
SheffieldML/GPy
GPy/util/netpbmfile.py
31
12223
#!/usr/bin/env python # -*- coding: utf-8 -*- # netpbmfile.py # Copyright (c) 2011-2013, Christoph Gohlke # Copyright (c) 2011-2013, The Regents of the University of California # Produced at the Laboratory for Fluorescence Dynamics. # All rights reserved. # # Redistribution and use in source and binary forms, with or ...
bsd-3-clause
mmagnus/rna-pdb-tools
rna_tools/tools/rna_alignment/utils/rna_alignment_get_species.py
1
10485
#!/usr/bin/env python # -*- coding: utf-8 -*- """ The output you simply get from the screen, save it it to a file. Example:: rna_alignment_get_species.py RF00004.stockholm.stk # STOCKHOLM 1.0 Sorex-araneus-(European-shrew) AUCGCU-UCU----CGGCC--UUU-U Examples 2:: [dhcp177-lan203] ...
gpl-3.0