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
nest/nest-simulator
pynest/examples/balancedneuron.py
8
7344
# -*- coding: utf-8 -*- # # balancedneuron.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,...
gpl-2.0
mmottahedi/neuralnilm_prototype
scripts/e280.py
2
4987
from __future__ import print_function, division import matplotlib import logging from sys import stdout matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! from neuralnilm import (Net, RealApplianceSource, BLSTMLayer, DimshuffleLayer, Bidirectio...
mit
jseabold/scikit-learn
examples/neighbors/plot_kde_1d.py
347
5100
""" =================================== Simple 1D Kernel Density Estimation =================================== This example uses the :class:`sklearn.neighbors.KernelDensity` class to demonstrate the principles of Kernel Density Estimation in one dimension. The first plot shows one of the problems with using histogram...
bsd-3-clause
louisLouL/pair_trading
capstone_env/lib/python3.6/site-packages/matplotlib/backends/backend_gtk3.py
2
32330
from __future__ import (absolute_import, division, print_function, unicode_literals) import six import os, sys try: import gi except ImportError: raise ImportError("Gtk3 backend requires pygobject to be installed.") try: gi.require_version("Gtk", "3.0") except AttributeError: ...
mit
Windy-Ground/scikit-learn
examples/mixture/plot_gmm_classifier.py
250
3918
""" ================== GMM classification ================== Demonstration of Gaussian mixture models for classification. See :ref:`gmm` for more information on the estimator. Plots predicted labels on both training and held out test data using a variety of GMM classifiers on the iris dataset. Compares GMMs with sp...
bsd-3-clause
Eric89GXL/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
nelango/ViralityAnalysis
model/lib/sklearn/tests/test_metaestimators.py
226
4954
"""Common tests for metaestimators""" import functools import numpy as np from sklearn.base import BaseEstimator from sklearn.externals.six import iterkeys from sklearn.datasets import make_classification from sklearn.utils.testing import assert_true, assert_false, assert_raises from sklearn.pipeline import Pipeline...
mit
pratapvardhan/scikit-image
doc/examples/segmentation/plot_join_segmentations.py
10
1998
""" ========================================== Find the intersection of two segmentations ========================================== When segmenting an image, you may want to combine multiple alternative segmentations. The `skimage.segmentation.join_segmentations` function computes the join of two segmentations, in wh...
bsd-3-clause
yonglehou/scikit-learn
sklearn/__check_build/__init__.py
345
1671
""" Module to give helpful messages to the user that did not compile the scikit properly. """ import os INPLACE_MSG = """ It appears that you are importing a local scikit-learn source tree. For this, you need to have an inplace install. Maybe you are in the source directory and you need to try from another location.""...
bsd-3-clause
SciTools/cartopy
lib/cartopy/tests/mpl/test_feature_artist.py
2
4353
# Copyright Cartopy Contributors # # This file is part of Cartopy and is released under the LGPL license. # See COPYING and COPYING.LESSER in the root of the repository for full # licensing details. from unittest import mock import numpy as np import pytest import shapely.geometry as sgeom from matplotlib.transforms ...
lgpl-3.0
dannyjacobs/PRISim
main/MWA_interferometer_array_observing_run_data_simulation.mpi.py
1
90520
from mpi4py import MPI import argparse import numpy as NP from astropy.io import fits from astropy.io import ascii import scipy.constants as FCNST from scipy import interpolate import matplotlib.pyplot as PLT import matplotlib.colors as PLTC import matplotlib.animation as MOV from scipy.interpolate import griddata im...
mit
mxjl620/scikit-learn
benchmarks/bench_plot_incremental_pca.py
374
6430
""" ======================== IncrementalPCA benchmark ======================== Benchmarks for IncrementalPCA """ import numpy as np import gc from time import time from collections import defaultdict import matplotlib.pyplot as plt from sklearn.datasets import fetch_lfw_people from sklearn.decomposition import Incre...
bsd-3-clause
pianomania/scikit-learn
sklearn/utils/tests/test_metaestimators.py
86
2304
from sklearn.utils.testing import assert_true, assert_false from sklearn.utils.metaestimators import if_delegate_has_method class Prefix(object): def func(self): pass class MockMetaEstimator(object): """This is a mock meta estimator""" a_prefix = Prefix() @if_delegate_has_method(delegate="a...
bsd-3-clause
gdooper/scipy
scipy/special/c_misc/struve_convergence.py
23
3678
""" Convergence regions of the expansions used in ``struve.c`` Note that for v >> z both functions tend rapidly to 0, and for v << -z, they tend to infinity. The floating-point functions over/underflow in the lower left and right corners of the figure. Figure legend ============= Red region Power series is clo...
bsd-3-clause
UptakeOpenSource/uptasticsearch
py-pkg/uptasticsearch/fetch_all.py
1
1666
"""Functions for Pulling data from Elasticsearch and unpacking into a table """ import pandas as pd import json from uptasticsearch.clients import uptasticsearch_factory def es_search(es_host, es_index, query_body="{}", size=10000, max_hits=None, scroll="5m"): """ Execute a query to elasticsea...
bsd-3-clause
wlamond/scikit-learn
examples/linear_model/plot_sparse_logistic_regression_mnist.py
18
2701
""" ===================================================== MNIST classfification using multinomial logistic + L1 ===================================================== Here we fit a multinomial logistic regression with L1 penalty on a subset of the MNIST digits classification task. We use the SAGA algorithm for this pur...
bsd-3-clause
gfyoung/pandas
pandas/tests/indexes/timedeltas/methods/test_shift.py
6
2751
import pytest from pandas.errors import NullFrequencyError import pandas as pd from pandas import TimedeltaIndex import pandas._testing as tm class TestTimedeltaIndexShift: # ------------------------------------------------------------- # TimedeltaIndex.shift is used by __add__/__sub__ def test_tdi_sh...
bsd-3-clause
Lx37/pyqtgraph
pyqtgraph/exporters/Matplotlib.py
39
4821
from ..Qt import QtGui, QtCore from .Exporter import Exporter from .. import PlotItem from .. import functions as fn __all__ = ['MatplotlibExporter'] """ It is helpful when using the matplotlib Exporter if your .matplotlib/matplotlibrc file is configured appropriately. The following are suggested for getting usable P...
mit
jiangjinjinyxt/vnpy
docker/dockerTrader/ctaStrategy/strategy/strategyDualThrust.py
5
9485
# encoding: UTF-8 """ DualThrust交易策略 """ from datetime import time from ..ctaBase import * from ..ctaTemplate import CtaTemplate ######################################################################## class DualThrustStrategy(CtaTemplate): """DualThrust交易策略""" className = 'DualThrustStrategy' author =...
mit
nelson-liu/scikit-learn
sklearn/feature_selection/tests/test_mutual_info.py
56
6268
from __future__ import division import numpy as np from numpy.testing import run_module_suite from scipy.sparse import csr_matrix from sklearn.utils.testing import (assert_array_equal, assert_almost_equal, assert_false, assert_raises, assert_equal) from sklearn.feature_selection.mut...
bsd-3-clause
jonathanlxy/miaozhen_hackathon
lib/classifier.py
1
1312
import pickle import numpy as np from math import ceil class Classifier: def __init__(self, model_pickle): # Load the pickled sklearn model with open(model_pickle, 'rb') as f: self.model = pickle.load(f) def predict(self, X, diff_rate=0.35): ''' Input: F...
mit
petosegan/scikit-learn
sklearn/semi_supervised/label_propagation.py
128
15312
# 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
unnikrishnankgs/va
venv/lib/python3.5/site-packages/matplotlib/dviread.py
10
33393
""" An experimental module for reading dvi files output by TeX. Several limitations make this not (currently) useful as a general-purpose dvi preprocessor, but it is currently used by the pdf backend for processing usetex text. Interface:: dvi = Dvi(filename, 72) # iterate over pages (but only one page is support...
bsd-2-clause
dmd/stabilitycalc
stabilitysummary.py
1
8521
#!/usr/bin/env python import os from os.path import join as pjoin import shutil import time import logging import matplotlib matplotlib.use('Agg', warn=False) import numpy as np import matplotlib.pyplot as plt import seaborn seaborn.set_style("dark") import pandas as pd from collections import OrderedDict from datetim...
apache-2.0
jayflo/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
rrozewsk/OurProject
UnitTests/test_corporateRates.py
2
1403
from datetime import date from unittest import TestCase import numpy as np import pandas as pd from Curves.Corporates.CorporateDaily import CorporateRates from parameters import WORKING_DIR periods = '1Y' freq = '1M' t_step = 1.0 / 365.0 simNumber = 10 start = date(2005, 3, 30) trim_start = date(2000, 1, 1) trim_en...
mit
zorroblue/scikit-learn
sklearn/kernel_ridge.py
16
6766
"""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
tedmeeds/tcga_encoder
tcga_encoder/models/pytorch/weibull_survival_sandbox.py
1
42931
from __future__ import print_function import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from torch.nn import Parameter import torch.optim as optim import pylab as pp import sklearn from sklearn.model_selection import KFold import pdb from lifelines...
mit
jkarnows/scikit-learn
sklearn/covariance/__init__.py
389
1157
""" The :mod:`sklearn.covariance` module includes methods and algorithms to robustly estimate the covariance of features given a set of points. The precision matrix defined as the inverse of the covariance is also estimated. Covariance estimation is closely related to the theory of Gaussian Graphical Models. """ from ...
bsd-3-clause
wzbozon/scikit-learn
sklearn/linear_model/tests/test_ransac.py
216
13290
import numpy as np from numpy.testing import assert_equal, assert_raises from numpy.testing import assert_array_almost_equal from sklearn.utils.testing import assert_raises_regexp from scipy import sparse from sklearn.utils.testing import assert_less from sklearn.linear_model import LinearRegression, RANSACRegressor f...
bsd-3-clause
cainiaocome/scikit-learn
examples/applications/plot_prediction_latency.py
234
11277
""" ================== Prediction Latency ================== This is an example showing the prediction latency of various scikit-learn estimators. The goal is to measure the latency one can expect when doing predictions either in bulk or atomic (i.e. one by one) mode. The plots represent the distribution of the pred...
bsd-3-clause
casawa/mdtraj
mdtraj/formats/pdb/pdbfile.py
3
27208
############################################################################## # MDTraj: A Python Library for Loading, Saving, and Manipulating # Molecular Dynamics Trajectories. # Copyright 2012-2013 Stanford University and the Authors # # Authors: Peter Eastman, Robert McGibbon # Contributors: Carlos Hernande...
lgpl-2.1
Designist/sympy
sympy/external/tests/test_importtools.py
91
1215
from sympy.external import import_module # fixes issue that arose in addressing issue 6533 def test_no_stdlib_collections(): ''' make sure we get the right collections when it is not part of a larger list ''' import collections matplotlib = import_module('matplotlib', __import__kwargs={...
bsd-3-clause
0asa/scikit-learn
sklearn/metrics/cluster/__init__.py
312
1322
""" The :mod:`sklearn.metrics.cluster` submodule contains evaluation metrics for cluster analysis results. There are two forms of evaluation: - supervised, which uses a ground truth class values for each sample. - unsupervised, which does not and measures the 'quality' of the model itself. """ from .supervised import ...
bsd-3-clause
andrej5elin/ddm
ddm/video/misc.py
1
4991
#python 3 compatibility stuff from __future__ import division, print_function, absolute_import import numpy as np import time import matplotlib.pyplot as plt from matplotlib.widgets import Slider, Button from matplotlib.animation import FuncAnimation from matplotlib.patches import Circle from ddm.core.ddm_tools impor...
gpl-3.0
plotly/python-api
packages/python/plotly/plotly/graph_objs/barpolar/marker/_colorbar.py
1
69658
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class ColorBar(_BaseTraceHierarchyType): # class properties # -------------------- _parent_path_str = "barpolar.marker" _path_str = "barpolar.marker.colorbar" _valid_props = { "bgcolor"...
mit
fpetitjean/DBA
cython/test.py
1
1196
from __future__ import division import numpy as np import matplotlib.pyplot as plt from DBA import performDBA def main(): #generating synthetic data n_series = 20 length = 200 series = list() padding_length=30 indices = range(0, length-padding_length) main_profile_gen = np.array(list(map(l...
gpl-3.0
RobertABT/heightmap
build/matplotlib/examples/pylab_examples/barb_demo.py
13
1712
''' Demonstration of wind barb plots ''' import matplotlib.pyplot as plt import numpy as np x = np.linspace(-5, 5, 5) X,Y = np.meshgrid(x, x) U, V = 12*X, 12*Y data = [(-1.5, .5, -6, -6), (1, -1, -46, 46), (-3, -1, 11, -11), (1, 1.5, 80, 80), (0.5, 0.25, 25, 15), (-1.5, -0.5, -...
mit
uri-mog/dreampie
dreampielib/subprocess/__init__.py
1
37102
# Copyright 2010 Noam Yorav-Raphael # # This file is part of DreamPie. # # DreamPie is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # ...
gpl-3.0
aashish24/seaborn
seaborn/miscplot.py
34
1498
from __future__ import division import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt def palplot(pal, size=1): """Plot the values in a color palette as a horizontal array. Parameters ---------- pal : sequence of matplotlib colors colors, i.e. as returned by seaborn.colo...
bsd-3-clause
harisbal/pandas
pandas/tests/groupby/test_function.py
3
38905
import pytest import numpy as np import pandas as pd from pandas import (DataFrame, Index, compat, isna, Series, MultiIndex, Timestamp, date_range) from pandas.errors import UnsupportedFunctionCall from pandas.util import testing as tm import pandas.core.nanops as nanops from string import ascii_lo...
bsd-3-clause
Sentient07/scikit-learn
examples/linear_model/plot_sgd_comparison.py
112
1819
""" ================================== Comparing various online solvers ================================== An example showing how different online solvers perform on the hand-written digits dataset. """ # Author: Rob Zinkov <rob at zinkov dot com> # License: BSD 3 clause import numpy as np import matplotlib.pyplot a...
bsd-3-clause
mbayon/TFG-MachineLearning
vbig/lib/python2.7/site-packages/sklearn/linear_model/ridge.py
8
52900
""" Ridge regression """ # Author: Mathieu Blondel <mathieu@mblondel.org> # Reuben Fletcher-Costin <reuben.fletchercostin@gmail.com> # Fabian Pedregosa <fabian@fseoane.net> # Michael Eickenberg <michael.eickenberg@nsup.org> # License: BSD 3 clause from abc import ABCMeta, abstractmethod impor...
mit
akucukelbir/stanhelper
stanhelper/stanhelper.py
1
13902
import re import linecache import os import subprocess import numpy as np import pandas as pd from functools import reduce from operator import mul from tempfile import NamedTemporaryFile def run(stan_binary_path: str, input_data: dict, method: str, init_data: dict=None, method_params:...
gpl-3.0
ephes/scikit-learn
sklearn/neural_network/rbm.py
206
12292
"""Restricted Boltzmann Machine """ # Authors: Yann N. Dauphin <dauphiya@iro.umontreal.ca> # Vlad Niculae # Gabriel Synnaeve # Lars Buitinck # License: BSD 3 clause import time import numpy as np import scipy.sparse as sp from ..base import BaseEstimator from ..base import TransformerMixi...
bsd-3-clause
beepee14/scikit-learn
examples/svm/plot_svm_nonlinear.py
268
1091
""" ============== Non-linear SVM ============== Perform binary classification using non-linear SVC with RBF kernel. The target to predict is a XOR of the inputs. The color map illustrates the decision function learned by the SVC. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from sklearn imp...
bsd-3-clause
Obus/scikit-learn
examples/plot_kernel_ridge_regression.py
230
6222
""" ============================================= Comparison of kernel ridge regression and SVR ============================================= Both kernel ridge regression (KRR) and SVR learn a non-linear function by employing the kernel trick, i.e., they learn a linear function in the space induced by the respective k...
bsd-3-clause
Ziqi-Li/bknqgis
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 ...
gpl-2.0
datapythonista/pandas
pandas/tests/frame/methods/test_set_index.py
2
25979
""" See also: test_reindex.py:TestReindexSetIndex """ from datetime import ( datetime, timedelta, ) import numpy as np import pytest from pandas import ( Categorical, DataFrame, DatetimeIndex, Index, MultiIndex, Series, date_range, period_range, to_datetime, ) import panda...
bsd-3-clause
gbellandi/bubble_size_analysis
bubblekicker/bubblekicker.py
1
13842
""" S. Van Hoey 2016-06-06 """ import os import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.ticker import FuncFormatter from skimage.feature import canny from skimage.segmentation import clear_border from skimage.morphology import dilation, rectangle from skimage.me...
mit
BerkeleyAutomation/vtsc
scripts/background_subtraction.py
1
2070
import numpy as np import cv2 import argparse import sys import matplotlib.pyplot as plt import IPython import parser import utils import constants def run_video_with_bsub(cap, func, kernel = None, params = None): if params is not None: fgbg = func(params[0], params[1], params[2], params[3]) else: fgbg = func()...
mit
HazyResearch/dd-genomics
document_classifier/classification/classify.py
1
2019
#! /usr/bin/python # -*- coding: utf-8 -*- from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer import sys from bunch import * import numpy as np import random from sklearn.linear_model import LogisticRegression from nltk.stem import WordNetLemmatizer...
apache-2.0
hitszxp/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
bmcage/stickproject
stick/stickApp.py
1
3341
#!/usr/bin/env python # Copyright (C) 2009 B. Malengier # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This pro...
gpl-2.0
phihes/sds-models
examples/verbose_test.py
1
2928
import pandas as pd import matplotlib.pyplot as plt import sdsModels as sdsm #data = pd.io.excel.read_excel('../data/data_klaus_feb_2015.xls') #data = pd.read_csv('../data/complete_april_2014.csv') data = pd.read_csv('../data/data_klaus_feb_2015.csv') data['label'] = data['user'].astype(int).astype('str') + data['t...
mit
ablifedev/ABLIRC
ABLIRC/bin/public/iv_cluster/get_CTSS.py
1
10604
#!/usr/bin/env python2.7 # -*- coding: utf-8 -*- #################################################################################### ### Copyright (C) 2015-2019 by ABLIFE #################################################################################### ########################################################...
mit
mit-crpg/openmc
tests/regression_tests/mgxs_library_nuclides/test.py
6
2524
import hashlib import openmc import openmc.mgxs from openmc.examples import pwr_pin_cell from tests.testing_harness import PyAPITestHarness class MGXSTestHarness(PyAPITestHarness): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # Initialize a two-group structure ...
mit
JosmanPS/scikit-learn
sklearn/utils/tests/test_class_weight.py
140
11909
import numpy as np from sklearn.linear_model import LogisticRegression from sklearn.datasets import make_blobs from sklearn.utils.class_weight import compute_class_weight from sklearn.utils.class_weight import compute_sample_weight from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testin...
bsd-3-clause
zorojean/scikit-learn
sklearn/feature_extraction/tests/test_text.py
110
34127
from __future__ import unicode_literals import warnings from sklearn.feature_extraction.text import strip_tags from sklearn.feature_extraction.text import strip_accents_unicode from sklearn.feature_extraction.text import strip_accents_ascii from sklearn.feature_extraction.text import HashingVectorizer from sklearn.fe...
bsd-3-clause
CIFASIS/vdiscover-workshop
split.py
2
3072
#!/usr/bin/python2 import os import sys import csv import random import gzip from sklearn import cross_validation data_filename = sys.argv[1] seed = sys.argv[2] data_dir = "data/"+seed train_filename = data_dir+"/train.csv" test_filename = data_dir+"/test.csv" os.system("mkdir -p "+data_dir) random.seed(seed) pr...
gpl-3.0
aerler/WRF-Projects
src/archive/plotDomain2.py
1
6131
''' Created on 2012-09-29 A simple script that reads a WRF netcdf-4 file and displays a 2D field in a proper geographic projection; application here is plotting precipitation in the inner WRF domain. @author: Andre R. Erler ''' ## includes # matplotlib config: size etc. import numpy as np import matplotlib.pylab as ...
gpl-3.0
huzq/scikit-learn
sklearn/decomposition/tests/test_incremental_pca.py
7
14464
"""Tests for Incremental PCA.""" import numpy as np import pytest from sklearn.utils._testing import assert_almost_equal from sklearn.utils._testing import assert_array_almost_equal from sklearn.utils._testing import assert_allclose_dense_sparse from sklearn import datasets from sklearn.decomposition import PCA, Incr...
bsd-3-clause
softEcon/talks
intro_structural_econometrics/images/entropy.py
1
1676
#!/usr/bin/env python """ This module collects all tools to explore the entropy. """ # standard library import matplotlib.pyplot as plt import shapely.geometry as sg import descartes # Module-wide variables NUM_POINTS = 3 KL_MAX = 0.02 # Translate to circle coordinates. center_coordinates = (0.0, 0.0) radius = KL_MAX...
mit
detrout/debian-statsmodels
statsmodels/sandbox/examples/ex_mixed_lls_timecorr.py
34
7824
# -*- coding: utf-8 -*- """Example using OneWayMixed with within group intertemporal correlation Created on Sat Dec 03 10:15:55 2011 Author: Josef Perktold This example constructs a linear model with individual specific random effects, and uses OneWayMixed to estimate it. This is a variation on ex_mixed_lls_0.py. ...
bsd-3-clause
dkushner/zipline
tests/test_batchtransform.py
18
9891
# # Copyright 2013 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
AlexanderFabisch/scikit-learn
examples/cluster/plot_kmeans_silhouette_analysis.py
242
5885
""" =============================================================================== Selecting the number of clusters with silhouette analysis on KMeans clustering =============================================================================== Silhouette analysis can be used to study the separation distance between the...
bsd-3-clause
glorizen/nupic
nupic/math/roc_utils.py
49
8308
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, 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
JosmanPS/scikit-learn
examples/exercises/plot_cv_diabetes.py
231
2527
""" =============================================== Cross-validation on diabetes Dataset Exercise =============================================== A tutorial exercise which uses cross-validation with linear models. This exercise is used in the :ref:`cv_estimators_tut` part of the :ref:`model_selection_tut` section of ...
bsd-3-clause
hainn8x/gnuradio
gr-filter/examples/channelize.py
58
7003
#!/usr/bin/env python # # Copyright 2009,2012,2013 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 your ...
gpl-3.0
Bioh4z4rd/scapy
scapy/plist.py
7
20977
## This file is part of Scapy ## See http://www.secdev.org/projects/scapy for more informations ## Copyright (C) Philippe Biondi <phil@secdev.org> ## This program is published under a GPLv2 license """ PacketList: holds several packets and allows to do operations on them. """ import os,subprocess from .config import...
gpl-2.0
bnoi/scikit-tracker
sktracker/data/__init__.py
1
3796
# -*- coding: utf-8 -*- from __future__ import unicode_literals from __future__ import division from __future__ import absolute_import from __future__ import print_function """Test dataset and fake auto generated trajectories. When data function end with _temp. The file is being copied to a temporary directory be...
bsd-3-clause
jgraving/pinpoint
pinpoint/utils.py
1
33939
""" Copyright 2015-2018 Jacob M. Graving <jgraving@gmail.com> 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 ag...
apache-2.0
web-masons/holocron-api
holocron_api/api/views.py
2
4775
from api.models import * # noqa from rest_framework import viewsets from api.serializers import * # noqa from rest_framework import filters from rest_pandas import PandasViewSet import django_filters class ProgramViewSet(viewsets.ModelViewSet): queryset = Program.objects.all() serializer_class = ProgramSeri...
apache-2.0
cainiaocome/scikit-learn
examples/bicluster/plot_spectral_biclustering.py
403
2011
""" ============================================= A demo of the Spectral Biclustering algorithm ============================================= This example demonstrates how to generate a checkerboard dataset and bicluster it using the Spectral Biclustering algorithm. The data is generated with the ``make_checkerboard`...
bsd-3-clause
frank-tancf/scikit-learn
examples/gaussian_process/plot_gpc_iris.py
81
2231
""" ===================================================== Gaussian process classification (GPC) on iris dataset ===================================================== This example illustrates the predicted probability of GPC for an isotropic and anisotropic RBF kernel on a two-dimensional version for the iris-dataset. ...
bsd-3-clause
sanketloke/scikit-learn
sklearn/linear_model/tests/test_ridge.py
32
26520
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
trankmichael/scikit-learn
examples/decomposition/plot_pca_vs_fa_model_selection.py
78
4510
#!/usr/bin/python # -*- coding: utf-8 -*- """ =============================================================== Model selection with Probabilistic PCA and Factor Analysis (FA) =============================================================== Probabilistic PCA and Factor Analysis are probabilistic models. The consequence ...
bsd-3-clause
boada/ICD
sandbox/lowerSN/plot_sersic_vs_icd_vs_mass_box_width.py
1
6738
#!/usr/bin/env python import pylab as pyl from mpl_toolkits.axes_grid1 import AxesGrid import cPickle as pickle from colsort import colsort def plot_uvj_vs_icd(): galaxies = pickle.load(open('galaxies.pickle','rb')) galaxies = filter(lambda galaxy: galaxy.ICD_IH != None, galaxies) galaxies = filter(lambda ...
mit
JackKelly/neuralnilm_prototype
scripts/e433.py
2
7273
from __future__ import print_function, division import matplotlib import logging from sys import stdout matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! from neuralnilm import (Net, RealApplianceSource, BLSTMLayer, DimshuffleLayer, Bidirectio...
mit
dataplumber/nexus
analysis/webservice/algorithms_spark/HofMoellerSpark.py
1
13208
""" Copyright (c) 2016 Jet Propulsion Laboratory, California Institute of Technology. All rights reserved """ import itertools import logging import traceback from cStringIO import StringIO from datetime import datetime from multiprocessing.dummy import Pool, Manager import matplotlib.pyplot as plt import mpld3 impor...
apache-2.0
andyraib/data-storage
python_scripts/env/lib/python3.6/site-packages/pandas/tests/indexes/test_multi.py
7
102429
# -*- coding: utf-8 -*- from datetime import timedelta from itertools import product import nose import re import warnings from pandas import (DataFrame, date_range, period_range, MultiIndex, Index, CategoricalIndex, compat) from pandas.core.common import PerformanceWarning from pandas.indexes.bas...
apache-2.0
akionakamura/scikit-learn
examples/cluster/plot_kmeans_stability_low_dim_dense.py
338
4324
""" ============================================================ Empirical evaluation of the impact of k-means initialization ============================================================ Evaluate the ability of k-means initializations strategies to make the algorithm convergence robust as measured by the relative stan...
bsd-3-clause
macks22/scikit-learn
sklearn/neighbors/tests/test_nearest_centroid.py
305
4121
""" Testing for the nearest centroid module. """ import numpy as np from scipy import sparse as sp from numpy.testing import assert_array_equal from numpy.testing import assert_equal from sklearn.neighbors import NearestCentroid from sklearn import datasets from sklearn.metrics.pairwise import pairwise_distances # t...
bsd-3-clause
satonreb/machine-learning-using-tensorflow
scripts/02_linear_regression.py
1
6206
import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from sklearn.metrics import mean_squared_error, r2_score from sklearn.model_selection import train_test_split # Data Preparation ===================================================================================================== # Synthetic D...
gpl-3.0
jpautom/scikit-learn
examples/ensemble/plot_bias_variance.py
357
7324
""" ============================================================ Single estimator versus bagging: bias-variance decomposition ============================================================ This example illustrates and compares the bias-variance decomposition of the expected mean squared error of a single estimator again...
bsd-3-clause
okadate/bgc
plot/plot_profiles.py
1
1896
# -*- coding: utf-8 -*- import pandas as pd import matplotlib.pyplot as plt import matplotlib.cm as cm import os from bgc_userconfig import * def plot_profiles(outdir, outfile, pngfile, obsfile): outfile = os.path.join(outdir, outfile) pngfile = os.path.join(outdir, pngfile) print outfile out = pd....
mit
huobaowangxi/scikit-learn
sklearn/feature_extraction/dict_vectorizer.py
234
12267
# Authors: Lars Buitinck # Dan Blanchard <dblanchard@ets.org> # License: BSD 3 clause from array import array from collections import Mapping from operator import itemgetter import numpy as np import scipy.sparse as sp from ..base import BaseEstimator, TransformerMixin from ..externals import six from ..ext...
bsd-3-clause
LargePanda/LearnPy
learnpy/models/NaiveBayes.py
1
4229
__author__ = 'Jiarui Xu' from learnpy.models.Model import Model import pandas as pd from learnpy.models.ModelUtil import * import operator import time # to be implemented next week class NaiveBayes(Model): def __init__(self, data, class_column): """ Constructor for the Naive Bayes Model ...
mit
saiwing-yeung/scikit-learn
examples/svm/plot_separating_hyperplane.py
294
1273
""" ========================================= SVM: Maximum margin separating hyperplane ========================================= Plot the maximum margin separating hyperplane within a two-class separable dataset using a Support Vector Machine classifier with linear kernel. """ print(__doc__) import numpy as np impor...
bsd-3-clause
costypetrisor/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
YuxingZhang/prescription
visualize/tsne.py
1
5462
# # tsne.py # # Implementation of t-SNE in Python. The implementation was tested on Python 2.7.10, and it requires a working # installation of NumPy. The implementation comes with an example on the MNIST dataset. In order to plot the # results of this example, a working installation of matplotlib is required. # # The ...
bsd-3-clause
JohanComparat/pySU
spm/bin/combine_model_spectra.py
1
10387
import time t0t=time.time() from os.path import join import os import numpy as n import glob import sys import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as p import astropy.io.fits as fits from scipy.interpolate import interp1d from scipy.stats import norm as gaussD plate = sys.argv[1] mjd =...
cc0-1.0
Myasuka/scikit-learn
sklearn/feature_selection/tests/test_rfe.py
209
11733
""" Testing Recursive feature elimination """ import warnings import numpy as np from numpy.testing import assert_array_almost_equal, assert_array_equal from nose.tools import assert_equal, assert_true from scipy import sparse from sklearn.feature_selection.rfe import RFE, RFECV from sklearn.datasets import load_iris,...
bsd-3-clause
abitofalchemy/hrg_nets
generalized_exact_phrg.py
1
18116
#!/usr/bin/env python # make the other metrics work # generate the txt files, then work on the pdf otuput # TODO:load_edgelist from vador.load_edgelist import print_treewidth __version__ = "0.1.0" import numpy as np import pandas as pd import matplotlib matplotlib.use('pdf') import matplotlib.pyplot as plt import sys...
gpl-3.0
pmorissette/ffn
setup.py
1
1415
import os import re import setuptools with open(os.path.join(os.path.dirname(__file__), "ffn", "__init__.py"), "r") as fp: version = re.search( "^__version__ = \\((\\d+), (\\d+), (\\d+)\\)$", fp.read(), re.MULTILINE ).groups() with open(os.path.join(os.path.dirname(__file__), "README.rst"), "r") as ...
mit
evgchz/scikit-learn
sklearn/neighbors/tests/test_dist_metrics.py
48
4949
import itertools import numpy as np from numpy.testing import assert_array_almost_equal import scipy from scipy.spatial.distance import cdist from sklearn.neighbors.dist_metrics import DistanceMetric from nose import SkipTest def cmp_version(version1, version2): version1 = tuple(map(int, version1.split('.')[:2]...
bsd-3-clause
saildata/data-science-from-scratch
code-python3/visualizing_data.py
12
5036
import matplotlib.pyplot as plt from collections import Counter def make_chart_simple_line_chart(): years = [1950, 1960, 1970, 1980, 1990, 2000, 2010] gdp = [300.2, 543.3, 1075.9, 2862.5, 5979.6, 10289.7, 14958.3] # create a line chart, years on x-axis, gdp on y-axis plt.plot(years, gdp, color='green...
unlicense
jenniew/BigDL
pyspark/bigdl/optim/optimizer.py
1
29556
# # Copyright 2016 The BigDL Authors. # # 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 ...
apache-2.0
robbymeals/scikit-learn
examples/ensemble/plot_adaboost_twoclass.py
347
3268
""" ================== Two-class AdaBoost ================== This example fits an AdaBoosted decision stump on a non-linearly separable classification dataset composed of two "Gaussian quantiles" clusters (see :func:`sklearn.datasets.make_gaussian_quantiles`) and plots the decision boundary and decision scores. The di...
bsd-3-clause
clemkoa/scikit-learn
examples/applications/plot_tomography_l1_reconstruction.py
27
5478
""" ====================================================================== Compressive sensing: tomography reconstruction with L1 prior (Lasso) ====================================================================== This example shows the reconstruction of an image from a set of parallel projections, acquired along dif...
bsd-3-clause