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
qeedquan/misc_utilities
math/controls/simple-gain-1.py
1
1866
""" https://lpsa.swarthmore.edu/Root_Locus/RootLocusWhy.html """ import numpy as np import matplotlib.pyplot as plt from sympy.abc import * from sympy.integrals import inverse_laplace_transform from sympy.solvers import solve from sympy import * def eval_transfer_function(G, R, K0, t0, t1): G = G.subs(K, K0) ...
mit
scubamut/SimpleBacktester
backtest_helpers/backtest.py
1
1659
# THIS ONE MATCHES PV # SEE PV backtest :https://goo.gl/lBR4K9 # AND spreadsheet : https://goo.gl/8KGp58 # and Quantopian backtest : https://goo.gl/xytT5L def backtest(prices, weights, capital, offset=1, commission=0.): import pandas as pd rebalance_dates = weights.index buy_dates = [prices.index[d + o...
gpl-3.0
abhishekkrthakur/scikit-learn
benchmarks/bench_covertype.py
154
7296
""" =========================== Covertype dataset benchmark =========================== Benchmark stochastic gradient descent (SGD), Liblinear, and Naive Bayes, CART (decision tree), RandomForest and Extra-Trees on the forest covertype dataset of Blackard, Jock, and Dean [1]. The dataset comprises 581,012 samples. It ...
bsd-3-clause
boomsbloom/dtm-fmri
DTM/for_gensim/lib/python2.7/site-packages/seaborn/categorical.py
1
133468
from __future__ import division from textwrap import dedent import colorsys import numpy as np from scipy import stats import pandas as pd from pandas.core.series import remove_na import matplotlib as mpl from matplotlib.collections import PatchCollection import matplotlib.patches as Patches import matplotlib.pyplot as...
mit
sourabhdalvi/sourabhdalvi.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
franzpl/sweep
peak_to_noise_ratio/pnr_depends_on_excitation_length.py
2
1779
#!/usr/bin/env python3 """The influence of excitation length. """ import sys sys.path.append('..') import measurement_chain import plotting import calculation import ir_imitation import generation import matplotlib.pyplot as plt import windows from scipy.signal import lfilter, fftconvolve import numpy as np # Pa...
mit
wavelets/BayesDataAnalysisWithPyMC
BayesDataAnalysisWithPymc/plot_post.py
2
2926
# -*- coding: utf-8 -*- '''Plot the histogram of the posterior distribution sample, with the mean and the 95% HDI. Adaptation of the R code from "Doing Bayesian Data Analysis", by John K. Krushcke. More info: http://doingbayesiandataanalysis.blogspot.com.br/ Histogram code based on (copied from!) 'Probabilistic...
mit
sergeykolychev/mxnet
example/reinforcement-learning/ddpg/strategies.py
42
2473
# 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
abinashpanda/pgmpy
pgmpy/models/NaiveBayes.py
3
7053
from pgmpy.independencies import Independencies from pgmpy.models import BayesianModel class NaiveBayes(BayesianModel): """ Class to represent Naive Bayes. Subclass of Bayesian Model. Model holds directed edges from one parent node to multiple children nodes only. Parameters ---------- ...
mit
nikste/tensorflow
tensorflow/contrib/learn/python/learn/dataframe/tensorflow_dataframe.py
75
29377
# 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
rahuldhote/scikit-learn
sklearn/linear_model/tests/test_sparse_coordinate_descent.py
244
9986
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_true from sklearn.utils.t...
bsd-3-clause
aleksandr-bakanov/astropy
astropy/visualization/wcsaxes/ticklabels.py
4
8121
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from matplotlib import rcParams from matplotlib.text import Text from .frame import RectangularFrame def sort_using(X, Y): return [x for (y, x) in sorted(zip(Y, X))] class TickLabels(Text): def __init__(self, frame, *arg...
bsd-3-clause
offirt/SMS-Broadcast
sms_broadcast.py
1
2314
import pandas as pd import sys, getopt from twilio.rest import Client def main(argv): file, nameColumn, phoneColumn, template, sendReal, twilioSid, twilioToken, twilioFrom = parseArgs(argv) rows = pd.read_csv(file) rows = rows[[nameColumn, phoneColumn]] client = Client(twilioSid, twilioToken) f...
mit
amolkahat/pandas
asv_bench/benchmarks/indexing.py
5
10167
import warnings import numpy as np import pandas.util.testing as tm from pandas import (Series, DataFrame, Panel, MultiIndex, Int64Index, UInt64Index, Float64Index, IntervalIndex, CategoricalIndex, IndexSlice, concat, date_range) class NumericSeriesIndexing...
bsd-3-clause
public-ink/public-ink
server/appengine/lib/matplotlib/tight_layout.py
4
13206
""" This module provides routines to adjust subplot params so that subplots are nicely fit in the figure. In doing so, only axis labels, tick labels, axes titles and offsetboxes that are anchored to axes are currently considered. Internally, it assumes that the margins (left_margin, etc.) which are differences between...
gpl-3.0
JunkieStyle/corgi
corgi/experiment.py
1
14841
import time import xgboost as xgb import lightgbm as lgb import catboost as cat import pandas as pd import numpy as np from hyperopt import fmin, tpe, Trials, STATUS_OK, STATUS_FAIL, hp import os from os.path import join from os import listdir from sklearn.model_selection import StratifiedKFold, TimeSeriesSplit, KFold...
mit
OshynSong/scikit-learn
benchmarks/bench_plot_fastkmeans.py
294
4676
from __future__ import print_function from collections import defaultdict from time import time import numpy as np from numpy import random as nr from sklearn.cluster.k_means_ import KMeans, MiniBatchKMeans def compute_bench(samples_range, features_range): it = 0 results = defaultdict(lambda: []) chun...
bsd-3-clause
sinhrks/pandas-ml
doc/source/conf.py
3
8742
# -*- coding: utf-8 -*- # # pandas-ml documentation build configuration file, created by # sphinx-quickstart on Sun Feb 22 14:58:37 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # #...
bsd-3-clause
espensirnes/paneltime
paneltime/regstats.py
2
9494
#!/usr/bin/env python # -*- coding: utf-8 -*- #This module calculates statistics and saves it to a file import statproc as stat import numpy as np import regprocs as rp from scipy import stats as scstats import csv import os import sys import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt imp...
gpl-3.0
jakevdp/seaborn
seaborn/rcmod.py
1
15625
"""Functions that alter the matplotlib rc dictionary on the fly.""" import numpy as np import matplotlib as mpl from . import palettes _style_keys = ( "axes.facecolor", "axes.edgecolor", "axes.grid", "axes.axisbelow", "axes.linewidth", "axes.labelcolor", "grid.color", "grid.linestyle...
bsd-3-clause
botswana-harvard/bcpp-interview
bcpp_interview/management/commands/extract_from_bcpp.py
1
5914
""" A few methods to help extract data from bcpp. either you are on the bcpp server console or have a bcpp virtualenv and tunnel to bcpp mysql To get locator data from bcpp: from bcpp_interview import get_locator_dataframe, identity, decrypt_locator, get_consent_dataframe, decrypt_consent df_locator = get_lo...
gpl-3.0
marqh/iris
lib/iris/tests/test_plot.py
3
32979
# (C) British Crown Copyright 2010 - 2017, Met Office # # This file is part of Iris. # # Iris is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option) any l...
lgpl-3.0
citiususc/construe
construe/knowledge/abstraction_patterns/segmentation/pwave.py
1
15026
# -*- coding: utf-8 -*- # pylint: disable=C0326 """ Created on Tue Sep 30 12:31:04 2014 This module contains the definition of the P wave abstraction pattern. @author: T. Teijeiro """ import pickle import numpy as np from pathlib import Path import sklearn.preprocessing as preproc import construe.knowledge.observab...
agpl-3.0
iABC2XYZ/abc
Temp/untitled14.py
1
1845
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Mon Jul 10 17:39:17 2017 @author: A """ import numpy as np import matplotlib.pyplot as plt def ReconstructionFFT(s): from scipy.fftpack import fft fs=1 N=len(s) #fs=N n=np.linspace(0,N-1,N) f=n*fs/N t=n/fs sFFT=fft(s,...
gpl-3.0
marcsans/cnn-physics-perception
phy/lib/python2.7/site-packages/scipy/stats/_multivariate.py
13
99071
# # Author: Joris Vankerschaver 2013 # from __future__ import division, print_function, absolute_import import math import numpy as np import scipy.linalg from scipy.misc import doccer from scipy.special import gammaln, psi, multigammaln from scipy._lib._util import check_random_state from scipy.linalg.blas import dro...
mit
felipemontefuscolo/bitme
research/ar.py
1
2635
from statsmodels.tsa.ar_model import AR from statsmodels.graphics.tsaplots import * from matplotlib.pyplot import * import scipy.signal as sg # for scipy.signal.welch from scipy.ndimage.interpolation import shift # this script is just to understand how AR model works def diff(x, n, remove_nan=True): r = x - shi...
mpl-2.0
humdings/zipline
tests/pipeline/base.py
2
5349
""" Base class for Pipeline API unit tests. """ import numpy as np from numpy import arange, prod from pandas import DataFrame, Timestamp from six import iteritems from zipline.utils.compat import wraps from zipline.pipeline.engine import SimplePipelineEngine from zipline.pipeline import ExecutionPlan from zipline.pip...
apache-2.0
alan-mnix/MLFinalProject
final.py
1
3568
import heapq, itertools import nltk, re, numpy import json import re import sklearn import sklearn.metrics import sklearn.svm from sklearn.feature_extraction.text import TfidfVectorizer, HashingVectorizer import time from nltk import word_tokenize from nltk.stem import WordNetLemmatizer import sys #import ps...
gpl-2.0
mogeiwang/nest
pynest/examples/plot_weight_matrices.py
4
3194
# -*- coding: utf-8 -*- # # plot_weight_matrices.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 Li...
gpl-2.0
ilo10/scikit-learn
examples/svm/plot_rbf_parameters.py
57
8096
''' ================== RBF SVM parameters ================== This example illustrates the effect of the parameters ``gamma`` and ``C`` of the Radius Basis Function (RBF) kernel SVM. Intuitively, the ``gamma`` parameter defines how far the influence of a single training example reaches, with low values meaning 'far' a...
bsd-3-clause
Scan-o-Matic/scanomatic
scanomatic/qc/compilation_results.py
1
9311
from __future__ import absolute_import import glob from itertools import izip import os import re import time from types import StringTypes from matplotlib import pyplot as plt import numpy as np from scanomatic.io.movie_writer import MovieWriter from scanomatic.models.factories.compile_project_factory import ( ...
gpl-3.0
aetilley/scikit-learn
examples/linear_model/plot_logistic_path.py
349
1195
#!/usr/bin/env python """ ================================= Path with L1- Logistic Regression ================================= Computes path on IRIS dataset. """ print(__doc__) # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD 3 clause from datetime import datetime import numpy as np import...
bsd-3-clause
CUFCTFACE/face-recognition
scripts/plot.py
4
2754
#!/usr/bin/python # Create plots for log files from experiments. import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import os def load_logfile(fname): fp = open(fname, "rt") X = [[], [], [], []] for line in fp: data = line.split() for i in xrange(4): X[i].append(float(data[i])) fp.c...
mit
OshynSong/scikit-learn
sklearn/utils/tests/test_seq_dataset.py
93
2471
# Author: Tom Dupre la Tour <tom.dupre-la-tour@m4x.org> # # License: BSD 3 clause import numpy as np import scipy.sparse as sp from sklearn.utils.seq_dataset import ArrayDataset, CSRDataset from sklearn.datasets import load_iris from numpy.testing import assert_array_equal from nose.tools import assert_equal iris =...
bsd-3-clause
sowe9385/qiime
scripts/plot_taxa_summary.py
15
12355
#!/usr/bin/env python # File created on 19 Jan 2011 from __future__ import division __author__ = "Jesse Stombaugh" __copyright__ = "Copyright 2011, The QIIME project" __credits__ = ["Jesse Stombaugh", "Julia Goodrich", "Justin Kuczynski", "John Chase", "Jose Antonio Navas Molina"] __license__ = "GPL" __...
gpl-2.0
vivekpatani/recommendation-system
UI.py
3
3385
""" Simple User Interface """ from movielens import * from sklearn.cluster import KMeans import numpy as np import pickle import random import sys import time user = [] item = [] d = Dataset() d.load_users("data/u.user", user) d.load_items("data/u.item", item) n_users = len(user) n_items = len(item) utility_matrix...
mit
subutai/htmresearch
projects/sdr_paper/scalar_sdrs.py
2
20118
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2019, 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
cwu2011/scikit-learn
sklearn/semi_supervised/label_propagation.py
128
15312
# coding=utf8 """ Label propagation in the context of this module refers to a set of semisupervised classification algorithms. In the high level, these algorithms work by forming a fully-connected graph between all points given and solving for the steady-state distribution of labels at each point. These algorithms per...
bsd-3-clause
thunlp/OpenNE
src/openne/tadw.py
1
4372
from __future__ import print_function import math import numpy as np from numpy import linalg as la from sklearn.preprocessing import normalize from .gcn.utils import * class TADW(object): def __init__(self, graph, dim, lamb=0.2): self.g = graph self.lamb = lamb self.dim = int(dim/2) ...
mit
ahoyosid/scikit-learn
sklearn/ensemble/partial_dependence.py
6
14973
"""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
taylort7147/udacity-projects
titanic_survival_exploration/titanic_visualizations.py
24
5425
import numpy as np import pandas as pd import matplotlib.pyplot as plt def filter_data(data, condition): """ Remove elements that do not match the condition provided. Takes a data list as input and returns a filtered list. Conditions should be a list of strings of the following format: '<field> <...
mit
cbmoore/statsmodels
statsmodels/graphics/functional.py
31
14477
"""Module for functional boxplots.""" from statsmodels.compat.python import combinations, range import numpy as np from scipy import stats from scipy.misc import factorial from . import utils __all__ = ['fboxplot', 'rainbowplot', 'banddepth'] def fboxplot(data, xdata=None, labels=None, depth=None, method='MBD', ...
bsd-3-clause
karstenw/nodebox-pyobjc
examples/Extended Application/matplotlib/examples/event_handling/figure_axes_enter_leave.py
1
1669
""" ======================= Figure Axes Enter Leave ======================= Illustrate the figure and axes enter and leave events by changing the frame colors on enter and leave """ from __future__ import print_function import matplotlib.pyplot as plt def enter_axes(event): print('enter_axes', event.inaxes) ...
mit
Achuth17/scikit-learn
examples/cluster/plot_kmeans_digits.py
53
4524
""" =========================================================== A demo of K-Means clustering on the handwritten digits data =========================================================== In this example we compare the various initialization strategies for K-means in terms of runtime and quality of the results. As the gr...
bsd-3-clause
adybbroe/atrain_match
atrain_match/reshaped_files_scr/pps_vrreport_ctth_stats.py
2
34243
"""Read all matched data and make some plotting """ import os import re from glob import glob import numpy as np from utils.get_flag_info import get_calipso_clouds_of_type_i_feature_classification_flags_one_layer import matplotlib.pyplot as plt import matplotlib from utils.get_flag_info import (get_calipso_low_medium_...
gpl-3.0
pgoeser/gnuradio
gr-utils/src/python/plot_data.py
10
5841
# # Copyright 2007,2008,2011 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) # any later ...
gpl-3.0
areeda/gwpy
gwpy/segments/flag.py
2
61756
# -*- 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
kashif/scikit-learn
examples/classification/plot_lda_qda.py
29
4952
""" ==================================================================== Linear and Quadratic Discriminant Analysis with confidence ellipsoid ==================================================================== Plot the confidence ellipsoids of each class and decision boundary """ print(__doc__) from scipy import lin...
bsd-3-clause
evanbiederstedt/RRBSfun
epiphen/cll_tests/annotation_scripts/total_cells_annotate_columns.py
1
34503
import glob import pandas as pd import numpy as np pd.set_option('display.max_columns', 50) # print all rows import os os.chdir("/gpfs/commons/home/biederstedte-934/evan_projects/correct_phylo_files") normalB = glob.glob("binary_position_RRBS_normal_B_cell*") mcell = glob.glob("binary_position_RRBS_NormalBCD19pCD27...
mit
thilbern/scikit-learn
sklearn/datasets/base.py
12
17971
""" Base IO code for all datasets """ # Copyright (c) 2007 David Cournapeau <cournape@gmail.com> # 2010 Fabian Pedregosa <fabian.pedregosa@inria.fr> # 2010 Olivier Grisel <olivier.grisel@ensta.org> # License: BSD 3 clause import os import csv import shutil from os import environ from os.pa...
bsd-3-clause
frank-tancf/scikit-learn
benchmarks/bench_plot_neighbors.py
287
6433
""" Plot the scaling of the nearest neighbors algorithms with k, D, and N """ from time import time import numpy as np import pylab as pl from matplotlib import ticker from sklearn import neighbors, datasets def get_data(N, D, dataset='dense'): if dataset == 'dense': np.random.seed(0) return np....
bsd-3-clause
pandas-ml/pandas-ml
pandas_ml/confusion_matrix/cm.py
3
1079
#!/usr/bin/python # -*- coding: utf8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np from pandas_ml.confusion_matrix.abstract import ConfusionMatrixAbstract """ A Python Pandas Confusion matrix implementation """ class ConfusionMa...
bsd-3-clause
zihua/scikit-learn
examples/gaussian_process/plot_gpr_prior_posterior.py
104
2878
""" ========================================================================== Illustration of prior and posterior Gaussian process for different kernels ========================================================================== This example illustrates the prior and posterior of a GPR with different kernels. Mean, st...
bsd-3-clause
jpautom/scikit-learn
sklearn/feature_selection/tests/test_chi2.py
56
2400
""" Tests for chi2, currently the only feature selection function designed specifically to work with sparse matrices. """ 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.univariate_selection im...
bsd-3-clause
DGrady/pandas
pandas/io/s3.py
16
1222
""" s3 support for remote file interactivity """ from pandas import compat try: import s3fs from botocore.exceptions import NoCredentialsError except: raise ImportError("The s3fs library is required to handle s3 files") if compat.PY3: from urllib.parse import urlparse as parse_url else: from urlpar...
bsd-3-clause
lifemapper/LmQGIS
dev/trees/newStatsCov.py
2
12533
import numpy as np from itertools import combinations import matplotlib.pyplot as plt from csv import reader import math import os #ll = [[1,1,1,0,0,0],[0,1,1,1,0,1],[1,1,1,0,0,0],[1,1,1,0,0,0], # [0,1,1,1,1,0],[1,1,1,0,0,1],[1,1,1,1,0,0]] def buildCovarianceAvgPerCell(): """ @summary: this is the averag...
gpl-2.0
drandykass/fatiando
fatiando/gravmag/transform.py
3
21318
""" Potential field transformations, like upward continuation and derivatives. .. note:: Most, if not all, functions here required gridded data. **Transformations** * :func:`~fatiando.gravmag.transform.upcontinue`: Upward continuation of gridded potential field data on a level surface. * :func:`~fatiando.gravmag.t...
bsd-3-clause
aabadie/scikit-learn
sklearn/feature_selection/__init__.py
140
1302
""" 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
pypot/scikit-learn
sklearn/ensemble/gradient_boosting.py
126
65552
"""Gradient Boosted Regression Trees This module contains methods for fitting gradient boosted regression trees for both classification and regression. The module structure is the following: - The ``BaseGradientBoosting`` base class implements a common ``fit`` method for all the estimators in the module. Regressio...
bsd-3-clause
cuemacro/findatapy
findatapy/market/datavendorweb.py
1
108889
__author__ = 'saeedamen' # Saeed Amen # # Copyright 2016 Cuemacro # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the # License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
apache-2.0
odoousers2014/addons-yelizariev
sugarcrm_migration/import_kashflow.py
16
21779
# -*- coding: utf-8 -*- import logging _logger = logging.getLogger(__name__) from openerp.exceptions import except_orm try: import MySQLdb import MySQLdb.cursors from pandas import merge, DataFrame except ImportError: pass from openerp.addons.import_framework.import_base import import_base from openerp...
lgpl-3.0
xzh86/scikit-learn
examples/cluster/plot_lena_ward_segmentation.py
271
1998
""" =============================================================== A demo of structured Ward hierarchical clustering on Lena image =============================================================== Compute the segmentation of a 2D image with Ward hierarchical clustering. The clustering is spatially constrained in order ...
bsd-3-clause
eg-zhang/scikit-learn
examples/tree/plot_tree_regression.py
206
1476
""" =================================================================== Decision Tree Regression =================================================================== A 1D regression with decision tree. The :ref:`decision trees <tree>` is used to fit a sine curve with addition noisy observation. As a result, it learns ...
bsd-3-clause
sunpy/solarbextrapolation
solarbextrapolation/analyticalmodels/base.py
1
8497
# -*- coding: utf-8 -*- """ Created on Mon Sep 28 19:30:22 2015 @author: alex_ """ # General Imports import matplotlib as mpl mpl.use('TkAgg') # Force mpl backend not to use qt. Else we have a conflict. import numpy as np #import pickle import time from datetime import datetime #from collections import namedtuple imp...
mit
DanielJMaher/compliance-checker
compliance_checker/tests/test_acdd.py
2
15456
from compliance_checker.acdd import ACDD1_1Check, ACDD1_3Check from compliance_checker.tests.resources import STATIC_FILES from compliance_checker.tests import BaseTestCase from netCDF4 import Dataset import os def to_singleton_var(l): ''' Get the first value of a list if this implements iterator protocol and...
apache-2.0
apdavison/IzhikevichModel
PyNN/old/test_IF_cond_exp.py
2
2394
from pyNN.random import RandomDistribution, NumpyRNG from pyNN.neuron import * from pyNN.utility import get_script_args, Timer, ProgressBar, init_logging, normalized_filename import matplotlib.pyplot as plt import numpy as np timeStep = 0.01 setup(timestep=timeStep, min_delay=0.5) tau_m = 20....
bsd-3-clause
stuart-knock/tvb-library
contrib/from_articles/region_deterministic_bnm_sj3d_a.py
5
6407
# -*- coding: utf-8 -*- """ What: Reproduces Figures 23 and 24of Sanz-Leon P., Knock, S. A., Spiegler, A. and Jirsa V. Mathematical framework for large-scale brain network modelling in The Virtual Brain. Neuroimage, 2014, (in review) Needs: A working installation of tvb Run: python region_det...
gpl-2.0
CFIS-Octarine/octarine
src/ossos_tests/test_ossos/test_fitsviewer/test_interaction.py
2
7159
__author__ = "David Rusk <drusk@uvic.ca>" import unittest from hamcrest import assert_that, instance_of, equal_to, none from matplotlib.backend_bases import MouseEvent as MPLMouseEvent from mock import Mock, patch from ossos.fitsviewer.displayable import ImageSinglet from ossos.fitsviewer.interaction import Interact...
gpl-3.0
ericmjl/bokeh
examples/reference/models/radio_button_group_server.py
1
1317
## Bokeh server for Radio Button Group import pandas as pd from bokeh.io import curdoc from bokeh.layouts import row from bokeh.models import ColumnDataSource, RadioButtonGroup from bokeh.plotting import figure x=[3,4,6,12,10,1,5,6,3,8] y=[7,1,3,4,1,6,10,4,10,3] label=['Red', 'Orange', 'Red', 'Orange','Red', 'Orange'...
bsd-3-clause
sgiavasis/nipype
build_docs.py
10
6995
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Code to build the documentation in the setup.py To use this code, run:: python setup.py build_sphinx """ from __future__ import print_function # Standard library imports import sys import os fro...
bsd-3-clause
ClementPhil/deep-learning
image-classification/helper.py
155
5631
import pickle import numpy as np import matplotlib.pyplot as plt from sklearn.preprocessing import LabelBinarizer def _load_label_names(): """ Load the label names from file """ return ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck'] def load_cfar10_batch(ci...
mit
FHannes/intellij-community
python/testData/debug/test_dataframe.py
23
1309
import pandas as pd import numpy as np df1 = pd.DataFrame({'row': [0, 1, 2], 'One_X': [1.1, 1.1, 1.1], 'One_Y': [1.2, 1.2, 1.2], 'Two_X': [1.11, 1.11, 1.11], 'Two_Y': [1.22, 1.22, 1.22]}) print(df1) ###line 8 df2 = pd.DataFrame({'row': [0...
apache-2.0
low-sky/GAS
ah_bootstrap.py
31
36163
""" This bootstrap module contains code for ensuring that the astropy_helpers package will be importable by the time the setup.py script runs. It also includes some workarounds to ensure that a recent-enough version of setuptools is being used for the installation. This module should be the first thing imported in th...
mit
thorwhalen/ut
ml/prep/relabeling.py
1
3943
from sklearn.cluster import SpectralClustering, AgglomerativeClustering, KMeans from sklearn.neighbors import KNeighborsClassifier from sklearn.base import ClusterMixin from numpy import max, array from scipy.spatial.distance import cdist import itertools class DataBasedLabeling(ClusterMixin): pass class Kn...
mit
tombstone/models
official/vision/detection/utils/object_detection/visualization_utils.py
1
29252
# Copyright 2019 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
mmottahedi/neuralnilm_prototype
scripts/e551.py
2
7824
from __future__ import print_function, division import matplotlib import logging from sys import stdout matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! from neuralnilm import (Net, RealApplianceSource) from neuralnilm.source import (standardise, discretize, fdiff, power_and_fdiff, ...
mit
agentfog/qiime
scripts/print_qiime_config.py
15
35150
#!/usr/bin/env python from __future__ import division __author__ = "Jens Reeder" __copyright__ = "Copyright 2011, The QIIME Project" __credits__ = ["Jens Reeder", "Dan Knights", "Antonio Gonzalez Pena", "Justin Kuczynski", "Jai Ram Rideout", "Greg Caporaso", "Emily TerAvest"] __license__ ...
gpl-2.0
schets/scikit-learn
sklearn/ensemble/tests/test_gradient_boosting_loss_functions.py
221
5517
""" Testing for the gradient boosting loss functions and initial estimators. """ import numpy as np from numpy.testing import assert_array_equal from numpy.testing import assert_almost_equal from numpy.testing import assert_equal from nose.tools import assert_raises from sklearn.utils import check_random_state from ...
bsd-3-clause
vivekmishra1991/scikit-learn
examples/ensemble/plot_adaboost_hastie_10_2.py
355
3576
""" ============================= Discrete versus Real AdaBoost ============================= This example is based on Figure 10.2 from Hastie et al 2009 [1] and illustrates the difference in performance between the discrete SAMME [2] boosting algorithm and real SAMME.R boosting algorithm. Both algorithms are evaluate...
bsd-3-clause
marcocaccin/scikit-learn
benchmarks/bench_plot_svd.py
325
2899
"""Benchmarks of Singular Value Decomposition (Exact and Approximate) The data is mostly low rank but is a fat infinite tail. """ import gc from time import time import numpy as np from collections import defaultdict from scipy.linalg import svd from sklearn.utils.extmath import randomized_svd from sklearn.datasets.s...
bsd-3-clause
liuwenf/moose
modules/porous_flow/doc/tests/mandel.py
6
8844
#!/usr/bin/env python # Solution to Mandel's problem as presented in # AHD Cheng and E Detournay "A direct boundary element method for plane strain poroelasticity" International Journal of Numerical and Analytical Methods in Geomechanics 12 (1988) 551-572 import os import sys import numpy as np import matplotlib.pypl...
lgpl-2.1
NeuroDataDesign/seelviz
Tony/clviz_web_tony_edits/densitygraph.py
1
12529
#!/usr/bin/env python #-*- coding:utf-8 -*- from __future__ import print_function __author__ = 'seelviz' # import matplotlib as mpl # mpl.use('Agg') from skimage import data, img_as_float from skimage import exposure import plotly from plotly.graph_objs import * import cv2 import collections as col import math, o...
apache-2.0
bsipocz/scikit-image
doc/examples/plot_ssim.py
15
2238
""" =========================== Structural similarity index =========================== When comparing images, the mean squared error (MSE)--while simple to implement--is not highly indicative of perceived similarity. Structural similarity aims to address this shortcoming by taking texture into account [1]_, [2]_. T...
bsd-3-clause
xhqu1981/pymatgen
pymatgen/analysis/pourbaix/plotter.py
1
34818
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. from __future__ import division, unicode_literals import platform from matplotlib.font_manager import FontProperties from matplotlib.ticker import FormatStrFormatter """ This module provides classes for plot...
mit
weixsong/algorithm
MLLearn/MLBox/logistic_regression/sms.py
1
2883
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' 通过垃圾短信数据训练Logistic回归模型,并进行留存交叉验证 ''' import re import random import numpy as np import matplotlib.pyplot as plt from logreg_stoch_grad_ascent import LogisticRegressionClassifier ENCODING = 'ISO-8859-1' TRAIN_PERCENTAGE = 0.9 def get_doc_vector(words, vocabulary): ...
mit
DebbyChiang/prospecting-reformat
For-LeadFuze/emails.py
1
1868
#import libraries import pandas as pd import numpy as np #import file prospects = pd.DataFrame(pd.read_csv("/Users/open/Desktop/department.csv")) #Drop rows with no company prospects = prospects.dropna(subset=['Company']) #Copy orange emails into 'Test Email 1' prospects['Test Email 1'] = "" prospects['Test Email...
gpl-2.0
jakirkham/lazyflow
lazyflow/operators/opDetectMissingData.py
1
40074
############################################################################### # lazyflow: data flow based lazy parallel computation framework # # Copyright (C) 2011-2014, the ilastik developers # <team@ilastik.org> # # This program is free software; you can redistribute it and/o...
lgpl-3.0
hunering/demo-code
python/books/DLWP/3.5-reuters.py
1
1163
import numpy as np from keras.datasets import reuters from keras import models from keras import layers from keras import optimizers from keras import losses from keras import metrics from keras.utils import to_categorical from sklearn.model_selection import train_test_split from utils import init_keras, vectorize_sequ...
gpl-3.0
zhengwsh/InplusTrader_Linux
InplusTrader/backtestEngine/model/account/stock_account.py
1
12148
# -*- coding: utf-8 -*- # # Copyright 2017 Ricequant, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
mit
huzq/scikit-learn
sklearn/ensemble/_forest.py
2
95540
""" Forest of trees-based ensemble methods. Those methods include random forests and extremely randomized trees. The module structure is the following: - The ``BaseForest`` base class implements a common ``fit`` method for all the estimators in the module. The ``fit`` method of the base ``Forest`` class calls th...
bsd-3-clause
printedheart/simpleai
simpleai/machine_learning/reinforcement_learning.py
5
6345
# -*- coding: utf-8 -*- from collections import defaultdict, Counter import math import random from simpleai.search.utils import argmax import pickle try: import matplotlib.pyplot as plt import numpy except: plt = None # lint:ok numpy = None # lint:ok def make_at_least_n_times(optimistic_reward, min...
mit
zfrenchee/pandas
pandas/plotting/_core.py
1
99095
# being a bit too dynamic # pylint: disable=E1101 from __future__ import division import warnings import re from collections import namedtuple from distutils.version import LooseVersion import numpy as np from pandas.util._decorators import cache_readonly from pandas.core.base import PandasObject from pandas.core.co...
bsd-3-clause
jungla/ICOM-fluidity-toolbox
Detectors/offline_advection/advect_particles_C_3Db_big.py
1
4082
import os, sys import myfun import numpy as np import lagrangian_stats import scipy.interpolate as interpolate import csv import matplotlib.pyplot as plt import advect_functions import fio from intergrid import Intergrid ## READ archive (too many points... somehow) # args: name, dayi, dayf, days #label = 'm_25_2_512'...
gpl-2.0
mkowoods/deep-learning
weight-initialization/helper.py
153
3649
import numpy as np import matplotlib.pyplot as plt import tensorflow as tf def hist_dist(title, distribution_tensor, hist_range=(-4, 4)): """ Display histogram of a TF distribution """ with tf.Session() as sess: values = sess.run(distribution_tensor) plt.title(title) plt.hist(values, ...
mit
ammarkhann/FinalSeniorCode
lib/python2.7/site-packages/pandas/io/json/json.py
6
24553
# pylint: disable-msg=E1101,W0613,W0603 import os import numpy as np import pandas._libs.json as json from pandas._libs.tslib import iNaT from pandas.compat import StringIO, long, u from pandas import compat, isnull from pandas import Series, DataFrame, to_datetime, MultiIndex from pandas.io.common import get_filepath...
mit
ethantang95/DIGITS
digits/dataset/generic/views.py
3
7099
# Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. from __future__ import absolute_import import os # Find the best implementation available try: from cStringIO import StringIO except ImportError: from StringIO import StringIO import caffe_pb2 import flask import matplotlib as mpl import mat...
bsd-3-clause
sunyihuan326/DeltaLab
Andrew_NG_learning/class_two/week_one/syh_01.py
1
8056
# coding:utf-8 ''' Created on 2017/11/10 @author: sunyihuan ''' import numpy as np import matplotlib.pyplot as plt import sklearn import sklearn.datasets from class_two.week_one.init_utils import sigmoid, relu, compute_loss, forward_propagation, backward_propagation from class_two.week_one.init_utils import update_pa...
mit
smartscheduling/scikit-learn-categorical-tree
examples/linear_model/plot_ard.py
248
2622
""" ================================================== Automatic Relevance Determination Regression (ARD) ================================================== Fit regression model with Bayesian Ridge Regression. See :ref:`bayesian_ridge_regression` for more information on the regressor. Compared to the OLS (ordinary l...
bsd-3-clause
loli/semisupervisedforests
doc/tutorial/text_analytics/solutions/exercise_01_language_train_model.py
254
2253
"""Build a language detector model The goal of this exercise is to train a linear classifier on text features that represent sequences of up to 3 consecutive characters so as to be recognize natural languages by using the frequencies of short character sequences as 'fingerprints'. """ # Author: Olivier Grisel <olivie...
bsd-3-clause
mirestrepo/voxels-at-lems
dbrec3d/bof/general/learn_categories/plot_histograms_in_one.py
1
3335
# -*- coding: utf-8 -*- """ Created on Mon Mar 7 14:38:46 2011 Plot pca test error vs train error @author: - """ # Computes the gaussian gradients on a boxm_alpha_scene import os; import optparse; import time; import sys; import numpy as np import matplotlib.pyplot as plt import glob if __name__=="__main__": ...
bsd-2-clause