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 |
|---|---|---|---|---|---|
google/qkeras | examples/example_ternary.py | 1 | 3557 | # Copyright 2020 Google LLC
#
#
# 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,... | apache-2.0 |
florian-f/sklearn | sklearn/datasets/species_distributions.py | 4 | 7844 | """
=============================
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>`_... | bsd-3-clause |
sniemi/SamPy | sandbox/src1/examples/animation_blit_qt4.py | 1 | 1976 | # For detailed comments on animation and the techniqes used here, see
# the wiki entry http://www.scipy.org/Cookbook/Matplotlib/Animations
import os, sys
import matplotlib
matplotlib.use('Qt4Agg') # qt4 example
from PyQt4 import QtCore, QtGui
ITERS = 1000
import pylab as p
import numpy as npy
import time
class Bli... | bsd-2-clause |
kwikadi/orange3 | Orange/classification/logistic_regression.py | 2 | 1302 | import numpy as np
import sklearn.linear_model as skl_linear_model
from Orange.classification import SklLearner, SklModel
from Orange.preprocess import Normalize
from Orange.preprocess.score import LearnerScorer
from Orange.data import Variable, DiscreteVariable
__all__ = ["LogisticRegressionLearner"]
class _Featu... | bsd-2-clause |
detrout/debian-statsmodels | statsmodels/graphics/tests/test_regressionplots.py | 5 | 4406 | '''Tests for regressionplots, entire module is skipped
'''
import numpy as np
import nose
import statsmodels.api as sm
from statsmodels.graphics.regressionplots import (plot_fit, plot_ccpr,
plot_partregress, plot_regress_exog, abline_plot,
plot_partregress_grid, plot_ccpr_grid, ad... | bsd-3-clause |
hmendozap/auto-sklearn | autosklearn/pipeline/components/feature_preprocessing/kitchen_sinks.py | 1 | 2125 | from HPOlibConfigSpace.configuration_space import ConfigurationSpace
from HPOlibConfigSpace.hyperparameters import UniformFloatHyperparameter, \
UniformIntegerHyperparameter
from autosklearn.pipeline.components.base import AutoSklearnPreprocessingAlgorithm
from autosklearn.pipeline.constants import *
class Random... | bsd-3-clause |
junwucs/h2o-3 | h2o-docs/src/api/data-science-example-1/example-native-pandas-scikit.py | 22 | 2796 | # -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
from pandas import Series, DataFrame
import pandas as pd
import numpy as np
import sklearn
from sklearn.ensemble import GradientBoostingClassifier
from sklearn import preprocessing
# <codecell>
air_raw = DataFrame.from_csv("allyears_tiny.csv", index_c... | apache-2.0 |
ygorshenin/omim | tools/python/transit/transit_graph_generator.py | 10 | 18195 | #!/usr/bin/env python3
# Generates transit graph for MWM transit section generator.
# Also shows preview of transit scheme lines.
import argparse
import copy
import json
import math
import numpy as np
import os.path
import bezier_curves
import transit_color_palette
class OsmIdCode:
NODE = 0x4000000000000000
... | apache-2.0 |
pydata/pandas-gbq | tests/system/test_read_gbq_with_bqstorage.py | 1 | 2024 | """System tests for read_gbq using the BigQuery Storage API."""
import functools
import uuid
import pytest
pytest.importorskip("google.cloud.bigquery", minversion="1.24.0")
@pytest.fixture
def method_under_test(credentials):
import pandas_gbq
return functools.partial(pandas_gbq.read_gbq, credentials=cred... | bsd-3-clause |
charanpald/wallhack | wallhack/modelselect/RealDataSVMExp4.py | 1 | 4740 | """
Plot the ideal versus estimated penalty and see where the largest mistakes occur.
"""
import logging
import numpy
import sys
import multiprocessing
from sandbox.util.PathDefaults import PathDefaults
from exp.modelselect.ModelSelectUtils import ModelSelectUtils
from sandbox.util.Sampling import Sampling
from ... | gpl-3.0 |
dbaranchuk/hnsw | plots/new_graphic.py | 1 | 10314 |
import matplotlib.patches as mpatches
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
import numpy
import seaborn as sns
sns.set(style='ticks', palette='Set2')
sns.despine()
SIFT_16_IMI_16384_recall = [0.329, 0.348, 0.353]
SIFT_16_IMI_16384_time = [2.56, 5.31, 8.46]
SIFT_16_IMI_4... | apache-2.0 |
opencobra/cobrapy | src/cobra/medium/boundary_types.py | 1 | 6160 | """Provide functions to identify the type of boundary reactions.
This module uses various heuristics to decide whether a boundary reaction
is an exchange, demand or sink reaction. It mostly orientates on the
following paper:
Thiele, I., & Palsson, B. Ø. (2010, January). A protocol for
generating a high-quality genome... | gpl-2.0 |
siutanwong/scikit-learn | benchmarks/bench_plot_lasso_path.py | 301 | 4003 | """Benchmarks of Lasso regularization path computation using Lars and CD
The input data is mostly low rank but is a fat infinite tail.
"""
from __future__ import print_function
from collections import defaultdict
import gc
import sys
from time import time
import numpy as np
from sklearn.linear_model import lars_pat... | bsd-3-clause |
cdr-stats/cdr-stats | cdr_stats/cdr_alert/tasks.py | 1 | 19322 | # -*- coding: utf-8 -*-
#
# CDR-Stats License
# http://www.cdr-stats.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2015 Star2Billing S.L.... | mpl-2.0 |
ElDeveloper/scikit-learn | benchmarks/bench_tree.py | 297 | 3617 | """
To run this, you'll need to have installed.
* scikit-learn
Does two benchmarks
First, we fix a training set, increase the number of
samples to classify and plot number of classified samples as a
function of time.
In the second benchmark, we increase the number of dimensions of the
training set, classify a sam... | bsd-3-clause |
nicocardiel/numina | numina/array/wavecalib/peaks_spectrum.py | 3 | 8947 | #
# Copyright 2015-2021 Universidad Complutense de Madrid
#
# This file is part of Numina
#
# SPDX-License-Identifier: GPL-3.0+
# License-Filename: LICENSE.txt
#
import numpy as np
from numpy.polynomial import Polynomial
from ..display.matplotlib_qt import set_window_geometry
from ..display.pause_debugplot import pau... | gpl-3.0 |
ningchi/scikit-learn | sklearn/utils/tests/test_estimator_checks.py | 4 | 2571 | import scipy.sparse as sp
import numpy as np
import sys
from sklearn.externals.six.moves import cStringIO as StringIO
from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.utils.testing import assert_raises_regex, assert_true
from sklearn.utils.estimator_checks import check_estimator
from sklearn.linear... | bsd-3-clause |
google/madi | src/madi/datasets/gaussian_mixture_dataset.py | 1 | 5652 | # Lint as: python3
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | apache-2.0 |
dongsenfo/pymatgen | pymatgen/io/abinit/tasks.py | 2 | 180142 | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""This module provides functions and classes related to Task objects."""
import os
import time
import datetime
import shutil
import collections
import abc
import copy
import ruamel.yaml as yaml
from io import ... | mit |
desihub/fiberassign | py/fiberassign/test/test_qa.py | 1 | 11199 | """
Test fiberassign target operations.
"""
import os
import subprocess
import re
import shutil
import unittest
from datetime import datetime
import json
import glob
import numpy as np
import fitsio
import desimodel
import fiberassign
from fiberassign.utils import option_list, GlobalTimers
from fiberassign.hardwa... | bsd-3-clause |
mequanta/z-runner | examples/quanto/ta_lib_example.py | 1 | 1960 | # This example algorithm uses the Relative Strength Index indicator as a buy/sell signal.
# When the RSI is over 70, a stock can be seen as overbought and it's time to sell.
# When the RSI is below 30, a stock can be seen as oversold and it's time to buy.
# Because this algorithm uses the history function, it will onl... | agpl-3.0 |
poryfly/scikit-learn | sklearn/tests/test_naive_bayes.py | 142 | 17496 | import pickle
from io import BytesIO
import numpy as np
import scipy.sparse
from sklearn.datasets import load_digits, load_iris
from sklearn.cross_validation import cross_val_score, train_test_split
from sklearn.externals.six.moves import zip
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.te... | bsd-3-clause |
rwl/PYPOWER-Dynamics | examples/02_SMIB_AVR_Step/test_SMIB.py | 2 | 2615 | #!python3
#
# Copyright (C) 2014-2015 Julius Susanto. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""
PYPOWER-Dynamics
Single Machine Infinite Bus (SMIB) Test
"""
# Dynamic model classes
from pydyn.controller import controller
from pydyn.s... | bsd-3-clause |
xyguo/scikit-learn | examples/cluster/plot_mean_shift.py | 351 | 1793 | """
=============================================
A demo of the mean-shift clustering algorithm
=============================================
Reference:
Dorin Comaniciu and Peter Meer, "Mean Shift: A robust approach toward
feature space analysis". IEEE Transactions on Pattern Analysis and
Machine Intelligence. 2002. ... | bsd-3-clause |
herilalaina/scikit-learn | sklearn/feature_extraction/text.py | 11 | 53904 | # -*- coding: utf-8 -*-
# Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Lars Buitinck
# Robert Layton <robertlayton@gmail.com>
# Jochen Wersdörfer <jochen@wersdoerfer.de>
# Roman Sinayev <roman.sinayev@gmail.com>
#
# License: B... | bsd-3-clause |
hsuantien/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 |
bgris/ODL_bgris | lib/python3.5/site-packages/scipy/stats/_multivariate.py | 13 | 99071 | #
# Author: Joris Vankerschaver 2013
#
from __future__ import division, print_function, absolute_import
import math
import numpy as np
import scipy.linalg
from scipy.misc import doccer
from scipy.special import gammaln, psi, multigammaln
from scipy._lib._util import check_random_state
from scipy.linalg.blas import dro... | gpl-3.0 |
jorge2703/scikit-learn | sklearn/ensemble/gradient_boosting.py | 126 | 65552 | """Gradient Boosted Regression Trees
This module contains methods for fitting gradient boosted regression trees for
both classification and regression.
The module structure is the following:
- The ``BaseGradientBoosting`` base class implements a common ``fit`` method
for all the estimators in the module. Regressio... | bsd-3-clause |
dfroger/geomalgo | test/triangulation/test_triangulation.py | 2 | 1509 | import unittest
import numpy as np
import geomalgo as ga
STEP = ga.data.step
class TestTriangulation(unittest.TestCase):
def test_get(self):
TG = ga.Triangulation2D(STEP.x, STEP.y, STEP.trivtx)
triangle = TG[3]
self.assertEqual(triangle.index, 3)
self.assertEqual(triangle.A... | gpl-3.0 |
huzq/scikit-learn | doc/conf.py | 1 | 15607 | # -*- coding: utf-8 -*-
#
# scikit-learn documentation build configuration file, created by
# sphinx-quickstart on Fri Jan 8 09:13:42 2010.
#
# This file is execfile()d with the current directory set to its containing
# dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
... | bsd-3-clause |
herilalaina/scikit-learn | sklearn/linear_model/tests/test_ridge.py | 21 | 29229 | import numpy as np
import scipy.sparse as sp
from scipy import linalg
from itertools import product
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn... | bsd-3-clause |
AstroTech/workshop-python | data-visualization/src/matplotlib-radar-chart.py | 1 | 7427 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.path import Path
from matplotlib.spines import Spine
from matplotlib.projections.polar import PolarAxes
from matplotlib.projections import register_projection
def radar_factory(num_vars, frame='circle'):
"""Create a radar chart with `num_vars` ax... | mit |
abhishekgahlot/scikit-learn | sklearn/linear_model/tests/test_ransac.py | 40 | 12814 | import numpy as np
from numpy.testing import assert_equal, assert_raises
from numpy.testing import assert_array_almost_equal
from scipy import sparse
from sklearn.utils.testing import assert_less
from sklearn.linear_model import LinearRegression, RANSACRegressor
from sklearn.linear_model.ransac import _dynamic_max_tri... | bsd-3-clause |
xdnian/pyml | code/optional-py-scripts/ch13.py | 2 | 11389 | # Sebastian Raschka, 2015 (http://sebastianraschka.com)
# Python Machine Learning - Code Examples
#
# Chapter 13 - Parallelizing Neural Network Training with Theano
#
# S. Raschka. Python Machine Learning. Packt Publishing Ltd., 2015.
# GitHub Repo: https://github.com/rasbt/python-machine-learning-book
#
# License: MIT... | mit |
xuewei4d/scikit-learn | examples/mixture/plot_gmm_selection.py | 15 | 3396 | """
================================
Gaussian Mixture Model Selection
================================
This example shows that model selection can be performed with
Gaussian Mixture Models using information-theoretic criteria (BIC).
Model selection concerns both the covariance type
and the number of components in the ... | bsd-3-clause |
zihua/scikit-learn | sklearn/linear_model/tests/test_bayes.py | 299 | 1770 | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
#
# License: BSD 3 clause
import numpy as np
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import SkipTest
from sklearn.linear_model.bayes import BayesianRidge, ARDRegres... | bsd-3-clause |
CforED/Machine-Learning | examples/classification/plot_classifier_comparison.py | 36 | 5123 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=====================
Classifier comparison
=====================
A comparison of a several classifiers in scikit-learn on synthetic datasets.
The point of this example is to illustrate the nature of decision boundaries
of different classifiers.
This should be taken with ... | bsd-3-clause |
Clyde-fare/scikit-learn | sklearn/metrics/metrics.py | 233 | 1262 | import warnings
warnings.warn("sklearn.metrics.metrics is deprecated and will be removed in "
"0.18. Please import from sklearn.metrics",
DeprecationWarning)
from .ranking import auc
from .ranking import average_precision_score
from .ranking import label_ranking_average_precision_score
fro... | bsd-3-clause |
macks22/gensim | gensim/sklearn_api/d2vmodel.py | 1 | 3875 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Scikit learn interface for gensim for easy use of gensim with scikit-learn
Follows scikit-learn API conventions
"""
import numpy as... | lgpl-2.1 |
alvarofierroclavero/scikit-learn | sklearn/grid_search.py | 103 | 36232 | """
The :mod:`sklearn.grid_search` includes utilities to fine-tune the parameters
of an estimator.
"""
from __future__ import print_function
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>,
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# ... | bsd-3-clause |
newville/scikit-image | doc/examples/plot_random_walker_segmentation.py | 3 | 2461 | """
==========================
Random walker segmentation
==========================
The random walker algorithm [1]_ determines the segmentation of an image from
a set of markers labeling several phases (2 or more). An anisotropic diffusion
equation is solved with tracers initiated at the markers' position. The loca... | bsd-3-clause |
INM-6/nest-git-migration | testsuite/manualtests/test_tsodyks_depr_fac.py | 13 | 1136 | # -*- coding: utf-8 -*-
#
# test_tsodyks_depr_fac.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the L... | gpl-2.0 |
trouden/MultiMediaVerwerking | Labo02/opdracht2.py | 1 | 2427 | import cv2
from matplotlib import pyplot as plt
import math
import numpy as np
def saltPepper(imgage, times, kernelWidth):
kernelSize = (kernelWidth -1) / 2
img = np.copy(imgage)
height, width = img.shape[:2]
for n in range(0, times):
newImage = np.copy(img)
for h in range(kernelSize... | mit |
caskorg/cask | src/frontend/cask.py | 1 | 18214 | """Implements the main DSE loop in spark."""
import maxbuild
import argparse
import itertools
import json
import os
import pprint
import re
import shutil
import subprocess
import sys
import pandas as pd
from tabulate import tabulate
from html import HTML
from bs4 import BeautifulSoup
from os import listdir
from os.pa... | mit |
hugobowne/scikit-learn | examples/semi_supervised/plot_label_propagation_digits.py | 268 | 2723 | """
===================================================
Label Propagation digits: Demonstrating performance
===================================================
This example demonstrates the power of semisupervised learning by
training a Label Spreading model to classify handwritten digits
with sets of very few labels.... | bsd-3-clause |
aitoralmeida/dl_activity_recognition | sensor2vec/casas_aruba_dataset/partial_dataset_creator.py | 1 | 3064 | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 31 10:27:31 2017
@author: gazkune
Script to generate several csv files for aruba dataset
"""
import sys
import pandas as pd
import numpy as np
# The input dataset
DATASET = "aruba_complete_dataset.csv"
# Output datasets
COMPLETE_NUMERIC = "aruba_complete_numeric.csv... | gpl-3.0 |
YihaoLu/statsmodels | examples/incomplete/wls_extended.py | 33 | 16137 | """
Weighted Least Squares
example is extended to look at the meaning of rsquared in WLS,
at outliers, compares with RLM and a short bootstrap
"""
from __future__ import print_function
import numpy as np
import statsmodels.api as sm
import matplotlib.pyplot as plt
data = sm.datasets.ccard.load()
data.exog = sm.add_c... | bsd-3-clause |
jeffery-do/Vizdoombot | doom/lib/python3.5/site-packages/matplotlib/transforms.py | 7 | 96105 | """
matplotlib includes a framework for arbitrary geometric
transformations that is used determine the final position of all
elements drawn on the canvas.
Transforms are composed into trees of :class:`TransformNode` objects
whose actual value depends on their children. When the contents of
children change, their pare... | mit |
wathen/PhD | MHD/FEniCS/MHD/Stabilised/SaddlePointForm/Test/SplitMatrix/ScottTest/Decouple/MU.py | 1 | 13311 | #!/usr/bin/python
# interpolate scalar gradient onto nedelec space
import petsc4py
import sys
petsc4py.init(sys.argv)
from petsc4py import PETSc
from dolfin import *
# from MatrixOperations import *
import numpy as np
import PETScIO as IO
import common
import scipy
import scipy.io
import time
import scipy.sparse as... | mit |
evidation-health/bokeh | bokeh/_legacy_charts/builder/tests/test_horizon_builder.py | 6 | 3422 | """ This is the Bokeh charts testing interface.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with thi... | bsd-3-clause |
jakobworldpeace/scikit-learn | sklearn/utils/estimator_checks.py | 16 | 64623 | from __future__ import print_function
import types
import warnings
import sys
import traceback
import pickle
from copy import deepcopy
import numpy as np
from scipy import sparse
from scipy.stats import rankdata
import struct
from sklearn.externals.six.moves import zip
from sklearn.externals.joblib import hash, Memor... | bsd-3-clause |
SiLab-Bonn/Scarce | scarce/examples/cce_3D.py | 1 | 3333 | ''' Example that calculates the collected charge.
The collected charge is calculated as a function
of the position in the sensor. The drift field
takes irradiation into account.
'''
import matplotlib.pyplot as plt
from matplotlib import cm
from scarce import tools
from scarce.examples import cc_3D
if _... | mit |
shikhardb/scikit-learn | sklearn/metrics/tests/test_pairwise.py | 16 | 22326 | import numpy as np
from numpy import linalg
from scipy.sparse import dok_matrix, csr_matrix, issparse
from scipy.spatial.distance import cosine, cityblock, minkowski, wminkowski
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing impo... | bsd-3-clause |
jreback/pandas | pandas/tests/plotting/test_misc.py | 2 | 20162 | """ Test cases for misc plot functions """
import numpy as np
import pytest
import pandas.util._test_decorators as td
from pandas import DataFrame, Series
import pandas._testing as tm
from pandas.tests.plotting.common import TestPlotBase, _check_plot_works
import pandas.plotting as plotting
pytestmark = pytest.mar... | bsd-3-clause |
kernelmilowill/PDMQBACKTEST | vn.how/tick2trade/vn.trader_t2t/ctaAlgo/strategyAtrRsi.py | 10 | 11369 | # encoding: UTF-8
"""
一个ATR-RSI指标结合的交易策略,适合用在股指的1分钟和5分钟线上。
注意事项:
1. 作者不对交易盈利做任何保证,策略代码仅供参考
2. 本策略需要用到talib,没有安装的用户请先参考www.vnpy.org上的教程安装
3. 将IF0000_1min.csv用ctaHistoryData.py导入MongoDB后,直接运行本文件即可回测策略
"""
from ctaBase import *
from ctaTemplate import CtaTemplate
import talib
import numpy as np
###################... | mit |
pkruskal/scikit-learn | examples/semi_supervised/plot_label_propagation_digits.py | 268 | 2723 | """
===================================================
Label Propagation digits: Demonstrating performance
===================================================
This example demonstrates the power of semisupervised learning by
training a Label Spreading model to classify handwritten digits
with sets of very few labels.... | bsd-3-clause |
jlegendary/scikit-learn | examples/ensemble/plot_forest_importances.py | 241 | 1761 | """
=========================================
Feature importances with forests of trees
=========================================
This examples shows the use of forests of trees to evaluate the importance of
features on an artificial classification task. The red bars are the feature
importances of the forest, along wi... | bsd-3-clause |
alephu5/Soundbyte | environment/lib/python3.3/site-packages/IPython/lib/tests/test_latextools.py | 10 | 4076 | # encoding: utf-8
"""Tests for IPython.utils.path.py"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this s... | gpl-3.0 |
bgris/ODL_bgris | lib/python3.5/site-packages/scipy/interpolate/_cubic.py | 10 | 29293 | """Interpolation algorithms using piecewise cubic polynomials."""
from __future__ import division, print_function, absolute_import
import numpy as np
from scipy._lib.six import string_types
from . import BPoly, PPoly
from .polyint import _isscalar
from scipy._lib._util import _asarray_validated
from scipy.linalg im... | gpl-3.0 |
JohnCEarls/DataDirac | datadirac/utils/stat.py | 1 | 1978 | import nipy.algorithms.statistics.empirical_pvalue as pval
import pandas
from collections import defaultdict
def get_fdr_cutoffs( tsv_file, index='networks', alphas=[.05, .01], dec_places=2 ):
for a in alphas:
if a < .01:
raise Exception("Alphas only go to .01, easy to fix, but I have bigger fi... | gpl-3.0 |
mjudsp/Tsallis | sklearn/utils/tests/test_seq_dataset.py | 47 | 2486 | # Author: Tom Dupre la Tour <tom.dupre-la-tour@m4x.org>
#
# License: BSD 3 clause
import numpy as np
import scipy.sparse as sp
from sklearn.utils.seq_dataset import ArrayDataset, CSRDataset
from sklearn.datasets import load_iris
from numpy.testing import assert_array_equal
from nose.tools import assert_equal
iris =... | bsd-3-clause |
klocey/Image-Analysis | python/using_scikit_image.py | 4 | 1477 | from matplotlib import pyplot as plt
from skimage import data
from skimage.feature import blob_dog, blob_log, blob_doh
from math import sqrt
from skimage.color import rgb2gray
import numpy as np
import cv2
from PIL import Image
import sys
import os
mydir = os.path.expanduser("~/GitHub/Image-Analysis")
# Read image
... | mit |
Aasmi/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 |
zhoulingjun/zipline | zipline/utils/tradingcalendar_tse.py | 24 | 10413 | #
# 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 |
pravsripad/jumeg | examples/connectivity/plot_brain_connectome.py | 3 | 1329 | #!/usr/bin/env python
'''
Plot connectivity on a glass brain using 'plot_connectome' function from
Nilearn (https://nilearn.github.io/).
Author: Praveen Sripad <pravsripad@gmail.com>
'''
import numpy as np
import mne
from mne.datasets import sample
from nilearn import plotting
import nibabel as nib
import matplotl... | bsd-3-clause |
grundgruen/powerline | powerline/utils/global_calendar.py | 2 | 2177 | import pandas as pd
from dateutil import rrule
from zipline.utils.tradingcalendar import end, canonicalize_datetime
__author__ = 'Warren'
start = pd.Timestamp('2013-01-01', tz='UTC')
end_base = pd.Timestamp('today', tz='UTC')
start = canonicalize_datetime(start)
end = canonicalize_datetime(end)
weekends = rrule.... | apache-2.0 |
leesavide/pythonista-docs | Documentation/matplotlib/mpl_examples/pie_and_polar_charts/pie_demo_features.py | 3 | 1070 | """
Demo of a basic pie chart plus a few additional features.
In addition to the basic pie chart, this demo shows a few optional features:
* slice labels
* auto-labeling the percentage
* offsetting a slice with "explode"
* drop-shadow
* custom start angle
Note about the custom start angle:
The d... | apache-2.0 |
AlexandreAbraham/brainhack2013 | brainhack/datasets.py | 1 | 2280 | import os
from nilearn.datasets import _get_dataset, _fetch_dataset
from sklearn.datasets.base import Bunch
def fetch_craddock_2012_test(n_subjects=None, data_dir=None, resume=True,
verbose=0):
"""Download and load example data from Craddock 2012 work.
Parameters
----------
... | bsd-3-clause |
rbalda/neural_ocr | env/lib/python2.7/site-packages/matplotlib/backends/backend_pgf.py | 7 | 36822 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
from matplotlib.externals import six
import math
import os
import sys
import errno
import re
import shutil
import tempfile
import codecs
import atexit
import weakref
import warnings
import numpy as np
import... | mit |
hypergravity/bopy | setup.py | 1 | 1310 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name='bopy',
version='0.4.0',
author='Bo Zhang',
author_email='bozhang@nao.cas.cn',
description='Bo Zhang (@NAOC)''s python package.', # short description
long_description=long_description,
... | bsd-3-clause |
enigmampc/catalyst | catalyst/examples/simple_loop.py | 1 | 4210 | import pandas as pd
import talib
from logbook import Logger, INFO
from catalyst import run_algorithm
from catalyst.api import symbol, record
from catalyst.exchange.utils.stats_utils import get_pretty_stats, \
extract_transactions
log = Logger('simple_loop', level=INFO)
def initialize(context):
log.info('ini... | apache-2.0 |
rolando/theusual-kaggle-seeclickfix-ensemble | Bryan/data_io.py | 2 | 4219 | """
Functions for data IO
"""
__author__ = 'Bryan Gregory'
__email__ = 'bryan.gregory1@gmail.com'
__date__ = '09-06-2013'
#Internal modules
import utils
#Start logger to record all info, warnings, and errors to Logs/logfile.log
log = utils.start_logging(__name__)
#External modules
import json
import csv... | bsd-3-clause |
alexeyum/scikit-learn | benchmarks/bench_multilabel_metrics.py | 276 | 7138 | #!/usr/bin/env python
"""
A comparison of multilabel target formats and metrics over them
"""
from __future__ import division
from __future__ import print_function
from timeit import timeit
from functools import partial
import itertools
import argparse
import sys
import matplotlib.pyplot as plt
import scipy.sparse as... | bsd-3-clause |
shangwuhencc/scikit-learn | sklearn/feature_selection/rfe.py | 64 | 17509 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Vincent Michel <vincent.michel@inria.fr>
# Gilles Louppe <g.louppe@gmail.com>
#
# License: BSD 3 clause
"""Recursive feature elimination for feature ranking"""
import warnings
import numpy as np
from ..utils import check_X_y, safe_sqr
fro... | bsd-3-clause |
CooperLuan/yoka_bot | yoka_bot/spiders/yoka_bot_spider.py | 1 | 6117 | # encoding: utf8
import re
import pandas as pd
from lxml import etree
import scrapy
from yoka_bot.items import YokaBotBrandListItem, YokaBotBrandItem, YokaBotProductListItem, YokaBotProductItem
host = 'http://brand.yoka.com'
def wrap_full_url(url):
if url.startswith('http'):
return url
return host + u... | mit |
senthil10/scilifelab | scripts/RNA_analysis/plot_complexity_curves.py | 4 | 5371 | import sys
import os
import yaml
import glob
import subprocess
import argparse
import pandas as pd
from matplotlib import pyplot as plt
import numpy as np
import math
def main(args):
ccurves = args.ccurves[0]
x_min = args.x_min
x_max = args.x_max
if x_min < 0 or x_max <= x_min:
... | mit |
vortex-ape/scikit-learn | sklearn/manifold/t_sne.py | 2 | 36774 | # Author: Alexander Fabisch -- <afabisch@informatik.uni-bremen.de>
# Author: Christopher Moody <chrisemoody@gmail.com>
# Author: Nick Travers <nickt@squareup.com>
# License: BSD 3 clause (C) 2014
# This is the exact and Barnes-Hut t-SNE implementation. There are other
# modifications of the algorithm:
# * Fast Optimi... | bsd-3-clause |
GuessWhoSamFoo/pandas | pandas/tests/indexing/test_timedelta.py | 4 | 3710 | import numpy as np
import pytest
import pandas as pd
from pandas.util import testing as tm
class TestTimedeltaIndexing(object):
def test_boolean_indexing(self):
# GH 14946
df = pd.DataFrame({'x': range(10)})
df.index = pd.to_timedelta(range(10), unit='s')
conditions = [df['x'] > 3... | bsd-3-clause |
kiyoto/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 |
abimannans/scikit-learn | examples/tree/plot_tree_regression.py | 206 | 1476 | """
===================================================================
Decision Tree Regression
===================================================================
A 1D regression with decision tree.
The :ref:`decision trees <tree>` is
used to fit a sine curve with addition noisy observation. As a result, it
learns ... | bsd-3-clause |
davidgbe/scikit-learn | sklearn/kernel_ridge.py | 155 | 6545 | """Module :mod:`sklearn.kernel_ridge` implements kernel ridge regression."""
# Authors: Mathieu Blondel <mathieu@mblondel.org>
# Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
# License: BSD 3 clause
import numpy as np
from .base import BaseEstimator, RegressorMixin
from .metrics.pairwise import pairwise... | bsd-3-clause |
kenshay/ImageScripter | ProgramData/SystemFiles/Python/Lib/site-packages/skimage/viewer/canvastools/recttool.py | 43 | 8886 | from matplotlib.widgets import RectangleSelector
from ...viewer.canvastools.base import CanvasToolBase
from ...viewer.canvastools.base import ToolHandles
__all__ = ['RectangleTool']
class RectangleTool(CanvasToolBase, RectangleSelector):
"""Widget for selecting a rectangular region in a plot.
After making ... | gpl-3.0 |
lin-credible/scikit-learn | examples/applications/plot_species_distribution_modeling.py | 254 | 7434 | """
=============================
Species distribution modeling
=============================
Modeling species' geographic distributions is an important
problem in conservation biology. In this example we
model the geographic distribution of two south american
mammals given past observations and 14 environmental
varia... | bsd-3-clause |
akrherz/dep | scripts/cligen/qc_summarize.py | 2 | 7378 | """Need something that prints diagnostics of our climate file"""
import sys
import datetime
import numpy as np
import netCDF4
import pytz
import pandas as pd
import requests
from pyiem.dep import read_cli
from pyiem.iemre import hourly_offset
from pyiem.util import c2f, mm2inch
def compute_stage4(lon, lat, year):
... | mit |
elenita1221/BDA_py_demos | demos_ch2/demo2_4.py | 19 | 2780 | """Bayesian Data Analysis, 3rd ed
Chapter 2, demo 4
Calculate the posterior distribution on a discrete grid of points by
multiplying the likelihood and a non-conjugate prior at each point, and
normalizing over the points. Simulate samples from the resulting non-standard
posterior distribution using inverse cdf usin... | gpl-3.0 |
kjung/scikit-learn | examples/model_selection/plot_precision_recall.py | 74 | 6377 | """
================
Precision-Recall
================
Example of Precision-Recall metric to evaluate classifier output quality.
In information retrieval, precision is a measure of result relevancy, while
recall is a measure of how many truly relevant results are returned. A high
area under the curve represents both ... | bsd-3-clause |
qifeigit/scikit-learn | sklearn/preprocessing/label.py | 137 | 27165 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Joel Nothman <joel.nothman@gmail.com>
# Hamzeh Alsalhi <ha258@cornell.edu>
# Licens... | bsd-3-clause |
verashira/ml-python | classification/seeds_knn/knn.py | 1 | 2577 | import numpy as np
def find_plurality(labels):
'''
prediction = find_plurality(labels)
Return the label of most votes.
'''
from collections import defaultdict
counts = defaultdict(int)
for label in labels:
counts[label] += 1
maxv = max(counts.values())
for k,v in c... | mit |
xwolf12/scikit-learn | benchmarks/bench_tree.py | 297 | 3617 | """
To run this, you'll need to have installed.
* scikit-learn
Does two benchmarks
First, we fix a training set, increase the number of
samples to classify and plot number of classified samples as a
function of time.
In the second benchmark, we increase the number of dimensions of the
training set, classify a sam... | bsd-3-clause |
DanHickstein/pyBASEX | examples/example_all_dribinski.py | 2 | 3691 | # -*- coding: utf-8 -*-
# This example compares the available inverse Abel transform methods
# for the Ominus sample image
#
# Note it transforms only the Q0 (top-right) quadrant
# using the fundamental transform code
from __future__ import absolute_import
from __future__ import division
from __future__ import print_... | gpl-2.0 |
f3r/scikit-learn | sklearn/datasets/__init__.py | 72 | 3807 | """
The :mod:`sklearn.datasets` module includes utilities to load datasets,
including methods to load and fetch popular reference datasets. It also
features some artificial data generators.
"""
from .base import load_diabetes
from .base import load_digits
from .base import load_files
from .base import load_iris
from .... | bsd-3-clause |
prheenan/Research | Perkins/Projects/Lipids/2017-1-negative-control-gallery/main_negative_gallery.py | 1 | 1450 | # 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("../../../../../")
from GeneralUtil.python import GenUtilities,CheckpointUtilities... | gpl-3.0 |
ishanic/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 |
rohanp/scikit-learn | sklearn/cluster/tests/test_dbscan.py | 176 | 12155 | """
Tests for DBSCAN clustering algorithm
"""
import pickle
import numpy as np
from scipy.spatial import distance
from scipy import sparse
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing im... | bsd-3-clause |
cumc-dbmi/pmi_sprint_reporter | run_config.py | 1 | 1638 | """
Module contains runtime configuration variables
"""
import pandas
from sqlalchemy import DateTime
from sqlalchemy import create_engine
import resources
import settings
from sqlalchemy.dialects.mssql import DATETIME2
engine = create_engine(settings.conn_str)
all_hpos = pandas.read_csv(resources.hpo_csv_path)
all... | mit |
jorge2703/scikit-learn | examples/neighbors/plot_approximate_nearest_neighbors_scalability.py | 225 | 5719 | """
============================================
Scalability of Approximate Nearest Neighbors
============================================
This example studies the scalability profile of approximate 10-neighbors
queries using the LSHForest with ``n_estimators=20`` and ``n_candidates=200``
when varying the number of sa... | bsd-3-clause |
hsiaoyi0504/scikit-learn | sklearn/linear_model/tests/test_sparse_coordinate_descent.py | 244 | 9986 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_true
from sklearn.utils.t... | bsd-3-clause |
walterst/qiime | qiime/make_rarefaction_plots.py | 6 | 65388 | #!/usr/bin/env python
# file make_rarefaction_plots.py
from __future__ import division
__author__ = "Meg Pirrung"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = ["Meg Pirrung", "Jesse Stombaugh", "Antonio Gonzalez Pena",
"Will Van Treuren", "Yoshiki Vazquez Baeza", "Jai Ram Rideout",
... | gpl-2.0 |
dopplershift/MetPy | src/metpy/plots/declarative.py | 1 | 65191 | # Copyright (c) 2018,2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Declarative plotting tools."""
import contextlib
import copy
from datetime import datetime, timedelta
import re
import matplotlib.pyplot as plt
import numpy as np
import... | bsd-3-clause |
jburos/survivalstan | test/test_byo-gamma_survival_model_sim.py | 1 | 3465 |
import matplotlib as mpl
mpl.use('Agg')
import survivalstan
from stancache import stancache
import numpy as np
from functools import partial
from nose.tools import ok_
num_iter = 500
from .test_datasets import sim_test_dataset
model_code = '''
functions {
int count_value(vector a, real val) {
int s;
... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.