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 |
|---|---|---|---|---|---|
dwhswenson/openpathsampling | openpathsampling/numerics/histogram.py | 2 | 26899 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import math
from .lookup_function import LookupFunction, VoxelLookupFunction
import collections
import warnings
from functools import reduce
class SparseHistogram(object):
"""
Base class for sparse-based histograms.
Parameters
---... | mit |
iShoto/testpy | codes/20200106_metric_learning_cifar10/src/utils/visualizer.py | 2 | 1085 | import visdom
import time
import numpy as np
from matplotlib import pyplot as plt
from sklearn.metrics import roc_curve
class Visualizer(object):
def __init__(self, env='default', **kwargs):
self.vis = visdom.Visdom(env=env, **kwargs)
self.vis.close()
self.iters = {}
self.lines =... | mit |
DougBurke/astropy | examples/io/plot_fits-image.py | 3 | 1938 | # -*- coding: utf-8 -*-
"""
=======================================
Read and plot an image from a FITS file
=======================================
This example opens an image stored in a FITS file and displays it to the screen.
This example uses `astropy.utils.data` to download the file, `astropy.io.fits` to open
th... | bsd-3-clause |
BorisJeremic/Real-ESSI-Examples | analytic_solution/test_cases/Contact/Interface_Mesh_Types/Interface_2/HardContact_ElPPlShear/Interface_Test_Shear_Plot.py | 23 | 3513 | #!/usr/bin/python
import h5py
import matplotlib.pylab as plt
import matplotlib as mpl
import sys
import numpy as np;
plt.rcParams.update({'font.size': 28})
# set tick width
mpl.rcParams['xtick.major.size'] = 10
mpl.rcParams['xtick.major.width'] = 5
mpl.rcParams['xtick.minor.size'] = 10
mpl.rcParams['xtick.minor.width... | cc0-1.0 |
terkkila/scikit-learn | examples/cluster/plot_agglomerative_clustering.py | 343 | 2931 | """
Agglomerative clustering with and without structure
===================================================
This example shows the effect of imposing a connectivity graph to capture
local structure in the data. The graph is simply the graph of 20 nearest
neighbors.
Two consequences of imposing a connectivity can be s... | bsd-3-clause |
TGAC/KAT | scripts/kat/plot/cold.py | 1 | 5566 | #!/usr/bin/env python3
import argparse
import matplotlib.patches as mpatches
import matplotlib.lines as mlines
from matplotlib.ticker import ScalarFormatter
import math
from scipy import stats
try:
from misc import *
except:
from kat.plot.misc import *
def main():
# ----- command line parsing -----
... | gpl-3.0 |
yaroslavvb/tensorflow | tensorflow/contrib/learn/__init__.py | 3 | 2093 | # 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 |
ashhher3/scikit-learn | sklearn/decomposition/__init__.py | 99 | 1331 | """
The :mod:`sklearn.decomposition` module includes matrix decomposition
algorithms, including among others PCA, NMF or ICA. Most of the algorithms of
this module can be regarded as dimensionality reduction techniques.
"""
from .nmf import NMF, ProjectedGradientNMF
from .pca import PCA, RandomizedPCA
from .incrementa... | bsd-3-clause |
ishanic/scikit-learn | examples/neighbors/plot_species_kde.py | 282 | 4059 | """
================================================
Kernel Density Estimate of Species Distributions
================================================
This shows an example of a neighbors-based query (in particular a kernel
density estimate) on geospatial data, using a Ball Tree built upon the
Haversine distance metric... | bsd-3-clause |
BrechtBa/plottools | plottools/cm/hotwater.py | 1 | 13692 |
from matplotlib.colors import ListedColormap
from numpy import nan, inf
# Used to reconstruct the colormap in viscm
parameters = {'xp': [1.2291944322885904, 15.686577994354849, 30.928398202273232, 36.957902166964374, 39.352619720280053, 37.854922859529893],
'yp': [-17.104696078108354, -28.20005858230811... | gpl-2.0 |
yunque/sms-tools | lectures/04-STFT/plots-code/blackman-even-odd.py | 24 | 1481 | import matplotlib.pyplot as plt
import numpy as np
from scipy.fftpack import fft, fftshift
from scipy import signal
M = 32
N = 128
hN = N/2
hM = M/2
fftbuffer = np.zeros(N)
w = signal.blackman(M)
plt.figure(1, figsize=(9.5, 6))
plt.subplot(3,2,1)
plt.plot(np.arange(-hM, hM), w, 'b', lw=1.5)
plt.axis([-hM, hM-1,... | agpl-3.0 |
aewhatley/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 |
b1quint/samfp | other/find_airy_circles.py | 1 | 9357 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from scipy import ndimage
import cv2
import matplotlib as mpl
import matplotlib.pyplot as plt
from fptools.fpreduc import pyadhoc
import copy
import ipdb
#from mpfit import mpfit
import mpyfit
#from scipy.optimize import curve_fit
#import lmfit
def ga... | bsd-3-clause |
dandanvidi/effective-capacity | scripts/correlations.py | 3 | 1725 | import matplotlib.pyplot as plt
import sys, os
sys.path.append(os.path.expanduser('~/git/kvivo_max/scripts/'))
#from catalytic_rates import rates
from cobra.io.sbml import create_cobra_model_from_sbml_file
from cobra.manipulation.modify import convert_to_irreversible
import pandas as pd
import numpy as np
from helper i... | mit |
msampathkumar/datadriven_pumpit | scripts/sam_variance_check.py | 1 | 3830 | """Feature selection tools for variance thresholds check on dataframes.
Using skelarn.feature_selection.VarianceThreshold, created a minor function
to know more about details.
"""
import numpy as np
import pandas as pd
from sklearn.feature_selection import VarianceThreshold
def get_low_variance_columns(dframe=None... | apache-2.0 |
knossos-project/knossos_python_tools | knossos_utils/synapses.py | 3 | 81958 | ################################################################################
# This file provides a functions and classes for working with synapse annotations.
# and writing raw and overlay data.
#
# (C) Copyright 2017
# Max-Planck-Gesellschaft zur Foerderung der Wissenschaften e.V.
#
# synapses.py is free sof... | gpl-2.0 |
shikhardb/scikit-learn | benchmarks/bench_sparsify.py | 323 | 3372 | """
Benchmark SGD prediction time with dense/sparse coefficients.
Invoke with
-----------
$ kernprof.py -l sparsity_benchmark.py
$ python -m line_profiler sparsity_benchmark.py.lprof
Typical output
--------------
input data sparsity: 0.050000
true coef sparsity: 0.000100
test data sparsity: 0.027400
model sparsity:... | bsd-3-clause |
Rubenknex/qtplot | qtplot/linecut.py | 1 | 12835 | import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import textwrap
from itertools import cycle
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg, NavigationToolbar2QT
from PyQt4 import QtGui, QtCore
from .util import FixedOrderFormatter, eng_format
class Linetrace(plt.L... | mit |
mne-tools/mne-tools.github.io | 0.15/_downloads/plot_3d_to_2d.py | 1 | 4539 | """
====================================================
How to convert 3D electrode positions to a 2D image.
====================================================
Sometimes we want to convert a 3D representation of electrodes into a 2D
image. For example, if we are using electrocorticography it is common to
create sca... | bsd-3-clause |
rvraghav93/scikit-learn | examples/plot_compare_reduction.py | 45 | 4959 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
=================================================================
Selecting dimensionality reduction with Pipeline and GridSearchCV
=================================================================
This example constructs a pipeline that does dimensionality
reduction f... | bsd-3-clause |
ahaberlie/MetPy | examples/sigma_to_pressure_interpolation.py | 3 | 3544 | # Copyright (c) 2017,2018 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""
===============================
Sigma to Pressure Interpolation
===============================
By using `metpy.calc.log_interp`, data with sigma as the vertical coordinate... | bsd-3-clause |
xasopheno/audio_visual | audio/Detection/parabolic.py | 1 | 1616 | # -*- coding: utf-8 -*-
from __future__ import division
from numpy import polyfit, arange
def parabolic(f, x):
"""Quadratic interpolation for estimating the true position of an
inter-sample maximum when nearby samples are known.
f is a vector and x is an index for that vector.
Returns (vx, vy), the ... | mit |
kenjyoung/MinAtar | examples/plot_return.py | 1 | 6487 | ################################################################################################################
# Authors: #
# Kenny Young (kjyoung@ualberta.ca) ... | gpl-3.0 |
gritlogic/incubator-airflow | docs/conf.py | 33 | 8957 | # -*- coding: utf-8 -*-
#
# Airflow documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 9 20:50:01 2014.
#
# 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.
#
# A... | apache-2.0 |
Knight13/Exploring-Deep-Neural-Decision-Trees | Covertype/NNDT_RF.py | 1 | 2646 | import numpy as np
import tensorflow as tf
import random
from neural_network_decision_tree import nn_decision_tree
from joblib import Parallel, delayed
"""train_data and test_data are list containg the X_train, y_train and X_test, y_test
obatined after splitting the data set using sklearn.model_selection.train_tes... | unlicense |
datapythonista/pandas | pandas/tests/indexes/categorical/test_constructors.py | 2 | 6229 | import numpy as np
import pytest
from pandas import (
Categorical,
CategoricalDtype,
CategoricalIndex,
Index,
)
import pandas._testing as tm
class TestCategoricalIndexConstructors:
def test_construction_without_data_deprecated(self):
# Once the deprecation is enforced, we can add this cas... | bsd-3-clause |
hsuantien/scikit-learn | examples/exercises/plot_cv_digits.py | 232 | 1206 | """
=============================================
Cross-validation on Digits Dataset Exercise
=============================================
A tutorial exercise using Cross-validation with an SVM on the Digits dataset.
This exercise is used in the :ref:`cv_generators_tut` part of the
:ref:`model_selection_tut` section... | bsd-3-clause |
glouppe/scikit-learn | sklearn/utils/tests/test_extmath.py | 19 | 21979 | # Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Denis Engemann <d.engemann@fz-juelich.de>
#
# License: BSD 3 clause
import numpy as np
from scipy import sparse
from scipy import linalg
from scipy import stats
from sklearn.utils.testing import assert_eq... | bsd-3-clause |
nkeim/trackpy | exmaples/identification_example.py | 1 | 1740 | #Copyright 2013 Thomas A Caswell
#tcaswell@uchicago.edu
#http://jfi.uchicago.edu/~tcaswell
#
#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 |
openpathsampling/openpathsampling | openpathsampling/step_visualizer_2D.py | 2 | 4280 | import matplotlib
import matplotlib.pyplot as plt
import openpathsampling as paths
import logging
logger = logging.getLogger(__name__)
class StepVisualizer2D(object):
def __init__(self, network, cv_x, cv_y, xlim, ylim, output_directory=None):
self.network = network
self.cv_x = cv_x
self.cv... | mit |
jkarnows/scikit-learn | sklearn/covariance/tests/test_graph_lasso.py | 272 | 5245 | """ Test the graph_lasso module.
"""
import sys
import numpy as np
from scipy import linalg
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_array_less
from sklearn.covariance import (graph_lasso, GraphLasso, GraphLassoCV,
empirical_... | bsd-3-clause |
arahuja/scikit-learn | examples/mixture/plot_gmm_pdf.py | 284 | 1528 | """
=============================================
Density Estimation for a mixture of Gaussians
=============================================
Plot the density estimation of a mixture of two Gaussians. Data is
generated from two Gaussians with different centers and covariance
matrices.
"""
import numpy as np
import ma... | bsd-3-clause |
wdecoster/nanoget | nanoget/extraction_functions.py | 1 | 18527 | import logging
from functools import reduce
import nanoget.utils as ut
import pandas as pd
import sys
import pysam
import re
from Bio import SeqIO
import concurrent.futures as cfutures
from itertools import repeat
def process_summary(summaryfile, **kwargs):
"""Extracting information from an albacore summary file.... | gpl-3.0 |
Novartis/yap | bin/yap_tools.py | 1 | 60942 | #!/usr/bin/env python
"""
Copyright 2014 Novartis Institutes for Biomedical Research
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 ... | apache-2.0 |
igryski/TRMM_blend | src/blend/lu_et_al_2003_blend.py | 1 | 9612 | # Make python script executable
#!/usr/bin/python
# ioa_first_blend.py
# Method of Intellective Objective Analysis (Lu et al, 2003)
# is applied to TRMM v.7 gridded precipitation dataset to merge
# with the SACA database station data.
# Paper:
# A fusing technique with satellite precipitation estimate and raingauge... | gpl-3.0 |
abhisg/scikit-learn | sklearn/utils/tests/test_class_weight.py | 90 | 12846 | import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.datasets import make_blobs
from sklearn.utils.class_weight import compute_class_weight
from sklearn.utils.class_weight import compute_sample_weight
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testin... | bsd-3-clause |
hsiaoyi0504/scikit-learn | examples/neighbors/plot_digits_kde_sampling.py | 251 | 2022 | """
=========================
Kernel Density Estimation
=========================
This example shows how kernel density estimation (KDE), a powerful
non-parametric density estimation technique, can be used to learn
a generative model for a dataset. With this generative model in place,
new samples can be drawn. These... | bsd-3-clause |
wp-lai/xmachinelearning | models/logistic_regression/plot.py | 1 | 1101 | import numpy as np
import matplotlib.pyplot as plt
from logistic import LogisticRegression
# read data
X = np.loadtxt('logistic_x.txt')
y = np.loadtxt('logistic_y.txt')
# build model
lr = LogisticRegression()
lr.fit(X, y)
y_ = lr.predict(X)
# create a mesh to plot in
x_min, x_max = X[:, 0].min() - 1, X[:, 0].max() +... | mit |
mlyundin/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 |
swharden/SWHLab | swhlab/analysis/protocols.py | 1 | 26224 | """
scripts to help automated analysis of basic protocols.
All output data should be named:
* 12345678_experiment_thing.jpg (time course experiment, maybe with drug)
* 12345678_intrinsic_thing.jpg (any intrinsic property)
* 12345678_micro_thing.jpg (anything copied, likely a micrograph)
* 12345678_data... | mit |
eaplatanios/tensorflow | tensorflow/python/estimator/canned/dnn_linear_combined_test.py | 11 | 33691 | # 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 |
dimroc/tensorflow-mnist-tutorial | lib/python3.6/site-packages/matplotlib/backends/backend_gdk.py | 10 | 17086 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import math
import os
import sys
import warnings
def fn_name(): return sys._getframe(1).f_code.co_name
import gobject
import gtk; gdk = gtk.gdk
import pango
pygtk_version_required = (2,2,0)
if gtk.... | apache-2.0 |
lmallin/coverage_test | python_venv/lib/python2.7/site-packages/pandas/tests/indexes/period/test_partial_slicing.py | 19 | 5909 | import pytest
import numpy as np
import pandas as pd
from pandas.util import testing as tm
from pandas import (Series, period_range, DatetimeIndex, PeriodIndex,
DataFrame, _np_version_under1p12, Period)
class TestPeriodIndex(object):
def setup_method(self, method):
pass
def tes... | mit |
datapythonista/pandas | pandas/tests/indexes/test_engines.py | 3 | 8922 | import re
import numpy as np
import pytest
from pandas._libs import (
algos as libalgos,
index as libindex,
)
import pandas as pd
import pandas._testing as tm
@pytest.fixture(
params=[
(libindex.Int64Engine, np.int64),
(libindex.Int32Engine, np.int32),
(libindex.Int16Engine, np.... | bsd-3-clause |
calberti/models | autoencoder/MaskingNoiseAutoencoderRunner.py | 10 | 1689 | import numpy as np
import sklearn.preprocessing as prep
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
from autoencoder.autoencoder_models.DenoisingAutoencoder import MaskingNoiseAutoencoder
mnist = input_data.read_data_sets('MNIST_data', one_hot = True)
def standard_scale(X_trai... | apache-2.0 |
mcanthony/airflow | airflow/www/app.py | 1 | 69924 | from __future__ import print_function
from __future__ import division
from builtins import str
from past.builtins import basestring
from past.utils import old_div
import copy
from datetime import datetime, timedelta
import dateutil.parser
from functools import wraps
import inspect
import json
import logging
import os
i... | apache-2.0 |
thomasaarholt/hyperspy | hyperspy/tests/drawing/test_plot_widgets.py | 3 | 10577 | # -*- coding: utf-8 -*-
# Copyright 2007-2020 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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... | gpl-3.0 |
GuessWhoSamFoo/pandas | pandas/tests/series/test_period.py | 2 | 6121 | import numpy as np
import pytest
import pandas as pd
from pandas import DataFrame, Period, Series, period_range
from pandas.core.arrays import PeriodArray
import pandas.util.testing as tm
class TestSeriesPeriod(object):
def setup_method(self, method):
self.series = Series(period_range('2000-01-01', peri... | bsd-3-clause |
ninotoshi/tensorflow | tensorflow/examples/skflow/text_classification_character_rnn.py | 9 | 2530 | # Copyright 2015-present The Scikit Flow 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 require... | apache-2.0 |
seckcoder/lang-learn | python/sklearn/sklearn/datasets/species_distributions.py | 7 | 7758 | """
=============================
Species distribution dataset
=============================
This dataset represents the geographic distribution of species.
The dataset is provided by Phillips et. al. (2006).
The two species are:
- `"Bradypus variegatus"
<http://www.iucnredlist.org/apps/redlist/details/3038/0>`_... | unlicense |
ElDeveloper/scikit-learn | examples/model_selection/plot_roc.py | 49 | 5041 | """
=======================================
Receiver Operating Characteristic (ROC)
=======================================
Example of Receiver Operating Characteristic (ROC) metric to evaluate
classifier output quality.
ROC curves typically feature true positive rate on the Y axis, and false
positive rate on the X a... | bsd-3-clause |
has2k1/plotnine | plotnine/stats/stat_ydensity.py | 1 | 5708 | from contextlib import suppress
import numpy as np
import pandas as pd
from ..doctools import document
from ..exceptions import PlotnineError
from .stat_density import stat_density, compute_density
from .stat import stat
@document
class stat_ydensity(stat):
"""
Density estimate
{usage}
Parameters
... | gpl-2.0 |
bromjiri/Presto | predictor/diff-natural.py | 1 | 3885 | import settings
import pandas as pd
import numpy as np
import datetime
import os
class Stock:
def __init__(self, subject):
input_file = settings.PREDICTOR_STOCK + "/" + subject + ".csv"
self.stock_df = pd.read_csv(input_file, sep=',', index_col='Date')
def get_diff(self, from_date, to_date):... | mit |
BryanCutler/spark | python/pyspark/pandas/tests/plot/test_frame_plot.py | 1 | 4711 | #
# 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 |
conversationai/wikidetox | experimental/conversation_go_awry/prediction_utils/features2vec.py | 1 | 8273 | """
Copyright 2017 Google 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 law or agreed to in writing, software
dis... | apache-2.0 |
clemkoa/scikit-learn | sklearn/setup.py | 69 | 3201 | import os
from os.path import join
import warnings
from sklearn._build_utils import maybe_cythonize_extensions
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
from numpy.distutils.system_info import get_info, BlasNotFoundError
import numpy
lib... | bsd-3-clause |
meduz/scikit-learn | benchmarks/bench_isotonic.py | 84 | 3458 | """
Benchmarks of isotonic regression performance.
We generate a synthetic dataset of size 10^n, for n in [min, max], and
examine the time taken to run isotonic regression over the dataset.
The timings are then output to stdout, or visualized on a log-log scale
with matplotlib.
This allows the scaling of the algorit... | bsd-3-clause |
appapantula/scikit-learn | sklearn/neighbors/approximate.py | 128 | 22351 | """Approximate nearest neighbor search"""
# Author: Maheshakya Wijewardena <maheshakya.10@cse.mrt.ac.lk>
# Joel Nothman <joel.nothman@gmail.com>
import numpy as np
import warnings
from scipy import sparse
from .base import KNeighborsMixin, RadiusNeighborsMixin
from ..base import BaseEstimator
from ..utils.va... | bsd-3-clause |
IshankGulati/scikit-learn | sklearn/svm/tests/test_bounds.py | 49 | 2386 | import warnings
import numpy as np
from scipy import sparse as sp
from sklearn.svm.bounds import l1_min_c
from sklearn.svm import LinearSVC
from sklearn.linear_model.logistic import LogisticRegression
from sklearn.utils.testing import assert_true, raises
from sklearn.utils.testing import assert_raise_message
dense... | bsd-3-clause |
sandeepdsouza93/TensorFlow-15712 | tensorflow/examples/learn/iris_val_based_early_stopping.py | 25 | 2816 | # 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 appl... | apache-2.0 |
rs2/pandas | pandas/tests/io/test_spss.py | 7 | 2745 | from pathlib import Path
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
pyreadstat = pytest.importorskip("pyreadstat")
@pytest.mark.parametrize("path_klass", [lambda p: p, Path])
def test_spss_labelled_num(path_klass, datapath):
# test file from the Haven project (https://hav... | bsd-3-clause |
CalculatedContent/tsvm | incremental_tsvm_news.py | 1 | 3680 | # coding: utf-8
import pandas as pd
import numpy as np
import scipy
import scipy.sparse
import sklearn
import sklearn.svm
import sklearn.datasets
import sklearn.cross_validation
import warnings
warnings.filterwarnings('ignore')
X, y = sklearn.datasets.load_svmlight_file('data/news20.binary')
instance_ids = np.ar... | mit |
tawsifkhan/scikit-learn | sklearn/tests/test_isotonic.py | 230 | 11087 | import numpy as np
import pickle
from sklearn.isotonic import (check_increasing, isotonic_regression,
IsotonicRegression)
from sklearn.utils.testing import (assert_raises, assert_array_equal,
assert_true, assert_false, assert_equal,
... | bsd-3-clause |
kjung/scikit-learn | sklearn/metrics/ranking.py | 4 | 27716 | """Metrics to assess performance on classification task given scores
Functions named as ``*_score`` return a scalar value to maximize: the higher
the better
Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize:
the lower the better
"""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.... | bsd-3-clause |
zfrenchee/pandas | pandas/tests/categorical/test_sorting.py | 6 | 5106 | # -*- coding: utf-8 -*-
import numpy as np
import pandas.util.testing as tm
from pandas import Categorical, Index
class TestCategoricalSort(object):
def test_argsort(self):
c = Categorical([5, 3, 1, 4, 2], ordered=True)
expected = np.array([2, 4, 1, 3, 0])
tm.assert_numpy_array_equal(c... | bsd-3-clause |
kpespinosa/BuildingMachineLearningSystemsWithPython | ch04/build_lda.py | 22 | 2443 | # This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
from __future__ import print_function
try:
import nltk.corpus
except ImportError:
print("nltk n... | mit |
gldmt-duke/CokerAmitaiSGHMC | Report/posterior_samples.py | 1 | 2633 |
# coding: utf-8
# In[10]:
import numpy as np
import matplotlib.pyplot as plt
# In[11]:
# Hamiltonian dynaimcs with noised gradient
m = 1
C = 3
dt = 0.1
nstep = 300
niter = 50
# noise in the gradient
sigma = 0.5
gradUPerfect = lambda x: x
gradU = lambda x: x + np.random.randn(1) * sigma
xstart = np.ones((1, 1))
... | mit |
CenterForOpenScience/modular-file-renderer | mfr/extensions/tabular/libs/panda_tools.py | 4 | 2300 | from tempfile import NamedTemporaryFile
import numpy
import pandas
from mfr.extensions.tabular.utilities import header_population, strip_comments, sav_to_csv
def csv_pandas(fp):
"""Read and convert a csv file to JSON format using the pandas library
:param fp: File pointer object
:return: tuple of table ... | apache-2.0 |
tu-rbo/differentiable-particle-filters | plotting/swap_plot.py | 1 | 8068 | import pickle
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import itertools
import os
results = None
# matplotlib.rcParams.update({'font.size': 12})
color_list = plt.cm.tab10(np.linspace(0, 1, 10))
colors = {'lstm': color_list[0], 'pf_e2e': color_list[1... | mit |
sangwook236/general-development-and-testing | sw_dev/python/rnd/test/machine_learning/tensorflow/tensorflow_visualization_activation2.py | 2 | 14167 | # REF [paper] >> "Visualizing and Understanding Convolutional Networks", ECCV 2014.
import numpy as np
#%matplotlib inline
import matplotlib.pyplot as plt
import tensorflow as tf
import tensorflow.contrib.slim as slim
from tensorflow.examples.tutorials.mnist import input_data
import math
#---------------------------... | gpl-2.0 |
SenGonzo/ia_tools | IA_Statbook.py | 1 | 16145 |
import pandas as pd
import matplotlib.pyplot as plt
import Attack_Calc as atk
import seaborn as sns
import numpy as np
from matplotlib.backends.backend_pdf import PdfPages
def data_input():
# import and fold data
df = pd.read_csv('input_data/units.csv')
df.sort_values(by=['name'], ascending... | mit |
adamrvfisher/TechnicalAnalysisLibrary | ChaikinAggMaker.py | 1 | 3853 | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 3 16:24:54 2017
@author: AmatVictoriaCuramIII
"""
#multiperiod tester
import numpy as np
import pandas as pd
import time as t
from pandas_datareader import data
empty = []
openspace = []
openseries = pd.Series()
testsetwinners = pd.DataFrame()
def ChaikinAggMaker(ticker,... | apache-2.0 |
huongttlan/seaborn | doc/sphinxext/plot_directive.py | 38 | 27578 | """
A directive for including a matplotlib plot in a Sphinx document.
By default, in HTML output, `plot` will include a .png file with a
link to a high-res .png and .pdf. In LaTeX output, it will include a
.pdf.
The source code for the plot may be included in one of three ways:
1. **A path to a source file** as t... | bsd-3-clause |
vybstat/scikit-learn | sklearn/tests/test_common.py | 70 | 7717 | """
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 |
sniemi/EuclidVisibleInstrument | analysis/fitPSF.py | 1 | 18758 | """
PSF Fitting
===========
This script can be used to fit a set of basis functions to a point spread function.
:requires: Scikit-learn
:requires: PyFITS
:requires: NumPy
:requires: SciPy
:requires: matplotlib
:requires: VISsim-Python
:version: 0.2
:author: Sami-Matias Niemi
:contact: smn2@mssl.ucl.ac.uk
"""
import... | bsd-2-clause |
ovgarol/chaPulin9.0 | simPulsar/simPulsar.py | 1 | 18313 | #!/usr/bin/env python
""" Tercera implementacion del codigo
Segunda modulariozacion
Datos obtenidos de atnfParameters
Segunda construccion completa
Debug astronomico completo: L max a 27 Jy kpc2
Indice espectral a -1.82
maximo brillo de burst 10e5 L mean
Incluye envejecimiento
Incluye d... | agpl-3.0 |
CharLLCH/Rotus-TC | logistic/get_voc_matrix.py | 1 | 3780 | #coding=utf-8
from word import word
from read_conf import config
from nlp import NLP
import numpy as np
import os
from sklearn import linear_model
from logistic_nd import LogisticRegression
data_conf = config('../conf/dp.conf')
tr_data_path = data_conf['train_path']
te_data_path = data_conf['test_path']
cat_dict = {... | gpl-2.0 |
ivanlyon/exercises | kattis/k_knapsack.py | 1 | 5356 | """
Maximum value of 0-1 knapsack
Status: Time Limit Exceeded
"""
import copy
import sys
from collections import namedtuple
Item = namedtuple('Item', ['value', 'weight', 'index'])
###############################################################################
def knapsack(items, capacity, is_demo=False):
"""De... | mit |
oaelhara/numbbo | code-postprocessing/bbob_pproc/comp2/pptable2.py | 1 | 21140 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Rank-sum tests table on "Final Data Points".
That is, for example, using 1/#fevals(ftarget) if ftarget was reached
and -f_final otherwise as input for the rank-sum test, where obviously
the larger the better.
One table per function and dimension.
"""
from __future__... | bsd-3-clause |
krez13/scikit-learn | examples/svm/plot_svm_margin.py | 318 | 2328 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
SVM Margins Example
=========================================================
The plots below illustrate the effect the parameter `C` has
on the separation line. A large value of `C` basically tells
our model that w... | bsd-3-clause |
alexis-jacq/shape_learning | tools/log_replay.py | 3 | 5727 | #! /usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
from ast import literal_eval
import sys
import re
from collections import OrderedDict
from shape_learning.shape_learner_manager import ShapeLearnerManager
from shape_learning.shape_learner import SettingsStruct
from shape_learning.shape_modele... | isc |
vybstat/scikit-learn | sklearn/cross_decomposition/pls_.py | 187 | 28507 | """
The :mod:`sklearn.pls` module implements Partial Least Squares (PLS).
"""
# Author: Edouard Duchesnay <edouard.duchesnay@cea.fr>
# License: BSD 3 clause
from ..base import BaseEstimator, RegressorMixin, TransformerMixin
from ..utils import check_array, check_consistent_length
from ..externals import six
import w... | bsd-3-clause |
NunoEdgarGub1/scikit-learn | sklearn/tests/test_isotonic.py | 230 | 11087 | import numpy as np
import pickle
from sklearn.isotonic import (check_increasing, isotonic_regression,
IsotonicRegression)
from sklearn.utils.testing import (assert_raises, assert_array_equal,
assert_true, assert_false, assert_equal,
... | bsd-3-clause |
PyQuake/earthquakemodels | code/cocobbob/coco/code-postprocessing/cocopp/cococommands.py | 1 | 3281 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Module for using COCO from the (i)Python interpreter.
For all operations in the Python interpreter, it will be assumed that
the package has been imported as bb, just like it is done in the first
line of the examples below.
The main data structures used in COCO are :py... | bsd-3-clause |
earlbellinger/asteroseismology | scripts/kern/ker_extractor.py | 3 | 4764 | #### Parse FORTRAN binary formatted kernel functions and return ascii files
#### Author: Earl Bellinger ( bellinger@mps.mpg.de )
#### Stellar Ages & Galactic Evolution Group
#### Max-Planck-Institut fur Sonnensystemforschung
import sys
import struct
import numpy as np
import os
import matplotlib as mpl
from re im... | gpl-2.0 |
cbrnr/scot | doc/sphinxext/inheritance_diagram.py | 4 | 13650 | """
Defines a docutils directive for inserting inheritance diagrams.
Provide the directive with one or more classes or modules (separated
by whitespace). For modules, all of the classes in that module will
be used.
Example::
Given the following classes:
class A: pass
class B(A): pass
class C(A): pass
... | mit |
colinbrislawn/scikit-bio | skbio/stats/distance/tests/test_bioenv.py | 13 | 9972 | # ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | bsd-3-clause |
aminert/scikit-learn | examples/bicluster/plot_spectral_biclustering.py | 403 | 2011 | """
=============================================
A demo of the Spectral Biclustering algorithm
=============================================
This example demonstrates how to generate a checkerboard dataset and
bicluster it using the Spectral Biclustering algorithm.
The data is generated with the ``make_checkerboard`... | bsd-3-clause |
nzavagli/UnrealPy | UnrealPyEmbed/Development/Python/2015.08.07-Python2710-x64-Source-vs2015/Python27/Source/numpy-1.9.2/numpy/fft/fftpack.py | 35 | 42179 | """
Discrete Fourier Transforms
Routines in this module:
fft(a, n=None, axis=-1)
ifft(a, n=None, axis=-1)
rfft(a, n=None, axis=-1)
irfft(a, n=None, axis=-1)
hfft(a, n=None, axis=-1)
ihfft(a, n=None, axis=-1)
fftn(a, s=None, axes=None)
ifftn(a, s=None, axes=None)
rfftn(a, s=None, axes=None)
irfftn(a, s=None, axes=None... | mit |
osvaldshpengler/BuildingMachineLearningSystemsWithPython | ch09/fft.py | 24 | 3673 | # This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
import sys
import os
import glob
import numpy as np
import scipy
import scipy.io.wavfile
from utils i... | mit |
newville/scikit-image | skimage/viewer/tests/test_tools.py | 19 | 5681 | from collections import namedtuple
import numpy as np
from numpy.testing import assert_equal
from numpy.testing.decorators import skipif
from skimage import data
from skimage.viewer import ImageViewer, has_qt
from skimage.viewer.canvastools import (
LineTool, ThickLineTool, RectangleTool, PaintTool)
from skimage.v... | bsd-3-clause |
sonalranjit/GOCE_SECS-EICS | SECS-EICS_krigger/eics_single_plot.py | 2 | 3501 | __author__ = 'sonal'
import numpy as np
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import os
from math import *
def plot_grid(EIC_grid,sat_track,sat_krig,title):
'''
This function plots a scatter map of the EICS grid and its horizontal components, and the krigged value for the
... | gpl-2.0 |
probml/pyprobml | scripts/linreg_2d_bayes_demo.py | 1 | 5078 | #Bayesian inference for simple linear regression with known noise variance
#The goal is to reproduce fig 3.7 from Bishop's book.
#We fit the linear model f(x,w) = w0 + w1*x and plot the posterior over w.
import numpy as np
import matplotlib.pyplot as plt
import os
import pyprobml_utils as pml
from scipy.stats ... | mit |
phueb/rnnlab | rnnlab/params.py | 1 | 6828 | import pandas as pd
import numpy as np
from rnnlab import config
class Params:
options = [('num_parts', 256, [[1, 2, 4, 8, 256, 512, 1024]]),
('corpus_name', 'childes-20180319', [['childes-20171212', 'childes-20171213',
'childes-20180120', 'chil... | mit |
mehdidc/scikit-learn | examples/mixture/plot_gmm.py | 248 | 2817 | """
=================================
Gaussian Mixture Model Ellipsoids
=================================
Plot the confidence ellipsoids of a mixture of two Gaussians with EM
and variational Dirichlet process.
Both models have access to five components with which to fit the
data. Note that the EM model will necessari... | bsd-3-clause |
mirestrepo/voxels-at-lems | super3d/filter_vis_images.py | 1 | 1230 | import boxm_batch;
import sys;
import optparse;
import os;
import glob;
#import matplotlib.pyplot as plt;
boxm_batch.register_processes();
boxm_batch.register_datatypes();
class dbvalue:
def __init__(self, index, type):
self.id = index # unsigned integer
self.type = type # string
dir = "/Users/isa... | bsd-2-clause |
jmargeta/scikit-learn | sklearn/linear_model/tests/test_logistic.py | 16 | 5067 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_raises
from sklearn.util... | bsd-3-clause |
lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/build/lib.linux-i686-2.7/matplotlib/projections/geo.py | 2 | 21226 | from __future__ import print_function
import math
import numpy as np
import numpy.ma as ma
import matplotlib
rcParams = matplotlib.rcParams
from matplotlib.axes import Axes
from matplotlib import cbook
from matplotlib.patches import Circle
from matplotlib.path import Path
import matplotlib.spines as mspines
import ma... | mit |
prheenan/Research | Perkins/Projects/Conferences/2016_7_CPLC/Day2_FRET_Dynamics/TracePlotting/MainTracePlotting.py | 1 | 2299 | # force floating point division. Can still use integer with //
from __future__ import division
# This file is used for importing the common utilities classes.
import numpy as np
import matplotlib.pyplot as plt
import sys
sys.path.append("../../../../../../../")
import GeneralUtil.python.PlotUtilities as pPlotUtil
impo... | gpl-3.0 |
Hiyorimi/scikit-image | doc/examples/xx_applications/plot_rank_filters.py | 4 | 20058 | """
============
Rank filters
============
Rank filters are non-linear filters using the local gray-level ordering to
compute the filtered value. This ensemble of filters share a common base: the
local gray-level histogram is computed on the neighborhood of a pixel (defined
by a 2-D structuring element). If the filter... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.