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 |
|---|---|---|---|---|---|
hyperspy/hyperspy | hyperspy/utils/peakfinders2D.py | 2 | 20090 | # -*- coding: utf-8 -*-
# Copyright 2007-2021 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 |
gnieboer/tensorflow | tensorflow/examples/tutorials/input_fn/boston.py | 51 | 2709 | # 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 |
roxyboy/scikit-learn | examples/linear_model/plot_ols_ridge_variance.py | 387 | 2060 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Ordinary Least Squares and Ridge Regression Variance
=========================================================
Due to the few points in each dimension and the straight
line that linear regression uses to follow thes... | bsd-3-clause |
abitofalchemy/hrg_nets | prod_rules_toHstar.py | 1 | 1496 | import shelve
import os
import re
import networkx as nx
import tw_karate_chop as tw
import net_metrics as metrics
import graph_sampler as gs
import david as pcfg
#
# # Load production rules
# ########################
shelf = shelve.open("../Results/production_rules_dict.shl.db") # the same filename that you used bef... | gpl-3.0 |
arokem/scipy | scipy/signal/windows/windows.py | 1 | 74167 | """The suite of window functions."""
from __future__ import division, print_function, absolute_import
import operator
import warnings
import numpy as np
from scipy import linalg, special, fft as sp_fft
__all__ = ['boxcar', 'triang', 'parzen', 'bohman', 'blackman', 'nuttall',
'blackmanharris', 'flattop', ... | bsd-3-clause |
jamdin/jdiner-mobile-byte3 | lib/numpy/doc/creation.py | 94 | 5411 | """
==============
Array Creation
==============
Introduction
============
There are 5 general mechanisms for creating arrays:
1) Conversion from other Python structures (e.g., lists, tuples)
2) Intrinsic numpy array array creation objects (e.g., arange, ones, zeros,
etc.)
3) Reading arrays from disk, either from... | apache-2.0 |
rseubert/scikit-learn | examples/linear_model/plot_iris_logistic.py | 283 | 1678 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Logistic Regression 3-class Classifier
=========================================================
Show below is a logistic-regression classifiers decision boundaries on the
`iris <http://en.wikipedia.org/wiki/Iris_f... | bsd-3-clause |
themrmax/scikit-learn | sklearn/linear_model/ransac.py | 12 | 19391 | # coding: utf-8
# Author: Johannes Schönberger
#
# License: BSD 3 clause
import numpy as np
import warnings
from ..base import BaseEstimator, MetaEstimatorMixin, RegressorMixin, clone
from ..utils import check_random_state, check_array, check_consistent_length
from ..utils.random import sample_without_replacement
fr... | bsd-3-clause |
joernhees/scikit-learn | sklearn/neighbors/classification.py | 4 | 14328 | """Nearest Neighbor Classification"""
# Authors: Jake Vanderplas <vanderplas@astro.washington.edu>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Sparseness support by Lars Buitinck
# Multi-output support by Arnaud Joly <a.joly@ul... | bsd-3-clause |
aflaxman/scikit-learn | sklearn/neural_network/tests/test_stochastic_optimizers.py | 146 | 4310 | import numpy as np
from sklearn.neural_network._stochastic_optimizers import (BaseOptimizer,
SGDOptimizer,
AdamOptimizer)
from sklearn.utils.testing import (assert_array_equal, assert_true,
... | bsd-3-clause |
suyashbire1/pyhton_scripts_mom6 | plot_uvutwavtwa.py | 1 | 4405 | import sys
import readParams_moreoptions as rdp1
import matplotlib.pyplot as plt
from mom_plot1 import m6plot, xdegtokm
import numpy as np
from netCDF4 import MFDataset as mfdset, Dataset as dset
import time
from getvaratz import getvaratz
def extract_uv(geofil,
fil,
fil2,
... | gpl-3.0 |
fengzhyuan/scikit-learn | examples/cluster/plot_ward_structured_vs_unstructured.py | 320 | 3369 | """
===========================================================
Hierarchical clustering: structured vs unstructured ward
===========================================================
Example builds a swiss roll dataset and runs
hierarchical clustering on their position.
For more information, see :ref:`hierarchical_clus... | bsd-3-clause |
antgonza/qiita | qiita_pet/handlers/rest/study_samples.py | 1 | 4233 | # -----------------------------------------------------------------------------
# Copyright (c) 2014--, 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 |
shakamunyi/tensorflow | tensorflow/contrib/learn/python/learn/tests/io_test.py | 7 | 4991 | # 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 |
shubham0d/smc | salvus/sage_salvus.py | 1 | 120803 | ##################################################################################
# #
# Extra code that the Salvus server makes available in the running Sage session. #
# ... | gpl-3.0 |
Eric89GXL/mne-python | tutorials/misc/plot_seeg.py | 10 | 7388 | """
.. _tut_working_with_seeg:
======================
Working with sEEG data
======================
MNE supports working with more than just MEG and EEG data. Here we show some
of the functions that can be used to facilitate working with
stereoelectroencephalography (sEEG) data.
This example shows how to use:
- sEE... | bsd-3-clause |
Nyker510/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 |
marscher/PyEMMA | pyemma/_base/parallel.py | 1 | 2204 |
def get_n_jobs(logger=None):
def _from_hardware():
import psutil
return psutil.cpu_count(logical=False)
def _from_env(var):
import os
e = os.getenv(var, None)
if e:
try:
return int(e)
except ValueError as ve:
if l... | lgpl-3.0 |
jostep/tensorflow | tensorflow/contrib/learn/python/learn/learn_io/pandas_io_test.py | 111 | 7865 | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
DiamondLightSource/auto_tomo_calibration-experimental | old_code_scripts/simulate_data/lmfit-py/examples/fit_NIST_lmfit.py | 4 | 5071 | from __future__ import print_function
import sys
import math
from optparse import OptionParser
try:
import matplotlib
matplotlib.use('WXAgg')
import pylab
HASPYLAB = True
except ImportError:
HASPYLAB = False
from lmfit import Parameters, minimize
from NISTModels import Models, ReadNistData
def... | apache-2.0 |
Kamp9/scipy | scipy/stats/kde.py | 27 | 17303 | #-------------------------------------------------------------------------------
#
# Define classes for (uni/multi)-variate kernel density estimation.
#
# Currently, only Gaussian kernels are implemented.
#
# Written by: Robert Kern
#
# Date: 2004-08-09
#
# Modified: 2005-02-10 by Robert Kern.
# Contr... | bsd-3-clause |
chapmanb/bcbio-nextgen | bcbio/rnaseq/stringtie.py | 2 | 5368 | """
implements support for StringTie, intended to be a drop in replacement for
Cufflinks
http://ccb.jhu.edu/software/stringtie/
http://www.nature.com/nbt/journal/v33/n3/full/nbt.3122.html
manual: http://ccb.jhu.edu/software/stringtie/#contact
"""
import os
import pandas as pd
import subprocess
import contextlib
from d... | mit |
ThomasMiconi/nupic.research | projects/capybara/sandbox/sklearn/run_baseline.py | 9 | 2773 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2016, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | agpl-3.0 |
aetilley/scikit-learn | sklearn/svm/tests/test_svm.py | 116 | 31653 | """
Testing for Support Vector Machine module (sklearn.svm)
TODO: remove hard coded numerical results when possible
"""
import numpy as np
import itertools
from numpy.testing import assert_array_equal, assert_array_almost_equal
from numpy.testing import assert_almost_equal
from scipy import sparse
from nose.tools im... | bsd-3-clause |
alexis-roche/nipy | examples/algorithms/bayesian_gaussian_mixtures.py | 4 | 2309 | #!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import print_function # Python 2/3 compatibility
__doc__ = """
Example of a demo that fits a Bayesian Gaussian Mixture Model (GMM)
to a dataset.
Variational bayes and ... | bsd-3-clause |
zuku1985/scikit-learn | sklearn/metrics/__init__.py | 28 | 3604 | """
The :mod:`sklearn.metrics` module includes score functions, performance metrics
and pairwise metrics and distance computations.
"""
from .ranking import auc
from .ranking import average_precision_score
from .ranking import coverage_error
from .ranking import label_ranking_average_precision_score
from .ranking imp... | bsd-3-clause |
mifumagalli/mypython | ifu/muse_emitters.py | 1 | 33984 | """
General code to handle the ID of emitters
See e.g. Lofthouse et al. 2019, Fossati et al. 2019
Depend on proprietary code [cubex]
"""
import subprocess
import os
import numpy as np
import shutil
import mypython as mp
from mypython.ifu import muse
from mypython.ifu import muse_utils as utl
from mypython.ifu impo... | gpl-2.0 |
IssamLaradji/scikit-learn | sklearn/datasets/tests/test_mldata.py | 384 | 5221 | """Test functionality of mldata fetching utilities."""
import os
import shutil
import tempfile
import scipy as sp
from sklearn import datasets
from sklearn.datasets import mldata_filename, fetch_mldata
from sklearn.utils.testing import assert_in
from sklearn.utils.testing import assert_not_in
from sklearn.utils.test... | bsd-3-clause |
abysmon/pythonStuff | nsescrape.py | 1 | 1586 | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 14 12:56:51 2015
@author: itithilien
"""
from nsetools import Nse
import pandas as pd
import time
from urllib2 import build_opener, HTTPCookieProcessor, Request
#test
nse = Nse()
print nse
all_stock_codes = nse.get_stock_codes()
ticklist = all_stock_codes.keys()
tickli... | artistic-2.0 |
GiggleLiu/tba | hgen/op.py | 1 | 23225 | '''
Tree structured Operator classes.
Operator -> Base class for operators.
* Bilinear -> Elemental(leaf) Operator in the form of { factor * c^\dag c }.
* BBilinear -> Bilinear defined on the bond.
* Qlinear -> Elemental(leaf) Operator in the form of { factor * c^\dag c^\dag c c }.
* Operator_C -... | gpl-2.0 |
mayblue9/scikit-learn | sklearn/datasets/tests/test_mldata.py | 384 | 5221 | """Test functionality of mldata fetching utilities."""
import os
import shutil
import tempfile
import scipy as sp
from sklearn import datasets
from sklearn.datasets import mldata_filename, fetch_mldata
from sklearn.utils.testing import assert_in
from sklearn.utils.testing import assert_not_in
from sklearn.utils.test... | bsd-3-clause |
johnmcdowall/procedural_city_generation | procedural_city_generation/building_generation/merge_polygons.py | 3 | 2996 | import numpy as np
import time
import matplotlib.pyplot as plt
def merge_polygons(polygons,textures):
"""
Groups Polygon3Ds with identical Texture because Blender's mesh.from_pydata()
and bpy.context.scene.objects.link take an increasing amount of time with amount
of existingPolygons. Saves Polygons to /outputs/... | mpl-2.0 |
ucsc-mus-strain-cactus/Comparative-Annotation-Toolkit | tools/sqlInterface.py | 1 | 15392 | """
Functions to interface with the sqlite databases produced by various steps of the annotation pipeline
"""
import transcripts
import pandas as pd
from sqlalchemy import Column, Integer, Text, Float, Boolean, func, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessi... | apache-2.0 |
jzt5132/scikit-learn | examples/gaussian_process/plot_gp_probabilistic_classification_after_regression.py | 252 | 3490 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
==============================================================================
Gaussian Processes classification example: exploiting the probabilistic output
==============================================================================
A two-dimensional regression exerci... | bsd-3-clause |
jefffohl/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/units.py | 70 | 4810 | """
The classes here provide support for using custom classes with
matplotlib, eg those that do not expose the array interface but know
how to converter themselves to arrays. It also supoprts classes with
units and units conversion. Use cases include converters for custom
objects, eg a list of datetime objects, as we... | gpl-3.0 |
yonglehou/scikit-learn | examples/plot_johnson_lindenstrauss_bound.py | 134 | 7452 | """
=====================================================================
The Johnson-Lindenstrauss bound for embedding with random projections
=====================================================================
The `Johnson-Lindenstrauss lemma`_ states that any high dimensional
dataset can be randomly projected in... | bsd-3-clause |
rjenc29/numerical | course/matplotlib/examples/statistical_example.py | 1 | 2475 | """
Matplotlib has a handful of specalized statistical plotting methods.
For many statistical plots, you may find that a specalized statistical plotting
package such as Seaborn (which uses matplotlib behind-the-scenes) is a better
fit to your needs.
"""
import numpy as np
import matplotlib.pyplot as plt
import exampl... | mit |
MatthieuBizien/scikit-learn | sklearn/ensemble/voting_classifier.py | 4 | 8679 | """
Soft Voting/Majority Rule classifier.
This module contains a Soft Voting/Majority Rule classifier for
classification estimators.
"""
# Authors: Sebastian Raschka <se.raschka@gmail.com>,
# Gilles Louppe <g.louppe@gmail.com>
#
# License: BSD 3 clause
import numpy as np
from ..base import BaseEstimator
f... | bsd-3-clause |
chugunovyar/factoryForBuild | env/lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_rgb.py | 6 | 7005 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import numpy as np
from .axes_divider import make_axes_locatable, Size, locatable_axes_factory
import sys
from .mpl_axes import Axes
def make_rgb_axes(ax, pad=0.01, axes_class=None, add_all=True):... | gpl-3.0 |
PawarPawan/h2o-v3 | h2o-py/tests/testdir_algos/glm/pyunit_link_functions_poissonGLM.py | 3 | 2252 | import sys
sys.path.insert(1, "../../../")
import h2o
import pandas as pd
import zipfile
import statsmodels.api as sm
def link_functions_poisson(ip,port):
print("Read in prostate data.")
h2o_data = h2o.import_file(path=h2o.locate("smalldata/prostate/prostate_complete.csv.zip"))
sm_data = pd.rea... | apache-2.0 |
bmazin/ARCONS-pipeline | examples/Pal2012-nltt/fitpsf.py | 1 | 4828 | from gaussfitter import gaussfit
import numpy as np
from util import utils
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
def aperture(startpx,startpy,radius=3):
r = radius
length = 2*r
height = length
allx = xrange(startpx-int(np.ceil(length/2.0)),startpx+int(np.floor(length... | gpl-2.0 |
lazywei/scikit-learn | sklearn/utils/tests/test_shortest_path.py | 88 | 2828 | from collections import defaultdict
import numpy as np
from numpy.testing import assert_array_almost_equal
from sklearn.utils.graph import (graph_shortest_path,
single_source_shortest_path_length)
def floyd_warshall_slow(graph, directed=False):
N = graph.shape[0]
#set nonzer... | bsd-3-clause |
iut-ibk/DynaMind-ToolBox | DynaMind-BasicModules/scripts/Modules/plotvectordata.py | 2 | 5927 | """
@file
@author Chrisitan Urich <christian.urich@gmail.com>
@version 1.0
@section LICENSE
This file is part of DynaMind
Copyright (C) 2011-2012 Christian Urich
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 Softwar... | gpl-2.0 |
ryfeus/lambda-packs | Sklearn_scipy_numpy/source/sklearn/manifold/locally_linear.py | 206 | 25061 | """Locally Linear Embedding"""
# Author: Fabian Pedregosa -- <fabian.pedregosa@inria.fr>
# Jake Vanderplas -- <vanderplas@astro.washington.edu>
# License: BSD 3 clause (C) INRIA 2011
import numpy as np
from scipy.linalg import eigh, svd, qr, solve
from scipy.sparse import eye, csr_matrix
from ..base import B... | mit |
neherlab/ffpopsim | tests/python_hiv.py | 2 | 1305 | # vim: fdm=indent
'''
author: Fabio Zanini
date: 25/04/12
content: Test script for the python bindings
'''
# Import module
import sys
sys.path.insert(0, '../pkg/python')
import numpy as np
import matplotlib.pyplot as plt
import FFPopSim as h
# Construct class
pop = h.hivpopulation(1000)
# Test I/O fitne... | gpl-3.0 |
glenngillen/dotfiles | .vscode/extensions/ms-toolsai.jupyter-2021.5.745244803/pythonFiles/vscode_datascience_helpers/getJupyterVariableDataFrameRows.py | 3 | 2194 | # Query Jupyter server for the rows of a data frame
import json as _VSCODE_json
import pandas as _VSCODE_pd
import pandas.io.json as _VSCODE_pd_json
import builtins as _VSCODE_builtins
# In IJupyterVariables.getValue this '_VSCode_JupyterTestValue' will be replaced with the json stringified value of the target variabl... | mit |
cernops/CloudMan | cloudman/cloudman/charts.py | 1 | 3431 | import os
os.environ['HOME']='/var/www/tmp'
import random
import django
import datetime
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from matplotlib.dates import DateFormatter
def HepSpecsAllocationPieChart(request):
fig = Figure(figsize=(4,4))... | apache-2.0 |
eteq/bokeh | bokeh/charts/builder/tests/test_horizon_builder.py | 33 | 3440 | """ 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 |
fastai/fastai | fastai/callback/captum.py | 1 | 5575 | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/73_callback.captum.ipynb (unless otherwise specified).
__all__ = ['json_clean', 'CaptumInterpretation']
# Cell
import tempfile
from ..basics import *
# Cell
from ipykernel import jsonutil
# Cell
# Dirty hack as json_clean doesn't support CategoryMap type
_json_clean=j... | apache-2.0 |
pprett/scikit-learn | examples/cluster/plot_mini_batch_kmeans.py | 86 | 4092 | """
====================================================================
Comparison of the K-Means and MiniBatchKMeans clustering algorithms
====================================================================
We want to compare the performance of the MiniBatchKMeans and KMeans:
the MiniBatchKMeans is faster, but give... | bsd-3-clause |
ilo10/scikit-learn | examples/text/document_clustering.py | 230 | 8356 | """
=======================================
Clustering text documents using k-means
=======================================
This is an example showing how the scikit-learn can be used to cluster
documents by topics using a bag-of-words approach. This example uses
a scipy.sparse matrix to store the features instead of ... | bsd-3-clause |
wanggang3333/scikit-learn | sklearn/feature_selection/tests/test_from_model.py | 244 | 1593 | import numpy as np
import scipy.sparse as sp
from nose.tools import assert_raises, assert_true
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_greater
from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
from sklearn.linear_model import SGD... | bsd-3-clause |
googleinterns/deepspeech-reconstruction | src/deep_speaker/viz/triplet_visualization.py | 1 | 2004 | import logging
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
def remove_values_along_axes():
from matplotlib import pylab
frame = pylab.gca()
frame.axes.get_xaxis().set_ticks([])
frame.axes.get_yaxis().set_ticks([])
def get_coordinates_from_cosine_simi... | apache-2.0 |
Myasuka/scikit-learn | doc/conf.py | 210 | 8446 | # -*- 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 |
fredhusser/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 |
BiaDarkia/scikit-learn | sklearn/datasets/tests/test_svmlight_format.py | 21 | 17406 | from __future__ import division
from bz2 import BZ2File
import gzip
from io import BytesIO
import numpy as np
import scipy.sparse as sp
import os
import shutil
from tempfile import NamedTemporaryFile
from sklearn.externals.six import b
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import a... | bsd-3-clause |
zelros/bunt | tools/scorer.py | 1 | 3751 | # -*- coding: utf-8 -*-
from sklearn.cross_validation import train_test_split
import logging
import numpy as np
logger = logging.getLogger(__name__)
class Scorer:
def __init__(self, manager, metrics, fallback_name, n_fold=5, test_size=0.3, random_state=42):
self.manager = manager
self.metrics =... | mit |
paperparrot/conjoint | conjoint_summary.py | 1 | 1407 | # coding=utf-8
__author__ = 'sebastiengenty'
import numpy as np
import pandas as pd
"""
This program is made to take the utilities from a CBC/HBC estimation. It then outputs summary relative utilities and
importances for the attributes and levels included.
"""
def conjoint_utltilites(utilities_file, demo_var=None):... | apache-2.0 |
hrjn/scikit-learn | sklearn/neighbors/graph.py | 36 | 6650 | """Nearest Neighbors graph functions"""
# Author: Jake Vanderplas <vanderplas@astro.washington.edu>
#
# License: BSD 3 clause (C) INRIA, University of Amsterdam
from .base import KNeighborsMixin, RadiusNeighborsMixin
from .unsupervised import NearestNeighbors
def _check_params(X, metric, p, metric_params):
"""C... | bsd-3-clause |
bthirion/scikit-learn | doc/tutorial/text_analytics/solutions/exercise_02_sentiment.py | 104 | 3139 | """Build a sentiment analysis / polarity model
Sentiment analysis can be casted as a binary text classification problem,
that is fitting a linear classifier on features extracted from the text
of the user messages so as to guess wether the opinion of the author is
positive or negative.
In this examples we will use a ... | bsd-3-clause |
Haleyo/spark-tk | regression-tests/sparktkregtests/testcases/frames/lda_groupby_flow_test.py | 11 | 3240 | # vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | apache-2.0 |
andreshp/Algorithms | Problems/Hackerrank/IndeedPrime/6_knn.py | 1 | 1577 | #!/usr/bin/python
#######################################################################
# Author: Andrés Herrera Poyatos
# Universidad de Granada, June, 2015
# Indeed Prime Challengue
# Problem 6
########################################################################
import numpy
import math
from sklearn import ne... | gpl-2.0 |
mblondel/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 |
saiwing-yeung/scikit-learn | examples/neural_networks/plot_mlp_alpha.py | 58 | 4088 | """
================================================
Varying regularization in Multi-layer Perceptron
================================================
A comparison of different values for regularization parameter 'alpha' on
synthetic datasets. The plot shows that different alphas yield different
decision functions.
A... | bsd-3-clause |
nrz/ylikuutio | external/bullet3/examples/pybullet/examples/projective_texture.py | 4 | 1491 | import pybullet as p
from time import sleep
import matplotlib.pyplot as plt
import numpy as np
import pybullet_data
physicsClient = p.connect(p.GUI)
p.setAdditionalSearchPath(pybullet_data.getDataPath())
p.setGravity(0, 0, 0)
bearStartPos1 = [-3.3, 0, 0]
bearStartOrientation1 = p.getQuaternionFromEuler([0, 0, 0])
bea... | agpl-3.0 |
awohns/selection | python_lib/lib/python3.4/site-packages/numpy/core/function_base.py | 30 | 12092 | from __future__ import division, absolute_import, print_function
import warnings
import operator
from . import numeric as _nx
from .numeric import (result_type, NaN, shares_memory, MAY_SHARE_BOUNDS,
TooHardError,asanyarray)
__all__ = ['logspace', 'linspace', 'geomspace']
def _index_deprecate(... | mit |
yutiansut/QUANTAXIS | QUANTAXIS_Test/Monitor_GUI_Test/TasksByThreading_Test/QThread_Check_ZJLX_DB_Status_Test.py | 2 | 1996 | import unittest
from QUANTAXIS.QAFetch.QAQuery import QA_fetch_stock_list
from QUANTAXIS.QAUtil import DATABASE
from QUANTAXIS.QAUtil import (DATABASE, QA_Setting, QA_util_date_stamp,
QA_util_date_valid, QA_util_dict_remove_key,
QA_util_log_info, QA_util_co... | mit |
opi9a/data_accelerator | plot_functions.py | 1 | 11155 |
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import rcParams
import matplotlib.ticker as ticker
import projection_funcs as pf
import policy_tools as pt
import inspect
from copy import deepcopy
def bigplot(scens, res_df, shapes_df, name=None, _debug=False):
'''Makes ... | apache-2.0 |
mojoboss/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 |
ClimbsRocks/scikit-learn | examples/feature_selection/plot_permutation_test_for_classification.py | 94 | 2264 | """
=================================================================
Test with permutations the significance of a classification score
=================================================================
In order to test if a classification score is significative a technique
in repeating the classification procedure aft... | bsd-3-clause |
mwv/scikit-learn | sklearn/utils/tests/test_murmurhash.py | 261 | 2836 | # Author: Olivier Grisel <olivier.grisel@ensta.org>
#
# License: BSD 3 clause
import numpy as np
from sklearn.externals.six import b, u
from sklearn.utils.murmurhash import murmurhash3_32
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_array_equal
from nose.tools import assert_equa... | bsd-3-clause |
kastnerkyle/pylearn2 | pylearn2/expr/tests/test_probabilistic_max_pooling.py | 5 | 24555 | import numpy as np
import warnings
from theano import config
from theano import function
import theano.tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams
from pylearn2.expr.probabilistic_max_pooling import max_pool_python
from pylearn2.expr.probabilistic_max_pooling import max_pool_channels_python
from ... | bsd-3-clause |
FangMath/isaac-thedataincubator-project | analysis/myplotting.py | 2 | 4762 |
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
from matplotlib.ticker import MaxNLocator
import itertools as itt
def setfigdefaults():
mpl.rcParams['axes.linewidth'] = 1
mpl.rcParams['font.size'] = 14
#mpl.rcParams['font.family'] = 'sans-serif... | apache-2.0 |
mugizico/scikit-learn | sklearn/externals/joblib/parallel.py | 36 | 34375 | """
Helpers for embarrassingly parallel code.
"""
# Author: Gael Varoquaux < gael dot varoquaux at normalesup dot org >
# Copyright: 2010, Gael Varoquaux
# License: BSD 3 clause
from __future__ import division
import os
import sys
import gc
import warnings
from math import sqrt
import functools
import time
import thr... | bsd-3-clause |
MAndelkovic/pybinding | pybinding/leads.py | 1 | 7117 | """Lead interface for scattering models
The only way to create leads is using the :meth:`.Model.attach_lead` method.
The classes represented here are the final product of that process, listed
in :attr:`.Model.leads`.
"""
import numpy as np
import matplotlib.pyplot as plt
from math import pi
from scipy.sparse import cs... | bsd-2-clause |
hammerlab/mhcflurry | mhcflurry/custom_loss.py | 1 | 11026 | """
Custom loss functions.
For losses supporting inequalities, each training data point is associated with
one of (=), (<), or (>). For e.g. (>) inequalities, penalization is applied only
if the prediction is less than the given value.
"""
from __future__ import division
import pandas
import numpy
from numpy import is... | apache-2.0 |
pyro-ppl/numpyro | examples/funnel.py | 1 | 4025 | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
"""
Example: Neal's Funnel
======================
This example, which is adapted from [1], illustrates how to leverage non-centered
parameterization using the :class:`~numpyro.handlers.reparam` handler.
We will examine the difference ... | apache-2.0 |
tuany/RNN | exec02.py | 1 | 5086 | import numpy as np
import Neural_Network as NN
import matplotlib.pyplot as plt
import PokeTrainer as pkt
import csv
import os
from datetime import date, datetime, timedelta
import collections
import operator
###########Parametros############
tamInput = 2
tamCamadaEsc = 3
tamCamadaSaida = 1
lambdaVal = 0.00001
timespan... | mit |
chrsrds/scikit-learn | sklearn/manifold/t_sne.py | 2 | 36438 | # 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 |
aaronr/shapely | docs/sphinxext/inheritance_diagram.py | 98 | 13648 | """
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
... | bsd-3-clause |
MatthieuBizien/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 |
466152112/scikit-learn | examples/plot_isotonic_regression.py | 303 | 1767 | """
===================
Isotonic Regression
===================
An illustration of the isotonic regression on generated data. The
isotonic regression finds a non-decreasing approximation of a function
while minimizing the mean squared error on the training data. The benefit
of such a model is that it does not assume a... | bsd-3-clause |
smartscheduling/scikit-learn-categorical-tree | examples/tree/plot_tree_regression_multioutput.py | 43 | 1791 | """
===================================================================
Multi-output Decision Tree Regression
===================================================================
An example to illustrate multi-output regression with decision tree.
The :ref:`decision trees <tree>`
is used to predict simultaneously the ... | bsd-3-clause |
luoshao23/ML_algorithm | Deep_Learning/WGAN.py | 1 | 9010 |
# Large amount of credit goes to:
# https://github.com/keras-team/keras-contrib/blob/master/examples/improved_wgan.py
# which I've used as a reference for this implementation
from __future__ import print_function, division
from keras.datasets import mnist
from keras.layers.merge import _Merge
from keras.layers impor... | mit |
sinhrks/pandas-ml | pandas_ml/skaccessors/cluster.py | 1 | 2901 | #!/usr/bin/env python
from pandas.util.decorators import cache_readonly
from pandas_ml.core.accessor import _AccessorMethods, _attach_methods, _wrap_data_func
class ClusterMethods(_AccessorMethods):
"""Accessor to ``sklearn.cluster``."""
_module_name = 'sklearn.cluster'
def k_means(self, n... | bsd-3-clause |
rjeli/scikit-image | doc/tools/plot_pr.py | 34 | 4128 | import json
import urllib
import dateutil.parser
from collections import OrderedDict
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
from matplotlib.transforms import blended_transfo... | bsd-3-clause |
fabianp/scikit-learn | sklearn/ensemble/tests/test_weight_boosting.py | 40 | 16837 | """Testing for the boost module (sklearn.ensemble.boost)."""
import numpy as np
from sklearn.utils.testing import assert_array_equal, assert_array_less
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal, assert_true
from sklearn.utils.testing import assert_raises... | bsd-3-clause |
ppries/tensorflow | tensorflow/contrib/learn/python/learn/learn_io/data_feeder.py | 7 | 29950 | # 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 |
owaiskhan/Retransmission-Combining | gr-utils/src/python/gr_plot_const.py | 6 | 10269 | #!/usr/bin/env python
#
# Copyright 2007,2008,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at you... | gpl-3.0 |
perimosocordiae/scipy | scipy/stats/_binned_statistic.py | 12 | 30918 | import builtins
import numpy as np
from numpy.testing import suppress_warnings
from operator import index
from collections import namedtuple
__all__ = ['binned_statistic',
'binned_statistic_2d',
'binned_statistic_dd']
BinnedStatisticResult = namedtuple('BinnedStatisticResult',
... | bsd-3-clause |
garibaldu/sensible_sensoring | docs/pics/change_hider_PGM.py | 1 | 1965 | from matplotlib import rc
rc("font", family="serif", size=12)
rc("text", usetex=True)
import daft
from matplotlib import text
# Colors.
action_color = {"ec": "#f89406"}
faded_color = {"ec": "#dddddd"}
# Instantiate the PGM.
pgm = daft.PGM([6.3, 5.55], origin=[0.3, 0.3])
# Hierarchical parameters.
#pgm.add_node(daf... | gpl-2.0 |
CVL-dev/cvl-fabric-launcher | pyinstaller-2.1/PyInstaller/hooks/hookutils.py | 9 | 22893 | #-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this softwa... | gpl-3.0 |
vivekmishra1991/scikit-learn | examples/text/hashing_vs_dict_vectorizer.py | 284 | 3265 | """
===========================================
FeatureHasher and DictVectorizer Comparison
===========================================
Compares FeatureHasher and DictVectorizer by using both to vectorize
text documents.
The example demonstrates syntax and speed only; it doesn't actually do
anything useful with the e... | bsd-3-clause |
jmargeta/scikit-learn | examples/cluster/plot_kmeans_digits.py | 4 | 4494 | """
===========================================================
A demo of K-Means clustering on the handwritten digits data
===========================================================
In this example with compare the various initialization strategies for
K-means in terms of runtime and quality of the results.
As the ... | bsd-3-clause |
pompiduskus/scikit-learn | sklearn/linear_model/tests/test_least_angle.py | 57 | 16523 | from nose.tools import assert_equal
import numpy as np
from scipy import linalg
from sklearn.cross_validation import train_test_split
from sklearn.externals import joblib
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_... | bsd-3-clause |
deepchem/deepchem | contrib/DiabeticRetinopathy/run.py | 5 | 1147 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 10 06:12:11 2018
@author: zqwu
"""
import deepchem as dc
import numpy as np
import pandas as pd
import os
import logging
from model import DRModel, DRAccuracy, ConfusionMatrix, QuadWeightedKappa
from data import load_images_DR
train, valid, test =... | mit |
mehdidc/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 |
skwbc/numpy | numpy/doc/creation.py | 52 | 5507 | """
==============
Array Creation
==============
Introduction
============
There are 5 general mechanisms for creating arrays:
1) Conversion from other Python structures (e.g., lists, tuples)
2) Intrinsic numpy array array creation objects (e.g., arange, ones, zeros,
etc.)
3) Reading arrays from disk, either from... | bsd-3-clause |
jm-begon/scikit-learn | sklearn/neural_network/tests/test_rbm.py | 142 | 6276 | import sys
import re
import numpy as np
from scipy.sparse import csc_matrix, csr_matrix, lil_matrix
from sklearn.utils.testing import (assert_almost_equal, assert_array_equal,
assert_true)
from sklearn.datasets import load_digits
from sklearn.externals.six.moves import cStringIO as ... | bsd-3-clause |
ddna1021/spark | python/pyspark/sql/dataframe.py | 3 | 86793 | #
# 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.