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 |
|---|---|---|---|---|---|
mogrodnik/piernik | problems/mcrtest/piernik_problem.py | 5 | 1868 | #!/usr/bin/env python
import sys
import numpy as np
import matplotlib
from yt.mods import load as yt_load
from pylab import *
matplotlib.use('cairo')
THRESHOLD = 1e-9
FIELD = "cr1"
def plot_diff(pf1, pf2, data1, data2, field):
wd = pf1.domain_width
n_d = pf1.domain_dimensions
ext = np.array([pf1.domain_... | gpl-3.0 |
wavelets/scipy_2015_sklearn_tutorial | notebooks/solutions/06B_learning_curves.py | 21 | 1448 | from sklearn.metrics import explained_variance_score, mean_squared_error
from sklearn.cross_validation import train_test_split
def plot_learning_curve(model, err_func=explained_variance_score, N=300, n_runs=10, n_sizes=50, ylim=None):
sizes = np.linspace(5, N, n_sizes).astype(int)
train_err = np.zeros((n_runs,... | cc0-1.0 |
jereze/scikit-learn | sklearn/tests/test_kernel_ridge.py | 342 | 3027 | import numpy as np
import scipy.sparse as sp
from sklearn.datasets import make_regression
from sklearn.linear_model import Ridge
from sklearn.kernel_ridge import KernelRidge
from sklearn.metrics.pairwise import pairwise_kernels
from sklearn.utils.testing import ignore_warnings
from sklearn.utils.testing import assert... | bsd-3-clause |
mne-tools/mne-tools.github.io | 0.12/_downloads/plot_spatio_temporal_cluster_stats_sensor.py | 7 | 7157 | """
.. _stats_cluster_sensors_2samp_spatial:
=====================================================
Spatiotemporal permutation F-test on full sensor data
=====================================================
Tests for differential evoked responses in at least
one condition using a permutation clustering test.
The Fiel... | bsd-3-clause |
guangtunbenzhu/BGT-Cosmology | Spectroscopy/emissioninfill_movie.py | 1 | 1832 | import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
import speclines
import ebossspec, ebossanalysis
data = ebossanalysis.unify_emissionline_profile_readin()
absorption = ebossanalysis.unify_absorptionline_profile_readin()
vel = data['VEL']
yabs = 1.-(1.-absorption['UNIFIEDABSORPTION'])*1.25
ya... | mit |
liyu1990/sklearn | examples/neural_networks/plot_rbm_logistic_classification.py | 99 | 4608 | """
==============================================================
Restricted Boltzmann Machine features for digit classification
==============================================================
For greyscale image data where pixel values can be interpreted as degrees of
blackness on a white background, like handwritten... | bsd-3-clause |
mikebenfield/scikit-learn | sklearn/metrics/scorer.py | 33 | 17925 | """
The :mod:`sklearn.metrics.scorer` submodule implements a flexible
interface for model selection and evaluation using
arbitrary score functions.
A scorer object is a callable that can be passed to
:class:`sklearn.model_selection.GridSearchCV` or
:func:`sklearn.model_selection.cross_val_score` as the ``scoring``
par... | bsd-3-clause |
pyrolysis/low-order-particle | oak-diff.py | 1 | 2887 | """
Calculate and compare difference between 3-D surface and center temperature profiles.
"""
import numpy as np
import matplotlib.pyplot as py
# Data from Comsol 3-D Oak Particle Simulation
# -----------------------------------------------------------------------------
f200 = 'comsol/200tempsOak.txt'
t200, _, _, Tc... | mit |
RPGOne/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 |
pygeo/pycmbs | pycmbs/plots/violin.py | 1 | 10656 | # -*- coding: utf-8 -*-
"""
This file is part of pyCMBS.
(c) 2012- Alexander Loew
For COPYING and LICENSE details, please refer to the LICENSE file
"""
import matplotlib.pyplot as plt
import numpy as np
class ViolinPlot(object):
"""
generate ViolinPlot
References
----------
inspired by
[1] h... | mit |
freedomflyer/test | lab1/plotting.py | 1 | 2686 | import optparse
import sys
import matplotlib
matplotlib.use('Agg')
from pylab import *
import matplotlib.patches as mpatches
# Class that parses a file and plots several graphs
class Plotter:
def __init__(self):
# create some fake data
self.x = []
self.y = []
self.all = []
... | gpl-2.0 |
zingale/pyro2 | compressible/problems/logo.py | 2 | 2297 | from __future__ import print_function
import sys
import mesh.patch as patch
import numpy as np
from util import msg
import matplotlib.pyplot as plt
def init_data(my_data, rp):
""" initialize the logo problem """
msg.bold("initializing the logo problem...")
# make sure that we are passed a valid patch o... | bsd-3-clause |
marcocaccin/scikit-learn | sklearn/neighbors/approximate.py | 30 | 22370 | """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 |
marko-asplund/vowpal_wabbit | python/test_sklearn_vw.py | 1 | 5022 | from collections import namedtuple
import numpy as np
import pytest
from sklearn.utils.estimator_checks import check_estimator
from sklearn_vw import VW, VWClassifier, VWRegressor, tovw
from sklearn import datasets
from sklearn.utils.validation import NotFittedError
from scipy.sparse import csr_matrix
"""
Test utili... | bsd-3-clause |
jstoxrocky/statsmodels | statsmodels/sandbox/nonparametric/tests/ex_gam_new.py | 34 | 3845 | # -*- coding: utf-8 -*-
"""Example for GAM with Poisson Model and PolynomialSmoother
This example was written as a test case.
The data generating process is chosen so the parameters are well identified
and estimated.
Created on Fri Nov 04 13:45:43 2011
Author: Josef Perktold
"""
from __future__ import print_function... | bsd-3-clause |
bhargav/scikit-learn | examples/linear_model/plot_ard.py | 29 | 2828 | """
==================================================
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 |
wanggang3333/scikit-learn | examples/mixture/plot_gmm_sin.py | 248 | 2747 | """
=================================
Gaussian Mixture Model Sine Curve
=================================
This example highlights the advantages of the Dirichlet Process:
complexity control and dealing with sparse data. The dataset is formed
by 100 points loosely spaced following a noisy sine curve. The fit by
the GMM... | bsd-3-clause |
icdishb/scikit-learn | sklearn/svm/tests/test_sparse.py | 15 | 12169 | from nose.tools import assert_raises, assert_true, assert_false
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_classif... | bsd-3-clause |
revanthkolli/osf.io | scripts/analytics/utils.py | 6 | 1349 | # -*- coding: utf-8 -*-
import os
import unicodecsv as csv
from bson import ObjectId
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import seaborn as sns # noqa
import requests
from website.addons.osfstorage import utils as storage_utils
def oid_to_datetime(oid):
return ObjectId(oid).gener... | apache-2.0 |
frank-tancf/scikit-learn | examples/applications/plot_out_of_core_classification.py | 32 | 13829 | """
======================================================
Out-of-core classification of text documents
======================================================
This is an example showing how scikit-learn can be used for classification
using an out-of-core approach: learning from data that doesn't fit into main
memory. ... | bsd-3-clause |
geophysics/mtpy | mtpy/modeling/occam1d.py | 1 | 112593 | # -*- coding: utf-8 -*-
"""
==================
Occam1D
==================
* Wrapper class to interact with Occam1D written by Kerry Keys at Scripps
adapted from the method of Constable et al., [1987].
* This class only deals with the MT functionality of the Fortran code, so
it can make the... | gpl-3.0 |
exowanderer/Charge-Carrier-Trapping-Comparison | PyMultiNest Learning Tutorial.py | 1 | 48066 |
# coding: utf-8
# # PyMultiNest My Models
# In[ ]:
from __future__ import absolute_import, unicode_literals, print_function
import pymultinest
import math
import os
import threading, subprocess
from sys import platform
from pylab import *;ion()
if not os.path.exists("chains"): os.mkdir("chains")
# ** Straight L... | gpl-3.0 |
toobaz/pandas | pandas/tests/frame/conftest.py | 2 | 10626 | import numpy as np
import pytest
from pandas import DataFrame, NaT, date_range
import pandas.util.testing as tm
@pytest.fixture
def float_frame_with_na():
"""
Fixture for DataFrame of floats with index of unique strings
Columns are ['A', 'B', 'C', 'D']; some entries are missing
A... | bsd-3-clause |
bcaine/maddux | maddux/plot.py | 1 | 1372 | import numpy as np
def plot_sphere_data(position, radius):
"""Given a position and radius, get the data needed to plot.
:param position: Position in (x, y, z) of sphere
:type position: numpy.ndarray
:param radius: radius of sphere
:type radius: int
:returns: (x, y, z) tuple of sphere data t... | mit |
icereval/modular-file-renderer | mfr/ext/tabular/tests/test_panda_tools.py | 2 | 1244 | # -*- coding: utf-8 -*-
import os
from ..libs import panda_tools
HERE = os.path.dirname(os.path.abspath(__file__))
def test_data_from_dateframe():
with open(os.path.join(HERE, 'fixtures', 'test.csv')) as fp:
headers, data = panda_tools.csv_pandas(fp)
assert type(data) == list
assert type(data[0]... | apache-2.0 |
lzamparo/SdA_reduce | plot_scripts/plot_sda_2d.py | 1 | 6051 | """
==========
SdA 2d visualizations
==========
This script selects a stratified sample from a validation set and plots it. The input data resides in .h5 files from a given directory
After first grabbing one file and calculating the indices of points to sample, go through and plot those sampled points for each h5 fil... | bsd-3-clause |
squirrelo/qiita | qiita_plugins/target_gene/setup.py | 1 | 1827 | #!/usr/bin/env python
# -----------------------------------------------------------------------------
# Copyright (c) 2013, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ---------------------------... | bsd-3-clause |
amloewi/css-blockmodels | testing_rpy2.py | 1 | 1545 |
# import numpy as np
# import pandas as pd
#
# # base = library('base') -- import packages from R
# from rpy2.robjects.packages import importr as library
# # R.R('x <- 1') AND R.Array('...') etc -- the core interface
# import rpy2.robjects as R
# # Not clear what this does yet, but allows numpy->R easily?
# import rp... | mit |
DSLituiev/scikit-learn | sklearn/ensemble/tests/test_voting_classifier.py | 25 | 8160 | """Testing for the boost module (sklearn.ensemble.boost)."""
import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_raise_message
from sklearn.exceptions import NotFittedError
from sklearn.linear_model import Logi... | bsd-3-clause |
popoyz/charts | common/utils.py | 1 | 19081 | # coding=utf-8
from __base__.error import APIError
import os
import re
import urllib2
import urllib
from decimal import Decimal
import json
import glob
import time
from traceback import format_exc
from pandas import DataFrame, Series
import pandas as pd
import numpy as np
from collections import Iterable as IterType
fr... | lgpl-3.0 |
wubr2000/zipline | zipline/history/history_container.py | 18 | 33931 | #
# Copyright 2014 Quantopian, 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 wr... | apache-2.0 |
qrsforever/workspace | python/learn/sklearn/l1/main.py | 1 | 2408 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# import urllib.request
from numpy import genfromtxt, zeros, array
# pylab 是matplotlib的接口
from pylab import plot, figure, subplot, hist, xlim, show
from sklearn.naive_bayes import GaussianNB
# url = 'http://aima.cs.berkeley.edu/data/iris.csv'
# u = urllib.request.urlopen... | mit |
kit-cel/lecture-examples | wt/uebung/u5_2D_gaussian.py | 1 | 5513 | #!/usr/bin/env python3
"""
Simulation einer 2D Normalverteilung. Gezeigt werden neben zuf.
Realisierungen auch die Höhenlinie der Dichte für K=9.
"""
from functools import partial
import numpy as np
import matplotlib as mp
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
from PyQt5 import Q... | gpl-2.0 |
FRidh/scipy | scipy/stats/_binned_statistic.py | 17 | 17622 | from __future__ import division, print_function, absolute_import
import warnings
import numpy as np
from scipy._lib.six import callable
from collections import namedtuple
def binned_statistic(x, values, statistic='mean',
bins=10, range=None):
"""
Compute a binned statistic for a set of d... | bsd-3-clause |
haphaeu/yoshimi | spyder_workspace/Statistics/load_vs_resistance.py | 1 | 5065 | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 26 13:07:02 2015
@author: rarossi
A structure will fail if subjected to a load greater then its own resistance:
failure := load > resistance
We can safely assume that the load and the resistance are independent.
By means of probability density functions (pdf) and cumulat... | lgpl-3.0 |
fabianp/scikit-learn | examples/plot_multioutput_face_completion.py | 330 | 3019 | """
==============================================
Face completion with a multi-output estimators
==============================================
This example shows the use of multi-output estimator to complete images.
The goal is to predict the lower half of a face given its upper half.
The first column of images sho... | bsd-3-clause |
anhaidgroup/py_entitymatching | py_entitymatching/blocker/blocker.py | 1 | 4527 | import logging
import math
import pandas as pd
import six
import multiprocessing
from py_entitymatching.utils.validation_helper import validate_object_type
logger = logging.getLogger(__name__)
class Blocker(object):
"""Blocker base class.
"""
def validate_types_params_tables(self, ltable, rtable,
... | bsd-3-clause |
returnandrisk/meucci-python | dynamic_allocation_performance_analysis.py | 1 | 7540 | """
Python code for blog post "mini-Meucci : Applying The Checklist - Steps 10+"
http://www.returnandrisk.com/2016/07/mini-meucci-applying-checklist-steps-10.html
Copyright (c) 2016 Peter Chan (peter-at-return-and-risk-dot-com)
"""
###############################################################################
# Dynam... | mit |
aattaran/Machine-Learning-with-Python | smartcab - Copy/smartcab/simulator.py | 11 | 25158 | ###########################################
# Suppress matplotlib user warnings
# Necessary for newer version of matplotlib
import warnings
warnings.filterwarnings("ignore", category = UserWarning, module = "matplotlib")
###########################################
import os
import time
import random
import importlib
i... | bsd-3-clause |
jennyzhang0215/incubator-mxnet | example/kaggle-ndsb1/training_curves.py | 52 | 1879 | # 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 |
ilo10/scikit-learn | benchmarks/bench_plot_parallel_pairwise.py | 297 | 1247 | # Author: Mathieu Blondel <mathieu@mblondel.org>
# License: BSD 3 clause
import time
import pylab as pl
from sklearn.utils import check_random_state
from sklearn.metrics.pairwise import pairwise_distances
from sklearn.metrics.pairwise import pairwise_kernels
def plot(func):
random_state = check_random_state(0)
... | bsd-3-clause |
pakodekker/oceansar | misc/dressed_spectrum_v2.py | 1 | 8434 | """
WAVESIM Test - Maria 2014
Testing program to obtain the dressed spectrum of Choppy waves,
in comparsion with the theoretical linear one.
The number of realizations can be selected
"""
import numpy as np
from scipy import linalg
from trampa import utils
from oceansar import spec
from ocea... | gpl-3.0 |
kaichogami/scikit-learn | examples/decomposition/plot_incremental_pca.py | 175 | 1974 | """
===============
Incremental PCA
===============
Incremental principal component analysis (IPCA) is typically used as a
replacement for principal component analysis (PCA) when the dataset to be
decomposed is too large to fit in memory. IPCA builds a low-rank approximation
for the input data using an amount of memo... | bsd-3-clause |
loli/sklearn-ensembletrees | 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 |
themrmax/scikit-learn | examples/tree/plot_iris.py | 86 | 1965 | """
================================================================
Plot the decision surface of a decision tree on the iris dataset
================================================================
Plot the decision surface of a decision tree trained on pairs
of features of the iris dataset.
See :ref:`decision tree ... | bsd-3-clause |
Obus/scikit-learn | examples/manifold/plot_mds.py | 261 | 2616 | """
=========================
Multi-dimensional scaling
=========================
An illustration of the metric and non-metric MDS on generated noisy data.
The reconstructed points using the metric MDS and non metric MDS are slightly
shifted to avoid overlapping.
"""
# Author: Nelle Varoquaux <nelle.varoquaux@gmail.... | bsd-3-clause |
jmhsi/justin_tinker | data_science/courses/deeplearning2/kmeans.py | 10 | 2802 | import tensorflow as tf
import math, numpy as np
import matplotlib.pyplot as plt
def plot_data(centroids, data, n_samples):
colour = plt.cm.rainbow(np.linspace(0,1,len(centroids)))
for i, centroid in enumerate(centroids):
samples = data[i*n_samples:(i+1)*n_samples]
plt.scatter(samples[:,0], sa... | apache-2.0 |
quheng/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 |
bioinformatics-centre/AsmVar | src/AsmvarVarScore/AGE_Stat.py | 2 | 8989 | """
========================================================
Statistic the SV Stat after AGE Process
========================================================
Author : Shujia Huang
Date : 2014-03-07 0idx:54:15
"""
import sys
import re
import os
import string
import numpy as np
import matplotlib.pyplot as plt
def Draw... | mit |
hasadna/OpenTrain | webserver/opentrain/algorithm/trip_matcher_test.py | 1 | 3681 | """ comment
export DJANGO_SETTINGS_MODULE="opentrain.settings"
"""
import os
import sys
sys.path.append(os.getcwd())
sys.path.append(os.path.dirname(os.getcwd()))
os.environ['DJANGO_SETTINGS_MODULE']='opentrain.settings'
#/home/oferb/docs/train_project/OpenTrains/webserver
import timetable.services
import analysis.mod... | bsd-3-clause |
luo66/scikit-learn | sklearn/metrics/cluster/supervised.py | 207 | 27395 | """Utilities to evaluate the clustering performance of models
Functions named as *_score return a scalar value to maximize: the higher the
better.
"""
# Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Wei LI <kuantkid@gmail.com>
# Diego Molla <dmolla-aliod@gmail.com>
# License: BSD 3 clause
fr... | bsd-3-clause |
fw1121/galaxy_tools | driver_to_inchlib/driver_to_inchlib.py | 2 | 4327 | #!/usr/bin/env python
import sys
import argparse
import pandas
MAPPINGS={"ma": [ 8], "sift": [10,14], "polyphen" : []}
keys = ["sift", "ma", "polyphen"]
def stop_err(msg, err=1):
sys.stderr.write('%s\n' % msg)
sys.exit(err)
def main_web(args):
if args[1]:
print args[1]
stop_err("Unknown ... | mit |
hainm/statsmodels | statsmodels/examples/ex_kernel_test_functional.py | 34 | 2246 | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 08 19:03:20 2013
Author: Josef Perktold
"""
from __future__ import print_function
if __name__ == '__main__':
import numpy as np
from statsmodels.regression.linear_model import OLS
#from statsmodels.nonparametric.api import KernelReg
import statsmodel... | bsd-3-clause |
CityPulse/CP_Resourcemanagement | virtualisation/misc/stats.py | 1 | 11883 | '''
Created on 19 Oct 2015
@author: thiggena
'''
from collections import OrderedDict
import csv
import datetime
from matplotlib import pyplot
from virtualisation.misc.buffer import NumericRingBuffer
from virtualisation.misc.jsonobject import JSONObject
PATH = "./"
BUFFER_SIZE = 1000
class Element(object):
def ... | mit |
HSC-Users/hscTools | bick/bin/camPlot.py | 2 | 6927 | #!/usr/bin/env python
# Original filename: camPlot.py
#
# Author: Steve Bickerton
# Email:
# Date: Tue 2013-12-31 13:02:29
#
# Summary:
#
import sys
import os
import re
import math
import argparse
import numpy
import datetime
import matplotlib.figure as figure
from matplotlib.backends.backend_agg import FigureCanv... | gpl-3.0 |
Caoimhinmg/PmagPy | programs/__init__.py | 1 | 1484 | #!/usr/bin/env pythonw
from __future__ import print_function
from __future__ import absolute_import
import sys
from os import path
import pkg_resources
command = path.split(sys.argv[0])[-1]
from .program_envs import prog_env
if command.endswith(".py"):
mpl_env = prog_env.get(command[:-3])
elif command.endswith("_... | bsd-3-clause |
roxyboy/scikit-learn | examples/cluster/plot_kmeans_assumptions.py | 270 | 2040 | """
====================================
Demonstration of k-means assumptions
====================================
This example is meant to illustrate situations where k-means will produce
unintuitive and possibly unexpected clusters. In the first three plots, the
input data does not conform to some implicit assumptio... | bsd-3-clause |
jh23453/privacyidea | privacyidea/lib/stats.py | 3 | 5545 | # -*- coding: utf-8 -*-
#
# 2015-07-16 Initial writeup
# (c) Cornelius Kölbel
# License: AGPLv3
# contact: http://www.privacyidea.org
#
# This code is free software; you can redistribute it and/or
# modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
# License as published by the Free Software Foun... | agpl-3.0 |
keflavich/TurbuStat | turbustat/analysis/comparison_plot.py | 1 | 7136 | # Licensed under an MIT open source license - see LICENSE
import numpy as np
import os
import matplotlib.pyplot as p
from pandas import read_csv
def comparison_plot(path, num_fids=5, verbose=False, obs=False,
statistics=["Wavelet", "MVC", "PSpec", "Bispectrum",
"De... | mit |
mobarski/sandbox | covid19/xxx_crawl_data.py | 1 | 1696 | from pprint import pprint
import requests
import re
import json
from math import log
# TESTY: https://ourworldindata.org/coronavirus#testing-for-covid-19
# INNE: https://www.worldometers.info/coronavirus/country/{country}/
def get_stats(country):
out = {}
url = f"https://www.worldometers.info/coronavirus/country/... | mit |
johnmwalters/ThinkStats2 | code/hinc.py | 67 | 1494 | """This file contains code used in "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2014 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function
import numpy as np
import pandas
import thinkplot
import thinkstats2
def Clean(s):... | gpl-3.0 |
keiserlab/e3fp-paper | project/analysis/experiments/make_supp_mat.py | 1 | 11385 | """Create supporting info experimental curves and binding summary table.
Author: Seth Axen
E-mail: seth.axen@gmail.com
"""
import os
import glob
import math
from collections import Counter
from matplotlib import pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
from e3fp_paper.plotting.defaul... | lgpl-3.0 |
waynenilsen/statsmodels | statsmodels/sandbox/tsa/movstat.py | 34 | 14871 | '''using scipy signal and numpy correlate to calculate some time series
statistics
original developer notes
see also scikits.timeseries (movstat is partially inspired by it)
added 2009-08-29
timeseries moving stats are in c, autocorrelation similar to here
I thought I saw moving stats somewhere in python, maybe not)... | bsd-3-clause |
precice/aste | plotting/plot_preallocation.py | 1 | 1968 | import json, pandas, sys
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
publication = True
if publication:
import plot_helper
plot_helper.set_save_fig_params()
fields = ["PetRBF.fillA", "PetRBF.fillC", "PetRBF.preallocA", "PetRBF.preallocC"]
colors = {f : c for (f, c) in zip(fields,
... | gpl-3.0 |
janmedlock/HIV-95-vaccine | plots/common.py | 1 | 15852 | '''
Common plotting settings etc.
'''
import collections
import copy
import inspect
import operator
import os
import subprocess
import sys
import tempfile
import time
import unicodedata
import matplotlib
from matplotlib import cm
from matplotlib import colors
from matplotlib import ticker
from matplotlib.backends imp... | agpl-3.0 |
LionelR/pyair | pyair/xair.py | 1 | 25393 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
**Air Quality
Module de connexion et de récupération de données sur une base XAIR
"""
import cx_Oracle
import pandas as pd
import pandas.io.sql as psql
import datetime as dt
INVALID_CODES = ['C', 'D', 'I', 'M', 'Z', 'B', 'N', 'X', 'G', 'H']
MISSING_CODE = 'N'
def is_i... | mit |
ilo10/scikit-learn | examples/svm/plot_iris.py | 225 | 3252 | """
==================================================
Plot different SVM classifiers in the iris dataset
==================================================
Comparison of different linear SVM classifiers on a 2D projection of the iris
dataset. We only consider the first 2 features of this dataset:
- Sepal length
- Se... | bsd-3-clause |
Loke155/fbht | mainFunc.py | 4 | 126869 | import sys,os
from platform import system
from getpass import getpass
from mainLib import *
import MyParser
from urllib import urlencode
import simplejson as json
import database
from time import time,ctime,sleep
import pickle
import re
from handlers import *
import signal
import networkx as nx
import matplotlib.pyplo... | bsd-2-clause |
gfyoung/pandas | pandas/tests/extension/base/printing.py | 5 | 1167 | import io
import pytest
import pandas as pd
from .base import BaseExtensionTests
class BasePrintingTests(BaseExtensionTests):
"""Tests checking the formatting of your EA when printed."""
@pytest.mark.parametrize("size", ["big", "small"])
def test_array_repr(self, data, size):
if size == "small... | bsd-3-clause |
naturali/tensorflow | tensorflow/examples/skflow/text_classification_character_cnn.py | 6 | 4109 | # 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 |
LiaoPan/scikit-learn | sklearn/metrics/cluster/unsupervised.py | 230 | 8281 | """ Unsupervised evaluation metrics. """
# Authors: Robert Layton <robertlayton@gmail.com>
#
# License: BSD 3 clause
import numpy as np
from ...utils import check_random_state
from ..pairwise import pairwise_distances
def silhouette_score(X, labels, metric='euclidean', sample_size=None,
random... | bsd-3-clause |
RPGOne/Skynet | scikit-learn-c604ac39ad0e5b066d964df3e8f31ba7ebda1e0e/examples/feature_selection/plot_rfe_with_cross_validation.py | 24 | 1384 | """
===================================================
Recursive feature elimination with cross-validation
===================================================
A recursive feature elimination example with automatic tuning of the
number of features selected with cross-validation.
"""
print(__doc__)
from sklearn.svm im... | bsd-3-clause |
yutiansut/QUANTAXIS | QUANTAXIS/QAUtil/QAcrypto.py | 2 | 9250 | from QUANTAXIS.QAUtil import (QASETTING, DATABASE, QA_util_log_info)
from QUANTAXIS.QAUtil.QAParameter import (FREQUENCE)
import pandas as pd
from datetime import datetime
import time
from dateutil.tz import tzutc
import pymongo
from QUANTAXIS.QAUtil.QADate_Adv import (
QA_util_str_to_Unix_timestamp,
QA_util_d... | mit |
TheNeuralBit/arrow | python/pyarrow/tests/test_hdfs.py | 3 | 6134 | # 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 |
morganwallace/open_data | notebooks/Day_04_A_PfDA.py | 2 | 3708 | # -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <headingcell level=1>
# How to use Python for Data Analysis (PfDA)
# <markdowncell>
#
# *Reading Assigned a while ago from PfDA*
#
# * read [`PfDA`, Chap 1 Preliminaries](http://proquest.safaribooksonline.com/book/programming/python/9781449323592/1dot-preli... | apache-2.0 |
numenta/nupic.research | projects/visual_recognition_grid_cells/SDR_decoder.py | 3 | 7700 | # Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2020, 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 program is free software: you can redistribute it and/or modify
# it unde... | agpl-3.0 |
JPFrancoia/scikit-learn | examples/cluster/plot_cluster_comparison.py | 58 | 4681 | """
=========================================================
Comparing different clustering algorithms on toy datasets
=========================================================
This example aims at showing characteristics of different
clustering algorithms on datasets that are "interesting"
but still in 2D. The last ... | bsd-3-clause |
xuewei4d/scikit-learn | sklearn/utils/_show_versions.py | 13 | 1961 | """
Utility methods to print system info for debugging
adapted from :func:`pandas.show_versions`
"""
# License: BSD 3 clause
import platform
import sys
import importlib
from ._openmp_helpers import _openmp_parallelism_enabled
def _get_sys_info():
"""System information
Returns
-------
sys_info : di... | bsd-3-clause |
DavidPowell/OpenModes | test/test_multipoles.py | 1 | 3921 | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 18 16:59:21 2016
@author: dap124
"""
import numpy as np
import os.path as osp
import matplotlib.pyplot as plt
import openmodes
from openmodes.mesh import gmsh
from openmodes.constants import c
from openmodes.sources import PlaneWaveSource
import helpers
tests_filename... | gpl-3.0 |
loretoparisi/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_svg.py | 69 | 23593 | from __future__ import division
import os, codecs, base64, tempfile, urllib, gzip, cStringIO
try:
from hashlib import md5
except ImportError:
from md5 import md5 #Deprecated in 2.5
from matplotlib import verbose, __version__, rcParams
from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\
... | agpl-3.0 |
mbayon/TFG-MachineLearning | vbig/lib/python2.7/site-packages/sklearn/model_selection/tests/test_validation.py | 6 | 57672 | """Test the validation module"""
from __future__ import division
import sys
import warnings
import tempfile
import os
from time import sleep
import numpy as np
from scipy.sparse import coo_matrix, csr_matrix
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.uti... | mit |
has2k1/plotnine | plotnine/tests/test_geom_map.py | 1 | 2879 | import numpy as np
import shapefile
from geopandas import GeoDataFrame
from plotnine import ggplot, aes, geom_map, labs, theme, facet_wrap
_theme = theme(subplots_adjust={'right': 0.85})
def _point_file(test_file):
with shapefile.Writer(test_file, shapefile.POINT) as shp:
shp.field('name', 'C')
... | gpl-2.0 |
B3AU/waveTree | sklearn/linear_model/omp.py | 3 | 31732 | """Orthogonal matching pursuit algorithms
"""
# Author: Vlad Niculae
#
# License: BSD 3 clause
import warnings
import numpy as np
from scipy import linalg
from scipy.linalg.lapack import get_lapack_funcs
from .base import LinearModel, _pre_fit
from ..base import RegressorMixin
from ..utils import array2d, as_float_... | bsd-3-clause |
mwv/scikit-learn | examples/applications/plot_prediction_latency.py | 234 | 11277 | """
==================
Prediction Latency
==================
This is an example showing the prediction latency of various scikit-learn
estimators.
The goal is to measure the latency one can expect when doing predictions
either in bulk or atomic (i.e. one by one) mode.
The plots represent the distribution of the pred... | bsd-3-clause |
mistercrunch/panoramix | superset/utils/csv.py | 2 | 3022 | # 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 |
jeffkinnison/awe-wq | lib/python2.7/site-packages/awe/voronoi.py | 2 | 3930 | #!/usr/bin/env python
# -----------------------------------------------------------------------------
# Voronoi diagram from a list of points
# Copyright (C) 2011 Nicolas P. Rougier
#
# Distributed under the terms of the BSD License.
# -----------------------------------------------------------------------------
impor... | gpl-2.0 |
plissonf/scikit-learn | examples/ensemble/plot_gradient_boosting_oob.py | 230 | 4762 | """
======================================
Gradient Boosting Out-of-Bag estimates
======================================
Out-of-bag (OOB) estimates can be a useful heuristic to estimate
the "optimal" number of boosting iterations.
OOB estimates are almost identical to cross-validation estimates but
they can be compute... | bsd-3-clause |
rtogo/sap-cost-center-hierarchy | ksh3.py | 1 | 3297 | # -*- coding: utf-8 -*-
import logging
log = logging.getLogger(__name__)
import pandas as pd
import numpy as np
import os
import yaml
class ETL(object):
def __init__(self, path, config_filename='de-para.yml'):
self.path = path
self.config_filename = config_filename
self.df = pd.DataFrame... | mit |
osv-team/osvcad | osvcad/view.py | 1 | 4586 | # coding: utf-8
r"""Visualization of Parts and Assemblies"""
from random import uniform, randint
import wx
import wx.aui
import wx.lib.agw.aui
import matplotlib.pyplot as plt
import networkx as nx
from OCC.Core.gp import gp_Pnt, gp_Vec
import ccad.display as cd
from aocutils.display.wx_viewer import Wx3dViewerFrame... | gpl-3.0 |
aclifton/cpeg853-gem5 | util/dram_lat_mem_rd_plot.py | 13 | 5155 | #!/usr/bin/env python
# Copyright (c) 2015 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation... | bsd-3-clause |
maojrs/riemann_book | exact_solvers/advection.py | 3 | 1870 |
import sys, os
import matplotlib.pyplot as plt
import numpy as np
from utils import riemann_tools
from ipywidgets import interact
from ipywidgets import widgets
def characteristics(a=1.):
x = np.linspace(-2*np.abs(a)-1,2*np.abs(a)+1,41)
t = np.linspace(0,1,20)
for ix in x:
plt.plot(ix+a*t,t,'-k',l... | bsd-3-clause |
btabibian/scikit-learn | examples/model_selection/grid_search_text_feature_extraction.py | 99 | 4163 |
"""
==========================================================
Sample pipeline for text feature extraction and evaluation
==========================================================
The dataset used in this example is the 20 newsgroups dataset which will be
automatically downloaded and then cached and reused for the d... | bsd-3-clause |
bikong2/scikit-learn | examples/svm/plot_svm_anova.py | 250 | 2000 | """
=================================================
SVM-Anova: SVM with univariate feature selection
=================================================
This example shows how to perform univariate feature before running a SVC
(support vector classifier) to improve the classification scores.
"""
print(__doc__)
import... | bsd-3-clause |
GenericMappingTools/gmt-python | examples/tutorials/subplots.py | 1 | 10360 | """
Making subplots
===============
When you're preparing a figure for a paper, there will often be times when
you'll need to put many individual plots into one large figure, and label them
'abcd'. These individual plots are called subplots.
There are two main ways to create subplots in GMT:
- Use :meth:`pygmt.Figur... | bsd-3-clause |
nicolagritti/ACVU_project | source/03cropImages.py | 1 | 1947 | import glob
from tifffile import *
from generalFunctions import *
import numpy as np
import os.path
import matplotlib.pyplot as plt
import pickle
import scipy.interpolate as ip
from scipy.stats import gaussian_kde
from scipy import interpolate
import shutil
import os
import matplotlib as mpl
mpl.rcParams['pdf.fonttype... | gpl-3.0 |
gustfrontar/LETKF_WRF | wrf/verification/python/plot_letkfpertamp_timeseries.py | 1 | 7226 | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 1 18:45:15 2016
@author:
"""
# LECTURA Y GRAFICADO RADAR (Formato binario GVAR-SMN)
import numpy as np
import matplotlib.pyplot as plt
import datetime as dt
import binary_io as bio
import bred_vector_functions as bvf
import os
basedir='/data9/jruiz/EXPERIMENTS/'
exp... | gpl-3.0 |
glennq/scikit-learn | sklearn/neighbors/nearest_centroid.py | 37 | 7348 | # -*- coding: utf-8 -*-
"""
Nearest Centroid Classification
"""
# Author: Robert Layton <robertlayton@gmail.com>
# Olivier Grisel <olivier.grisel@ensta.org>
#
# License: BSD 3 clause
import warnings
import numpy as np
from scipy import sparse as sp
from ..base import BaseEstimator, ClassifierMixin
from ..met... | bsd-3-clause |
djgagne/scikit-learn | sklearn/metrics/tests/test_regression.py | 272 | 6066 | from __future__ import division, print_function
import numpy as np
from itertools import product
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.... | bsd-3-clause |
noslenfa/tdjangorest | uw/lib/python2.7/site-packages/IPython/core/tests/test_pylabtools.py | 2 | 4546 | """Tests for pylab tools module.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2011, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#---------... | apache-2.0 |
slimpotatoes/STEM_Moire_GPA | src/main.py | 1 | 4692 | # ############################# #
# #
# STEM Moire GPA Software #
# #
# ############################# #
#
# #####################################################################################
#
# Python script calculating the 2D relative strain maps fr... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.