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
Winand/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
dpressel/baseline
scripts/compare_calibrations.py
1
6096
"""Plot and compare the metrics from various calibrated models. This script creates the following: * A csv file with columns for the Model Type (the label), and the various calibration metrics * A grid of graphs, the first row is confidence histograms for each model, the second row is the reliability di...
apache-2.0
WebMole/crawler-benchmark
tests/test_home.py
1
2095
import matplotlib matplotlib.use('Agg') import os import tempfile import pytest import project @pytest.fixture def client(): db_fd, project.app.config['DATABASE'] = tempfile.mkstemp() project.app.config['TESTING'] = True client = project.app.test_client() with project.app.app_context(): pro...
gpl-2.0
kennethdecker/MagnePlane
paper/images/trade_scripts/pressure_zoom_writer.py
2
7103
import numpy as np import matplotlib.pylab as plt from openmdao.api import Group, Problem, IndepVarComp from hyperloop.Python import tube_and_pod # def create_problem(component): # root = Group() # prob = Problem(root) # prob.root.add('comp', component) # return prob # class PressureTradeStudy(object...
apache-2.0
poppingtonic/BayesDB
bayesdb/tests/experiments/fills_in_the_blanks.py
2
6247
# # Copyright (c) 2010-2014, MIT Probabilistic Computing Project # # Lead Developers: Jay Baxter and Dan Lovell # Authors: Jay Baxter, Dan Lovell, Baxter Eaves, Vikash Mansinghka # Research Leads: Vikash Mansinghka, Patrick Shafto # # Licensed under the Apache License, Version 2.0 (the "License"); # you may...
apache-2.0
rvraghav93/scikit-learn
sklearn/tests/test_isotonic.py
24
14350
import warnings import numpy as np import pickle import copy from sklearn.isotonic import (check_increasing, isotonic_regression, IsotonicRegression) from sklearn.utils.testing import (assert_raises, assert_array_equal, assert_true, assert_false, assert...
bsd-3-clause
xuewei4d/scikit-learn
sklearn/neighbors/_base.py
4
45497
"""Base and mixin classes for nearest neighbors""" # Authors: Jake Vanderplas <vanderplas@astro.washington.edu> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Sparseness support by Lars Buitinck # Multi-output support by Arnaud Jol...
bsd-3-clause
doylew/detectionsc
format_py/n_gram_svm_with_cv.py
1
24856
################################################## ######scikit_learn to do the classifications###### ################################################## ################################################## from time import sleep from sklearn import svm from sklearn import cross_validation from sklearn import metrics impo...
mit
cdiazbas/enhance
enhance.py
1
7212
import warnings # To deactivate future warnings: # warnings.simplefilter(action='ignore', category=FutureWarning) warnings.filterwarnings("ignore") import numpy as np import platform import os import time import argparse from astropy.io import fits import tensorflow as tf import keras as krs import keras.backend.tenso...
mit
physycom/metnum
python/bernoulli2D.py
1
1068
# -*- coding: utf-8 -*- """ Created on Mon Mar 19 22:30:58 2018 @author: NICO """ import numpy as np # numerical library import matplotlib.pylab as plt # plot library import matplotlib.animation as animation # animation plot #%% Bernoulli2D bernoulli2D = lambda x : np.mod(2*x, 1) # bernoulli formula # initial condi...
bsd-2-clause
keialk/TRAP
TimeSeries.py
1
9396
""" TRAP - Time-series RNA-seq Analysis Package Created by Kyuri Jo on 2014-02-05. Copyright (c) 2014 Kyuri Jo. All rights reserved. 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...
gpl-3.0
rgommers/statsmodels
statsmodels/sandbox/distributions/otherdist.py
33
10145
'''Parametric Mixture Distributions Created on Sat Jun 04 2011 Author: Josef Perktold Notes: Compound Poisson has mass point at zero http://en.wikipedia.org/wiki/Compound_Poisson_distribution and would need special treatment need a distribution that has discrete mass points and contiuous range, e.g. compound Pois...
bsd-3-clause
timcera/tsgettoolbox
tsgettoolbox/ulmo/usgs/eddn/core.py
1
10407
# -*- coding: utf-8 -*- """ ulmo.usgs.eddn.core ~~~~~~~~~~~~~~~~~~~~~ This module provides access to data provided by the `United States Geological Survey`_ `Emergency Data Distribution Network`_ web site. The `DCP message format`_ includes some header information that is parsed and the messag...
bsd-3-clause
qe-team/marmot
marmot/experiment/learning_utils.py
1
9015
# utils for interfacing with Scikit-Learn import logging import numpy as np import copy from multiprocessing import Pool from sklearn.metrics import f1_score from marmot.learning.pystruct_sequence_learner import PystructSequenceLearner from marmot.experiment.import_utils import call_for_each_element from marmot.experi...
isc
erikdejonge/youtube-dl
youtube_dl/extractor/peertube.py
2
25248
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..compat import compat_str from ..utils import ( int_or_none, parse_resolution, try_get, unified_timestamp, url_or_none, urljoin, ) class PeerTubeIE(InfoExtractor): _INSTANCES_RE = r'...
unlicense
benjaminhmtan/benjaminhmtan.github.io
markdown_generator/publications.py
197
3887
# coding: utf-8 # # Publications markdown generator for academicpages # # Takes a TSV of publications with metadata and converts them for use with [academicpages.github.io](academicpages.github.io). This is an interactive Jupyter notebook, with the core python code in publications.py. Run either from the `markdown_g...
mit
ronak3shah1/ml_lab_ecsc_306
labwork/lab2/sci-learn/non_linear_regression.py
120
1520
""" =================================================================== Support Vector Regression (SVR) using linear and non-linear kernels =================================================================== Toy example of 1D regression using linear, polynomial and RBF kernels. """ print(__doc__) import numpy as np ...
apache-2.0
ahoyosid/scikit-learn
examples/plot_johnson_lindenstrauss_bound.py
134
7452
""" ===================================================================== The Johnson-Lindenstrauss bound for embedding with random projections ===================================================================== The `Johnson-Lindenstrauss lemma`_ states that any high dimensional dataset can be randomly projected in...
bsd-3-clause
bjackman/lisa
libs/utils/analysis/tasks_analysis.py
2
29151
# SPDX-License-Identifier: Apache-2.0 # # Copyright (C) 2015, ARM Limited and 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/LICENSE-2.0 # # ...
apache-2.0
bkendzior/scipy
scipy/stats/_discrete_distns.py
5
21973
# # Author: Travis Oliphant 2002-2011 with contributions from # SciPy Developers 2004-2011 # from __future__ import division, print_function, absolute_import from scipy import special from scipy.special import entr, gammaln as gamln from scipy.misc import logsumexp from scipy._lib._numpy_compat import broad...
bsd-3-clause
cyberphox/MissionPlanner
Lib/site-packages/numpy/fft/fftpack.py
59
39653
""" Discrete Fourier Transforms Routines in this module: fft(a, n=None, axis=-1) ifft(a, n=None, axis=-1) rfft(a, n=None, axis=-1) irfft(a, n=None, axis=-1) hfft(a, n=None, axis=-1) ihfft(a, n=None, axis=-1) fftn(a, s=None, axes=None) ifftn(a, s=None, axes=None) rfftn(a, s=None, axes=None) irfftn(a, s=None, axes=None...
gpl-3.0
DR08/mxnet
docs/mxdoc.py
7
12702
# 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
slundberg/shap
tests/explainers/test_gpu_tree.py
1
6842
# pylint: disable=missing-function-docstring """ Test gpu accelerated tree functions. """ import sklearn import pytest import numpy as np import shap from shap.utils import assert_import try: assert_import("cext_gpu") except ImportError: pytestmark = pytest.mark.skip("cuda module not built") def test_front_p...
mit
nikitasingh981/scikit-learn
examples/classification/plot_lda_qda.py
32
5381
""" ==================================================================== Linear and Quadratic Discriminant Analysis with covariance ellipsoid ==================================================================== This example plots the covariance ellipsoids of each class and decision boundary learned by LDA and QDA. The...
bsd-3-clause
nophie-123/sms-tools
software/transformations_interface/hpsMorph_function.py
24
7354
# function for doing a morph between two sounds using the hpsModel import numpy as np import matplotlib.pyplot as plt from scipy.signal import get_window import sys, os sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../models/')) sys.path.append(os.path.join(os.path.dirname(os.path.realpath...
agpl-3.0
jason-neal/equanimous-octo-tribble
octotribble/extraction/dracs_quicklooks2017.py
1
10650
# DRACS Output quicklook/status. # Plot all 8 reduced spectra # Plot all 8 normalized reduced spectra # plot mean combined and median combined spectra. from __future__ import division, print_function import argparse import os import sys from os.path import join import matplotlib.pyplot as plt import numpy as np fro...
mit
SanPen/CopperPlate
Gui/matplotlibwidget.py
1
8175
# 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
sbrisard/janus
sphinx/tutorials/square_basic/square_basic.py
1
3972
# Begin: imports import itertools import numpy as np import matplotlib.pyplot as plt import janus.green as green import janus.fft.serial as fft import janus.material.elastic.linear.isotropic as material import janus.operators as operators from janus.operators import isotropic_4 # End: imports # Begin: init class Ex...
bsd-3-clause
sys-bio/tellurium
docs/conf.py
1
10266
# -*- coding: utf-8 -*- # # tellurium documentation build configuration file, created by # sphinx-quickstart on Fri Jan 22 13:08:36 2016. # # 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. # #...
apache-2.0
m4rx9/rna-pdb-tools
rna_tools/tools/PyMOL4RNA/PyMOL4Spliceosome.py
2
11183
""" See the PyMOL Sessions processed with this code here <https://github.com/mmagnus/PyMOL4Spliceosome> """ from pymol import cmd from rna_tools.tools.PyMOL4RNA import code_for_color_spl from rna_tools.tools.PyMOL4RNA import code_for_spl try: from pymol import cmd except ImportError: print("PyMOL Python lib is...
mit
lukeiwanski/tensorflow-opencl
tensorflow/contrib/learn/python/learn/learn_io/pandas_io_test.py
18
5832
# 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
saimn/glue
glue/viewers/image/layer_artist.py
2
11664
from __future__ import absolute_import, division, print_function import logging from abc import ABCMeta, abstractproperty, abstractmethod import numpy as np from matplotlib.cm import gray from glue.external import six from glue.core.exceptions import IncompatibleAttribute from glue.core.layer_artist import Matplotli...
bsd-3-clause
danielSbastos/face-recognition-scienceFair
detect_webcam.py
1
6003
#libraries to plot face features import matplotlib.pyplot as plt import matplotlib.patches as patches from PIL import Image import numpy as np #libraries for apiconnection import requests import json import sys #Libraries to take photo with webcam import pygame import pygame.camera from pygame.locals import * ''' TA...
mit
marcocaccin/scikit-learn
sklearn/mixture/gmm.py
6
31222
""" Gaussian Mixture Models. This implementation corresponds to frequentist (non-Bayesian) formulation of Gaussian Mixture Models. """ # Author: Ron Weiss <ronweiss@gmail.com> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Bertrand Thirion <bertrand.thirion@inria.fr> import warnings import numpy as...
bsd-3-clause
litaotao/mpld3
doc/sphinxext/plot_generator.py
19
10614
import sys import os import glob import token import tokenize import shutil import json import matplotlib matplotlib.use('Agg') # don't display plots import mpld3 from matplotlib import image from matplotlib.figure import Figure class disable_mpld3(object): """Context manager to temporarily disable mpld3.show(...
bsd-3-clause
jordanopensource/data-science-bootcamp
MachineLearning/Session3/k_means_cluster.py
1
2249
import pickle import numpy import matplotlib.pyplot as plt import sys sys.path.append("../tools/") from feature_format import featureFormat, targetFeatureSplit def Draw(pred, features, poi, mark_poi=False, name="image.png", f1_name="feature 1", f2_name="feature 2"): """ some plotting code designed to help you v...
mit
ChanChiChoi/scikit-learn
examples/model_selection/plot_train_error_vs_test_error.py
349
2577
""" ========================= Train error vs Test error ========================= Illustration of how the performance of an estimator on unseen data (test data) is not the same as the performance on training data. As the regularization increases the performance on train decreases while the performance on test is optim...
bsd-3-clause
neutrons/FastGR
addie/processing/idl/table_handler.py
1
22403
from __future__ import (absolute_import, division, print_function) #import re import glob import os import numpy as np from qtpy.QtCore import (Qt) from qtpy.QtGui import (QCursor) from qtpy.QtWidgets import (QFileDialog, QMenu, QMessageBox, QTableWidgetSelectionRange) import addie.processing.idl.populate_master_table...
mit
yyjiang/scikit-learn
examples/cross_decomposition/plot_compare_cross_decomposition.py
142
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
RichardTMR/homework
week1/class1_linear_regression.py
1
3290
import numpy as np import matplotlib.pyplot as plt from sklearn import datasets, linear_model def plot_line(x, y, y_hat,line_color='blue'): # Plot outputs plt.scatter(x, y, color='black') plt.plot(x, y_hat, color=line_color, linewidth=3) plt.xticks(()) plt.yticks(()) plt.show() ...
apache-2.0
jyhmiinlin/cineFSE
GeRaw/phantom.py
2
5548
# -*- coding: utf-8 -*- """ Created on Wed Sep 14 17:22:39 2011 Copied from Alex Opie (see below) @author: Eric """ ## Copyright (C) 2010 Alex Opie <lx_op@orcon.net.nz> ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as pu...
gpl-3.0
nilmtk/nilmtk
nilmtk/disaggregate/fhmm_exact.py
1
10107
import itertools from copy import deepcopy from collections import OrderedDict from warnings import warn import pickle import nilmtk import pandas as pd import numpy as np from hmmlearn import hmm from nilmtk.feature_detectors import cluster from nilmtk.disaggregate import Disaggregator from nilmtk.datastore import HD...
apache-2.0
bzero/statsmodels
statsmodels/sandbox/examples/try_quantile_regression.py
33
1302
'''Example to illustrate Quantile Regression Author: Josef Perktold ''' import numpy as np from statsmodels.compat.python import zip import statsmodels.api as sm from statsmodels.regression.quantile_regression import QuantReg sige = 5 nobs, k_vars = 500, 5 x = np.random.randn(nobs, k_vars) #x[:,0] = 1 y = x.sum(1) ...
bsd-3-clause
IndraVikas/scikit-learn
sklearn/linear_model/setup.py
169
1567
import os from os.path import join import numpy from sklearn._build_utils import get_blas_info def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('linear_model', parent_package, top_path) cblas_libs, blas_info = get_blas_info...
bsd-3-clause
LaurencePeanuts/Music
beatbox/ctu2015.py
3
9335
import numpy as np import matplotlib.pylab as plt import ipdb plt.ion() np.random.seed(3) # for reproduceability r_cmb_mpc = 14.0 cmap = 'gray' vscale = 15. def demo(): """ Short demo made at the "Compute the Universe 2015" Hack Week, Berkeley. This was originally part of the "universe" class file ...
mit
jooojo/cnnTSR
train.py
1
2490
#%% '''Reads traffic sign data for German Traffic Sign Recognition Benchmark. ''' from os.path import join import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy.misc import imresize from sklearn.model_selection import train_test_split TRAIN_PATH = r".\Final_Training\Images" imag...
mit
RomainBrault/scikit-learn
examples/linear_model/plot_sparse_recovery.py
70
7486
""" ============================================================ Sparse recovery: feature selection for sparse linear models ============================================================ Given a small number of observations, we want to recover which features of X are relevant to explain y. For this :ref:`sparse linear ...
bsd-3-clause
wzbozon/statsmodels
statsmodels/tsa/stattools.py
26
37127
""" Statistical tools for time series analysis """ from statsmodels.compat.python import (iteritems, range, lrange, string_types, lzip, zip, map) import numpy as np from numpy.linalg import LinAlgError from scipy import stats from statsmodels.regression.linear_model import OLS, yule_walk...
bsd-3-clause
dmitryduev/pypride
src/pypride/classes.py
1
108453
# -*- coding: utf-8 -*- """ Created on Mon Oct 7 17:05:04 2013 Definitions of classes used in pypride @author: Dmitry A. Duev """ import ConfigParser import datetime from astropy.time import Time #import sys import numpy as np import scipy as sp #from matplotlib.cbook import flatten from math import * #from math i...
gpl-2.0
nhejazi/scikit-learn
sklearn/linear_model/tests/test_omp.py
76
7752
# Author: Vlad Niculae # License: BSD 3 clause import numpy as np from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equa...
bsd-3-clause
jmschrei/scikit-learn
sklearn/gaussian_process/gpr.py
9
18634
"""Gaussian processes regression. """ # 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_triangular from scipy.optimize import fmin_l_bfgs_b from sklearn.base im...
bsd-3-clause
samzhang111/scikit-learn
examples/applications/plot_tomography_l1_reconstruction.py
81
5461
""" ====================================================================== Compressive sensing: tomography reconstruction with L1 prior (Lasso) ====================================================================== This example shows the reconstruction of an image from a set of parallel projections, acquired along dif...
bsd-3-clause
huobaowangxi/scikit-learn
sklearn/manifold/tests/test_spectral_embedding.py
216
8091
from nose.tools import assert_true from nose.tools import assert_equal from scipy.sparse import csr_matrix from scipy.sparse import csc_matrix import numpy as np from numpy.testing import assert_array_almost_equal, assert_array_equal from nose.tools import assert_raises from nose.plugins.skip import SkipTest from sk...
bsd-3-clause
SixTrack/SixTrack
test/elensidealthin6d/elens_plot_kick.py
1
1663
import matplotlib.pyplot as plt import numpy as np r2hel1=6.928 # from fort.3 [mm] sig=r2hel1/6 # 1 sigma beam size, hel1 between 4-6 sigma offsetx=-1.1547 offsety=-2.3093 theta_r2=4.920e-03 # max. kick [mrad] oFile=open('kicks.dat','w') plt.figure('elens kick',figsize=(13,13)) for fnin,fnout,offx,offy,R,R2f,peakT i...
lgpl-2.1
mutirri/bokeh
examples/glyphs/colors.py
25
8920
from __future__ import print_function from math import pi import pandas as pd from bokeh.models import Plot, ColumnDataSource, FactorRange, CategoricalAxis, TapTool, HoverTool, OpenURL from bokeh.models.glyphs import Rect from bokeh.document import Document from bokeh.embed import file_html from bokeh.resources impor...
bsd-3-clause
tedmeeds/tcga_encoder
tcga_encoder/analyses/kmeans_from_z_space_global_learn_survival.py
1
17736
from tcga_encoder.utils.helpers import * from tcga_encoder.data.data import * from tcga_encoder.definitions.tcga import * #from tcga_encoder.definitions.nn import * from tcga_encoder.definitions.locations import * #from tcga_encoder.algorithms import * import seaborn as sns from sklearn.manifold import TSNE, locally_li...
mit
inodb/sufam
sufam/__main__.py
1
14002
#!/usr/bin/env python """ So U Found A Mutation? (SUFAM) Found a mutation in one or more samples? Now you want to check if they are in another sample. Unfortunately mutect, varscan or whatever other variant caller is not calling them. Use SUFAM. The super sensitive validation caller that calls everything on a given po...
mit
ddempsey/PyFEHM
fvars.py
1
44312
"""Functions for FEHM thermodynamic variables calculations.""" """ Copyright 2013. Los Alamos National Security, LLC. This material was produced under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), which is operated by Los Alamos National Security, LLC for the U.S. Depa...
lgpl-2.1
metpy/MetPy
examples/Four_Panel_Map.py
6
4683
# Copyright (c) 2017 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """ Four Panel Map =============== By reading model output data from a netCDF file, we can create a four panel plot showing: * 300 hPa heights and winds * 500 hPa heights and absol...
bsd-3-clause
andyk/cluster-scheduler-simulator
src/main/python/graphing-scripts/utils.py
1
3341
# Copyright (c) 2013, Regents of the University of California # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # Redistributions of source code must retain the above copyright notice, this # list o...
bsd-3-clause
DGrady/pandas
pandas/core/series.py
2
102152
""" Data structure for 1-dimensional cross-sectional and time series data """ from __future__ import division # pylint: disable=E1101,E1103 # pylint: disable=W0703,W0622,W0613,W0201 import types import warnings from textwrap import dedent import numpy as np import numpy.ma as ma from pandas.core.dtypes.common impor...
bsd-3-clause
TomAugspurger/pandas
pandas/tests/frame/methods/test_update.py
4
4259
import numpy as np import pytest import pandas as pd from pandas import DataFrame, Series, date_range import pandas._testing as tm class TestDataFrameUpdate: def test_update_nan(self): # #15593 #15617 # test 1 df1 = DataFrame({"A": [1.0, 2, 3], "B": date_range("2000", periods=3)}) ...
bsd-3-clause
krebeljk/openInjMoldSim
tutorials/demo/dogbone/plot_co.py
3
1072
import numpy as np from io import StringIO import matplotlib.pyplot as plt import re import sys ''' example usage: python plot_dt.py log.openInjMoldSimFimaaIbac ''' # get data cas = '' coMean = '' coMax = '' with open(str(sys.argv[1])) as origin_file: data = origin_file.read() for match in re.findall(r'(?m)^Tim...
gpl-3.0
lauralwatkins/voronoi
example/test.py
1
1615
""" Demo by G. Brammer """ import numpy as np from voronoi import bin2d import matplotlib.pyplot as plt # Noisy gaussian yp, xp = np.indices((100,100)) R = np.sqrt((xp-50)**2+(yp-50)**2) sigma = 10 g = 10*np.exp(-R**2/2/sigma**2) s = 1 noise = np.random.normal(size=R.shape)*s pix_bin, bin_x, bin_y, bin_sn, bin_npix, ...
bsd-2-clause
ojustino/test-demo
3ps/bayes.py
1
1826
import numpy as np import matplotlib.pyplot as plt '''data should be whether or not a star had a companion. so d is an a array with three 1s and 18 0s.''' '''f = .8 d_i = np.array([1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]) # for 21 stars N = 0; k = 0 j = 0 while(j < len(d_i)): N += 1 if d_i[j] == 1: ...
mit
liuzhaoguo/FreeROI-1
froi/gui/component/unused/volumedintensitydialog.py
6
2368
__author__ = 'zhouguangfu' # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from PyQt4.QtCore import * from PyQt4.QtGui import * import matplotlib.pyplot as plt from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplo...
bsd-3-clause
leewujung/ooi_sonar
misc_source_files/decomp_plot.py
1
5722
import sys import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable def separate_transform_result(D,ori_data,ping_per_day_mvbs,log_opt=1): ''' Separate transformed results into different frequencies and for use with `plot_cmp_data_decomp` and `plot_single...
apache-2.0
thientu/scikit-learn
sklearn/linear_model/tests/test_logistic.py
59
35368
import numpy as np import scipy.sparse as sp from scipy import linalg, optimize, sparse import scipy from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from...
bsd-3-clause
Titan-C/scikit-learn
sklearn/kernel_approximation.py
7
18505
""" 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
sbonner0/DeepTopologyClassification
src/legacy/DataGeneration/GenFingerPrint.py
1
1814
from graph_tool.all import * import os, csv, time, datetime, sys import GFP import pickle import numpy as np from sklearn.cluster import KMeans from sklearn.decomposition import PCA def loadDataAndGenPKL(inputdir, filename): filehandler = open(filename, 'wb') # Load the graph data. Need to think about the dire...
gpl-3.0
marcua/qurk_experiments
qurkexp/join/bestfit.py
1
1419
#!/usr/bin/env python import sys import numpy as np import matplotlib.pyplot as plt from scipy.optimize import curve_fit from scipy.stats.stats import ss #setup_environ(settings) from scipy import stats def sigmoid(x, x0, k): y = 1 / (1 + np.exp(-k*(x-x0))) return y def regress(x, y, howmuch): # polyno...
bsd-3-clause
vybstat/scikit-learn
benchmarks/bench_random_projections.py
397
8900
""" =========================== Random projection benchmark =========================== Benchmarks for random projections. """ from __future__ import division from __future__ import print_function import gc import sys import optparse from datetime import datetime import collections import numpy as np import scipy.s...
bsd-3-clause
AlertaDengue/InfoDenguePredict
infodenguepredict/models/visualizations/metrics_viz.py
1
7870
import pandas as pd import seaborn as sns import numpy as np import matplotlib.pyplot as plt from sqlalchemy import create_engine from decouple import config from infodenguepredict.data.infodengue import get_cluster_data, get_city_names from infodenguepredict.models.random_forest import build_lagged_features def l...
gpl-3.0
hickerson/bbn
fable/fable_sources/libtbx/auto_build/package_defs.py
1
1935
""" Listing of current dependencies for CCTBX and related applications (including LABELIT, xia2, DIALS, and Phenix with GUI). Not all of these can be downloaded via the web (yet). """ from __future__ import division BASE_CCI_PKG_URL = "http://cci.lbl.gov/third_party" BASE_XIA_PKG_URL = "http://www.ccp4.ac.uk/xia" ...
mit
gviejo/ThalamusPhysio
python/figure_article/main_article_fig_supp_1.py
1
16135
#!/usr/bin/env python import sys sys.path.append("../") import numpy as np import pandas as pd import scipy.io from functions import * from sklearn.decomposition import PCA import _pickle as cPickle import neuroseries as nts import sys import scipy.ndimage.filters as filters from sklearn.mixture import GaussianMixtu...
gpl-3.0
makelove/OpenCV-Python-Tutorial
ch46-机器学习-K近邻/2-使用kNN对手写数字OCR.py
1
1987
# -*- coding: utf-8 -*- # @Time : 2017/7/13 下午7:32 # @Author : play4fun # @File : 2-使用kNN对手写数字OCR.py # @Software: PyCharm """ 2-使用kNN对手写数字OCR.py: """ # 准备数据 import numpy as np import cv2 from matplotlib import pyplot as plt img = cv2.imread('../data/digits.png') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) ...
mit
bmazin/SDR
Projects/FirmwareTests/darkDebug/a2gPhaseStreamTest.py
1
17461
""" File: a2gPhaseStreamTest.py Author: Matt Strader Date: Jun 29, 2016 Firmware: darksc2_2016_Jun_28_1925.fpg This script inserts a phase pulse in the qdr dds table. It checks snap blocks for each stage of the channelization process. In the end the phase pulse should be recovered in the phase timestre...
gpl-2.0
BhallaLab/moose-examples
traub_2005/py/display_morphology.py
1
5931
# display_morphology.py --- # # Filename: display_morphology.py # Description: # Author: # Maintainer: # Created: Fri Mar 8 11:26:13 2013 (+0530) # Version: # Last-Updated: Sun Jun 25 15:09:55 2017 (-0400) # By: subha # Update #: 390 # URL: # Keywords: # Compatibility: # # # Commentary: # #...
gpl-2.0
ephes/scikit-learn
sklearn/decomposition/pca.py
192
23117
""" Principal Component Analysis """ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Denis A. Engemann <d.engemann@fz-juelich.de> # Michael Eickenberg <michael.eickenberg@inria.fr> # # Lice...
bsd-3-clause
datapythonista/pandas
pandas/tests/tslibs/test_fields.py
3
1124
import numpy as np from pandas._libs.tslibs import fields import pandas._testing as tm def test_fields_readonly(): # https://github.com/vaexio/vaex/issues/357 # fields functions shouldn't raise when we pass read-only data dtindex = np.arange(5, dtype=np.int64) * 10 ** 9 * 3600 * 24 * 32 dtindex.fla...
bsd-3-clause
jpautom/scikit-learn
sklearn/feature_extraction/image.py
263
17600
""" The :mod:`sklearn.feature_extraction.image` submodule gathers utilities to extract features from images. """ # Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org> # Gael Varoquaux <gael.varoquaux@normalesup.org> # Olivier Grisel # Vlad Niculae # License: BSD 3 clause fro...
bsd-3-clause
dpaiton/OpenPV
pv-core/analysis/python/plot_fourier_activity.py
1
40569
""" Plot the highest activity of four different bar positionings """ import sys import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as mlab import matplotlib.cm as cm import PVReadSparse as rs import PVReadWeights as rw import PVConversions as conv import scipy.cluster.vq as sp import math import ...
epl-1.0
kjung/scikit-learn
doc/datasets/mldata_fixture.py
367
1183
"""Fixture module to skip the datasets loading when offline Mock urllib2 access to mldata.org and create a temporary data folder. """ from os import makedirs from os.path import join import numpy as np import tempfile import shutil from sklearn import datasets from sklearn.utils.testing import install_mldata_mock fr...
bsd-3-clause
raymond91125/tissue_enrichment_tool_hypergeometric_test
tea_paper_docs/src/hgf_benchmark_script.py
4
14884
# -*- coding: utf-8 -*- """ A script to benchmark TEA. @david angeles dangeles@caltech.edu """ import tissue_enrichment_analysis as tea # the library to be used import pandas as pd import os import numpy as np import seaborn as sns import matplotlib.pyplot as plt import re import matplotlib as mpl sns.set_context('...
mit
lthurlow/Network-Grapher
proj/external/matplotlib-1.2.1/doc/mpl_examples/pylab_examples/image_interp.py
6
1923
#!/usr/bin/env python """ The same (small) array, interpolated with three different interpolation methods. The center of the pixel at A[i,j] is plotted at i+0.5, i+0.5. If you are using interpolation='nearest', the region bounded by (i,j) and (i+1,j+1) will have the same color. If you are using interpolation, the pi...
mit
markslwong/tensorflow
tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined_test.py
9
67662
# 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
samzhang111/scikit-learn
sklearn/neighbors/tests/test_dist_metrics.py
230
5234
import itertools import pickle import numpy as np from numpy.testing import assert_array_almost_equal import scipy from scipy.spatial.distance import cdist from sklearn.neighbors.dist_metrics import DistanceMetric from nose import SkipTest def dist_func(x1, x2, p): return np.sum((x1 - x2) ** p) ** (1. / p) de...
bsd-3-clause
tdhopper/scikit-learn
examples/plot_multioutput_face_completion.py
330
3019
""" ============================================== Face completion with a multi-output estimators ============================================== This example shows the use of multi-output estimator to complete images. The goal is to predict the lower half of a face given its upper half. The first column of images sho...
bsd-3-clause
xwolf12/scikit-learn
examples/classification/plot_classification_probability.py
242
2624
""" =============================== Plot classification probability =============================== Plot the classification probability for different classifiers. We use a 3 class dataset, and we classify it with a Support Vector classifier, L1 and L2 penalized logistic regression with either a One-Vs-Rest or multinom...
bsd-3-clause
hlin117/statsmodels
statsmodels/graphics/gofplots.py
29
26714
from statsmodels.compat.python import lzip, string_types import numpy as np from scipy import stats from statsmodels.regression.linear_model import OLS from statsmodels.tools.tools import add_constant from statsmodels.tools.decorators import (resettable_cache, cache_readonly, ...
bsd-3-clause
sk2/ank_le
AutoNetkit/plotting/PathDrawer.py
1
13638
""" ********** PathDrawer ********** Draw multiple paths in a graph. Uses matplotlib (pylab). The path corners are rounded with the help of cube Bezier curves. If two or more paths traverse the same edge, they are automatically shifted to make them all visible. References: - matplotlib: http://m...
bsd-3-clause
ADicksonLab/wepy
src/wepy/analysis/network.py
1
52176
"""Module that allows for imposing a kinetically connected network structure of weighted ensemble simulation data. """ from collections import defaultdict from copy import deepcopy import gc import numpy as np import networkx as nx from wepy.analysis.transitions import ( transition_counts, counts_d_to_matrix...
mit
astroML/astroML
astroML/plotting/mcmc.py
5
4279
import numpy as np def convert_to_stdev(logL): """ Given a grid of log-likelihood values, convert them to cumulative standard deviation. This is useful for drawing contours from a grid of likelihoods. """ sigma = np.exp(logL) shape = sigma.shape sigma = sigma.ravel() # obtain th...
bsd-2-clause
wzbozon/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
martinwicke/tensorflow
tensorflow/contrib/learn/python/learn/tests/dataframe/feeding_functions_test.py
30
4777
# 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
nrhine1/scikit-learn
sklearn/utils/estimator_checks.py
33
48331
from __future__ import print_function import types import warnings import sys import traceback import inspect import pickle from copy import deepcopy import numpy as np from scipy import sparse import struct from sklearn.externals.six.moves import zip from sklearn.externals.joblib import hash, Memory from sklearn.ut...
bsd-3-clause
jasoncorso/kittipy
kitti/velodyne.py
2
4979
import os import numpy as np from kitti.data import get_drive_dir, Calib, get_inds, image_shape, get_calib_dir def get_velodyne_dir(drive, **kwargs): drive_dir = get_drive_dir(drive, **kwargs) return os.path.join(drive_dir, 'velodyne_points', 'data') def load_velodyne_points(drive, frame, **kwargs): v...
mit
febert/DeepRL
easy21/sarsa_lambda.py
1
3748
import cPickle import matplotlib.pyplot as plt from sklearn.metrics import mean_squared_error from math import sqrt from mpl_toolkits.mplot3d import axes3d import os os.environ["FONTCONFIG_PATH"]="/etc/fonts" # # import time # # def procedure(): # time.sleep(2.5) # # # measure process time # t0 = time.clock() # ...
gpl-3.0
soazig/project-epsilon-1
code/utils/scripts/convolution_normal_script.py
3
3081
""" Purpose: ----------------------------------------------------------------------------------- We generate convolved hemodynamic neural prediction into seperated txt files for all four conditions (task, gain, lost, distance), and also generate plots for 4 BOLD signals over time for each of them too. Steps: -----...
bsd-3-clause
kingaza/kaggle
Bowl2017/preprocess.py
1
10729
# -*- coding: utf-8 -*- """ Created on Mon Jan 16 14:29:45 2017 @author: hejiew """ import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import dicom import os import h5py import scipy.ndimage import scipy.signal import matplotlib.pyplot as plt import skimage.ut...
mit