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
agile-geoscience/welly
welly/utils.py
1
14357
""" Utility functions for welly. :copyright: 2021 Agile Scientific :license: Apache 2.0 """ import re import glob import warnings import inspect import functools import numpy as np import matplotlib.pyplot as plt import matplotlib.cbook as cbook def deprecated(instructions): """ Flags a method as deprecated...
apache-2.0
jstoxrocky/statsmodels
statsmodels/tsa/statespace/tools.py
19
12762
""" Statespace Tools Author: Chad Fulton License: Simplified-BSD """ from __future__ import division, absolute_import, print_function import numpy as np from statsmodels.tools.data import _is_using_pandas from . import _statespace try: from scipy.linalg.blas import find_best_blas_type except ImportError: # prag...
bsd-3-clause
r-mart/scikit-learn
sklearn/preprocessing/tests/test_function_transformer.py
176
2169
from nose.tools import assert_equal import numpy as np from sklearn.preprocessing import FunctionTransformer def _make_func(args_store, kwargs_store, func=lambda X, *a, **k: X): def _func(X, *args, **kwargs): args_store.append(X) args_store.extend(args) kwargs_store.update(kwargs) ...
bsd-3-clause
yanlend/scikit-learn
sklearn/decomposition/truncated_svd.py
9
7737
"""Truncated SVD for sparse matrices, aka latent semantic analysis (LSA). """ # Author: Lars Buitinck <L.J.Buitinck@uva.nl> # Olivier Grisel <olivier.grisel@ensta.org> # Michael Becker <mike@beckerfuffle.com> # License: 3-clause BSD. import numpy as np import scipy.sparse as sp try: from scipy.sp...
bsd-3-clause
pnedunuri/scikit-learn
sklearn/decomposition/tests/test_dict_learning.py
69
8605
import numpy as np from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_less from sklearn.utils.testing import assert_raises...
bsd-3-clause
jereze/scikit-learn
sklearn/decomposition/tests/test_kernel_pca.py
57
8062
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import (assert_array_almost_equal, assert_less, assert_equal, assert_not_equal, assert_raises) from sklearn.decomposition import PCA, KernelPCA from sklearn.datasets import mak...
bsd-3-clause
JeanKossaifi/scikit-learn
sklearn/tests/test_random_projection.py
79
14035
from __future__ import division import numpy as np import scipy.sparse as sp from sklearn.metrics import euclidean_distances from sklearn.random_projection import johnson_lindenstrauss_min_dim from sklearn.random_projection import gaussian_random_matrix from sklearn.random_projection import sparse_random_matrix from...
bsd-3-clause
ssaeger/scikit-learn
examples/covariance/plot_lw_vs_oas.py
159
2951
""" ============================= Ledoit-Wolf vs OAS estimation ============================= The usual covariance maximum likelihood estimate can be regularized using shrinkage. Ledoit and Wolf proposed a close formula to compute the asymptotically optimal shrinkage parameter (minimizing a MSE criterion), yielding th...
bsd-3-clause
clemkoa/scikit-learn
sklearn/svm/tests/test_sparse.py
63
13366
import numpy as np from scipy import sparse from numpy.testing import (assert_array_almost_equal, assert_array_equal, assert_equal) from sklearn import datasets, svm, linear_model, base from sklearn.datasets import make_classification, load_digits, make_blobs from sklearn.svm.tests import te...
bsd-3-clause
metaml/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/projections/__init__.py
69
2179
from geo import AitoffAxes, HammerAxes, LambertAxes from polar import PolarAxes from matplotlib import axes class ProjectionRegistry(object): """ Manages the set of projections available to the system. """ def __init__(self): self._all_projection_types = {} def register(self, *projections)...
agpl-3.0
wallarelvo/TVD
examples/generate_graph_example.py
2
1548
import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "..")) import tvd import matplotlib.pyplot as plt import networkx as nx def tvd_example(): m = tvd.read_pgm("imgs/strongly_connected.pgm") G, rg, vor = tvd.topo_decomp(m, all_graphs=True) mg = tvd.partition(G, 4) tvd.draw_...
apache-2.0
nlalevee/spark
python/pyspark/sql/group.py
4
10631
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
apache-2.0
jayflo/scikit-learn
sklearn/tests/test_common.py
127
7665
""" General tests for all estimators in sklearn. """ # Authors: Andreas Mueller <amueller@ais.uni-bonn.de> # Gael Varoquaux gael.varoquaux@normalesup.org # License: BSD 3 clause from __future__ import print_function import os import warnings import sys import pkgutil from sklearn.externals.six import PY3 fr...
bsd-3-clause
PyWavelets/pywt
pywt/_doc_utils.py
3
5823
"""Utilities used to generate various figures in the documentation.""" from itertools import product import numpy as np from matplotlib import pyplot as plt from ._dwt import pad __all__ = ['wavedec_keys', 'wavedec2_keys', 'draw_2d_wp_basis', 'draw_2d_fswavedecn_basis', 'boundary_mode_subplot'] def wave...
mit
wzbozon/statsmodels
statsmodels/sandbox/nonparametric/tests/ex_smoothers.py
33
1413
# -*- coding: utf-8 -*- """ Created on Fri Nov 04 10:51:39 2011 @author: josef """ from __future__ import print_function import numpy as np from numpy.testing import assert_almost_equal, assert_equal from statsmodels.sandbox.nonparametric import smoothers, kernels from statsmodels.regression.linear_model import OLS, ...
bsd-3-clause
danche354/Sequence-Labeling
ner_BIOES/senna-hash-2-pos-chunk-gazetteer-no-dropout-128-64-rmsprop5.py
1
7836
from keras.models import Model from keras.layers import Input, Masking, Dense, LSTM from keras.layers import Dropout, TimeDistributed, Bidirectional, merge from keras.layers.embeddings import Embedding from keras.utils import np_utils from keras.optimizers import RMSprop import numpy as np import pandas as pd import ...
mit
466152112/scikit-learn
examples/missing_values.py
233
3056
""" ====================================================== Imputing missing values before building an estimator ====================================================== This example shows that imputing the missing values can give better results than discarding the samples containing any missing value. Imputing does not ...
bsd-3-clause
Parallel-in-Time/pySDC
pySDC/playgrounds/deprecated/Dedalus/periodic_playground_2D_parallel.py
1
5213
import sys import numpy as np import matplotlib.pyplot as plt from mpi4py import MPI from pySDC.helpers.stats_helper import filter_stats, sort_stats from pySDC.implementations.collocation_classes.gauss_radau_right import CollGaussRadau_Right from pySDC.implementations.controller_classes.controller_MPI import controll...
bsd-2-clause
hirofumi0810/tensorflow_end2end_speech_recognition
examples/erato/metrics/attention.py
1
9245
#! /usr/bin/env python # -*- coding: utf-8 -*- """Define evaluation method for the Attention-based model (ERATO corpus).""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import re import numpy as np import pandas as pd from tqdm import tqdm from utils.i...
mit
tedmeeds/tcga_encoder
tcga_encoder/models/pytorch/bootstrap_linear_regression.py
1
2238
import numpy as np import pylab as pp import scipy as sp import sklearn def bootstraps( x, m ): # samples from arange(n) with replacement, m times. #x = np.arange(n, dtype=int) n = len(x) N = np.zeros( (m,n), dtype=int) for i in range(m): N[i,:] = sklearn.utils.resample( x, replace = True ) return ...
mit
benanne/theano-tutorial
3_logistic_regression.py
2
1394
import theano import theano.tensor as T import numpy as np import matplotlib.pyplot as plt plt.ion() import load # load data x_train, t_train, x_test, t_test = load.cifar10(dtype=theano.config.floatX) labels_test = np.argmax(t_test, axis=1) # visualize data plt.imshow(x_train[0].reshape(32, 32), cmap=plt.cm.gray) ...
mit
vibhorag/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
DTMilodowski/SPA_tools
construct_drivers/downscale_rs_data_random_forests.py
1
1110
import numpy as np from sklearn.ensemble import RandomForestRegressor from sklearn.model_selection import train_test_split def downsample_with_randomforest(rs_variables,target_variable,n_trees_in_forest = 100, min_samples_leaf = 50, n_cores = 1): print "\t downsampling with random forest regression" # first of...
gpl-3.0
simondona/img-fft-filter-bec-tn
libraries/imagelab.py
1
47424
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (C) 2014-2016 Simone Donadello # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) an...
gpl-3.0
WafaaT/spark-tk
regression-tests/sparktkregtests/testcases/graph/graph_connected_test.py
11
2429
# vim: set encoding=utf-8 # Copyright (c) 2016 Intel Corporation  # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # #       http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
apache-2.0
winklerand/pandas
pandas/compat/__init__.py
1
12006
""" compat ====== Cross-compatible functions for Python 2 and 3. Key items to import for 2/3 compatible code: * iterators: range(), map(), zip(), filter(), reduce() * lists: lrange(), lmap(), lzip(), lfilter() * unicode: u() [no unicode builtin in Python 3] * longs: long (int in Python 3) * callable * iterable method...
bsd-3-clause
L3nzian/AutoPermit
TmdlGui.py
1
198879
import wx from wx import aui,grid from wx.lib import colourdb import wxmpl_plus import matplotlib.dates import _winreg import TmdlFrame if wx.Platform == '__WXMSW__': import wx.lib.iewin as iewin import TmdlLogic import datetime from dateutil import parser as DateParse, relativedelta as Relative import types from c...
gpl-2.0
pmeier82/SpikePlot
spikeplot/plot_waveforms.py
1
5398
# -*- coding: utf-8 -*- # # spikeplot - plot_waveforms.py # # Philipp Meier <pmeier82 at googlemail dot com> # 2011-09-29 # """scatter plot for clustering data""" __docformat__ = 'restructuredtext' __all__ = ['waveforms'] ##---IMPORTS import scipy as sp from .common import COLOURS, save_figure, check_plotting_handl...
mit
dvro/UnbalancedDataset
examples/under-sampling/plot_nearmiss_1.py
3
1837
""" ========== Nearmiss 1 ========== An illustration of the nearmiss 1 method. """ print(__doc__) import matplotlib.pyplot as plt import seaborn as sns sns.set() # Define some color for the plotting almost_black = '#262626' palette = sns.color_palette() from sklearn.datasets import make_classification from sklear...
mit
phdowling/scikit-learn
examples/ensemble/plot_adaboost_multiclass.py
354
4124
""" ===================================== Multi-class AdaBoosted Decision Trees ===================================== This example reproduces Figure 1 of Zhu et al [1] and shows how boosting can improve prediction accuracy on a multi-class problem. The classification dataset is constructed by taking a ten-dimensional ...
bsd-3-clause
untom/scikit-learn
sklearn/utils/multiclass.py
92
13986
# Author: Arnaud Joly, Joel Nothman, Hamzeh Alsalhi # # License: BSD 3 clause """ Multi-class / multi-label utility function ========================================== """ from __future__ import division from collections import Sequence from itertools import chain import warnings from scipy.sparse import issparse fro...
bsd-3-clause
JFriel/honours_project
venv/lib/python2.7/site-packages/nltk/tbl/demo.py
7
14715
# -*- coding: utf-8 -*- # Natural Language Toolkit: Transformation-based learning # # Copyright (C) 2001-2016 NLTK Project # Author: Marcus Uneson <marcus.uneson@gmail.com> # based on previous (nltk2) version by # Christopher Maloof, Edward Loper, Steven Bird # URL: <http://nltk.org/> # For license information, see...
gpl-3.0
andrewv587/pycharm-project
VOC-CAM.py
1
9896
import glob import keras.backend as K from keras.applications.imagenet_utils import preprocess_input from keras.callbacks import ModelCheckpoint from keras.engine import Input from keras.engine import Model from keras.models import Sequential, load_model from keras.layers.core import Flatten, Dense from keras.layers.c...
apache-2.0
jcchin/Hyperloop_v2
paper/images/trade_scripts/overland_structural_trades_plot.py
4
1193
import numpy as np import matplotlib.pyplot as plt m_pod = np.loadtxt('../data_files/overland_structural_trades/m_pod.txt', delimiter = '\t') A_tube = np.loadtxt('../data_files/overland_structural_trades/A_tube.txt', delimiter = '\t') dx = np.loadtxt('../data_files/overland_structural_trades/dx.txt', delimiter = '\t')...
apache-2.0
shyamalschandra/scikit-learn
examples/cluster/plot_lena_compress.py
271
2229
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Vector Quantization Example ========================================================= The classic image processing example, Lena, an 8-bit grayscale bit-depth, 512 x 512 sized image, is used here to illustrate how ...
bsd-3-clause
passiweinberger/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/font_manager.py
69
42655
""" A module for finding, managing, and using fonts across platforms. This module provides a single :class:`FontManager` instance that can be shared across backends and platforms. The :func:`findfont` function returns the best TrueType (TTF) font file in the local or system font path that matches the specified :class...
agpl-3.0
nvoron23/statsmodels
statsmodels/sandbox/stats/stats_mstats_short.py
34
14910
'''get versions of mstats percentile functions that also work with non-masked arrays uses dispatch to mstats version for difficult cases: - data is masked array - data requires nan handling (masknan=True) - data should be trimmed (limit is non-empty) handle simple cases directly, which doesn't require apply_alon...
bsd-3-clause
cbertinato/pandas
pandas/tests/resample/test_datetime_index.py
1
50749
from datetime import datetime, timedelta from functools import partial from io import StringIO import numpy as np import pytest import pytz from pandas.errors import UnsupportedFunctionCall import pandas as pd from pandas import DataFrame, Series, Timedelta, Timestamp, isna, notna from pandas.core.groupby.grouper im...
bsd-3-clause
jblackburne/scikit-learn
sklearn/mixture/tests/test_gaussian_mixture.py
9
39845
# Author: Wei Xue <xuewei4d@gmail.com> # Thierry Guillemot <thierry.guillemot.work@gmail.com> # License: BSD 3 clauseimport warnings import sys import warnings import numpy as np from scipy import stats, linalg from sklearn.covariance import EmpiricalCovariance from sklearn.datasets.samples_generator import...
bsd-3-clause
swift-lang/swift-e-lab
parsl/monitoring/web_app/apps/workflows.py
1
1514
import pandas as pd import dash_html_components as html from parsl.monitoring.web_app.app import get_db, close_db from parsl.monitoring.web_app.utils import dataframe_to_html_table sql_conn = get_db() layout = html.Div(children=[ html.H1("Workflows"), dataframe_to_html_table(id='workflows_table', ...
apache-2.0
kpj/SDEMotif
reaction_finder.py
1
54567
""" Find reactions via combinatoric investigations of data files """ import os import csv import copy import pickle import random import itertools import collections import numpy as np import pandas as pd import networkx as nx import scipy.stats as scis import seaborn as sns import matplotlib as mpl import matplotli...
mit
liberatorqjw/scikit-learn
sklearn/qda.py
15
7139
""" Quadratic Discriminant Analysis """ # Author: Matthieu Perrot <matthieu.perrot@gmail.com> # # License: BSD 3 clause import warnings import numpy as np from .base import BaseEstimator, ClassifierMixin from .externals.six.moves import xrange from .utils import check_array, check_X_y __all__ = ['QDA'] class QDA...
bsd-3-clause
snowzjx/ns3-buffer-management
src/core/examples/sample-rng-plot.py
188
1246
# -*- Mode:Python; -*- # /* # * This program is free software; you can redistribute it and/or modify # * it under the terms of the GNU General Public License version 2 as # * published by the Free Software Foundation # * # * This program is distributed in the hope that it will be useful, # * but WITHOUT ANY WARRA...
gpl-2.0
davidlmorton/spikepy
spikepy/plotting_utils/import_matplotlib.py
1
1221
# Copyright (C) 2012 David Morton # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distribut...
gpl-3.0
zrhans/pythonanywhere
.virtualenvs/django19/lib/python3.4/site-packages/plotly/matplotlylib/mplexporter/tools.py
75
1732
""" Tools for matplotlib plot exporting """ def ipynb_vega_init(): """Initialize the IPython notebook display elements This function borrows heavily from the excellent vincent package: http://github.com/wrobstory/vincent """ try: from IPython.core.display import display, HTML except I...
apache-2.0
igryski/TRMM_blend
src/satellite/remove_SEA_points_from_TRMM.py
1
3930
# ============================================= # Remove all sea points from all TRMM data # Author: I.Stepanov # : KNMI # : 16.08.2016. # ============================================= # Load python modules import netCDF4 import pylab as pl import numpy as np import matplotlib as mpl import matplotlib.pyplot as ...
gpl-3.0
xbresson/graph_convnets_pytorch
lib/coarsening.py
1
9169
import numpy as np import scipy.sparse import sklearn.metrics def laplacian(W, normalized=True): """Return graph Laplacian""" # Degree matrix. d = W.sum(axis=0) # Laplacian matrix. if not normalized: D = scipy.sparse.diags(d.A.squeeze(), 0) L = D - W else: d += np.spa...
mit
sergpolly/Thermal_adapt_scripts
ArchNew/DONE_extract_asm_termo.py
1
5627
import pandas as pd import numpy as np import re from fuzzywuzzy import fuzz from fuzzywuzzy import process import copy # archaea genomes description from /ftp...ncbi/genomes/genbank/archaea/... asm = pd.read_csv("assembly_summary_arch_ncbi.txt",sep='\t') # # geomes description and connection with organism names/assem...
mit
aleksandr-bakanov/astropy
astropy/convolution/utils.py
3
10909
# Licensed under a 3-clause BSD style license - see LICENSE.rst import ctypes import numpy as np from astropy.modeling.core import FittableModel, custom_model __all__ = ['discretize_model'] class DiscretizationError(Exception): """ Called when discretization of models goes wrong. """ class KernelSizeE...
bsd-3-clause
castelao/AutoQC
util/benchmarks.py
3
4332
import util.combineTests as combinatorics import matplotlib.pyplot as plt import numpy as np def compare_to_truth(combos, trueResult): '''Given the results from all the possible combinations of tests (combos) and a set of truth results (trueResult), the false positive rate and the true positive rate ...
mit
sarathid/Python-works
Intro_to_ML/tools/startup.py
6
1170
#!/usr/bin/python print print "checking for nltk" try: import nltk except ImportError: print "you should install nltk before continuing" print "checking for numpy" try: import numpy except ImportError: print "you should install numpy before continuing" print "checking for scipy" try: import scipy...
gpl-3.0
ThunderShiviah/runtime_visualizer
rtviz/main.py
1
3371
from time import time from random import randrange from concurrent.futures import ThreadPoolExecutor from functools import partial from matplotlib import pyplot as plt def func_timer(func, *params, verbose=False): """Takes in a function and some parameters to the function and returns the execution time""" ...
mit
samzhang111/scikit-learn
sklearn/ensemble/gradient_boosting.py
4
69888
"""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
ContinuumIO/dask
dask/array/numpy_compat.py
1
11515
from distutils.version import LooseVersion import numpy as np import warnings from ..utils import derived_from _numpy_115 = LooseVersion(np.__version__) >= "1.15.0" _numpy_116 = LooseVersion(np.__version__) >= "1.16.0" _numpy_117 = LooseVersion(np.__version__) >= "1.17.0" _numpy_118 = LooseVersion(np.__version__) >=...
bsd-3-clause
jnmclarty/trump
trump/test/test_orm.py
2
17330
from trump.orm import Symbol, SetupTrump, SymbolManager, ConversionManager, \ SymbolLogEvent from trump.templating.templates import GoogleFinanceFT, YahooFinanceFT,\ SimpleExampleMT, CSVFT, FFillIT, FeedsMatchVT, DateExistsVT, PctChangeMT import pandas as pd import pytest from pytest import mark...
bsd-3-clause
nikdavis/livefft
fft_tones.py
1
4210
import matplotlib #required by OS X, must be done before other matplotlib imports matplotlib.use('TKAgg') from cmath import exp from math import pi, log10 import matplotlib.pyplot as plt from matplotlib import animation import pyaudio import struct import sys #based on wikipedia's FFT psuedocode, expects floats def f...
mit
saiwing-yeung/scikit-learn
examples/decomposition/plot_pca_vs_lda.py
176
2027
""" ======================================================= Comparison of LDA and PCA 2D projection of Iris dataset ======================================================= The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour and Virginica) with 4 attributes: sepal length, sepal width, petal length a...
bsd-3-clause
Duke-QCD/freestream
animate.py
1
3294
#!/usr/bin/env python3 import argparse import multiprocessing import sys # workaround possible backend bug import matplotlib matplotlib.use('agg') import numpy as np import h5py import matplotlib.pyplot as plt import matplotlib.animation as anim import freestream class RepeatingFreeStreamer: def __init__(self,...
mit
pslacerda/GromacsWrapper
gromacs/utilities.py
1
21856
# GromacsWrapper: utilities.py # Copyright (c) 2009 Oliver Beckstein <orbeckst@gmail.com> # Released under the GNU Public License 3 (or higher, your choice) # See the file COPYING for details. """ :mod:`gromacs.utilities` -- Helper functions and classes ======================================================== The mod...
gpl-3.0
YinongLong/scikit-learn
sklearn/tests/test_learning_curve.py
59
10869
# Author: Alexander Fabisch <afabisch@informatik.uni-bremen.de> # # License: BSD 3 clause import sys from sklearn.externals.six.moves import cStringIO as StringIO import numpy as np import warnings from sklearn.base import BaseEstimator from sklearn.utils.testing import assert_raises from sklearn.utils.testing import ...
bsd-3-clause
nruggero/Standard-curve-analysis
generate_peptide_plot.py
1
3923
import subprocess import os import argparse import csv from collections import OrderedDict import matplotlib matplotlib.use("Agg") from matplotlib import pyplot as plt import numpy as np NCOL = 3 def main(input_directory, output_directory): # Get all files in input directory input_files = os.listdir(input_director...
mit
Huyuwei/tvm
tutorials/frontend/deploy_ssd_gluoncv.py
1
4348
# 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
murali-munna/scikit-learn
examples/cluster/plot_kmeans_stability_low_dim_dense.py
338
4324
""" ============================================================ Empirical evaluation of the impact of k-means initialization ============================================================ Evaluate the ability of k-means initializations strategies to make the algorithm convergence robust as measured by the relative stan...
bsd-3-clause
gibiansky/tensorflow
tensorflow/python/client/notebook.py
33
4608
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
benizl/pymoku
examples/basic_phasemeter.py
1
4514
# # pymoku example: Phasemeter networking streaming # # This example provides a network stream of Phasemeter # data samples from Channel 1 and Channel 2. These samples # are output in the form (I,Q,F,phi,counter) for each channel. # # (c) 2016 Liquid Instruments Pty. Ltd. # # The phasemeter is a little more complex th...
mit
lindsayberry/lindsayberry.github.io
markdown_generator/talks.py
199
4000
# coding: utf-8 # # Talks markdown generator for academicpages # # Takes a TSV of talks with metadata and converts them for use with [academicpages.github.io](academicpages.github.io). This is an interactive Jupyter notebook ([see more info here](http://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/what_i...
mit
ArteliaTelemac/PostTelemac
PostTelemac/meshlayerparsers/libs_telemac/parsers/parserSELAFIN.py
1
56945
"""@author Christopher J. Cawthorn and Sebastien E. Bourban """ """@note ... this work is based on a collaborative effort between .________. ,--. HR Wallingford | | EDF - LNHE . ( ( Bundesanstalt fur +- -+ ...
gpl-3.0
Midafi/scikit-image
doc/examples/plot_watershed.py
7
2336
""" ====================== Watershed segmentation ====================== The watershed is a classical algorithm used for **segmentation**, that is, for separating different objects in an image. Starting from user-defined markers, the watershed algorithm treats pixels values as a local topography (elevation). The algo...
bsd-3-clause
cowlicks/dask
dask/dataframe/partitionquantiles.py
1
18529
"""Determine new partition divisions using approximate percentiles. We use a custom algorithm to calculate approximate, evenly-distributed percentiles of arbitrarily-ordered data for any dtype in a distributed fashion with one pass over the data. This is used to determine new partition divisions when changing the ind...
bsd-3-clause
Tiggels/opencog
opencog/python/spatiotemporal/temporal_events/membership_function.py
34
4673
from math import fabs from random import random from scipy.stats.distributions import rv_frozen from spatiotemporal.time_intervals import TimeInterval from spatiotemporal.unix_time import random_time, UnixTime from utility.generic import convert_dict_to_sorted_lists from utility.functions import Function, FunctionPiece...
agpl-3.0
akalicki/genomics-snack-to-sequence
quality-assessment/group3_report1_question8.py
1
1830
""" Usage: (python) group3_report1_question8.py Takes in 2d_files.txt and times.txt from group3_report1_question8.sh Matches files with those in tabular that are 2d. Extracts read_length and unix_timestamp from times nanopore function. Makes a scatter plot with the data. Run these commands before: poretools tabular -q...
gpl-2.0
ales-erjavec/scipy
scipy/interpolate/ndgriddata.py
45
7161
""" Convenience interface to N-D interpolation .. versionadded:: 0.9 """ from __future__ import division, print_function, absolute_import import numpy as np from .interpnd import LinearNDInterpolator, NDInterpolatorBase, \ CloughTocher2DInterpolator, _ndim_coords_from_arrays from scipy.spatial import cKDTree _...
bsd-3-clause
ferasboulala/Robot_Project
Robot_Project_GUI/Robot.py
1
11000
from tkinter import * from tkinter.messagebox import * from HW_Classes import * import time, _thread, pigpio, matplotlib, math, os, numpy as np matplotlib.use("TkAgg") import matplotlib.pyplot as plt from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg # The following function works on my desktop ...
gpl-3.0
rrohan/scikit-learn
sklearn/cluster/bicluster.py
211
19443
"""Spectral biclustering algorithms. Authors : Kemal Eren License: BSD 3 clause """ from abc import ABCMeta, abstractmethod import numpy as np from scipy.sparse import dia_matrix from scipy.sparse import issparse from . import KMeans, MiniBatchKMeans from ..base import BaseEstimator, BiclusterMixin from ..external...
bsd-3-clause
PALab/pyjamaseis
pyjamaseis/pyjamaseisv1.0.py
1
40544
#================================================================================================================= # Structure of PyjAmaseis # # - IMPORTS # - STATION INFORMATION USER INTERFACE CODE (class myFrame4) # - SECONDARY OPTIONS UI WINDOW CODE (class selectionWindow) # - alignToBottomRight Function - aligns s...
gpl-2.0
kaichogami/scikit-learn
sklearn/decomposition/truncated_svd.py
30
7896
"""Truncated SVD for sparse matrices, aka latent semantic analysis (LSA). """ # Author: Lars Buitinck <L.J.Buitinck@uva.nl> # Olivier Grisel <olivier.grisel@ensta.org> # Michael Becker <mike@beckerfuffle.com> # License: 3-clause BSD. import numpy as np import scipy.sparse as sp try: from scipy.sp...
bsd-3-clause
mantidproject/mantid
scripts/test/MultiPlotting/Gridspec_test.py
3
1317
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + from...
gpl-3.0
xiaoxiamii/scikit-learn
sklearn/decomposition/tests/test_fastica.py
272
7798
""" Test the fastica algorithm. """ import itertools import warnings import numpy as np from scipy import stats from nose.tools import assert_raises from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_true from skl...
bsd-3-clause
swook/autocrop
suitability/Trainer.py
1
2972
from multiprocessing import cpu_count from sklearn import svm from sklearn.externals import joblib from sklearn.grid_search import GridSearchCV from sklearn.linear_model import LassoCV from sklearn.preprocessing import StandardScaler import numpy as np import config class Trainer: clf = None svm = None ...
mit
pianomania/scikit-learn
examples/svm/plot_oneclass.py
80
2338
""" ========================================== One-class SVM with non-linear kernel (RBF) ========================================== An example using a one-class SVM for novelty detection. :ref:`One-class SVM <svm_outlier_detection>` is an unsupervised algorithm that learns a decision function for novelty detection: ...
bsd-3-clause
kazemakase/scikit-learn
examples/classification/plot_digits_classification.py
289
2397
""" ================================ Recognizing hand-written digits ================================ An example showing how the scikit-learn can be used to recognize images of hand-written digits. This example is commented in the :ref:`tutorial section of the user manual <introduction>`. """ print(__doc__) # Autho...
bsd-3-clause
vberaudi/scipy
scipy/stats/stats.py
18
169352
# Copyright (c) Gary Strangman. All rights reserved # # Disclaimer # # This software is provided "as-is". There are no expressed or implied # warranties of any kind, including, but not limited to, the warranties # of merchantability and fitness for a given application. In no event # shall Gary Strangman be liable fo...
bsd-3-clause
rexshihaoren/scikit-learn
sklearn/decomposition/nmf.py
15
19103
""" Non-negative matrix factorization """ # Author: Vlad Niculae # Lars Buitinck <L.J.Buitinck@uva.nl> # Author: Chih-Jen Lin, National Taiwan University (original projected gradient # NMF implementation) # Author: Anthony Di Franco (original Python and NumPy port) # License: BSD 3 clause from __future__ ...
bsd-3-clause
laurensstoop/HiSPARC-BONZ
egg/legacy/egg_saskia_v2.1_multifile.py
1
3693
# -*- coding: utf-8 -*- """ =================================== Created on Thu Mar 24 13:17:57 2016 @author: Laurens Stoop =================================== """ ################################## HEADER ################################## """ Import of Packages """ import sapphire # The HiSparc Python Framework ...
gpl-3.0
johnmgregoire/NanoCalorimetry
accal_mcattempt.py
1
2195
import numpy, h5py, pylab, copy from PnSC_h5io import * from PnSC_math import * from matplotlib.ticker import FuncFormatter def myexpformat(x, pos): for ndigs in range(5): lab=(('%.'+'%d' %ndigs+'e') %x).replace('e+0','e').replace('e+','e').replace('e0','').replace('e-0','e-') if eval(lab)==x: ...
bsd-3-clause
nelango/ViralityAnalysis
model/lib/pandas/computation/ops.py
9
15234
"""Operator classes for eval. """ import operator as op from functools import partial from datetime import datetime import numpy as np import pandas as pd from pandas.compat import PY3, string_types, text_type import pandas.core.common as com from pandas.core.base import StringMixin from pandas.computation.common im...
mit
AlexRobson/scikit-learn
examples/neighbors/plot_approximate_nearest_neighbors_hyperparameters.py
227
5170
""" ================================================= Hyper-parameters of Approximate Nearest Neighbors ================================================= This example demonstrates the behaviour of the accuracy of the nearest neighbor queries of Locality Sensitive Hashing Forest as the number of candidates and the numb...
bsd-3-clause
moonbury/pythonanywhere
github/Numpy/Chapter9/emalegend.py
2
1648
from matplotlib.finance import quotes_historical_yahoo from matplotlib.dates import DateFormatter from matplotlib.dates import DayLocator from matplotlib.dates import MonthLocator import sys from datetime import date import matplotlib.pyplot as plt import numpy as np today = date.today() start = (today.year - 1, today...
gpl-3.0
tarthy6/dozer-thesis
py/pre/horse.py
3
11731
# encoding: utf-8 from woo.dem import * from woo.fem import * import woo.core import woo.dem import woo.pyderived import woo.models import math from minieigen import * class FallingHorse(woo.core.Preprocessor,woo.pyderived.PyWooObject): '''Preprocessor for the falling horse simulation. The falling horse is historica...
gpl-2.0
niltonlk/nest-simulator
pynest/examples/clopath_synapse_small_network.py
8
7493
# -*- coding: utf-8 -*- # # clopath_synapse_small_network.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 ...
gpl-2.0
rpcoelho17/Simulated-Annealing
RodsAnnealMultiV2_2.py
1
27872
from __future__ import print_function import numpy as np import math import csv import time from matplotlib import cm import matplotlib.animation as animation from matplotlib.ticker import LinearLocator, FormatStrFormatter from mpl_toolkits.mplot3d import axis3d import matplotlib.pyplot as plt import random ...
bsd-3-clause
zorojean/scikit-learn
sklearn/feature_extraction/tests/test_dict_vectorizer.py
276
3790
# Authors: Lars Buitinck <L.J.Buitinck@uva.nl> # Dan Blanchard <dblanchard@ets.org> # License: BSD 3 clause from random import Random import numpy as np import scipy.sparse as sp from numpy.testing import assert_array_equal from sklearn.utils.testing import (assert_equal, assert_in, ...
bsd-3-clause
dyoung418/tensorflow
tensorflow/python/estimator/inputs/queues/feeding_functions_test.py
59
13552
# 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
lucidfrontier45/scikit-learn
examples/covariance/plot_outlier_detection.py
2
3866
""" ========================================== Outlier detection with several methods. ========================================== This example illustrates two ways of performing :ref:`outlier_detection` when the amount of contamination is known: - based on a robust estimator of covariance, which is assuming that the ...
bsd-3-clause
huangziwei/MorphoPy
morphopy/_utils/utils.py
1
13733
import numpy as np import pandas as pd import networkx as nx from copy import deepcopy import logging from .summarize import * def get_logger(loglevel): """ Log out useful or debug infos. Parameters --------- loglevel: str 'debug', 'info', 'warning', 'error', 'critical'. Returns ...
mit
jm-begon/scikit-learn
sklearn/preprocessing/tests/test_data.py
113
38432
import warnings import numpy as np import numpy.linalg as la from scipy import sparse from distutils.version import LooseVersion from sklearn.utils.testing import assert_almost_equal, clean_warning_registry from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_array_equal...
bsd-3-clause
LennonLab/simplex
tools/SADfits/SADfits.py
9
3639
from __future__ import division import matplotlib.pyplot as plt import sys import os from random import shuffle import numpy as np ########### PATHS ############################################################## mydir = os.path.expanduser("~/GitHub/residence-time") tools = os.path.expanduser(mydir + "/tools") sys.p...
mit
wanggang3333/scikit-learn
examples/classification/plot_lda_qda.py
164
4806
""" ==================================================================== 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
rudaoshi/keras
examples/kaggle_otto_nn.py
70
3775
from __future__ import absolute_import from __future__ import print_function import numpy as np import pandas as pd np.random.seed(1337) # for reproducibility from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation from keras.layers.normalization import BatchNormalization from ke...
mit
nvoron23/scikit-learn
sklearn/datasets/tests/test_20news.py
280
3045
"""Test the 20news downloader, if the data is available.""" import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import SkipTest from sklearn import datasets def test_20news(): try: data = dat...
bsd-3-clause