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
ljchang/neurolearn
examples/01_DataOperations/plot_download.py
3
5125
""" Basic Data Operations ===================== A simple example showing how to download a dataset from neurovault and perform basic data operations. The bulk of the nltools toolbox is built around the Brain_Data() class. This class represents imaging data as a vectorized features by observations matrix. Each image...
mit
glennq/scikit-learn
examples/gaussian_process/plot_gpr_noisy.py
104
3778
""" ============================================================= Gaussian process regression (GPR) with noise-level estimation ============================================================= This example illustrates that GPR with a sum-kernel including a WhiteKernel can estimate the noise level of data. An illustration...
bsd-3-clause
scipy/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
jreback/pandas
pandas/tests/indexes/test_frozen.py
8
3069
import re import pytest from pandas.core.indexes.frozen import FrozenList class TestFrozenList: unicode_container = FrozenList(["\u05d0", "\u05d1", "c"]) def setup_method(self, _): self.lst = [1, 2, 3, 4, 5] self.container = FrozenList(self.lst) def check_mutable_error(self, *args, **...
bsd-3-clause
trungnt13/scikit-learn
examples/plot_multioutput_face_completion.py
330
3019
""" ============================================== Face completion with a multi-output estimators ============================================== This example shows the use of multi-output estimator to complete images. The goal is to predict the lower half of a face given its upper half. The first column of images sho...
bsd-3-clause
pratapvardhan/scikit-learn
examples/tree/unveil_tree_structure.py
67
4824
""" ========================================= Understanding the decision tree structure ========================================= The decision tree structure can be analysed to gain further insight on the relation between the features and the target to predict. In this example, we show how to retrieve: - the binary t...
bsd-3-clause
otmaneJai/Zipline
zipline/utils/tradingcalendar.py
9
11195
# # 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
Tobychev/tardis
tardis/simulation/base.py
2
16854
import os import logging import time import itertools import pandas as pd import numpy as np from astropy import units as u from tardis.montecarlo.base import MontecarloRunner from tardis.plasma.properties.base import Input # Adding logging support logger = logging.getLogger(__name__) class Simulation(object): ...
bsd-3-clause
voxlol/scikit-learn
examples/decomposition/plot_pca_3d.py
354
2432
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Principal components analysis (PCA) ========================================================= These figures aid in illustrating how a point cloud can be very flat in one direction--which is where PCA comes in to ch...
bsd-3-clause
shangwuhencc/scikit-learn
examples/cluster/plot_feature_agglomeration_vs_univariate_selection.py
218
3893
""" ============================================== Feature agglomeration vs. univariate selection ============================================== This example compares 2 dimensionality reduction strategies: - univariate feature selection with Anova - feature agglomeration with Ward hierarchical clustering Both metho...
bsd-3-clause
eig-2017/the-magical-csv-merge-machine
merge_machine/exact_linker.py
1
5694
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 19 19:57:59 2017 @author: leo """ import numpy as np import pandas as pd from dedupe_linker import pd_pre_process def enrich_sirene(tab): # TODO: this has nothing to do here '''Splits column L6_DECLAREE to create L6_DECLAREE.code_commune ...
mit
bsipocz/astroML
astroML/correlation.py
2
10579
""" Tools for computing two-point correlation functions. """ import numpy as np from sklearn.neighbors import KDTree from sklearn.utils import check_random_state def uniform_sphere(RAlim, DEClim, size=1): """Draw a uniform sample on a sphere Parameters ---------- RAlim : tuple select Right ...
bsd-2-clause
Laurae2/LightGBM
tests/python_package_test/test_consistency.py
1
4056
# coding: utf-8 # pylint: skip-file import os import unittest import lightgbm as lgb import numpy as np from sklearn.datasets import load_svmlight_file class FileLoader(object): def __init__(self, directory, prefix, config_file='train.conf'): directory = os.path.join(os.path.dirname(os.path.realpath(__f...
mit
billy-inn/scikit-learn
sklearn/naive_bayes.py
128
28358
# -*- coding: utf-8 -*- """ The :mod:`sklearn.naive_bayes` module implements Naive Bayes algorithms. These are supervised learning methods based on applying Bayes' theorem with strong (naive) feature independence assumptions. """ # Author: Vincent Michel <vincent.michel@inria.fr> # Minor fixes by Fabian Pedre...
bsd-3-clause
ilyes14/scikit-learn
sklearn/utils/random.py
234
10510
# 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
grundgruen/zipline
tests/pipeline/test_frameload.py
4
7620
""" Tests for zipline.pipeline.loaders.frame.DataFrameLoader. """ from unittest import TestCase from mock import patch from numpy import arange, ones from numpy.testing import assert_array_equal from pandas import ( DataFrame, DatetimeIndex, Int64Index, ) from zipline.lib.adjustment import ( ADD, ...
apache-2.0
perryjohnson/biplaneblade
sandia_blade_lib/layer_plane_angles_stn08.py
1
5257
"""Determine the layer plane angle of all the elements in a grid. Author: Perry Roth-Johnson Last modified: March 18, 2014 References: http://stackoverflow.com/questions/3365171/calculating-the-angle-between-two-lines-without-having-to-calculate-the-slope/3366569#3366569 http://stackoverflow.com/questions/1929...
gpl-3.0
andybrnr/QuantEcon.py
examples/illustrates_clt.py
7
1257
""" Filename: illustrates_clt.py Authors: John Stachurski and Thomas J. Sargent Visual illustration of the central limit theorem. Histograms draws of Y_n := \sqrt{n} (\bar X_n - \mu) for a given distribution of X_i, and a given choice of n. """ import numpy as np from scipy.stats import expon, norm import matpl...
bsd-3-clause
schlegelp/tanglegram
tanglegram/tangle.py
1
28171
# A Python package to plot tanglegrams # # Copyright (C) 2017 Philipp Schlegel # # 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 3 of the License, or # (at your opt...
gpl-3.0
elijah513/scikit-learn
benchmarks/bench_random_projections.py
397
8900
""" =========================== Random projection benchmark =========================== Benchmarks for random projections. """ from __future__ import division from __future__ import print_function import gc import sys import optparse from datetime import datetime import collections import numpy as np import scipy.s...
bsd-3-clause
omeed-maghzian/mtag
ldsc_mod/test/test_munge_sumstats.py
3
12198
from __future__ import division import munge_sumstats as munge import unittest import numpy as np import pandas as pd import nose from pandas.util.testing import assert_series_equal from pandas.util.testing import assert_frame_equal from numpy.testing import assert_array_equal, assert_array_almost_equal, assert_allclos...
gpl-3.0
LohithBlaze/scikit-learn
examples/applications/face_recognition.py
191
5513
""" =================================================== Faces recognition example using eigenfaces and SVMs =================================================== The dataset used in this example is a preprocessed excerpt of the "Labeled Faces in the Wild", aka LFW_: http://vis-www.cs.umass.edu/lfw/lfw-funneled.tgz (2...
bsd-3-clause
RobertABT/heightmap
build/matplotlib/examples/pylab_examples/pcolor_demo.py
6
1430
""" Demonstrates similarities between pcolor, pcolormesh, imshow and pcolorfast for drawing quadrilateral grids. """ import matplotlib.pyplot as plt import numpy as np # make these smaller to increase the resolution dx, dy = 0.15, 0.05 # generate 2 2d grids for the x & y bounds y, x = np.mgrid[slice(-3, 3 + dy, dy),...
mit
jakobkolb/MayaSim
Experiments/mayasim_X6_scan_drought_parameters.py
1
7378
""" Experiment to test the influence of drought events. Drought events start once the civilisation has reached a 'complex society' state and vary in length and severity. Therefore, starting point is at t = 150 where the model has reached a complex society state in all previous studies. We also use parameters for incom...
gpl-3.0
ywcui1990/nupic.research
projects/sequence_prediction/continuous_sequence/run_tm_model.py
3
16411
## ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013-2015, 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 ...
agpl-3.0
ibadami/pytorch-semseg
ptsemseg/loader/camvid_loader.py
2
3322
import os import collections import torch import torchvision import numpy as np import scipy.misc as m import matplotlib.pyplot as plt from torch.utils import data class camvidLoader(data.Dataset): def __init__(self, root, split="train", is_transform=False, img_size=None): self.root = root self.s...
mit
toastedcornflakes/scikit-learn
doc/sphinxext/numpy_ext/docscrape_sphinx.py
408
8061
import re import inspect import textwrap import pydoc from .docscrape import NumpyDocString from .docscrape import FunctionDoc from .docscrape import ClassDoc class SphinxDocString(NumpyDocString): def __init__(self, docstring, config=None): config = {} if config is None else config self.use_plots...
bsd-3-clause
frodre/pyLIM
calib_test_scripts/verif_utils.py
1
21049
import os import pandas as pd import numpy as np import dask.array as da from multiprocessing import Pool from itertools import product import lim_utils as lutils import plot_tools as ptools import misc_utils as mutils import data_utils as dutils import pylim.Stats as ST def get_scalar_outputs(dobj, nelem_in_yr, v...
mit
TobiasLundby/UAST
Module5/exercise_imu/imu_exercise_4_2_1.py
1
3266
#!/usr/bin/python # -*- coding: utf-8 -*- # IMU exercise # Copyright (c) 2015-2017 Kjeld Jensen kjen@mmmi.sdu.dk kj@kjen.dk ##### Insert initialize code below ################### ## Uncomment the file to read ## #fileName = 'nmea_data.txt' #fileName = 'imu_razor_data_static.txt' fileName = 'imu_razor_data_yaw_90deg....
bsd-3-clause
hothHowler/pymc3
pymc3/examples/ARM12_6uranium.py
14
1919
import numpy as np from pymc3 import * import pandas as pd data = pd.read_csv(get_data_file('pymc3.examples', 'data/srrs2.dat')) cty_data = pd.read_csv(get_data_file('pymc3.examples', 'data/cty.dat')) data = data[data.state == 'MN'] data['fips'] = data.stfips * 1000 + data.cntyfips cty_data['fips'] = cty_data.stfip...
apache-2.0
ioam/holoviews
holoviews/plotting/mpl/sankey.py
1
6343
from __future__ import absolute_import, division, unicode_literals import param from matplotlib.patches import Rectangle from matplotlib.collections import PatchCollection from ...core.util import basestring, max_range from ...util.transform import dim from .graphs import GraphPlot from .util import filter_styles ...
bsd-3-clause
aakashsinha19/Aspectus
Image Classification/models/autoencoder/AdditiveGaussianNoiseAutoencoderRunner.py
10
1859
import numpy as np import sklearn.preprocessing as prep import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data from autoencoder.autoencoder_models.DenoisingAutoencoder import AdditiveGaussianNoiseAutoencoder mnist = input_data.read_data_sets('MNIST_data', one_hot = True) def standard_sca...
apache-2.0
pratapvardhan/scikit-image
doc/examples/segmentation/plot_threshold_adaptive.py
5
1307
""" ===================== Adaptive Thresholding ===================== Thresholding is the simplest way to segment objects from a background. If that background is relatively uniform, then you can use a global threshold value to binarize the image by pixel-intensity. If there's large variation in the background intensi...
bsd-3-clause
SusanJL/iris
docs/iris/example_code/General/custom_file_loading.py
6
12521
""" Loading a cube from a custom file format ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This example shows how a custom text file can be loaded using the standard Iris load mechanism. The first stage in the process is to define an Iris :class:`FormatSpecification <iris.io.format_picker.FormatSpecification>` for the fil...
gpl-3.0
blink1073/image_inspector
iminspector/linetool.py
1
9446
import numpy as np import scipy.ndimage as ndi from base import ToolHandles from roi import ROIToolBase __all__ = ['LineTool', 'ThickLineTool'] class LineTool(ROIToolBase): """Widget for line selection in a plot. Parameters ---------- ax : :class:`matplotlib.axes.Axes` Matp...
mit
tkaitchuck/nupic
external/darwin64/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py
69
24593
# Todd Miller jmiller@stsci.edu from __future__ import division import os, sys, math import Tkinter as Tk, FileDialog import tkagg # Paint image to Tk photo blitter extension from backend_agg import FigureCanvasAgg import os.path import matplotlib from matplotlib.cbook import is_string_like from ...
gpl-3.0
dkoes/qsar-tools
applyclassifier.py
1
1085
#!/usr/bin/env python3 '''Apply a classification model trained with trainclassifier.py''' import numpy as np import pandas as pd import argparse, sys, pickle from sklearn.linear_model import * from sklearn.metrics import * from sklearn import svm from sklearn.ensemble import RandomForestClassifier from sklearn.neighbor...
apache-2.0
jennolsen84/PyTables
c-blosc/bench/plot-speeds.py
11
6852
"""Script for plotting the results of the 'suite' benchmark. Invoke without parameters for usage hints. :Author: Francesc Alted :Date: 2010-06-01 """ import matplotlib as mpl from pylab import * KB_ = 1024 MB_ = 1024*KB_ GB_ = 1024*MB_ NCHUNKS = 128 # keep in sync with bench.c linewidth=2 #markers= ['+', ',', 'o...
bsd-3-clause
xyguo/scikit-learn
sklearn/tree/tests/test_tree.py
32
52369
""" Testing for the tree module (sklearn.tree). """ import pickle from functools import partial from itertools import product import platform import numpy as np from scipy.sparse import csc_matrix from scipy.sparse import csr_matrix from scipy.sparse import coo_matrix from sklearn.random_projection import sparse_rand...
bsd-3-clause
nikste/tensorflow
tensorflow/examples/learn/iris_val_based_early_stopping.py
62
2827
# 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
jakobworldpeace/scikit-learn
examples/model_selection/grid_search_text_feature_extraction.py
99
4163
""" ========================================================== Sample pipeline for text feature extraction and evaluation ========================================================== The dataset used in this example is the 20 newsgroups dataset which will be automatically downloaded and then cached and reused for the d...
bsd-3-clause
dhruv13J/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
bennlich/scikit-image
skimage/transform/tests/test_radon_transform.py
16
14464
from __future__ import print_function, division import numpy as np from numpy.testing import assert_raises import itertools import os.path from skimage.transform import radon, iradon, iradon_sart, rescale from skimage.io import imread from skimage import data_dir from skimage._shared.testing import test_parallel PH...
bsd-3-clause
lesserwhirls/scipy-cwt
scipy/interpolate/tests/test_rbf.py
3
3557
#!/usr/bin/env python # Created by John Travers, Robert Hetland, 2007 """ Test functions for rbf module """ import numpy as np from numpy.testing import assert_, assert_array_almost_equal, assert_almost_equal from numpy import linspace, sin, random, exp, allclose from scipy.interpolate.rbf import Rbf FUNCTIONS = ('mu...
bsd-3-clause
Tong-Chen/scikit-learn
sklearn/utils/tests/test_utils.py
12
4539
import warnings import numpy as np import scipy.sparse as sp from scipy.linalg import pinv2 from sklearn.utils.testing import (assert_equal, assert_raises, assert_true, assert_almost_equal, assert_array_equal) from sklearn.utils import check_random_state from sklearn.utils import d...
bsd-3-clause
NikNitro/Python-iBeacon-Scan
sympy/interactive/tests/test_ipythonprinting.py
24
6208
"""Tests that the IPython printing module is properly loaded. """ from sympy.interactive.session import init_ipython_session from sympy.external import import_module from sympy.utilities.pytest import raises # run_cell was added in IPython 0.11 ipython = import_module("IPython", min_module_version="0.11") # disable ...
gpl-3.0
mattgiguere/scikit-learn
sklearn/utils/mocking.py
38
1807
from sklearn.base import BaseEstimator from sklearn.utils.testing import assert_true class ArraySlicingWrapper(object): def __init__(self, array): self.array = array def __getitem__(self, aslice): return MockDataFrame(self.array[aslice]) class MockDataFrame(object): # have shape an len...
bsd-3-clause
giorgiop/scikit-learn
examples/ensemble/plot_gradient_boosting_quantile.py
392
2114
""" ===================================================== Prediction Intervals for Gradient Boosting Regression ===================================================== This example shows how quantile regression can be used to create prediction intervals. """ import numpy as np import matplotlib.pyplot as plt from skle...
bsd-3-clause
bflaven/BlogArticlesExamples
extending_streamlit_usage/010_streamlit_design/streamlit_design_5.py
1
6097
#!/usr/bin/python # -*- coding: utf-8 -*- """ [path] cd /Users/brunoflaven/Documents/01_work/blog_articles/extending_streamlit_usage/streamlit_design/ [file] streamlit run streamlit_design_5.py # source https://github.com/Jcharis/Streamlit_DataScience_Apps/blob/master/Streamlit_Python_Crash_Course/docs_app.py ...
mit
krez13/scikit-learn
examples/cluster/plot_dbscan.py
346
2479
# -*- coding: utf-8 -*- """ =================================== Demo of DBSCAN clustering algorithm =================================== Finds core samples of high density and expands clusters from them. """ print(__doc__) import numpy as np from sklearn.cluster import DBSCAN from sklearn import metrics from sklearn...
bsd-3-clause
jrderuiter/pybiomart
src/pybiomart/mart.py
1
4194
from __future__ import absolute_import, division, print_function # pylint: disable=wildcard-import,redefined-builtin,unused-wildcard-import from builtins import * # pylint: enable=wildcard-import,redefined-builtin,unused-wildcard-import from io import StringIO import pandas as pd # pylint: disable=import-error from...
mit
xzh86/scikit-learn
examples/applications/svm_gui.py
287
11161
""" ========== Libsvm GUI ========== A simple graphical frontend for Libsvm mainly intended for didactic purposes. You can create data points by point and click and visualize the decision region induced by different kernels and parameter settings. To create positive examples click the left mouse button; to create neg...
bsd-3-clause
YudinYury/Python_Netology_homework
less_4_1_classwork_for_dig_data.py
1
1630
"""lesson_4_1_Classwork "Data processing tools" """ import os import pandas as pd def count_of_len(row): return len(row.Name) def main(): source_path = 'D:\Python_my\Python_Netology_homework\data_names' source_dir_path = os.path.normpath(os.path.abspath(source_path)) source_file = os.path.normpa...
gpl-3.0
Mitchkoens/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
AdamRTomkins/libSpineML2NK
libSpineML2NK/examples/Narx/Narx_Python/python/mean_contrast_filter.py
1
1559
import numpy as np from matplotlib import pyplot as plt import scipy from scipy import io def _1st_digital_linear_filter(x, x_1, y_1, fs, Tau, Kss, ...
gpl-3.0
zihua/scikit-learn
sklearn/datasets/tests/test_20news.py
280
3045
"""Test the 20news downloader, if the data is available.""" import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import SkipTest from sklearn import datasets def test_20news(): try: data = dat...
bsd-3-clause
FederatedAI/FATE
examples/benchmark_quality/hetero_linear_regression/local-linr.py
1
2555
# # Copyright 2019 The FATE 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 appli...
apache-2.0
hsiaoyi0504/scikit-learn
sklearn/cluster/tests/test_spectral.py
262
7954
"""Testing for Spectral Clustering methods""" from sklearn.externals.six.moves import cPickle dumps, loads = cPickle.dumps, cPickle.loads import numpy as np from scipy import sparse from sklearn.utils import check_random_state from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_a...
bsd-3-clause
arahuja/scikit-learn
examples/decomposition/plot_image_denoising.py
84
5820
""" ========================================= Image denoising using dictionary learning ========================================= An example comparing the effect of reconstructing noisy fragments of the Lena image using firstly online :ref:`DictionaryLearning` and various transform methods. The dictionary is fitted o...
bsd-3-clause
hugobowne/scikit-learn
sklearn/utils/tests/test_multiclass.py
34
13405
from __future__ import division import numpy as np import scipy.sparse as sp from itertools import product from sklearn.externals.six.moves import xrange from sklearn.externals.six import iteritems from scipy.sparse import issparse from scipy.sparse import csc_matrix from scipy.sparse import csr_matrix from scipy.sp...
bsd-3-clause
exa-analytics/atomic
exatomic/formula.py
2
2582
# -*- coding: utf-8 -*- # Copyright (c) 2015-2020, Exa Analytics Development Team # Distributed under the terms of the Apache License 2.0 """ Simple Formula ################## """ import numpy as np import pandas as pd from .core.error import StringFormulaError from exatomic.base import isotopes, sym2mass ...
apache-2.0
AlexanderFabisch/scikit-learn
examples/linear_model/plot_ridge_path.py
14
1599
""" =========================================================== Plot Ridge coefficients as a function of the regularization =========================================================== Shows the effect of collinearity in the coefficients of an estimator. .. currentmodule:: sklearn.linear_model :class:`Ridge` Regressi...
bsd-3-clause
aetilley/scikit-learn
sklearn/linear_model/least_angle.py
57
49338
""" Least Angle Regression algorithm. See the documentation on the Generalized Linear Model for a complete discussion. """ from __future__ import print_function # Author: Fabian Pedregosa <fabian.pedregosa@inria.fr> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Gael Varoquaux # # License: BSD 3 ...
bsd-3-clause
wackymaster/QTClock
Libraries/matplotlib/markers.py
8
26608
""" This module contains functions to handle markers. Used by both the marker functionality of `~matplotlib.axes.Axes.plot` and `~matplotlib.axes.Axes.scatter`. All possible markers are defined here: ============================== =============================================== marker descrip...
mit
texta-tk/texta
task_manager/tasks/workers/entity_extractor_worker.py
1
19137
import os import sys import json import logging import numpy as np import pickle as pkl import psutil from itertools import chain, product from task_manager.models import Task from searcher.models import Search from utils.es_manager import ES_Manager from utils.datasets import Datasets from texta.settings import ERRO...
gpl-3.0
kgullikson88/HET-Scripts
FitPrimarySpectrum.py
1
22695
from scipy.interpolate import InterpolatedUnivariateSpline as interp from scipy.optimize import leastsq, brute from scipy import mat from scipy.linalg import svd, diagsvd import sys import os from collections import defaultdict import numpy as np import matplotlib.pyplot as plt import DataStructures from astropy impor...
gpl-3.0
AlexanderFabisch/scikit-learn
sklearn/decomposition/tests/test_online_lda.py
22
13165
import numpy as np from scipy.linalg import block_diag from scipy.sparse import csr_matrix from scipy.special import psi from sklearn.decomposition import LatentDirichletAllocation from sklearn.decomposition._online_lda import (_dirichlet_expectation_1d, _dirichlet_expect...
bsd-3-clause
RPGOne/scikit-learn
examples/ensemble/plot_random_forest_regression_multioutput.py
46
2640
""" ============================================================ Comparing random forests and the multi-output meta estimator ============================================================ An example to compare multi-output regression with random forest and the :ref:`multioutput.MultiOutputRegressor <multiclass>` meta-e...
bsd-3-clause
IntelLabs/hpat
examples/series/series_corr.py
1
1773
# ***************************************************************************** # Copyright (c) 2020, Intel Corporation All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # Redistributions of sou...
bsd-2-clause
wdbm/datavision
setup.py
1
1970
#!/usr/bin/python # -*- coding: utf-8 -*- import os import setuptools def main(): setuptools.setup( name = "datavision", version = "2018.01.08.2333", description = "Python data visualisation", long_description = long_description(), url ...
gpl-3.0
Avsecz/concise
concise/layers.py
1
28897
import numpy as np from keras import backend as K from keras.engine.topology import Layer from keras.layers.pooling import _GlobalPooling1D from keras.layers import Conv1D, Input, LocallyConnected1D from keras.layers.core import Dropout from concise.utils.plot import seqlogo, seqlogo_fig import matplotlib.pyplot as plt...
mit
bhillmann/gingivere
tests/test_lr.py
2
1117
from sklearn.linear_model import LinearRegression from sklearn.cross_validation import StratifiedKFold import numpy as np from sklearn.metrics import classification_report from sklearn.metrics import roc_auc_score from tests import shelve_api XX, yy = shelve_api.load('lr') X = XX[2700:] y = yy[2700:] clf = LinearRe...
mit
gnocchixyz/gnocchi
tools/duration_perf_analyse.py
1
2586
#!/usr/bin/env python # # Copyright (c) 2014 eNovance # # 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 a...
apache-2.0
cavestruz/L500analysis
plotting/profiles/T_Vcirc_evolution/Vcirc_evolution/plot_Vcirc2_Vc200m.py
1
2692
from L500analysis.data_io.get_cluster_data import GetClusterData from L500analysis.utils.utils import aexp2redshift from L500analysis.plotting.tools.figure_formatting import * from L500analysis.plotting.profiles.tools.profiles_percentile \ import * from L500analysis.utils.constants import rbins from derived_field_f...
mit
alonecoder1337/Dos-Attack-Detection-using-Machine-Learning
App.py
1
1271
from Classifier import Classififer import pandas as pd import numpy as np from Dataset import Dataset class App: def __init__(self): self.classifier = Classififer().get_classifier(); def train(self): df = pd.read_csv('data/train.csv', header=None) data = np.array(df) self.x_t...
mit
benjaminoh1/tensorflowcookbook
Chapter 03/logistic_regression.py
1
3832
# Logistic Regression #---------------------------------- # # This function shows how to use Tensorflow to # solve logistic regression. # y = sigmoid(Ax + b) # # We will use the low birth weight data, specifically: # y = 0 or 1 = low birth weight # x = demographic and medical history data import matplotlib.pyplot as...
mit
lucidfrontier45/scikit-learn
examples/linear_model/plot_ols_ridge_variance.py
2
2021
#!/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
rsivapr/scikit-learn
sklearn/tests/test_lda.py
22
1521
import numpy as np from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_true from .. import lda # Data is just 6 separable points in the plane X = np.array([[-2, -1], [-...
bsd-3-clause
weaver-viii/h2o-3
h2o-py/tests/testdir_algos/glm/pyunit_link_functions_gammaGLM.py
3
2022
import sys sys.path.insert(1, "../../../") import h2o import pandas as pd import zipfile import statsmodels.api as sm def link_functions_gamma(ip,port): print("Read in prostate data.") h2o_data = h2o.import_file(path=h2o.locate("smalldata/prostate/prostate_complete.csv.zip")) h2o_data.head() sm_data = pd.rea...
apache-2.0
pp-mo/iris
docs/iris/src/userguide/plotting_examples/1d_with_legend.py
2
1103
import matplotlib.pyplot as plt import iris import iris.plot as iplt fname = iris.sample_data_path("air_temp.pp") # Load exactly one cube from the given file temperature = iris.load_cube(fname) # We are only interested in a small number of longitudes (the 4 after and # including the 5th element), so index them out...
lgpl-3.0
samzhang111/scikit-learn
sklearn/decomposition/tests/test_nmf.py
26
8544
import numpy as np from scipy import linalg from sklearn.decomposition import (NMF, ProjectedGradientNMF, non_negative_factorization) from sklearn.decomposition import nmf # For testing internals from scipy.sparse import csc_matrix from sklearn.utils.testing import assert_true from...
bsd-3-clause
jiangzhonglian/MachineLearning
src/py3.x/ml/7.AdaBoost/adaboost.py
1
11037
#!/usr/bin/python # coding:utf8 """ Created on Nov 28, 2010 Update on 2017-05-18 Adaboost is short for Adaptive Boosting Author: Peter/片刻/BBruceyuan GitHub: https://github.com/apachecn/AiLearning """ import numpy as np def load_sim_data(): """ 测试数据, :return: data_arr feature对应的数据集 label_arr...
gpl-3.0
lewisc/spark-tk
regression-tests/sparktkregtests/testcases/scoretests/random_forest_test.py
10
3004
# 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
breznak/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/axes.py
69
259904
from __future__ import division, generators import math, sys, warnings, datetime, new import numpy as np from numpy import ma import matplotlib rcParams = matplotlib.rcParams import matplotlib.artist as martist import matplotlib.axis as maxis import matplotlib.cbook as cbook import matplotlib.collections as mcoll im...
agpl-3.0
jm-begon/scikit-learn
sklearn/tests/test_grid_search.py
68
28778
""" Testing for grid search module (sklearn.grid_search) """ from collections import Iterable, Sized from sklearn.externals.six.moves import cStringIO as StringIO from sklearn.externals.six.moves import xrange from itertools import chain, product import pickle import sys import numpy as np import scipy.sparse as sp ...
bsd-3-clause
evgchz/scikit-learn
examples/covariance/plot_mahalanobis_distances.py
348
6232
r""" ================================================================ Robust covariance estimation and Mahalanobis distances relevance ================================================================ An example to show covariance estimation with the Mahalanobis distances on Gaussian distributed data. For Gaussian dis...
bsd-3-clause
dsullivan7/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
SpectreJan/gnuradio
gr-filter/examples/decimate.py
58
6061
#!/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
fyffyt/scikit-learn
examples/cluster/plot_kmeans_assumptions.py
270
2040
""" ==================================== Demonstration of k-means assumptions ==================================== This example is meant to illustrate situations where k-means will produce unintuitive and possibly unexpected clusters. In the first three plots, the input data does not conform to some implicit assumptio...
bsd-3-clause
kaichogami/scikit-learn
sklearn/model_selection/_search.py
8
38827
""" The :mod:`sklearn.model_selection._search` includes utilities to fine-tune the parameters of an estimator. """ from __future__ import print_function # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>, # Gael Varoquaux <gael.varoquaux@normalesup.org> # Andreas Mueller <amueller@ais.uni-bonn....
bsd-3-clause
NixaSoftware/CVis
venv/lib/python2.7/site-packages/pandas/core/indexes/category.py
3
27066
import numpy as np from pandas._libs import index as libindex from pandas import compat from pandas.compat.numpy import function as nv from pandas.core.dtypes.generic import ABCCategorical, ABCSeries from pandas.core.dtypes.common import ( is_categorical_dtype, _ensure_platform_int, is_list_like, is_in...
apache-2.0
pcmoritz/Strada.jl
deps/src/caffe/python/detect.py
23
5743
#!/usr/bin/env python """ detector.py is an out-of-the-box windowed detector callable from the command line. By default it configures and runs the Caffe reference ImageNet model. Note that this model was trained for image classification and not detection, and finetuning for detection can be expected to improve results...
bsd-2-clause
mhdella/scikit-learn
examples/linear_model/plot_sgd_separating_hyperplane.py
260
1219
""" ========================================= SGD: Maximum margin separating hyperplane ========================================= Plot the maximum margin separating hyperplane within a two-class separable dataset using a linear Support Vector Machines classifier trained using SGD. """ print(__doc__) import numpy as n...
bsd-3-clause
ephes/scikit-learn
sklearn/utils/tests/test_testing.py
144
4121
import warnings import unittest import sys from nose.tools import assert_raises from sklearn.utils.testing import ( _assert_less, _assert_greater, assert_less_equal, assert_greater_equal, assert_warns, assert_no_warnings, assert_equal, set_random_state, assert_raise_message) from ...
bsd-3-clause
Zsailer/epistasis
epistasis/pyplot/coefs.py
2
13923
import matplotlib.pyplot as plt from matplotlib.path import Path import matplotlib.patches as patches import matplotlib as mpl import numpy as np import gpmap from scipy.stats import norm as scipy_norm from epistasis.utils import Bunch def plot_coefs(model=None, sites=None, values=None, errors=None, **kwargs): ""...
unlicense
luo66/scikit-learn
examples/feature_selection/plot_feature_selection.py
249
2827
""" =============================== Univariate Feature Selection =============================== An example showing univariate feature selection. Noisy (non informative) features are added to the iris data and univariate feature selection is applied. For each feature, we plot the p-values for the univariate feature s...
bsd-3-clause
gakarak/FCN_MSCOCO_Food_Segmentation
MSCOCO_Processing/PythonAPI/run11_FCN_COCO_Segmentation_Train_v1.py
1
5077
#!/usr/bin/python # -*- coding: utf-8 -*- __author__ = 'ar' import os import sys import time import numpy as np import json import skimage.io as skio import skimage.transform as sktf import skimage.color as skolor import pandas as pd import matplotlib.pyplot as plt try: import cPickle as pickle except: import ...
apache-2.0
HeraclesHX/scikit-learn
sklearn/utils/tests/test_testing.py
144
4121
import warnings import unittest import sys from nose.tools import assert_raises from sklearn.utils.testing import ( _assert_less, _assert_greater, assert_less_equal, assert_greater_equal, assert_warns, assert_no_warnings, assert_equal, set_random_state, assert_raise_message) from ...
bsd-3-clause
anurag313/scikit-learn
examples/feature_stacker.py
246
1906
""" ================================================= Concatenating multiple feature extraction methods ================================================= In many real-world examples, there are many ways to extract features from a dataset. Often it is beneficial to combine several methods to obtain good performance. Th...
bsd-3-clause
ContinuumIO/dask
dask/sizeof.py
1
4406
import random import sys from distutils.version import LooseVersion from .utils import Dispatch try: # PyPy does not support sys.getsizeof sys.getsizeof(1) getsizeof = sys.getsizeof except (AttributeError, TypeError): # Monkey patch def getsizeof(x): return 100 sizeof = Dispatch(name="sizeof"...
bsd-3-clause