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
zoebchhatriwala/MachineLearningBasics
MachineLearning#5/main.py
1
1321
from sklearn import datasets from sklearn.cross_validation import train_test_split from sklearn.metrics import accuracy_score from scipy.spatial import distance # Finds Euclidean Distance def euc(a, b): return distance.euclidean(a, b) # New Classifier class NewClassifier: x_train = [] y_train = [] ...
gpl-3.0
sniemi/SamPy
sandbox/src1/examples/major_minor_demo1.py
4
1660
#!/usr/bin/env python """ Demonstrate how to use major and minor tickers. The two relevant userland classes are Locators and Formatters. Locators determine where the ticks are and formatters control the formatting of ticks. Minor ticks are off by default (NullLocator and NullFormatter). You can turn minor ticks on w...
bsd-2-clause
louisLouL/pair_trading
capstone_env/lib/python3.6/site-packages/pandas/tests/io/parser/test_parsers.py
7
3122
# -*- coding: utf-8 -*- import os import pandas.util.testing as tm from pandas import read_csv, read_table from pandas.core.common import AbstractMethodError from .common import ParserTests from .header import HeaderTests from .comment import CommentTests from .dialect import DialectTests from .quoting import Quoti...
mit
Solthis/Fugen-2.0
template_processor/base_template_processor.py
1
8312
# coding: utf-8 # Copyright 2017 Solthis. # # This file is part of Fugen 2.0. # # Fugen 2.0 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 ver...
gpl-3.0
LamaHamadeh/Microsoft-DAT210x
Module 5/assignment1.py
1
3075
#author Lama Hamadeh # TOOD: Import whatever needs to be imported to make this work # # .. your code here .. import pandas as pd import matplotlib import matplotlib.pyplot as plt from sklearn.cluster import KMeans matplotlib.style.use('ggplot') # Look Pretty # # TODO: To procure the dataset, follow ...
mit
mljar/mljar-examples
compare_Tensorflow_Sckit_Learn/benchmark_classification.py
1
2149
import os import time import json import numpy as np import pandas as pd from supervised.automl import AutoML from sklearn.model_selection import train_test_split from sklearn.metrics import log_loss from sklearn.model_selection import train_test_split from pmlb import fetch_data, classification_dataset_names results...
apache-2.0
xiaocanli/stochastic-parker
python/local_dist.py
1
21364
#!/usr/bin/env python3 """ Analysis procedures for local distribution """ from __future__ import print_function import argparse import itertools import json import multiprocessing import sys import math import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np from joblib import Parallel, delayed fr...
gpl-3.0
victorbergelin/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
kose-y/pylearn2
pylearn2/cross_validation/tests/test_subset_iterators.py
49
2411
""" Test subset iterators. """ import numpy as np from pylearn2.testing.skip import skip_if_no_sklearn def test_validation_k_fold(): """Test ValidationKFold.""" skip_if_no_sklearn() from pylearn2.cross_validation.subset_iterators import ValidationKFold n = 30 # test with indices cv = Validat...
bsd-3-clause
elkingtonmcb/scikit-learn
examples/cluster/plot_segmentation_toy.py
258
3336
""" =========================================== Spectral clustering for image segmentation =========================================== In this example, an image with connected circles is generated and spectral clustering is used to separate the circles. In these settings, the :ref:`spectral_clustering` approach solve...
bsd-3-clause
MatthieuBizien/scikit-learn
sklearn/utils/validation.py
15
25983
"""Utilities for input validation""" # Authors: Olivier Grisel # Gael Varoquaux # Andreas Mueller # Lars Buitinck # Alexandre Gramfort # Nicolas Tresegnie # License: BSD 3 clause import warnings import numbers import numpy as np import scipy.sparse as sp from ..externals...
bsd-3-clause
nonhermitian/scipy
scipy/signal/_max_len_seq.py
41
4942
# Author: Eric Larson # 2014 """Tools for MLS generation""" import numpy as np from ._max_len_seq_inner import _max_len_seq_inner __all__ = ['max_len_seq'] # These are definitions of linear shift register taps for use in max_len_seq() _mls_taps = {2: [1], 3: [2], 4: [3], 5: [3], 6: [5], 7: [6], 8: [7, 6, 1], ...
bsd-3-clause
raghavrv/scikit-learn
sklearn/linear_model/tests/test_ransac.py
22
20592
from scipy import sparse import numpy as np from scipy import sparse from numpy.testing import assert_equal, assert_raises from numpy.testing import assert_array_almost_equal from numpy.testing import assert_array_equal from sklearn.utils import check_random_state from sklearn.utils.testing import assert_less from s...
bsd-3-clause
andaag/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
liangz0707/scikit-learn
examples/ensemble/plot_feature_transformation.py
67
4285
""" =============================================== Feature transformations with ensembles of trees =============================================== Transform your features into a higher dimensional, sparse space. Then train a linear model on these features. First fit an ensemble of trees (totally random trees, a rand...
bsd-3-clause
erikgrinaker/BOUT-dev
tools/pylib/post_bout/pb_present.py
7
6244
from __future__ import print_function from __future__ import absolute_import from builtins import str from builtins import range from .pb_draw import LinResDraw,subset from .pb_corral import LinRes from .pb_nonlinear import NLinResDraw from pb_transport import Transport import numpy as np import matplotlib.pyplot as p...
gpl-3.0
sdsc/xsede_stats
tacc_stats/analysis/plot/plots.py
1
6375
# Plot generation tools for job analysis from __future__ import print_function import os import abc import numpy,traceback import multiprocessing from scipy.stats import scoreatpercentile as score import matplotlib from matplotlib.figure import Figure from matplotlib.backends.backend_agg import FigureCanvasAgg from m...
lgpl-2.1
Ttl/scikit-rf
skrf/__init__.py
2
1988
''' skrf is an object-oriented approach to microwave engineering, implemented in Python. ''' # Python 3 compatibility from __future__ import absolute_import, print_function, division from six.moves import xrange __version__ = '0.14.5' ## Import all module names for coherent reference of name-space #import io from...
bsd-3-clause
JoonasMelin/WeatherStation
station.py
1
14760
#!/usr/bin/python # include RPi libraries in to Python code import plotly.plotly as py import plotly.graph_objs as go import json import datetime import RPi.GPIO as GPIO import time import smbus import time from ctypes import c_short import sys import Adafruit_DHT import cPickle as pickle from collections import de...
gpl-3.0
NeuralEnsemble/elephant
elephant/sta.py
2
13537
# -*- coding: utf-8 -*- """ Functions to calculate spike-triggered average and spike-field coherence of analog signals. .. autosummary:: :toctree: _toctree/sta spike_triggered_average spike_field_coherence :copyright: Copyright 2014-2020 by the Elephant team, see `doc/authors.rst`. :license: Modified BSD...
bsd-3-clause
kushalbhola/MyStuff
Practice/PythonApplication/env/Lib/site-packages/pandas/core/tools/datetimes.py
1
35837
from collections import abc from datetime import datetime, time from functools import partial from typing import Optional, TypeVar, Union import numpy as np from pandas._libs import tslib, tslibs from pandas._libs.tslibs import Timestamp, conversion, parsing from pandas._libs.tslibs.parsing import ( # noqa DateP...
apache-2.0
ChristophKirst/ClearMapUnstable
docs/_build/html/imageanalysis-11.py
4
1303
import os import ClearMap.Settings as settings filename = os.path.join(settings.ClearMapPath, 'Test/Data/ImageAnalysis/cfos-substack.tif'); import ClearMap.Visualization.Plot as plt import ClearMap.IO as io data = io.readData(filename, z = (0,26)); import ClearMap.ImageProcessing.BackgroundRemoval as bgr dataBGR = bgr....
gpl-3.0
B3AU/waveTree
examples/cluster/plot_dbscan.py
6
2522
# -*- 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
JohanComparat/pyEmerge
bin/lc_wedge_plot.py
1
5144
""" + + + + + + + HEADER + + + + + + + + + file_name lc_remaped_position_L3_.hdf5 HDF5_Version 1.8.18 h5py_version 2.7.1 + + + + + + + DATA + + + + + + + + + + ======================================== agn_properties <HDF5 group "/agn_properties" (2 members)> - - - - - - - - - - - - - - - - - - - - agn_activity <H...
unlicense
anomam/pvlib-python
setup.py
1
3709
#!/usr/bin/env python import os try: from setuptools import setup from setuptools.extension import Extension except ImportError: raise RuntimeError('setuptools is required') import versioneer DESCRIPTION = ('A set of functions and classes for simulating the ' + 'performance of photovolt...
bsd-3-clause
kambysese/mne-python
mne/time_frequency/tfr.py
1
103477
"""A module which implements the time-frequency estimation. Morlet code inspired by Matlab code from Sheraz Khan & Brainstorm & SPM """ # Authors : Alexandre Gramfort <alexandre.gramfort@inria.fr> # Hari Bharadwaj <hari@nmr.mgh.harvard.edu> # Clement Moutard <clement.moutard@polytechnique.org> # ...
bsd-3-clause
yanboliang/spark
examples/src/main/python/sql/arrow.py
16
5034
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
apache-2.0
r-mart/scikit-learn
sklearn/tests/test_isotonic.py
230
11087
import numpy as np import pickle from sklearn.isotonic import (check_increasing, isotonic_regression, IsotonicRegression) from sklearn.utils.testing import (assert_raises, assert_array_equal, assert_true, assert_false, assert_equal, ...
bsd-3-clause
aditiiyer/CERR
CERR_core/ModelImplementationLibrary/SegmentationModels/ModelDependencies/CT_HeartStructure_DeepLab/dataloaders/utils.py
4
3279
import matplotlib.pyplot as plt import numpy as np import torch def decode_seg_map_sequence(label_masks, dataset='heart'): rgb_masks = [] for label_mask in label_masks: rgb_mask = decode_segmap(label_mask, dataset) rgb_masks.append(rgb_mask) rgb_masks = torch.from_numpy(np.array(rgb_masks)....
lgpl-2.1
siutanwong/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
Natetempid/nearfield
analyze_nfdata_tk/analyze_nfdata_tk/data_interpreter.py
1
8669
from __future__ import print_function import sys import Tkinter as tk import ttk import numpy as np import os import datetime from scipy import interpolate import tkFileDialog from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg from matplotlib.backends.backend_tkagg import NavigationToolbar2TkAgg from matpl...
gpl-3.0
doctornerdis/index_translationum
visualization.py
1
1451
import pandas as pd import numpy as np import glob as glob import matplotlib.pyplot as plt import seaborn as sns # Aggregating all the data file_pattern = "/Users/nicholascifuentes-goodbody/Documents/GitHub/index_translationum/data/*.csv" list_data = [] csv_files = glob.glob(file_pattern) for filename in csv_files:...
mit
chawins/aml
parameters_yolo.py
1
1410
# Import packages for all files import os import pickle import random import threading import time from os import listdir import cv2 import keras import keras.backend as K import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from keras.optimizers import SGD from keras.preprocessing.image import I...
mit
simonsfoundation/CaImAn
demos/obsolete/demo_caiman_patches.py
2
10389
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Wed Feb 24 18:39:45 2016 @author: Andrea Giovannucci For explanation consult at https://github.com/agiovann/Constrained_NMF/releases/download/v0.4-alpha/Patch_demo.zip and https://github.com/agiovann/Constrained_NMF """ from __future__ import division fr...
gpl-2.0
WEP11/NEXpy
level3.py
1
6752
####################################################### # # # PYTHON NEXRAD PLOT GENERATION # # # # Level-3, Single Site # # ...
gpl-3.0
deepchem/deepchem
examples/low_data/toxcast_maml.py
4
3781
from __future__ import print_function import deepchem as dc import numpy as np import tensorflow as tf from sklearn.metrics import accuracy_score # Load the data. tasks, datasets, transformers = dc.molnet.load_toxcast() (train_dataset, valid_dataset, test_dataset) = datasets x = train_dataset.X y = train_dataset.y w...
mit
Vvucinic/Wander
venv_2_7/lib/python2.7/site-packages/pandas/util/doctools.py
11
6612
import numpy as np import pandas as pd import pandas.compat as compat class TablePlotter(object): """ Layout some DataFrames in vertical/horizontal layout for explanation. Used in merging.rst """ def __init__(self, cell_width=0.37, cell_height=0.25, font_size=7.5): self.cell_width = cell_...
artistic-2.0
shamrt/jsPASAT
scripts/compile_data.py
1
17970
#!/usr/bin/env python # -*- coding: utf-8 -*- """A script that parses raw data output by jsPASAT (jsPsych), compiles each participant's data and creates/updates a file in jsPASAT's ``data`` directory. """ import os import glob import json import pandas as pd import numpy as np from scipy import stats PROJECT_DIR = o...
mit
VladimirTyrin/urbansim
urbansim/urbanchoice/tests/test_interaction.py
7
1734
import numpy as np import numpy.testing as npt import pandas as pd import pytest from .. import interaction as inter @pytest.fixture def choosers(): return pd.DataFrame( {'var1': range(5, 10), 'thing_id': ['a', 'c', 'e', 'g', 'i']}) @pytest.fixture def alternatives(): return pd.DataFrame( ...
bsd-3-clause
VasLem/KinectPainting
construct_actions_table.py
1
8161
import os from matplotlib import pyplot as plt import numpy as np import matplotlib.gridspec as gridspec import class_objects as co import cv2 import action_recognition_alg as ara from textwrap import wrap def extract_valid_action_utterance(action, testing=False, *args, **kwargs): ''' Visualizes action ...
bsd-3-clause
yyjiang/scikit-learn
sklearn/linear_model/tests/test_perceptron.py
378
1815
import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_raises from sklearn.utils import check_random_state from sklearn.datasets import load_iris from sklearn.linear_model import Pe...
bsd-3-clause
zorroblue/scikit-learn
examples/linear_model/plot_logistic_multinomial.py
81
2525
""" ==================================================== Plot multinomial and One-vs-Rest Logistic Regression ==================================================== Plot decision surface of multinomial and One-vs-Rest Logistic Regression. The hyperplanes corresponding to the three One-vs-Rest (OVR) classifiers are repre...
bsd-3-clause
poine/rosmip
rosmip/rosmip_control/scripts/test_sfb_ctl_on_ann.py
1
6165
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np, matplotlib.pyplot as plt import scipy.signal, scipy.optimize, control, control.matlab import keras import pdb import julie_misc.plot_utils as jpu import ident_plant # https://programtalk.com/vs2/?source=python/10610/python-control/external/yottalab.py...
gpl-3.0
graphistry/pygraphistry
graphistry/tests/test_hypergraph.py
1
9926
# -*- coding: utf-8 -*- import datetime as dt, logging, pandas as pd, pyarrow as pa import graphistry, graphistry.plotter from common import NoAuthTestCase logger = logging.getLogger(__name__) nid = graphistry.plotter.Plotter._defaultNodeId triangleNodesDict = { 'id': ['a', 'b', 'c'], 'a1': [1, 2, 3], ...
bsd-3-clause
yonglehou/scikit-learn
examples/neighbors/plot_nearest_centroid.py
264
1804
""" =============================== Nearest Centroid Classification =============================== Sample usage of Nearest Centroid classification. It will plot the decision boundaries for each class. """ print(__doc__) import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap f...
bsd-3-clause
dpaiton/OpenPV
pv-core/analysis/python/rate_estimation.py
1
2913
#!/usr/bin/python # script to estimate the firing rate in L1 versus the background rate in retina # copy this script to the location of your sandbox (STDP, marian, etc) import os import re # regular expression module import time import sys import numpy as np #import matplotlib.pyplot as plt #import matplotlib.ml...
epl-1.0
snnn/tensorflow
tensorflow/contrib/learn/python/learn/estimators/multioutput_test.py
136
1696
# 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
uwescience/pulse2percept
pulse2percept/implants/base.py
1
8549
"""`ProsthesisSystem`""" import numpy as np from copy import deepcopy from .electrodes import Electrode from .electrode_arrays import ElectrodeArray from ..stimuli import Stimulus from ..utils import PrettyPrint class ProsthesisSystem(PrettyPrint): """Visual prosthesis system A visual prosthesis combines an...
bsd-3-clause
kambysese/mne-python
tutorials/machine-learning/plot_sensors_decoding.py
4
17548
r""" =============== Decoding (MVPA) =============== .. include:: ../../links.inc Design philosophy ================= Decoding (a.k.a. MVPA) in MNE largely follows the machine learning API of the scikit-learn package. Each estimator implements ``fit``, ``transform``, ``fit_transform``, and (optionally) ``inverse_tran...
bsd-3-clause
andyh616/mne-python
tutorials/plot_raw_objects.py
15
5335
""" .. _tut_raw_objects The :class:`Raw <mne.io.RawFIF>` data structure: continuous data ================================================================ """ from __future__ import print_function import mne import os.path as op from matplotlib import pyplot as plt ###################################################...
bsd-3-clause
mMPI-MRI/TractLAS
utils.py
1
74376
# -*- coding: utf-8 -*- """ Created on Thu Feb 23, 2017 Compute large connectomes using mrtrix and sparse matrices @author: Christopher Steele """ from __future__ import division # to allow floating point calcs of number of voxels from pandas import read_csv def natural_sort(l): """ Returns alphanumerical...
gpl-3.0
ray-project/ray
python/ray/tune/examples/xgboost_example.py
1
3306
import sklearn.datasets import sklearn.metrics import os from ray.tune.schedulers import ASHAScheduler from sklearn.model_selection import train_test_split import xgboost as xgb from ray import tune from ray.tune.integration.xgboost import TuneReportCheckpointCallback def train_breast_cancer(config: dict): # Thi...
apache-2.0
wujinjun/TFbook
chapter5/models-master/autoencoder/VariationalAutoencoderRunner.py
12
1653
import numpy as np import sklearn.preprocessing as prep import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data from autoencoder_models.VariationalAutoencoder import VariationalAutoencoder mnist = input_data.read_data_sets('MNIST_data', one_hot = True) def min_max_scale(X_train, X_test)...
gpl-3.0
loli/semisupervisedforests
examples/cluster/plot_cluster_iris.py
350
2593
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= K-means Clustering ========================================================= The plots display firstly what a K-means algorithm would yield using three clusters. It is then shown what the effect of a bad initializa...
bsd-3-clause
AnasGhrab/scikit-learn
sklearn/ensemble/tests/test_base.py
284
1328
""" Testing for the base module (sklearn.ensemble.base). """ # Authors: Gilles Louppe # License: BSD 3 clause from numpy.testing import assert_equal from nose.tools import assert_true from sklearn.utils.testing import assert_raise_message from sklearn.datasets import load_iris from sklearn.ensemble import BaggingCla...
bsd-3-clause
joshbohde/scikit-learn
examples/linear_model/plot_ridge_path.py
2
1436
""" =========================================================== Plot Ridge coefficients as a function of the regularization =========================================================== .. currentmodule:: sklearn.linear_model Shows the effect of collinearity in the coefficients or the :class:`Ridge`. At the end of the ...
bsd-3-clause
shanot/imp
modules/pmi/pyext/src/analysis.py
1
106818
#!/usr/bin/env python """@namespace IMP.pmi.analysis Tools for clustering and cluster analysis """ from __future__ import print_function import IMP import IMP.algebra import IMP.em import IMP.pmi import IMP.pmi.tools import IMP.pmi.output import IMP.rmf import RMF import IMP.pmi.analysis from operator import itemge...
gpl-3.0
dereknewman/cancer_detection
extract_cubes_by_label.py
1
7790
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 10 12:51:14 2017 @author: derek """ import pandas as pd import SimpleITK import numpy as np import tensorflow as tf import cv2 TARGET_VOXEL_MM = 0.682 BASE_DIR = "/media/derek/disk1/kaggle_ndsb2017/" def normalize(image): """ Normalize image -...
mit
nhejazi/scikit-learn
examples/gaussian_process/plot_gpc_isoprobability.py
64
3049
#!/usr/bin/python # -*- coding: utf-8 -*- """ ================================================================= Iso-probability lines for Gaussian Processes classification (GPC) ================================================================= A two-dimensional classification example showing iso-probability lines for...
bsd-3-clause
maxalbert/bokeh
examples/plotting/file/elements.py
2
1491
import pandas as pd from bokeh.plotting import figure, show, output_file from bokeh.sampledata import periodic_table elements = periodic_table.elements elements = elements[elements["atomic number"] <= 82] elements = elements[~pd.isnull(elements["melting point"])] mass = [float(x.strip("[]")) for x in elements["atomic...
bsd-3-clause
dpinney/omf
omf/scratch/transients/04_Classical_Nine_Bus/test_nine_bus.py
1
6094
#!python3 # # Copyright (C) 2014-2015 Julius Susanto. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. """ PYPOWER-Dynamics Classical Stability Test """ # Dynamic model classes from pydyn.ext_grid import ext_grid from pydyn.sym_order6a import s...
gpl-2.0
YinongLong/scikit-learn
setup.py
4
11924
#! /usr/bin/env python # # Copyright (C) 2007-2009 Cournapeau David <cournape@gmail.com> # 2010 Fabian Pedregosa <fabian.pedregosa@inria.fr> # License: 3-clause BSD import subprocess descr = """A set of python modules for machine learning and data mining""" import sys import os import shutil from distut...
bsd-3-clause
xyguo/scikit-learn
sklearn/ensemble/__init__.py
153
1382
""" The :mod:`sklearn.ensemble` module includes ensemble-based methods for classification, regression and anomaly detection. """ from .base import BaseEnsemble from .forest import RandomForestClassifier from .forest import RandomForestRegressor from .forest import RandomTreesEmbedding from .forest import ExtraTreesCla...
bsd-3-clause
DLR-SC/tigl
misc/math-scripts/ComponentSegmentNew.py
2
6822
# # Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) # # Created: 2013-04-19 Martin Siggel <Martin.Siggel@dlr.de> # # 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.ap...
apache-2.0
ischwabacher/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
yavalvas/yav_com
build/matplotlib/doc/mpl_examples/statistics/boxplot_demo.py
3
2674
""" Demo of the new boxplot functionality """ import numpy as np import matplotlib.pyplot as plt # fake data np.random.seed(937) data = np.random.lognormal(size=(37, 4), mean=1.5, sigma=1.75) labels = list('ABCD') fs = 10 # fontsize # demonstrate how to toggle the display of different elements: fig, axes = plt.subpl...
mit
abhisg/scikit-learn
examples/calibration/plot_calibration_multiclass.py
272
6972
""" ================================================== Probability Calibration for 3-class classification ================================================== This example illustrates how sigmoid calibration changes predicted probabilities for a 3-class classification problem. Illustrated is the standard 2-simplex, wher...
bsd-3-clause
0asa/scikit-learn
sklearn/cross_validation.py
2
63023
""" The :mod:`sklearn.cross_validation` module includes utilities for cross- validation and performance evaluation. """ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>, # Gael Varoquaux <gael.varoquaux@normalesup.org>, # Olivier Grisel <olivier.grisel@ensta.org> # License: BSD 3 clause from...
bsd-3-clause
Myasuka/scikit-learn
benchmarks/bench_plot_neighbors.py
287
6433
""" Plot the scaling of the nearest neighbors algorithms with k, D, and N """ from time import time import numpy as np import pylab as pl from matplotlib import ticker from sklearn import neighbors, datasets def get_data(N, D, dataset='dense'): if dataset == 'dense': np.random.seed(0) return np....
bsd-3-clause
jjx02230808/project0223
doc/tutorial/text_analytics/skeletons/exercise_02_sentiment.py
157
2409
"""Build a sentiment analysis / polarity model Sentiment analysis can be casted as a binary text classification problem, that is fitting a linear classifier on features extracted from the text of the user messages so as to guess wether the opinion of the author is positive or negative. In this examples we will use a ...
bsd-3-clause
jonathandunn/c2xg
c2xg/modules/rdrpos_tagger/pSCRDRtagger/RDRPOSTagger.py
1
5379
# -*- coding: utf-8 -*- import os import sys import cytoolz as ct from sklearn.utils import murmurhash3_32 from multiprocessing import Pool from ..SCRDRlearner.SCRDRTree import SCRDRTree from ..InitialTagger.InitialTagger import initializeCorpus, initializeSentence from ..SCRDRlearner.Object import FWObject from ..Uti...
gpl-3.0
mikebenfield/scikit-learn
sklearn/datasets/tests/test_mldata.py
384
5221
"""Test functionality of mldata fetching utilities.""" import os import shutil import tempfile import scipy as sp from sklearn import datasets from sklearn.datasets import mldata_filename, fetch_mldata from sklearn.utils.testing import assert_in from sklearn.utils.testing import assert_not_in from sklearn.utils.test...
bsd-3-clause
yangautumn/turing_pattern
amorphous_pattern/test.py
1
1800
""" # demo of plotting squared subfigures """ # import matplotlib.pyplot as plt # fig, ax = plt.subplots() # x = [0, 0.2, 0.4, 0.6, 0.8] # y = [0, 0.5, 1, 1.5, 2.0] # colors = ['k']*len(x) # ax.scatter(x, y, c=colors, alpha=0.5) # ax.set_xlim((0,2)) # ax.set_ylim((0,2)) # x0,x1 = ax.get_xlim() # y0,y1 = ax.get_ylim()...
gpl-3.0
GaryKriebel/osf.io
scripts/annotate_rsvps.py
60
2256
"""Utilities for annotating workshop RSVP data. Example :: import pandas as pd from scripts import annotate_rsvps frame = pd.read_csv('workshop.csv') annotated = annotate_rsvps.process(frame) annotated.to_csv('workshop-annotated.csv') """ import re import logging from dateutil.parser import par...
apache-2.0
bikong2/scikit-learn
sklearn/datasets/mldata.py
309
7838
"""Automatically download MLdata datasets.""" # Copyright (c) 2011 Pietro Berkes # License: BSD 3 clause import os from os.path import join, exists import re import numbers try: # Python 2 from urllib2 import HTTPError from urllib2 import quote from urllib2 import urlopen except ImportError: # Pyt...
bsd-3-clause
ndingwall/scikit-learn
sklearn/semi_supervised/_self_training.py
4
12700
import warnings import numpy as np from ..base import MetaEstimatorMixin, clone, BaseEstimator from ..utils.validation import check_is_fitted from ..utils.metaestimators import if_delegate_has_method from ..utils import safe_mask __all__ = ["SelfTrainingClassifier"] # Authors: Oliver Rausch <rauscho@ethz.ch> # ...
bsd-3-clause
cshallue/models
research/tcn/generate_videos.py
5
15889
# Copyright 2017 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 applicab...
apache-2.0
asm666/sympy
sympy/interactive/tests/test_ipythonprinting.py
27
5891
"""Tests that the IPython printing module is properly loaded. """ from sympy.core.compatibility import u 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",...
bsd-3-clause
aiguofer/bokeh
examples/charts/file/timeseries.py
4
2104
import pandas as pd from bokeh.charts import TimeSeries, show, output_file from bokeh.layouts import column # read in some stock data from the Yahoo Finance API AAPL = pd.read_csv( "http://ichart.yahoo.com/table.csv?s=AAPL&a=0&b=1&c=2000&d=0&e=1&f=2010", parse_dates=['Date']) MSFT = pd.read_csv( "http://i...
bsd-3-clause
amenonsen/ansible
hacking/cgroup_perf_recap_graph.py
54
4384
#!/usr/bin/env python # -*- coding: utf-8 -*- # (c) 2018, Matt Martz <matt@sivel.net> # # This file is part of Ansible # # Ansible 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 Licens...
gpl-3.0
guthemberg/yanoama
yanoama/monitoring/rtt_matrix/reload.py
1
3023
import pickle,sys,socket,subprocess,os,random from datetime import datetime from time import time #from planetlab import Monitor from configobj import ConfigObj import numpy as np import matplotlib.pyplot as plt from sklearn.cluster import MiniBatchKMeans def save_object_to_file(myobject,output_file): f = open(o...
bsd-3-clause
aidiary/keras_examples
cnn/cifar10/plot_results.py
1
1468
import os import matplotlib.pyplot as plt result_file1 = os.path.join('result_without_datagen', 'history.txt') result_file2 = os.path.join('result_with_datagen', 'history.txt') def load_results(filename): epoch_list = [] val_loss_list = [] val_acc_list = [] with open(filename) as fp: fp.readl...
mit
nanophotonics/nplab
nplab/instrument/electronics/SLM/pattern_generators.py
1
15649
# -*- coding: utf-8 -*- from __future__ import division from builtins import zip from builtins import range from past.utils import old_div import numpy as np # import pyfftw from scipy import misc import matplotlib.pyplot as plt from matplotlib import gridspec # TODO: performance quantifiers for IFT algorithms (smoo...
gpl-3.0
kevin-intel/scikit-learn
examples/linear_model/plot_logistic_path.py
19
2352
#!/usr/bin/env python """ ============================================== Regularization path of L1- Logistic Regression ============================================== Train l1-penalized logistic regression models on a binary classification problem derived from the Iris dataset. The models are ordered from strongest ...
bsd-3-clause
rjferrier/fluidity
tests/wetting_and_drying_balzano3_cg_parallel/plotfs_detec.py
5
5095
#!/usr/bin/env python import vtktools import sys import math import re import commands import matplotlib.pyplot as plt import getopt from scipy.special import erf from numpy import poly1d from matplotlib.pyplot import figure, show from numpy import pi, sin, linspace from matplotlib.mlab import stineman_interp from n...
lgpl-2.1
xmnlab/minilab
gui/plotter/async_chart.py
1
2771
from __future__ import print_function, division from collections import defaultdict from matplotlib import pyplot as plt from matplotlib.ticker import EngFormatter from random import random, randint from copy import deepcopy import time import numpy as np import traceback class DaqMultiPlotter(object): """ "...
gpl-3.0
pompiduskus/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
james-pack/ml
pack/ml/nodes/training_visualization.py
1
4326
import numpy as np from matplotlib import pyplot as plt class TrainingVisualization(object): def __init__(self): self.training_result = None self.figure = None self.loss_subplot = None self.aggregate_loss_line = None self.step_size_subplot = None self.step_size_l...
mit
stuart-knock/tvb-library
tvb/simulator/plot/power_spectra_interactive.py
3
18840
# -*- coding: utf-8 -*- # # # TheVirtualBrain-Scientific Package. This package holds all simulators, and # analysers necessary to run brain-simulations. You can use it stand alone or # in conjunction with TheVirtualBrain-Framework Package. See content of the # documentation-folder for more details. See also http://ww...
gpl-2.0
manipopopo/tensorflow
tensorflow/python/estimator/inputs/pandas_io_test.py
7
11057
# 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
rs2/pandas
pandas/tests/reshape/test_util.py
3
2846
import numpy as np import pytest from pandas import Index, date_range import pandas._testing as tm from pandas.core.reshape.util import cartesian_product class TestCartesianProduct: def test_simple(self): x, y = list("ABC"), [1, 22] result1, result2 = cartesian_product([x, y]) expected1 =...
bsd-3-clause
JustinWingChungHui/MyFamilyRoot
facial_recognition/models.py
2
1355
from django.db import models from sklearn import neighbors from family_tree.models import Family import math import pickle # Create your models here. class FaceModel(models.Model): family = models.OneToOneField( Family, on_delete=models.CASCADE, primary_key=True, ) fit_data_faces...
gpl-2.0
untom/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
UpSea/midProjects
histdataUI/Widgets/pgCrossAddition.py
1
6756
# -*- coding: utf-8 -*- import sys,os xpower = os.path.abspath(os.path.join(os.path.dirname(__file__),os.pardir,os.pardir,'thirdParty','pyqtgraph-0.9.10')) sys.path.append(xpower) xpower = os.path.abspath(os.path.join(os.path.dirname(__file__),os.pardir)) sys.path.append(xpower) from PyQt4 import QtCore, QtGui import p...
mit
jblackburne/scikit-learn
sklearn/utils/tests/test_utils.py
47
9089
import warnings import numpy as np import scipy.sparse as sp from scipy.linalg import pinv2 from itertools import chain from sklearn.utils.testing import (assert_equal, assert_raises, assert_true, assert_almost_equal, assert_array_equal, SkipTest, ...
bsd-3-clause
BigDataforYou/movie_recommendation_workshop_1
big_data_4_you_demo_1/venv/lib/python2.7/site-packages/pandas/tests/frame/test_analytics.py
1
76158
# -*- coding: utf-8 -*- from __future__ import print_function from datetime import timedelta, datetime from distutils.version import LooseVersion import sys import nose from numpy import nan from numpy.random import randn import numpy as np from pandas.compat import lrange from pandas import (compat, isnull, notnul...
mit
PiscesDream/Ideas
Cog_neusci/ex1/main.py
1
4431
from keras.layers import Input, Dense from keras.models import Model import keras from keras import regularizers import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt keras.backend.theano_backend._set_device('dev1') # this is the size of our encoded representations encoding_dim = 16 # 32 floats -> ...
apache-2.0
cerebis/i3seqdb
app/objects.py
1
6004
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship from sqlalchemy import Column, Integer, String, Date, Float, ForeignKey, Table, CheckConstraint import pandas Base = declarative_base() class Sample(Base): """ Defined by the minimum required for submission at NC...
gpl-3.0
jadsonjs/DataScience
MachineLearning/print_ensemble_precisions.py
1
2523
# # This program is distributed without any warranty and it # can be freely redistributed for research, classes or private studies, # since the copyright notices are not removed. # # This file just read the data to calculate the statistical test # # Jadson Santos - jadsonjs@gmail.com # # to run this exemple install py...
apache-2.0
wangqingbaidu/aliMusic
gen_X_features/user_clustering_artist_taset.py
1
1195
# -*- coding: UTF-8 -*- ''' Authorized by vlon Jang Created on May 25, 2016 Email:zhangzhiwei@ict.ac.cn From Institute of Computing Technology All Rights Reserved. ''' from sklearn.cluster import MiniBatchKMeans, KMeans import pandas as pd import numpy as np import pymysql mysql_cn= pymysql.connect(host...
gpl-3.0