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
aquadrop/solr_py
client/sc_belief_clf_fasttext.py
1
9680
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import traceback import requests import json import os import sys import argparse import time from sklearn.pipeline import Pipeline from sklearn.feature_extraction.text import CountVectorizer from sklearn.svm import LinearSVC from skl...
gpl-3.0
mne-tools/mne-tools.github.io
0.12/_downloads/plot_cluster_1samp_test_time_frequency.py
16
4759
""" .. _tut_stats_cluster_sensor_1samp_tfr: =============================================================== Non-parametric 1 sample cluster statistic on single trial power =============================================================== This script shows how to estimate significant clusters in time-frequency power est...
bsd-3-clause
probml/pyprobml
scripts/gibbs_potts_demo_jax.py
1
3170
# -*- coding: utf-8 -*- """ Author: Ang Ming Liang For further explanations refer to the following gist https://gist.github.com/Neoanarika/a339224d24affd7840a30a1064fc16ff """ import jax import jax.numpy as jnp from jax import lax from jax import vmap from jax import random from jax import jit import matplotlib.pyplo...
mit
vybstat/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
landmanbester/Copernicus
SimLTB.py
1
6581
# -*- coding: utf-8 -*- """ Created on Thu Aug 21 09:33:52 2014 @author: landman This program simulates data for an LTB model """ import numpy as np from scipy.integrate import quad from scipy.interpolate import UnivariateSpline as uvs import matplotlib.pyplot as plt import matplotlib as mpl from Copernicus.fortran_...
gpl-3.0
xavialex/Deep-Learning-Templates
Volume 1 - Supervised Deep Learning/Part 1 - Artificial Neural Networks (ANN)/Section 4 - Building an ANN/ann_homework_solution.py
6
2749
# Artificial Neural Network # Installing Theano # pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git # Installing Tensorflow # pip install tensorflow # Installing Keras # pip install --upgrade keras # Part 1 - Data Preprocessing # Importing the libraries import numpy as np import matplotlib.pyp...
mit
h2oai/h2o-3
h2o-py/h2o/estimators/svd.py
2
17854
#!/usr/bin/env python # -*- encoding: utf-8 -*- # # This file is auto-generated by h2o-3/h2o-bindings/bin/gen_python.py # Copyright 2016 H2O.ai; Apache License Version 2.0 (see LICENSE for details) # from __future__ import absolute_import, division, print_function, unicode_literals from h2o.estimators.estimator_base ...
apache-2.0
nearai/program_synthesis
program_synthesis/karel/scripts/eval_io_trace_code.py
1
6445
import sys import os import collections import glob import json import re import math import random import copy import numpy as np import pandas as pd from program_synthesis.common.tools import saver from program_synthesis.karel import arguments from program_synthesis.karel import dataset from program_synthesis.kare...
apache-2.0
jmeline/wifi_signal_analysis
src/sampleAnalyizer.py
1
3984
# sampleAnalyzer.py import pandas as pd import numpy as np import pprint class Vividict(dict): def __missing__(self, key): value = self[key] = type(self)() return value class SampleAnalyizer(): def __init__(self): self.tests = Vividict() def printVariables(self): print ("c...
mit
ishay2b/tensorflow
tensorflow/python/estimator/canned/dnn_test.py
20
16058
# Copyright 2017 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
wathen/PhD
MHD/FEniCS/Orignal/test.py
1
7894
#!/usr/bin/python import petsc4py import slepc4py import sys petsc4py.init(sys.argv) slepc4py.init(sys.argv) from petsc4py import PETSc from slepc4py import SLEPc Print = PETSc.Sys.Print # from MatrixOperations import * from dolfin import * import numpy as np import matplotlib.pylab as plt import scipy.sparse as sps ...
mit
JonatanAntoni/CMSIS_5
CMSIS/DSP/Testing/summaryBench.py
2
4189
# Process the test results # Test status (like passed, or failed with error code) import argparse import re import TestScripts.NewParser as parse import TestScripts.CodeGen from collections import deque import os.path import numpy as np import pandas as pd import statsmodels.api as sm import statsmodels.formula.api a...
apache-2.0
andyraib/data-storage
python_scripts/env/lib/python3.6/site-packages/pandas/util/clipboard/__init__.py
7
3420
""" Pyperclip A cross-platform clipboard module for Python. (only handles plain text for now) By Al Sweigart al@inventwithpython.com BSD License Usage: import pyperclip pyperclip.copy('The text to be copied to the clipboard.') spam = pyperclip.paste() if not pyperclip.copy: print("Copy functionality unav...
apache-2.0
blaze/dask
dask/dataframe/categorical.py
1
9117
from collections import defaultdict import pandas as pd from tlz import partition_all from numbers import Integral from ..base import tokenize, compute_as_if_collection from .accessor import Accessor from .utils import ( has_known_categories, clear_known_categories, is_scalar, is_categorical_dtype, ) f...
bsd-3-clause
tosolveit/scikit-learn
examples/linear_model/plot_ransac.py
250
1673
""" =========================================== Robust linear model estimation using RANSAC =========================================== In this example we see how to robustly fit a linear model to faulty data using the RANSAC algorithm. """ import numpy as np from matplotlib import pyplot as plt from sklearn import ...
bsd-3-clause
mfiers/hagfish
hagfishUtils.py
1
16813
import os import sys import math import numpy as np import matplotlib.pyplot as plt import matplotlib.path as mpath import matplotlib.colors as mcol import matplotlib.patches as mpatches import matplotlib as mpl import logging import optparse from hagfish_file_util import * ##########################################...
gpl-3.0
etkirsch/scikit-learn
sklearn/utils/graph.py
289
6239
""" Graph utilities and algorithms Graphs are represented with their adjacency matrices, preferably using sparse matrices. """ # Authors: Aric Hagberg <hagberg@lanl.gov> # Gael Varoquaux <gael.varoquaux@normalesup.org> # Jake Vanderplas <vanderplas@astro.washington.edu> # License: BSD 3 clause impo...
bsd-3-clause
tlhr/plumology
tests/test_calc.py
1
10237
import pytest import numpy as np import pandas as pd from plumology import calc, util arr = [[1.0, 10.5, 0.2], [-0.3, 0.5, 0.4], [-0.2, 0.5, 0.4]] data = pd.DataFrame(data=arr, columns=['a', 'b', 'c']) expdata = data.rename(columns={'c': 'exp_a'}).drop('b', axis=1) class Test_population: def test_1(self): ...
mit
tkoziara/parmec
tests/spherical_joint.py
1
3544
# PARMEC test --> spherical joint made of SPRING and TORSION_SPRING # bulk material matnum = MATERIAL (1E3, 1E9, 0.25) # two particles nodes1 = [0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1] nodes2 = [0.25, 0.25, 1, 0.75, 0.25, 1, 0.75, 0.75, 1, 0....
mit
loretoparisi/nupic
nupic/research/monitor_mixin/monitor_mixin_base.py
27
5512
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2014, 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
ssaeger/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
themrmax/scikit-learn
sklearn/cluster/tests/test_spectral.py
72
7950
"""Testing for Spectral Clustering methods""" from sklearn.externals.six.moves import cPickle dumps, loads = cPickle.dumps, cPickle.loads import numpy as np from scipy import sparse from sklearn.utils import check_random_state from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_a...
bsd-3-clause
micmn/shogun
examples/undocumented/python/graphical/inverse_covariance_estimation_demo.py
11
2514
#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt from pylab import show, imshow def simulate_data (n,p): from shogun import SparseInverseCovariance import numpy as np #create a random pxp covariance matrix cov = np.random.normal(size=(p,p)) #generate data set with multivariate Gaussian ...
gpl-3.0
kms6bn/FDA_Recalls
fdaStackPlot.py
1
3506
# -*- coding: utf-8 -*- """ Create stackplot for FDA food recall database using csv file created from PythonProject file. Katherine Schinkel, Hope McIntyre, Shannon Mitchell kms6bn, hm7zg, som3dq install seaborn (in your terminal, type pip install seaborn) August 12, 2015 """ import pandas as pd import numpy as np im...
mit
jobovy/apogee-maps
py/plot_mapflare_highalpha.py
1
5694
############################################################################### # plot_mapflare_highalpha.py: make of plot of the flaring of MAPs ############################################################################### import os, os.path import sys import csv import pickle import numpy import matplotlib matplotl...
bsd-3-clause
funbaker/astropy
astropy/visualization/wcsaxes/ticks.py
2
6187
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from matplotlib.lines import Path, Line2D from matplotlib.transforms import Affine2D from matplotlib import rcParams class Ticks(Line2D): """ Ticks are derived from Line2D, and note that ticks themselves are markers. Thu...
bsd-3-clause
tkaitchuck/nupic
external/linux64/lib/python2.6/site-packages/matplotlib/bezier.py
70
14387
""" A module providing some utility functions regarding bezier path manipulation. """ import numpy as np from math import sqrt from matplotlib.path import Path from operator import xor # some functions def get_intersection(cx1, cy1, cos_t1, sin_t1, cx2, cy2, cos_t2, sin_t2): """ return a...
gpl-3.0
civisanalytics/muffnn
muffnn/autoencoder/autoencoder.py
1
33037
""" Autoencoder in scikit-learn style with TensorFlow """ import logging import re import warnings import numpy as np import tensorflow as tf import scipy.sparse as sp from sklearn.base import TransformerMixin, BaseEstimator from sklearn.utils import check_array, check_random_state from sklearn.exceptions import Not...
bsd-3-clause
janmedlock/HIV-95-vaccine
plots/differences.py
1
5922
#!/usr/bin/python3 ''' Plot differences for samples from uncertainty analysis. ''' import operator import os.path import sys from matplotlib import colorbar from matplotlib import colors from matplotlib import gridspec from matplotlib import pyplot from matplotlib import ticker from matplotlib.backends import backend...
agpl-3.0
roxyboy/scikit-learn
sklearn/linear_model/least_angle.py
57
49338
""" Least Angle Regression algorithm. See the documentation on the Generalized Linear Model for a complete discussion. """ from __future__ import print_function # Author: Fabian Pedregosa <fabian.pedregosa@inria.fr> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Gael Varoquaux # # License: BSD 3 ...
bsd-3-clause
keflavich/APEX_CMZ_H2CO
analysis/backstream_pv.py
2
8401
import os import numpy as np import pvextractor import spectral_cube import aplpy import pylab as pl import matplotlib import pyregion import copy from paths import mpath,apath,fpath,molpath,hpath,rpath,h2copath from astropy import units as u from astropy import coordinates from astropy.io import ascii from astropy imp...
bsd-3-clause
JonathanAlvarado/bioclimatica
nom020/nom/ajax.py
1
13035
from dajaxice.decorators import dajaxice_register from dajax.core import Dajax from nom.models import estados, ciudades, soluciones, soluciones_detalles, ciudades_k, ciudades_fg, ciudades_temp, resultados import simplejson as json #from django.db.models import Q '''@dajaxice_register def multiply( request, a, b ): da...
mit
jlegendary/scikit-learn
sklearn/externals/joblib/parallel.py
36
34375
""" Helpers for embarrassingly parallel code. """ # Author: Gael Varoquaux < gael dot varoquaux at normalesup dot org > # Copyright: 2010, Gael Varoquaux # License: BSD 3 clause from __future__ import division import os import sys import gc import warnings from math import sqrt import functools import time import thr...
bsd-3-clause
gumm/luds
adc/plottest.py
1
2681
# Simple demo of reading each analog input from the ADS1x15 and printing it to # the screen. # Author: Tony DiCola # License: Public Domain import time import argparse import matplotlib.pyplot as plt # Import the ADS1x15 module. import Adafruit_ADS1x15 plt.ion() # Create an ADS1115 ADC (16-bit) instance. adc = Ada...
gpl-3.0
pgmpy/pgmpy
pgmpy/tests/test_factors/test_continuous/test_Linear_Gaussain_CPD.py
2
3451
import unittest import numpy.testing as np_test import pandas as pd import numpy as np from pgmpy.factors.continuous import LinearGaussianCPD class TestLGCPD(unittest.TestCase): # @unittest.skip("TODO") def test_class_init(self): mu = np.array([7, 13]) sigma = np.array([[4, 3], [3, 6]]) ...
mit
xapple/plumbing
setup.py
1
1238
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Written by Lucas Sinclair. MIT Licensed. Contact at www.sinclair.bio """ # Imports # from setuptools import setup, find_namespace_packages from os import path # Load the contents of the README file # this_dir = path.abspath(path.dirname(__file__)) readme_path = path...
mit
PmagPy/PmagPy
pmagpy_tests/test_contribution_builder.py
1
33035
#!/usr/bin/env python import unittest import os import sys import numpy as np import pandas as pd from pmagpy import pmag from pmagpy import ipmag from pmagpy import contribution_builder as cb from pmagpy import data_model3 as data_model from pmagpy import controlled_vocabularies3 as cv # set constants WD = pmag.get...
bsd-3-clause
mugwort-rc/idata
idata/config/csv.py
1
1387
import csv from .base import TableSourceConfig from ..source.table import TableSource, StackedTableSource class CSVTableSourceConfig(TableSourceConfig): def load(self, path, encoding="utf-8"): if hasattr(path, "read"): return self._load(path) with open(path, "r", encoding=encoding) as...
gpl-3.0
yuanagain/seniorthesis
venv/lib/python2.7/site-packages/matplotlib/textpath.py
7
16677
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) from matplotlib.externals import six from matplotlib.externals.six.moves import zip import warnings import numpy as np from matplotlib.path import Path from matplotlib import rcParam...
mit
C2SM-RCM/serialbox
python/serialbox/Visualizer.py
1
4181
# This file is released under terms of BSD license` # See LICENSE.txt for more information """Visualizer module used for visualization of serialized data.""" import numpy as np from matplotlib import pyplot as plt from matplotlib.widgets import Slider, CheckButtons from matplotlib.colors import LogNorm, SymLogNorm, N...
bsd-2-clause
andreyzhd/VideoMEG
examples/sync_test.py
1
4276
# -*- coding: utf-8 -*- """An example: code for assessing video/audio/MEG synchronization. This script takes a triplet (fiff, audio, and video) of files and generates a bunch of pictures. Each picture describes a short piece of the recordings. The upper pane shows 3 consecutive video frames. The lower ...
gpl-3.0
Erotemic/local
misc/code/physics.py
1
3177
#http://stackoverflow.com/questions/11874767/real-time-plotting-in-while-loop-with-matplotlib from __future__ import division import matplotlib import matplotlib.pyplot as plt import numpy as np import time G = 1 # Strength of gravity HEIGHT = 255 WIDTH = 255 DEPTH = 0 def calculate_gravity(p1, p2): global G ...
gpl-3.0
rcurtin/shogun
examples/undocumented/python_modular/graphical/preprocessor_kpca_graphical.py
26
1893
from numpy import * import matplotlib.pyplot as p import os, sys, inspect path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../tools')) if not path in sys.path: sys.path.insert(1, path) del path from generate_circle_data import circle_data cir=circle_data() number_of_points_for_circle1=42 number_of_p...
gpl-3.0
bzero/statsmodels
statsmodels/examples/ex_misc_tarma.py
34
1875
# -*- coding: utf-8 -*- """ Created on Wed Jul 03 23:01:44 2013 Author: Josef Perktold """ from __future__ import print_function import numpy as np from statsmodels.tsa.arima_process import arma_generate_sample, ArmaProcess from statsmodels.miscmodels.tmodel import TArma from statsmodels.tsa.arima_model import ARMA...
bsd-3-clause
sablet/algo_trade
src/nn_model.py
1
3740
from __future__ import print_function import os from keras.layers import LSTM, Conv1D from keras.layers.core import Dense from keras.models import Sequential, load_model from keras.optimizers import SGD from src.model_template import ModelTemplate from src.utility import get_out_path, np3to2 import pytest import pandas...
mit
rsheftel/pandas_market_calendars
pandas_market_calendars/exchange_calendar_jpx.py
1
3219
from datetime import time from itertools import chain from pandas.tseries.holiday import AbstractHolidayCalendar from pytz import timezone from pandas_market_calendars.holidays_jp import * from pandas_market_calendars.holidays_us import USNewYearsDay from .market_calendar import MarketCalendar # TODO: # From 1949 t...
mit
ephes/scikit-learn
examples/plot_isotonic_regression.py
303
1767
""" =================== Isotonic Regression =================== An illustration of the isotonic regression on generated data. The isotonic regression finds a non-decreasing approximation of a function while minimizing the mean squared error on the training data. The benefit of such a model is that it does not assume a...
bsd-3-clause
istb-mia/MIALab
exercise/exercise_rf.py
1
5635
"""A decision forest toy example. Trains and evaluates a decision forest classifier on a 2-D point cloud. """ import argparse import datetime import os import sys import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap import sklearn.ensemble as sk_ensemble from sklearn.datase...
apache-2.0
Z2PackDev/Z2Pack
z2pack/plot.py
1
7739
#!/usr/bin/env python # -*- coding: utf-8 -*- """This submodule contains all functions for plotting Z2Pack results.""" import colorsys import decorator import numpy as np from fsc.export import export from ._utils import _pol_step def _plot(proj_3d=False): """Decorator that sets up the figure axes and handles ...
gpl-3.0
wuxue/altanalyze
GO_Elite.py
1
155516
###GO-Elite #Copyright 2005-2008 J. David Gladstone Institutes, San Francisco California #Author Nathan Salomonis - nsalomonis@gmail.com #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 withou...
apache-2.0
nirdizati/nirdizati-runtime
PredictiveMethods/CaseOutcome/test_all_cases.py
1
3309
""" Copyright (c) 2016-2017 The Nirdizati Project. This file is part of "Nirdizati". "Nirdizati" 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 lat...
lgpl-3.0
toobaz/pandas
pandas/tests/resample/test_time_grouper.py
2
8802
from datetime import datetime from operator import methodcaller import numpy as np import pytest import pandas as pd from pandas import DataFrame, Series from pandas.core.groupby.grouper import Grouper from pandas.core.indexes.datetimes import date_range import pandas.util.testing as tm from pandas.util.testing impor...
bsd-3-clause
kdebrab/pandas
pandas/core/nanops.py
1
25582
import itertools import functools import operator import warnings from distutils.version import LooseVersion import numpy as np from pandas import compat from pandas._libs import tslibs, lib from pandas.core.dtypes.common import ( _get_dtype, is_float, is_scalar, is_integer, is_complex, is_float_dtype, ...
bsd-3-clause
herilalaina/scikit-learn
examples/decomposition/plot_sparse_coding.py
60
4016
""" =========================================== Sparse coding with a precomputed dictionary =========================================== Transform a signal as a sparse combination of Ricker wavelets. This example visually compares different sparse coding methods using the :class:`sklearn.decomposition.SparseCoder` esti...
bsd-3-clause
mbayon/TFG-MachineLearning
vbig/lib/python2.7/site-packages/pandas/io/sas/sas_xport.py
14
14805
""" Read a SAS XPort format file into a Pandas DataFrame. Based on code from Jack Cushman (github.com/jcushman/xport). The file format is defined here: https://support.sas.com/techsup/technote/ts140.pdf """ from datetime import datetime import pandas as pd from pandas.io.common import get_filepath_or_buffer, BaseIt...
mit
Thru-Echoes/BirdShader
database_prep/database_populate.py
2
1999
import os.path import osgeo.ogr import numpy as np import psycopg2 as psy import pandas as pd print('Creating database for temperature...') database_create = 'createdb temperature -T template_postgis' os.system(database_create ) connection = psy.connect('dbname = temperature host = localhost') cursor = connectio...
bsd-3-clause
klusta-team/kwiklib
kwiklib/dataio/experiment.py
1
29510
"""Object-oriented interface to an experiment's data.""" # ----------------------------------------------------------------------------- # Imports # ----------------------------------------------------------------------------- import os import os.path as op import re from itertools import chain from collections import...
bsd-3-clause
fengzhe29888/gnuradio-old
gr-filter/examples/synth_to_chan.py
40
3854
#!/usr/bin/env python # # Copyright 2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your ...
gpl-3.0
pianomania/scikit-learn
examples/applications/plot_prediction_latency.py
85
11395
""" ================== Prediction Latency ================== This is an example showing the prediction latency of various scikit-learn estimators. The goal is to measure the latency one can expect when doing predictions either in bulk or atomic (i.e. one by one) mode. The plots represent the distribution of the pred...
bsd-3-clause
mrshu/scikit-learn
sklearn/tests/test_dummy.py
2
2326
import numpy as np from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_raises from sklearn.dummy import DummyClassifier from sklearn.dummy import DummyRegressor def _check_p...
bsd-3-clause
juggernautone/trading-with-python
lib/vixFutures.py
79
4157
# -*- coding: utf-8 -*- """ set of tools for working with VIX futures @author: Jev Kuznetsov Licence: GPL v2 """ import datetime as dt from pandas import * import os import urllib2 #from csvDatabase import HistDataCsv m_codes = dict(zip(range(1,13),['F','G','H','J','K','M','N','Q','U','V','X','Z'])) #m...
bsd-3-clause
jkarnows/scikit-learn
sklearn/externals/joblib/__init__.py
36
4795
""" Joblib is a set of tools to provide **lightweight pipelining in Python**. In particular, joblib offers: 1. transparent disk-caching of the output values and lazy re-evaluation (memoize pattern) 2. easy simple parallel computing 3. logging and tracing of the execution Joblib is optimized to be **fast*...
bsd-3-clause
Evfro/polara
polara/datasets/yahoo.py
1
1594
import tarfile import pandas as pd def get_yahoo_music_data(path=None, fileid=0, include_test=True, read_attributes=False, read_genres=False): res = [] if path: data_folder = 'ydata-ymusic-user-song-ratings-meta-v1_0' col_names = ['userid', 'songid', 'rating'] with tarfile.open(path, 'r...
mit
arabenjamin/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
DSLituiev/scikit-learn
sklearn/utils/tests/test_fixes.py
281
1829
# Authors: Gael Varoquaux <gael.varoquaux@normalesup.org> # Justin Vincent # Lars Buitinck # License: BSD 3 clause import numpy as np from nose.tools import assert_equal from nose.tools import assert_false from nose.tools import assert_true from numpy.testing import (assert_almost_equal, ...
bsd-3-clause
dhaase-de/dh-python-dh
dh/thirdparty/tqdm/_tqdm_pandas.py
28
1608
import sys __author__ = "github.com/casperdcl" __all__ = ['tqdm_pandas'] def tqdm_pandas(tclass, *targs, **tkwargs): """ Registers the given `tqdm` instance with `pandas.core.groupby.DataFrameGroupBy.progress_apply`. It will even close() the `tqdm` instance upon completion. Parameters ------...
mit
shenzebang/scikit-learn
sklearn/neighbors/tests/test_kde.py
208
5556
import numpy as np from sklearn.utils.testing import (assert_allclose, assert_raises, assert_equal) from sklearn.neighbors import KernelDensity, KDTree, NearestNeighbors from sklearn.neighbors.ball_tree import kernel_norm from sklearn.pipeline import make_pipeline from sklearn.dataset...
bsd-3-clause
dcprojects/CoolProp
dev/scripts/fit_shape_factor.py
5
8075
from CoolProp import CoolProp as CP from PDSim.misc.datatypes import Collector import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from scipy.odr import * import textwrap fluid_REF = 'Propane' Tcrit_REF = CP.Props(fluid_REF,'Tcrit') omega_REF = CP.Props(fluid_REF,"accentric") mol...
mit
jonahe1/vwm_behaviorTask
data_analysis/dataMethods.py
1
8534
# This file performs the first step of data analysis, performing calculations # on a .csv data file output by the psychopy package. Pashler's K, d prime, # hit rates, RTs and more are returned in a dictionary by extractPerformance to # be utilized by pandas or another python data analysis library. # imports from __fut...
mit
alander/StarCluster
utils/scimage_12_04.py
20
17216
#!/usr/bin/env python """ This script is meant to be run inside of a ubuntu cloud image available at uec-images.ubuntu.com:: $ EC2_UBUNTU_IMG_URL=http://uec-images.ubuntu.com/precise/current $ wget $EC2_UBUNTU_IMG_URL/precise-server-cloudimg-amd64.tar.gz or:: $ wget $EC2_UBUNTU_IMG_URL/precise-server-clo...
gpl-3.0
DiamondLightSource/auto_tomo_calibration-experimental
old_code_scripts/simulate_data/lmfit-py/lmfit/ui/basefitter.py
7
12312
import warnings import numpy as np from ..model import Model from ..models import ExponentialModel # arbitrary default from ..asteval import Interpreter from ..astutils import NameFinder from ..parameter import check_ast_errors _COMMON_DOC = """ This an interactive container for fitting models to particular dat...
apache-2.0
belltailjp/scikit-learn
benchmarks/bench_mnist.py
154
6006
""" ======================= MNIST dataset benchmark ======================= Benchmark on the MNIST dataset. The dataset comprises 70,000 samples and 784 features. Here, we consider the task of predicting 10 classes - digits from 0 to 9 from their raw images. By contrast to the covertype dataset, the feature space is...
bsd-3-clause
CINPLA/expipe-dev
exana/exana/tests/test_salt.py
2
4650
import pytest import elephant import neo import quantities as pq import numpy as np def _test_salt_inh(): from exana.stimulus import salt, generate_salt_trials from exana.misc import concatenate_spiketrains from elephant.spike_train_generation import homogeneous_poisson_process as hpp np.random.seed(1...
gpl-3.0
grlee77/scipy
doc/source/tutorial/stats/plots/mgc_plot2.py
12
1282
import numpy as np import matplotlib.pyplot as plt from scipy.stats import multiscale_graphcorr def mgc_plot(x, y, mgc_dict): """Plot sim and MGC-plot""" plt.figure(figsize=(8, 8)) ax = plt.gca() # local correlation map mgc_map = mgc_dict["mgc_map"] # draw heatmap ax.set_title("Local Cor...
bsd-3-clause
mmmatthew/raycast
code/s13__ortho_cluster.py
1
1550
''' This function turns the image coordinates to geographic coordinates ''' import os import pandas as pd from s10__cluster_3d import cluster_dbscan def ortho_cluster(config, debug, settings): # Where to save clusters save_to_directory = os.path.join(config['iteration_directory'], ...
apache-2.0
yousrabk/mne-python
mne/tests/test_cov.py
6
18217
# Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Denis Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) import os.path as op from nose.tools import assert_true, assert_equal from numpy.testing import assert_array_almost_equal, assert_array_equal from nose.tools import as...
bsd-3-clause
mayblue9/bokeh
examples/glyphs/colors.py
19
8922
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
MesserLab/SLiM
SLiMgui/Recipes/Recipe 17.5 - Mapping admixture (analyzing ancestry in Python) II.py
2
1037
# Keywords: Python, tree-sequence recording, tree sequence recording # This is a Python recipe; note that it runs the SLiM model internally, below import subprocess, msprime, pyslim import matplotlib.pyplot as plt import numpy as np # Run the SLiM model and load the resulting .trees file subprocess.check_output(["sl...
gpl-3.0
foreversand/QSTK
Examples/Basic/tutorial6.py
1
3275
''' (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 June 1, 2011 @author: John Cornwell @contact: JohnWCornwellV@gmail.com @summary: Demonstrates the retrieva...
bsd-3-clause
xiaoxiamii/scikit-learn
examples/exercises/plot_iris_exercise.py
323
1602
""" ================================ SVM Exercise ================================ A tutorial exercise for using different SVM kernels. This exercise is used in the :ref:`using_kernels_tut` part of the :ref:`supervised_learning_tut` section of the :ref:`stat_learn_tut_index`. """ print(__doc__) import numpy as np i...
bsd-3-clause
eljost/td
td/mix_spectra.py
1
2711
#!/usr/bin/env python3 """This script plots two gradually mixed spectra. It can be used to visualize the spectra changes over the course of a chemical reaction, e.g. a photoreaction.""" import argparse import sys import matplotlib as mpl import matplotlib.animation as animation import matplotlib.pyplot as plt import...
gpl-3.0
gereon/trading-with-python
historicDataDownloader/historicDataDownloader.py
77
4526
''' Created on 4 aug. 2012 Copyright: Jev Kuznetsov License: BSD a module for downloading historic data from IB ''' import ib import pandas from ib.ext.Contract import Contract from ib.opt import ibConnection, message from time import sleep import tradingWithPython.lib.logger as logger from pandas impor...
bsd-3-clause
kagayakidan/scikit-learn
examples/cross_decomposition/plot_compare_cross_decomposition.py
128
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
hitrace/RDATKit
_deprecated_/likelihood/optimize.py
1
16052
import pickle from mpl_toolkits.mplot3d import Axes3D from matplotlib.pylab import * import random import pdb from numpy import * import numpy as np """ from cvxmod import * from cvxmod.atoms import * from cvxmod.sets import * """ from rdatkit import secondary_structure from rdatkit import settings from rdatkit import ...
bsd-3-clause
eclee25/flu-SDI-exploratory-age
scripts/create_fluseverity_figs_v5/FR_incid_time_v5.py
1
2436
#!/usr/bin/python ############################################## ###Python template ###Author: Elizabeth Lee ###Date: 1/19/15 ###Function: (France data) Total estimated incidence per 100,000 vs. week number normalized by the first 'gp_normweeks' of the season. ###Import data: Documents/FRANCE_ILI_DATA_2014/inc2_inc-...
mit
ColdSauce/solvinga858
solve.py
1
1526
import csv import numpy as np import matplotlib.mlab as mlab import matplotlib.pyplot as plt def is_number(c): try: int(c) return True except ValueError: return False def get_amount_chars_together(st): total = 0 previous_was_char = False for c in st: if not is_numbe...
mit
FRBs/DM
frb/galaxies/eazy.py
2
20922
""" Module to faciliate scripting of EAZY analysis""" import os import warnings from pkg_resources import resource_filename from distutils import spawn import subprocess import numpy as np import pandas from astropy.table import Table from astropy.cosmology import Planck15 from frb.surveys import catalog_utils fro...
bsd-3-clause
ghackebeil/sbb_project
problems.py
1
11801
import json from collections import OrderedDict import pyomo.kernel as pmo import numpy import relaxations registered_problems = {} class Problem(object): def create_model(self): raise NotImplementedError def transform_to_convex(self, model): raise NotImplementedError def restore_from_...
mit
bzero/statsmodels
statsmodels/iolib/tests/test_foreign.py
25
7274
""" Tests for iolib/foreign.py """ import os import warnings from datetime import datetime from numpy.testing import * import numpy as np from pandas import DataFrame, isnull import pandas.util.testing as ptesting from statsmodels.compat.python import BytesIO, asbytes import statsmodels.api as sm from statsmodels.iol...
bsd-3-clause
almarklein/bokeh
bokeh/mpl.py
1
18876
"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
ghost9023/DeepLearningPythonStudy
DeepLearning/DeepLearning/09_Deep_SongJW/book/ch04/train_neuralnet.py
1
1942
# coding: utf-8 import sys, os sys.path.append(os.pardir) # 부모 디렉터리의 파일을 가져올 수 있도록 설정 import numpy as np import matplotlib.pyplot as plt from dataset.mnist import load_mnist from book.ch04.two_layer_net import TwoLayerNet # 데이터 읽기 (x_train, t_train), (x_test, t_test) = load_mnist(normalize=True, one_hot_label=True) ...
mit
musoke/dotfiles
.ipython/profile_default/ipython_config.py
1
20580
# Configuration file for ipython. c = get_config() #------------------------------------------------------------------------------ # InteractiveShellApp configuration #------------------------------------------------------------------------------ # A Mixin for applications that start InteractiveShell instances. # #...
mit
felipecustodio/algorithms
digital_image_processing/steganography/demo.py
2
3941
import numpy as np import imageio import seaborn as sns from matplotlib import pyplot as plt from matplotlib import animation from subprocess import call # load images print("Loading images...") original = np.asarray(imageio.imread("images/forest.png", as_gray=False, pilmode="RGB")) secret = np.asarray(ima...
mit
clemkoa/scikit-learn
sklearn/metrics/cluster/supervised.py
13
31406
"""Utilities to evaluate the clustering performance of models. Functions named as *_score return a scalar value to maximize: the higher the better. """ # Authors: Olivier Grisel <olivier.grisel@ensta.org> # Wei LI <kuantkid@gmail.com> # Diego Molla <dmolla-aliod@gmail.com> # Arnaud Fouchet ...
bsd-3-clause
bundgus/python-playground
matplotlib-playground/examples/tests/backend_driver.py
1
15265
#!/usr/bin/env python from __future__ import print_function, division """ This is used to drive many of the examples across the backends, for regression testing, and comparing backend efficiency. You can specify the backends to be tested either via the --backends switch, which takes a comma-separated list, or as sepa...
mit
BhallaLab/moose
moose-examples/traub_2005/py/display_morphology.py
1
5878
# 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-3.0
frapa/Schr
windows/schr.py
2
8864
# -*- encoding:utf-8 -*- #!/usr/bin/python from multiprocessing import Process, Queue import time import locale, gettext import os from gi.repository import Gtk from gi.repository import GLib import numpy as np # stupid!!! from numpy import * import matplotlib.pyplot as plt import compy as cp APP = "schr" TRANSLATI...
gpl-3.0
UNR-AERIAL/scikit-learn
sklearn/linear_model/ransac.py
191
14261
# coding: utf-8 # Author: Johannes Schönberger # # License: BSD 3 clause import numpy as np from ..base import BaseEstimator, MetaEstimatorMixin, RegressorMixin, clone from ..utils import check_random_state, check_array, check_consistent_length from ..utils.random import sample_without_replacement from ..utils.valid...
bsd-3-clause
CrazyGuo/bokeh
examples/plotting/server/burtin.py
42
4826
# The plot server must be running # Go to http://localhost:5006/bokeh to view this plot from collections import OrderedDict from math import log, sqrt import numpy as np import pandas as pd from six.moves import cStringIO as StringIO from bokeh.plotting import figure, show, output_server antibiotics = """ bacteria,...
bsd-3-clause
abramovd/Newster
newster/algorithms/KMeans.py
1
3895
#!/usr/bin/env python # -*- coding: utf-8 # Dmitry Abramov # Python v. 2.7.9 from __future__ import print_function import os.path, sys sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)) import numpy as np from preprocessing.tokenize_and_stem import tokenize_and_stem from Scraper i...
mit