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 |
|---|---|---|---|---|---|
chenyyx/scikit-learn-doc-zh | examples/en/cluster/plot_kmeans_assumptions.py | 76 | 2055 | """
====================================
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... | gpl-3.0 |
thientu/scikit-learn | examples/model_selection/plot_validation_curve.py | 229 | 1823 | """
==========================
Plotting Validation Curves
==========================
In this plot you can see the training scores and validation scores of an SVM
for different values of the kernel parameter gamma. For very low values of
gamma, you can see that both the training score and the validation score are
low. ... | bsd-3-clause |
gfyoung/scipy | scipy/stats/_continuous_distns.py | 1 | 210620 | #
# Author: Travis Oliphant 2002-2011 with contributions from
# SciPy Developers 2004-2011
#
from __future__ import division, print_function, absolute_import
import warnings
import numpy as np
from scipy.misc.doccer import (extend_notes_in_docstring,
replace_notes_in_docstri... | bsd-3-clause |
alimuldal/numpy | numpy/core/tests/test_multiarray.py | 6 | 246246 | from __future__ import division, absolute_import, print_function
import collections
import tempfile
import sys
import shutil
import warnings
import operator
import io
import itertools
import ctypes
import os
import gc
if sys.version_info[0] >= 3:
import builtins
else:
import __builtin__ as builtins
from decima... | bsd-3-clause |
ishanic/scikit-learn | examples/linear_model/plot_robust_fit.py | 238 | 2414 | """
Robust linear estimator fitting
===============================
Here a sine function is fit with a polynomial of order 3, for values
close to zero.
Robust fitting is demoed in different situations:
- No measurement errors, only modelling errors (fitting a sine with a
polynomial)
- Measurement errors in X
- M... | bsd-3-clause |
gaamy/pyMuse | pymuse/viz.py | 1 | 6228 | __author__ = 'benjamindeleener'
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
from datetime import datetime, timedelta
from numpy import linspace
def timeTicks(x, pos):
d = timedelta(milliseconds=x)
return str(d)
class MuseViewer(object):
def __init__(self, acquisition_freq, signal... | mit |
ischwabacher/seaborn | doc/sphinxext/ipython_directive.py | 37 | 37557 | # -*- coding: utf-8 -*-
"""
Sphinx directive to support embedded IPython code.
This directive allows pasting of entire interactive IPython sessions, prompts
and all, and their code will actually get re-executed at doc build time, with
all prompts renumbered sequentially. It also allows you to input code as a pure
pyth... | bsd-3-clause |
bhargav/scikit-learn | examples/text/hashing_vs_dict_vectorizer.py | 93 | 3243 | """
===========================================
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 |
larsmans/numpy | numpy/lib/twodim_base.py | 37 | 26758 | """ Basic functions for manipulating 2d arrays
"""
from __future__ import division, absolute_import, print_function
from numpy.core.numeric import (
asanyarray, arange, zeros, greater_equal, multiply, ones, asarray,
where, int8, int16, int32, int64, empty, promote_types
)
from numpy.core import iinfo
__... | bsd-3-clause |
jeffkinnison/awe-wq | 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 |
yufengg/tensorflow | tensorflow/contrib/learn/python/learn/learn_io/pandas_io.py | 92 | 4535 | # 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 |
BeiLuoShiMen/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_cairo.py | 69 | 16706 | """
A Cairo backend for matplotlib
Author: Steve Chaplin
Cairo is a vector graphics library with cross-device output support.
Features of Cairo:
* anti-aliasing
* alpha channel
* saves image files as PNG, PostScript, PDF
http://cairographics.org
Requires (in order, all available from Cairo website):
cairo, pyc... | agpl-3.0 |
blue-yonder/azure-cost-mon | azure_costs_exporter/allocated_vm_collector.py | 1 | 3570 | from prometheus_client.core import GaugeMetricFamily
from pandas import DataFrame
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.compute import ComputeManagementClient
_BASE_COLUMNS = ['subscription', 'location', 'resource_group', 'vm_size']
_COUNT_COLUMN = ['total']
_ALL_COLUMNS =... | mit |
linjinjin123/Digital-Image-Processing-Homework | hw3/src/UI.py | 1 | 25466 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# python verson: 2.7
# @Author: JinJin Lin
# @Email: jinjin.lin@outlook.com
# @License: MIT
# @Date: 2015-10-21 18:38:17
# @Last Modified time: 2015-12-04 20:19:24
# All copyright reserved
#
import Image
import wx
import os
import numpy as np
import matplotlib.pyplot as ... | mit |
tmills/neural-assertion | scripts/keras/singletask/assertion_split_cnn_train.py | 1 | 7771 | #!#!/usr/bin/env python
from keras.callbacks import EarlyStopping
from keras.models import Sequential, Model
from keras.layers import Input, Dense, Dropout, Activation, Embedding, Merge, Convolution1D, Lambda
from keras.optimizers import SGD
from keras.utils import np_utils
#from sklearn.datasets import load_svmlight_... | apache-2.0 |
rexshihaoren/scikit-learn | sklearn/tests/test_random_projection.py | 142 | 14033 | from __future__ import division
import numpy as np
import scipy.sparse as sp
from sklearn.metrics import euclidean_distances
from sklearn.random_projection import johnson_lindenstrauss_min_dim
from sklearn.random_projection import gaussian_random_matrix
from sklearn.random_projection import sparse_random_matrix
from... | bsd-3-clause |
calatre/epidemics_network | plt/SIR 1 plot_maxs.py | 1 | 1093 | # 2016/2017 Project - Andre Calatre, 73207
# "Simulation of an epidemic" - 16/5/2017
# Plotting Multiple Simulations of a SIR Epidemic Model
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
#Choosing the values for c and r to stud... | apache-2.0 |
jplusplus/statscraper | tests/scrapertests/test_smhi_scraper.py | 1 | 3428 | # encoding: utf-8
from unittest import TestCase
import pandas as pd
from statscraper.scrapers.SMHIScraper import SMHI, Collection, API, SMHIDataset, Station
class TestSMHI(TestCase):
def setUp(self):
"""Setting up scraper."""
def test_fetch_api(self):
scraper = SMHI()
apis = scraper.... | mit |
TuSimple/mxnet | example/multivariate_time_series/src/lstnet.py | 17 | 11583 | # !/usr/bin/env python
# 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
# "... | apache-2.0 |
kmather73/zipline | tests/test_versioning.py | 30 | 3539 | #
# Copyright 2015 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 |
krischer/pyadjoint | src/pyadjoint/utils.py | 1 | 9017 | #!/usr/bin/env python
# -*- encoding: utf8 -*-
"""
Utility functions for Pyadjoint.
:copyright:
Lion Krischer (krischer@geophysik.uni-muenchen.de), 2015
:license:
BSD 3-Clause ("BSD New" or "BSD Simplified")
"""
from __future__ import absolute_import, division, print_function
import inspect
import os
import ... | bsd-3-clause |
stefco/geco_data | geco_diagnostic_plot_pages.py | 1 | 18782 | #!/usr/bin/env python
# (c) Stefan Countryman 2017
DESC="""Plot a list of timing diagnostic channels, which will be read from
stdin as a newline-delimited channel list, for a time window around a given
GPS time. This script can also generate a summary webpage for easy viewing of
plot results. Use this script when ther... | mit |
DonBeo/scikit-learn | sklearn/preprocessing/label.py | 2 | 28579 | # 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 |
scramblingbalam/Alta_Real | update_mongo.py | 1 | 15367 | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 16 12:22:55 2017
@author: scram
"""
from gensim import corpora, models, similarities
import gensim
import json
import os
import pickle
from pymongo import MongoClient
import unicodedata as uniD
import sys
import nltk
import networkx as nx
import numpy as np
import iterto... | mit |
rubikloud/scikit-learn | examples/ensemble/plot_adaboost_multiclass.py | 354 | 4124 | """
=====================================
Multi-class AdaBoosted Decision Trees
=====================================
This example reproduces Figure 1 of Zhu et al [1] and shows how boosting can
improve prediction accuracy on a multi-class problem. The classification
dataset is constructed by taking a ten-dimensional ... | bsd-3-clause |
wschenck/nest-simulator | pynest/examples/spatial/connex.py | 20 | 2341 | # -*- coding: utf-8 -*-
#
# connex.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 License, or
# (a... | gpl-2.0 |
meduz/scikit-learn | examples/model_selection/plot_roc.py | 102 | 5056 | """
=======================================
Receiver Operating Characteristic (ROC)
=======================================
Example of Receiver Operating Characteristic (ROC) metric to evaluate
classifier output quality.
ROC curves typically feature true positive rate on the Y axis, and false
positive rate on the X a... | bsd-3-clause |
ch3ll0v3k/scikit-learn | examples/ensemble/plot_gradient_boosting_regularization.py | 355 | 2843 | """
================================
Gradient Boosting regularization
================================
Illustration of the effect of different regularization strategies
for Gradient Boosting. The example is taken from Hastie et al 2009.
The loss function used is binomial deviance. Regularization via
shrinkage (``lear... | bsd-3-clause |
schinmayee/object-tracking | src/plot_errors.py | 2 | 3422 | #!/usr/bin/env python
import argparse, os
import numpy as np
import pickle
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser("Plot errors")
parser.add_argument('--config', dest='config', type=str, default='config.txt',
help='config file containing error directories'
... | mit |
kevin-intel/scikit-learn | sklearn/cluster/tests/test_k_means.py | 2 | 44252 | """Testing for K-means"""
import re
import sys
import numpy as np
from scipy import sparse as sp
from threadpoolctl import threadpool_limits
import pytest
from sklearn.utils._testing import assert_array_equal
from sklearn.utils._testing import assert_allclose
from sklearn.utils.fixes import _astype_copy_false
from s... | bsd-3-clause |
carrillo/scikit-learn | sklearn/metrics/regression.py | 175 | 16953 | """Metrics to assess performance on regression task
Functions named as ``*_score`` return a scalar value to maximize: the higher
the better
Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize:
the lower the better
"""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Ma... | bsd-3-clause |
timsnyder/bokeh | bokeh/core/json_encoder.py | 2 | 9041 | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | bsd-3-clause |
abhishekgahlot/scikit-learn | benchmarks/bench_lasso.py | 297 | 3305 | """
Benchmarks of Lasso vs LassoLars
First, we fix a training set and increase the number of
samples. Then we plot the computation time as function of
the number of samples.
In the second benchmark, we increase the number of dimensions of the
training set. Then we plot the computation time as function of
the number o... | bsd-3-clause |
mattilyra/scikit-learn | sklearn/gaussian_process/tests/test_gpr.py | 23 | 11915 | """Testing for Gaussian process regression """
# Author: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
# Licence: BSD 3 clause
import numpy as np
from scipy.optimize import approx_fprime
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels \
import RBF, Constan... | bsd-3-clause |
alexanderfield/spindle | benchmark-scripts/partitions.py | 3 | 5422 | #!/usr/bin/env python3
###########################################################################
##
## Copyright (c) 2014 Adobe Systems Incorporated. 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 ma... | apache-2.0 |
jpautom/scikit-learn | examples/model_selection/plot_roc.py | 49 | 5041 | """
=======================================
Receiver Operating Characteristic (ROC)
=======================================
Example of Receiver Operating Characteristic (ROC) metric to evaluate
classifier output quality.
ROC curves typically feature true positive rate on the Y axis, and false
positive rate on the X a... | bsd-3-clause |
Dapid/GPy | GPy/models/gplvm.py | 8 | 3049 | # Copyright (c) 2012-2014, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np
from .. import kern
from ..core import GP, Param
from ..likelihoods import Gaussian
from .. import util
class GPLVM(GP):
"""
Gaussian Process Latent Variable Model
"... | bsd-3-clause |
grlee77/pywt | demo/dwt_swt_show_coeffs.py | 6 | 2469 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import pywt
import pywt.data
ecg = pywt.data.ecg()
data1 = np.concatenate((np.arange(1, 400),
np.arange(398, 600),
np.arange(601, 1024)))
x = np.linspace(0.082, 2.128, nu... | mit |
RomainBrault/scikit-learn | sklearn/cross_decomposition/tests/test_pls.py | 42 | 14294 | import numpy as np
from sklearn.utils.testing import (assert_equal, assert_array_almost_equal,
assert_array_equal, assert_true,
assert_raise_message)
from sklearn.datasets import load_linnerud
from sklearn.cross_decomposition import pls_, CCA
def t... | bsd-3-clause |
untom/scikit-learn | examples/bicluster/bicluster_newsgroups.py | 162 | 7103 | """
================================================================
Biclustering documents with the Spectral Co-clustering algorithm
================================================================
This example demonstrates the Spectral Co-clustering algorithm on the
twenty newsgroups dataset. The 'comp.os.ms-windows... | bsd-3-clause |
kashif/scikit-learn | sklearn/metrics/classification.py | 7 | 69318 | """Metrics to assess performance on classification task given class prediction
Functions named as ``*_score`` return a scalar value to maximize: the higher
the better
Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize:
the lower the better
"""
# Authors: Alexandre Gramfort <alexandre.gramf... | bsd-3-clause |
nanophotonics/nplab | nplab/experiment/fiber_raman/test.py | 1 | 2056 | from __future__ import print_function
from __future__ import absolute_import
import matplotlib.pyplot as plt
import numpy as np
from nplab import datafile as df
from nplab.analysis.smoothing import convex_smooth
from nplab.instrument.spectrometer.acton_2300i import Acton
from nplab.instrument.camera.Picam.pixis impo... | gpl-3.0 |
icdishb/scikit-learn | examples/plot_multilabel.py | 87 | 4279 | # Authors: Vlad Niculae, Mathieu Blondel
# License: BSD 3 clause
"""
=========================
Multilabel classification
=========================
This example simulates a multi-label document classification problem. The
dataset is generated randomly based on the following process:
- pick the number of labels: n ... | bsd-3-clause |
almarklein/scikit-image | doc/examples/plot_marching_cubes.py | 32 | 2051 | """
==============
Marching Cubes
==============
Marching cubes is an algorithm to extract a 2D surface mesh from a 3D volume.
This can be conceptualized as a 3D generalization of isolines on topographical
or weather maps. It works by iterating across the volume, looking for regions
which cross the level of interest. ... | bsd-3-clause |
ivano666/tensorflow | tensorflow/examples/skflow/iris_val_based_early_stopping.py | 3 | 2213 | # Copyright 2015-present The Scikit Flow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | apache-2.0 |
Funtimezzhou/TradeBuildTools | Document/szse/Quantitative Trading/sat-ebook-and-full-source-20150618/algo-ebook-full-source-code-20150618/chapter11/forecast.py | 2 | 4129 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# forecast.py
from __future__ import print_function
import datetime
import numpy as np
import pandas as pd
import sklearn
from pandas.io.data import DataReader
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from sklea... | gpl-3.0 |
pianomania/scikit-learn | examples/linear_model/plot_multi_task_lasso_support.py | 102 | 2319 | #!/usr/bin/env python
"""
=============================================
Joint feature selection with multi-task Lasso
=============================================
The multi-task lasso allows to fit multiple regression problems
jointly enforcing the selected features to be the same across
tasks. This example simulates... | bsd-3-clause |
PBGraff/SwiftGRB_PEanalysis | pp_pipeline.py | 1 | 3476 | import numpy as np
import os
import triangle
import matplotlib.pyplot as plt
import scipy.stats
from matplotlib.ticker import MultipleLocator
def PlotTriangle(fileroot,usetruths=True):
data = np.loadtxt(fileroot+'post_equal_weights.dat', usecols=(0,1,2,3,4,5))
if (usetruths):
truths = np.loadtxt(fileroot+'injected... | apache-2.0 |
zuku1985/scikit-learn | examples/manifold/plot_manifold_sphere.py | 31 | 5118 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=============================================
Manifold Learning methods on a severed sphere
=============================================
An application of the different :ref:`manifold` techniques
on a spherical data-set. Here one can see the use of
dimensionality reducti... | bsd-3-clause |
s0hvaperuna/Not-a-bot | cogs/jojo.py | 1 | 22891 | """
MIT License
Copyright (c) 2017 s0hvaperuna
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | mit |
simon-anders/htseq | setup.py | 1 | 7870 | #!/usr/bin/env python
from __future__ import print_function
import sys
import os
from distutils.log import INFO as logINFO
if ((sys.version_info[0] == 2 and sys.version_info[1] < 7) or
(sys.version_info[0] == 3 and sys.version_info[1] < 5)):
sys.stderr.write("Error in setup script for HTSeq:\n")
sys.stderr... | gpl-3.0 |
dsm054/pandas | pandas/tests/indexes/interval/test_interval_range.py | 1 | 12905 | from __future__ import division
from datetime import timedelta
import numpy as np
import pytest
import pandas.util.testing as tm
from pandas import (
DateOffset, Interval, IntervalIndex, Timedelta, Timestamp, date_range,
interval_range, timedelta_range
)
from pandas.core.dtypes.common import is_integer
from ... | bsd-3-clause |
BigDataforYou/movie_recommendation_workshop_1 | big_data_4_you_demo_1/venv/lib/python2.7/site-packages/pandas/core/internals.py | 1 | 169308 | import copy
import itertools
import re
import operator
from datetime import datetime, timedelta, date
from collections import defaultdict
import numpy as np
from numpy import percentile as _quantile
from pandas.core.base import PandasObject
from pandas.core.common import (_possibly_downcast_to_dtype, isnull, _NS_DTY... | mit |
EhudTsivion/QCkit | thermalDesorption/mdSim.py | 1 | 8639 | import datetime
import random
import logging as log
from matplotlib import pyplot as plt
import numpy as np
from QCkit.atom import Atom
from QCkit.molecule import Molecule
from QCkit import physical_constants
from QCkit.thermalDesorption.mdjob import MDjob
from QCkit.thermalDesorption.mdScratchParser import MdScratchP... | lgpl-3.0 |
maziarraissi/ParametricGP-in-Python | PGPs_tensorflow/PGP/parametric_GP.py | 1 | 7144 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Maziar Raissi
"""
import numpy as np
import tensorflow as tf
from sklearn.cluster import KMeans
from Utilities import kernel, kernel_tf, fetch_minibatch
import timeit
class PGP:
def __init__(self, X, y, M=10, max_iter = 2000, N_batch = 1,
... | mit |
jat255/seaborn | seaborn/palettes.py | 4 | 28814 | from __future__ import division
import colorsys
from itertools import cycle
import numpy as np
import matplotlib as mpl
from .external import husl
from .external.six import string_types
from .external.six.moves import range
from .utils import desaturate, set_hls_values, get_color_cycle
from .xkcd_rgb import xkcd_rgb... | bsd-3-clause |
wathen/PhD | MHD/FEniCS/MHD/Stabilised/SaddlePointForm/Test/InnerOuterSchurTest/MHDallatonce.py | 4 | 9242 | import petsc4py
import sys
petsc4py.init(sys.argv)
from petsc4py import PETSc
import numpy as np
from dolfin import tic, toc
import HiptmairSetup
import PETScIO as IO
import scipy.sparse as sp
import matplotlib.pylab as plt
import MatrixOperations as MO
class BaseMyPC(object):
def setup(self, pc):
pass
... | mit |
spookysys/turbopump | pump/lobanoff/vane_and_shroud_thickness.py | 1 | 2453 | """Figure 3-11: Recommended minimum impeller vane and shroud thickness for castability (standard cast materials) from D2"""
from __future__ import print_function
from itertools import chain
import numpy as np
from matplotlib import pyplot as plt
from numpy.polynomial import polynomial
from utils import memoized, polyfi... | gpl-3.0 |
icdishb/scikit-learn | examples/ensemble/plot_adaboost_multiclass.py | 354 | 4124 | """
=====================================
Multi-class AdaBoosted Decision Trees
=====================================
This example reproduces Figure 1 of Zhu et al [1] and shows how boosting can
improve prediction accuracy on a multi-class problem. The classification
dataset is constructed by taking a ten-dimensional ... | bsd-3-clause |
mayblue9/scikit-learn | benchmarks/bench_rcv1_logreg_convergence.py | 149 | 7173 | # Authors: Tom Dupre la Tour <tom.dupre-la-tour@m4x.org>
# Olivier Grisel <olivier.grisel@ensta.org>
#
# License: BSD 3 clause
import matplotlib.pyplot as plt
import numpy as np
import gc
import time
from sklearn.externals.joblib import Memory
from sklearn.linear_model import (LogisticRegression, SGDClassifi... | bsd-3-clause |
Kyle-Crypton/CATL_Project | decisiontree.py | 1 | 1533 | import pydot
from sklearn import tree
from sklearn.ensemble import RandomForestClassifier
from sklearn.externals.six import StringIO
from db_operation import db_exec
from decisiontree_extracting import tree_to_code, tree_to_code_db
def DSTree(X, y, feature_names, class_names):
# Undefined input variable
package_name... | mit |
stephenliu1989/HK_DataMiner | hkdataminer/cluster/aplod_.py | 1 | 17907 | __author__ = 'LIU Song <liusong299@gmail.com>'
__contributors__ = "Lizhe ZHU, Tiago Lobato Gimenes, Xuhui HUANG"
__version__ = "0.91"
# Copyright (c) 2016, Hong Kong University of Science and Technology (HKUST)
# All rights reserved.
# ===============================================================================
# GL... | apache-2.0 |
bgoodr/how-to | python/python_matplotlib/gantt_chart_basic.py | 1 | 3472 | # -*- mode: python; -*-
# Execute this script using Bash script of the same name but without a file
# extension. Use ../pdbwrapper/pdbwrapper instead of pdb for debugging.
"""
GANTT Chart with Matplotlib
Sukhbinder
Inspired from
http://www.clowersresearch.com/main/gantt-charts-in-matplotlib/
"""
import os
import sys
i... | mit |
ninotoshi/tensorflow | tensorflow/contrib/learn/python/learn/estimators/rnn.py | 1 | 8531 | """Recurrent Neural Network estimators."""
# Copyright 2015-present The Scikit Flow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.o... | apache-2.0 |
nrhine1/scikit-learn | sklearn/cluster/spectral.py | 233 | 18153 | # -*- coding: utf-8 -*-
"""Algorithms for spectral clustering"""
# Author: Gael Varoquaux gael.varoquaux@normalesup.org
# Brian Cheung
# Wei LI <kuantkid@gmail.com>
# License: BSD 3 clause
import warnings
import numpy as np
from ..base import BaseEstimator, ClusterMixin
from ..utils import check_rand... | bsd-3-clause |
reedessick/pointy-Poisson | concentrationMultiPopVectors.py | 1 | 3445 | #!/usr/bin/python
usage = "concentrationMultiPopVectors.py [--options] vectors.txt"
description = "a tool to make concentration diagrams of data stored in vectors.txt"
author = "reed.essick@ligo.org"
import numpy as np
import matplotlib
matplotlib.use("Agg")
from matplotlib import pyplot as plt
plt.rcParams['text.use... | mit |
TomAugspurger/dota | dota/tests/test_scripts.py | 1 | 9003 | # -*- coding: utf-8 -*-
import pathlib
import unittest
from unittest.mock import patch
from os.path import expanduser
try:
from io import StringIO
except ImportError:
from StringIO import StringIO
import requests
from pandas.util.testing import network
from numpy import nan
import pandas as pd
from pandas im... | mit |
HengfengLi/algorithms-impl | 01.graham_scan/graham_scan.py | 1 | 5192 | # Re-write the C code from Computational Geometry in C - Section 3.5.
# max # of points
PMAX = 1000
P_origin = None
class Coord:
def __init__(self, x, y):
self.x = x
self.y = y
def __str__(self):
return "x:%.2f,y:%.2f" % (self.x, self.y)
def __repr__(self):
r... | mit |
heli522/scikit-learn | sklearn/ensemble/partial_dependence.py | 251 | 15097 | """Partial dependence plots for tree ensembles. """
# Authors: Peter Prettenhofer
# License: BSD 3 clause
from itertools import count
import numbers
import numpy as np
from scipy.stats.mstats import mquantiles
from ..utils.extmath import cartesian
from ..externals.joblib import Parallel, delayed
from ..externals im... | bsd-3-clause |
cinai/identification-algorithms | algoritmo_3/Post Presentation/borrador.py | 1 | 8741 | import sys
sys.path.append("..")
import numpy as np
import pandas as pd
from geopy.distance import vincenty
from scipy import stats
import scipy.integrate as integrate
from feature_tools import *
from scipy.cluster.hierarchy import linkage, fcluster
# Auxiliar Functions
def split_sequence_by_weekdays(df_sequence):
we... | mit |
aldian/tensorflow | tensorflow/examples/tutorials/word2vec/word2vec_basic.py | 6 | 10430 | # 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 |
xyguo/scikit-learn | sklearn/decomposition/tests/test_kernel_pca.py | 74 | 8472 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import (assert_array_almost_equal, assert_less,
assert_equal, assert_not_equal,
assert_raises)
from sklearn.decomposition import PCA, KernelPCA
from sklearn.datasets import mak... | bsd-3-clause |
rwhitt2049/nimble | tests/test_events.py | 1 | 13507 | import numpy as np
import numpy.testing as npt
import pandas as pd
from unittest import TestCase, main
from nimble import Events
class EvTestCase(TestCase):
@staticmethod
def assertStartStops(events, vstarts, vstops):
npt.assert_array_equal(events._starts, vstarts)
npt.assert_array_equal(event... | mit |
toenuff/treadmill | tests/reports_test.py | 1 | 5741 | """Unit test for treadmill.scheduler
"""
import datetime
import time
import unittest
# Disable W0611: Unused import
import tests.treadmill_test_deps # pylint: disable=W0611
import mock
import pandas as pd
from treadmill import scheduler
from treadmill import reports
def _construct_cell():
"""Constructs a tes... | apache-2.0 |
manashmndl/scikit-learn | sklearn/ensemble/tests/test_partial_dependence.py | 365 | 6996 | """
Testing for the partial dependence module.
"""
import numpy as np
from numpy.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import if_matplotlib
from sklearn.ensemble.partial_dependence import partial_dependence
from sklearn.ensemble.partial_dependence... | bsd-3-clause |
nrhine1/scikit-learn | sklearn/ensemble/tests/test_bagging.py | 127 | 25365 | """
Testing for the bagging ensemble module (sklearn.ensemble.bagging).
"""
# Author: Gilles Louppe
# License: BSD 3 clause
import numpy as np
from sklearn.base import BaseEstimator
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.te... | bsd-3-clause |
castelao/AutoQC | util/dbutils.py | 1 | 7274 | import io, math
import numpy
import pandas
import sqlite3
import util.main as main
def unpack_qc(value):
'unpack a qc result from the db'
try:
qc = numpy.load(io.BytesIO(value), allow_pickle=True)
except:
print('failed to unpack qc data - check db for missing entries.')
qc = numpy.... | mit |
imaculate/scikit-learn | sklearn/utils/__init__.py | 17 | 12898 | """
The :mod:`sklearn.utils` module includes various utilities.
"""
from collections import Sequence
import numpy as np
from scipy.sparse import issparse
import warnings
from .murmurhash import murmurhash3_32
from .validation import (as_float_array,
assert_all_finite,
... | bsd-3-clause |
berkeley-stat159/project-iota | code/utils/linear_modeling/block_linear_modeling_script.py | 1 | 8205 | from __future__ import division
import numpy as np
import pandas as pd
import numpy.linalg as npl
import matplotlib.pyplot as plt
import matplotlib.colors
import nibabel as nib
from scipy.stats import t as t_dist
from nilearn import image
from nilearn.plotting import plot_stat_map
import linear_modeling
from sys import... | bsd-3-clause |
ky822/scikit-learn | sklearn/decomposition/tests/test_nmf.py | 130 | 6059 | import numpy as np
from scipy import linalg
from sklearn.decomposition import nmf
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import raises
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_gr... | bsd-3-clause |
mjudsp/Tsallis | sklearn/linear_model/setup.py | 146 | 1713 | import os
from os.path import join
import numpy
from sklearn._build_utils import get_blas_info
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('linear_model', parent_package, top_path)
cblas_libs, blas_info = get_blas_info... | bsd-3-clause |
orbingol/NURBS-Python | docs/conf.py | 1 | 6225 | # -*- coding: utf-8 -*-
#
# NURBS-Python documentation build configuration file, created by
# sphinx-quickstart on Fri Mar 10 21:16:25 2017.
#
# 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.
... | mit |
f3r/scikit-learn | sklearn/cross_decomposition/tests/test_pls.py | 23 | 14318 | import numpy as np
from sklearn.utils.testing import (assert_array_almost_equal,
assert_array_equal, assert_true,
assert_raise_message)
from sklearn.datasets import load_linnerud
from sklearn.cross_decomposition import pls_, CCA
from nose.tools impor... | bsd-3-clause |
prisae/empymod | empymod/scripts/fdesign.py | 1 | 42420 | r"""
:mod:`empymod.scripts.fdesign` -- Digital Linear Filter (DLF) design
====================================================================
The add-on fdesign can be used to design digital linear filters for the Hankel
or Fourier transform, or for any linear transform ([Ghos70]_). For this
included or provided theo... | apache-2.0 |
fabioticconi/scikit-learn | sklearn/utils/random.py | 37 | 10511 | # Author: Hamzeh Alsalhi <ha258@cornell.edu>
#
# License: BSD 3 clause
from __future__ import division
import numpy as np
import scipy.sparse as sp
import operator
import array
from sklearn.utils import check_random_state
from sklearn.utils.fixes import astype
from ._random import sample_without_replacement
__all__ =... | bsd-3-clause |
oemof/feedinlib | src/feedinlib/open_FRED.py | 1 | 17002 | from itertools import chain
from itertools import groupby
from typing import Dict
from typing import List
from typing import Tuple
from typing import Union
import oedialect # noqa: F401
import open_FRED.cli as ofr
import pandas as pd
import sqlalchemy as sqla
from geoalchemy2.elements import WKTElement as WKTE
from g... | mit |
dhennes/pykep | PyKEP/trajopt/_mga_lt_nep.py | 2 | 15675 | from PyGMO.problem import base as base_problem
from PyKEP.core import epoch, fb_con, EARTH_VELOCITY, AU, MU_SUN
from PyKEP.planet import jpl_lp
from PyKEP.sims_flanagan import leg, spacecraft, sc_state
class mga_lt_nep(base_problem):
"""
This class is a PyGMO (http://esa.github.io/pygmo/) problem representin... | gpl-3.0 |
astocko/statsmodels | statsmodels/stats/anova.py | 25 | 13433 | from statsmodels.compat.python import lrange, lmap
import numpy as np
from scipy import stats
from pandas import DataFrame, Index
from statsmodels.formula.formulatools import (_remove_intercept_patsy,
_has_intercept, _intercept_idx)
def _get_covariance(model, robust):
if robust ... | bsd-3-clause |
vortex-ape/scikit-learn | sklearn/ensemble/partial_dependence.py | 5 | 15362 | """Partial dependence plots for tree ensembles. """
# Authors: Peter Prettenhofer
# License: BSD 3 clause
from itertools import count
import numbers
import numpy as np
from scipy.stats.mstats import mquantiles
from ..utils.extmath import cartesian
from ..utils import Parallel, delayed
from ..externals import six
fr... | bsd-3-clause |
simiden/BangsimonStocks | stockGUI.py | 2 | 14430 | import wx
import warnings
import os
import matplotlib
import wx.lib.hyperlink as hl
import wx.lib.scrolledpanel
import wx.lib.calendar as cal
matplotlib.use('WXAgg')
from matplotlib.figure import Figure
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigCanvas, NavigationToolbar2WxAgg as Navigatio... | gpl-3.0 |
degoldschmidt/ribeirolab-codeconversion | python/flyPAD/fp_swarmbox.py | 1 | 6802 | import numpy as np
import pandas as pd
import matplotlib
matplotlib.use("TkAgg")
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style("ticks")
sns.despine(left=True)
def conj(conditions, printit=False):
outstr = ""
for ind, cond in enumerate(conditions):
outstr += "Label == "
ou... | gpl-3.0 |
ryfeus/lambda-packs | Tensorflow_Pandas_Numpy/source3.6/pandas/io/sas/sas7bdat.py | 3 | 27470 | """
Read SAS7BDAT files
Based on code written by Jared Hobbs:
https://bitbucket.org/jaredhobbs/sas7bdat
See also:
https://github.com/BioStatMatt/sas7bdat
Partial documentation of the file format:
https://cran.r-project.org/web/packages/sas7bdat/vignettes/sas7bdat.pdf
Reference for binary data compression:
h... | mit |
yukke42/machine-learning | 2/p29_fitting.py | 1 | 1360 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
class Perceptron(object):
def __init__(self, eta=0.01, n_iter=10):
self.eta = eta
self.n_iter = n_iter
def fit(self, X, Y):
"""
paramater
# X.shape = [n_samples, n_features]
# Y.shape = [n_sa... | mit |
aasensio/elecciones2016 | sondeos.py | 2 | 6818 | # -*- coding: utf-8 -*-
import numpy as np
import xlrd
import numbers
import matplotlib.pyplot as pl
import seaborn as sn
import datetime as dt
import matplotlib.dates as mdates
import scipy.integrate as integ
import scipy.interpolate as interp
from ipdb import set_trace as stop
import nestle
import pyiacsun as ps
from... | mit |
zertan/Menace | menace/bin/addStrainCoverage.py | 2 | 3094 | #!/usr/bin/env python
import numpy as np
import pandas
import xmltodict
import os
import sys
#import time
def chunks(l, n):
"""Yield successive n-sized chunks from l."""
for i in range(0, len(l), n):
yield l[i:i+n]
def binData(x,binSize):
l=np.ceil((len(x)/binSize))
out=np.zeros(l+1)
tmp=chunks(x,binSize)
for... | gpl-2.0 |
nudles/incubator-singa | examples/gan/vanilla.py | 5 | 8295 | #
# 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... | apache-2.0 |
sppalkia/weld | python/grizzly/grizzly/grizzly_impl.py | 2 | 48957 | """Contains implementations for each ported operation in Pandas.
Attributes:
decoder_ (NumPyEncoder): Description
encoder_ (NumPyDecoder): Description
"""
from encoders import *
from weld.weldobject import *
encoder_ = NumPyEncoder()
decoder_ = NumPyDecoder()
def get_field(expr, field):
""" Fetch a fiel... | bsd-3-clause |
rsivapr/scikit-learn | sklearn/semi_supervised/label_propagation.py | 8 | 14061 | # coding=utf8
"""
Label propagation in the context of this module refers to a set of
semisupervised classification algorithms. In the high level, these algorithms
work by forming a fully-connected graph between all points given and solving
for the steady-state distribution of labels at each point.
These algorithms per... | bsd-3-clause |
solin319/incubator-mxnet | example/gan/dcgan.py | 24 | 10758 | # 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 |
kaichogami/scikit-learn | examples/ensemble/plot_forest_importances.py | 168 | 1793 | """
=========================================
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.