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
anhnv-3991/VoltDB
tools/vis2.py
2
13955
#!/usr/bin/env python # This is a visualizer which pulls TPC-C benchmark results from the MySQL # databases and visualizes them. Four graphs will be generated, latency graph on # sinigle node and multiple nodes, and throughput graph on single node and # multiple nodes. # # Run it without any arguments to see what argu...
agpl-3.0
Riverscapes/pyBRAT
Capacity_Validation.py
2
24291
# ------------------------------------------------------------------------------- # Name: BRAT Validation # Purpose: Tests the output of BRAT against a shape file of beaver dams # # Author: Braden Anderson # # Created: 05/2018 # -----------------------------------------------------------------------...
gpl-3.0
kazemakase/scikit-learn
sklearn/preprocessing/label.py
35
28877
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Mathieu Blondel <mathieu@mblondel.org> # Olivier Grisel <olivier.grisel@ensta.org> # Andreas Mueller <amueller@ais.uni-bonn.de> # Joel Nothman <joel.nothman@gmail.com> # Hamzeh Alsalhi <ha258@cornell.edu> # Licens...
bsd-3-clause
larsmans/scikit-learn
sklearn/linear_model/least_angle.py
8
48477
""" 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
nelson-liu/scikit-learn
sklearn/externals/joblib/__init__.py
23
5101
""" Joblib is a set of tools to provide **lightweight pipelining in Python**. In particular, joblib offers: 1. transparent disk-caching of the output values and lazy re-evaluation (memoize pattern) 2. easy simple parallel computing 3. logging and tracing of the execution Joblib is optimized to be **fast*...
bsd-3-clause
bioShaun/OMrnaseq
rnaseq/modules/quantification/quant.py
1
5665
#!/usr/bin/env python from __future__ import print_function import sys import luigi from luigi.util import requires, inherits import os from rnaseq.utils import config from rnaseq.utils.util_functions import txt_to_excel, add_gene_annotation from rnaseq.utils.util_functions import get_compare_names, pattern2files from...
gpl-3.0
adykstra/mne-python
examples/forward/plot_forward_sensitivity_maps.py
3
2498
""" .. _ex-sensitivity-maps: ================================================ Display sensitivity maps for EEG and MEG sensors ================================================ Sensitivity maps can be produced from forward operators that indicate how well different sensor types will be able to detect neural currents f...
bsd-3-clause
madmax983/h2o-3
h2o-py/h2o/model/metrics_base.py
2
22127
from h2o.model.confusion_matrix import ConfusionMatrix import imp class MetricsBase(object): """ A parent class to house common metrics available for the various Metrics types. The methods here are available across different model categories, and so appear here. """ def __init__(self, metric_json,on=None,a...
apache-2.0
UDST/activitysim
activitysim/abm/models/trip_purpose_and_destination.py
2
5215
# ActivitySim # See full license in LICENSE.txt. from __future__ import (absolute_import, division, print_function, ) from future.standard_library import install_aliases install_aliases() # noqa: E402 import logging import pandas as pd from activitysim.core import tracing from activitysim.core import config from a...
bsd-3-clause
mrGeen/metaseq
metaseq/colormap_adjust.py
2
5167
""" Module to handle custom colormaps. `cmap_powerlaw_adjust`, `cmap_center_adjust`, and `cmap_center_adjust` are from https://sites.google.com/site/theodoregoetz/notes/matplotlib_colormapadjust """ import math import copy import numpy import numpy as np from matplotlib import pyplot, colors, cm import matplotlib imp...
mit
clemkoa/scikit-learn
sklearn/cluster/birch.py
18
23684
# Authors: Manoj Kumar <manojkumarsivaraj334@gmail.com> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Joel Nothman <joel.nothman@gmail.com> # License: BSD 3 clause from __future__ import division import warnings import numpy as np from scipy import sparse from math import sqrt fro...
bsd-3-clause
adammenges/statsmodels
statsmodels/graphics/dotplots.py
31
18190
import numpy as np from statsmodels.compat import range from . import utils def dot_plot(points, intervals=None, lines=None, sections=None, styles=None, marker_props=None, line_props=None, split_names=None, section_order=None, line_order=None, stacked=False, styles_order=None, s...
bsd-3-clause
ch3ll0v3k/scikit-learn
examples/hetero_feature_union.py
288
6236
""" ============================================= Feature Union with Heterogeneous Data Sources ============================================= Datasets can often contain components of that require different feature extraction and processing pipelines. This scenario might occur when: 1. Your dataset consists of hetero...
bsd-3-clause
cloudera/ibis
ibis/backends/impala/tests/test_udf.py
1
19002
import unittest from decimal import Decimal from posixpath import join as pjoin import numpy as np import pandas as pd import pytest import ibis import ibis.backends.impala as api # noqa: E402 import ibis.common.exceptions as com import ibis.expr.datatypes as dt import ibis.expr.rules as rules import ibis.expr.types...
apache-2.0
alephu5/Soundbyte
environment/lib/python3.3/site-packages/matplotlib/widgets.py
1
52856
""" GUI Neutral widgets =================== Widgets that are designed to work for any of the GUI backends. All of these widgets require you to predefine an :class:`matplotlib.axes.Axes` instance and pass that as the first arg. matplotlib doesn't try to be too smart with respect to layout -- you will have to figure ou...
gpl-3.0
charman2/rsas
examples/solutes.py
1
6055
# -*- coding: utf-8 -*- """Storage selection (SAS) functions: example with three solutes Runs the rSAS model for a synthetic dataset with two fluxes out and three solutes Theory is presented in: Harman, C. J. (2014), Time-variable transit time distributions and transport: Theory and application to storage-dependent t...
mit
toobaz/pandas
pandas/tests/groupby/conftest.py
1
2605
import numpy as np import pytest from pandas import DataFrame, MultiIndex from pandas.core.groupby.base import reduction_kernels from pandas.util import testing as tm @pytest.fixture def mframe(): index = MultiIndex( levels=[["foo", "bar", "baz", "qux"], ["one", "two", "three"]], codes=[[0, 0, 0,...
bsd-3-clause
ageron/tensorflow
tensorflow/contrib/factorization/python/ops/kmeans_test.py
16
21836
# 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
nistats/nistats
examples/02_first_level_models/plot_bids_features.py
1
7375
""" First level analysis of a complete BIDS dataset from openneuro =============================================================== Full step-by-step example of fitting a GLM to perform a first level analysis in an openneuro BIDS dataset. We demonstrate how BIDS derivatives can be exploited to perform a simple one sub...
bsd-3-clause
jm-begon/scikit-learn
sklearn/feature_extraction/tests/test_text.py
75
34122
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
parloma/robotcontrol
python/DEMO_INPUT_kinect_free.py
1
5176
#Parameters: RF First Classification Layer - RF Second Classification Layer #Import required import sys from os import path,sep,mkdir import numpy as np from cv2 import * from hand_grabber import PyOpenNIHandGrabber from pose_recognizer import PyPoseRecognizer import xml.etree.ElementTree as ET import Image from rando...
gpl-2.0
mabevillar/rmtk
rmtk/plotting/damage_dist/plot_damage_dist.py
3
4650
''' Post-process damage calculation outputs to plot damage distibution charts ''' import os import csv import argparse import numpy as np from collections import OrderedDict from matplotlib import pyplot from mpl_toolkits.mplot3d import Axes3D import parse_damage_dist as parsedd xmlNRML = '{http://openquake.org/xmlns...
agpl-3.0
oemof/examples
oemof_examples/oemof.solph/v0.1.x/storage_investment/storage_investment.py
2
10074
# -*- coding: utf-8 -*- """ General description: --------------------- The example models the following energy system: input/output bgas bel | | | | | | | | wind(FixedSource) |------------------>| | ...
gpl-3.0
JanNash/sms-tools
lectures/03-Fourier-properties/plots-code/convolution-2.py
24
1259
import matplotlib.pyplot as plt import numpy as np from scipy.fftpack import fft, fftshift plt.figure(1, figsize=(9.5, 7)) M = 64 N = 64 x1 = np.hanning(M) x2 = np.cos(2*np.pi*2/M*np.arange(M)) y1 = x1*x2 mY1 = 20 * np.log10(np.abs(fftshift(fft(y1, N)))) plt.subplot(3,2,1) plt.title('x1 (hanning)') plt.plot(np.arange...
agpl-3.0
lukecwik/incubator-beam
sdks/python/apache_beam/io/parquetio.py
1
20134
# # 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
pratapvardhan/pandas
pandas/tests/arrays/categorical/test_indexing.py
2
4603
# -*- coding: utf-8 -*- import pytest import numpy as np import pandas.util.testing as tm from pandas import Categorical, Index, CategoricalIndex, PeriodIndex from pandas.tests.arrays.categorical.common import TestCategorical class TestCategoricalIndexingWithFactor(TestCategorical): def test_getitem(self): ...
bsd-3-clause
jarvis-fga/Projetos
Problema 2/lucas/src/text_classification.py
1
5048
# Create by Lucas Andrade # On 11 / 09 / 2017 import pandas as pd import codecs import numpy as np from sklearn import svm from sklearn.svm import SVC from sklearn.model_selection import cross_val_score from sklearn.naive_bayes import MultinomialNB from sklearn.naive_bayes import GaussianNB from sklearn.ensemble impo...
mit
blink1073/scikit-image
skimage/filters/_gabor.py
23
6926
import numpy as np from scipy import ndimage as ndi from .._shared.utils import assert_nD __all__ = ['gabor_kernel', 'gabor'] def _sigma_prefactor(bandwidth): b = bandwidth # See http://www.cs.rug.nl/~imaging/simplecell.html return 1.0 / np.pi * np.sqrt(np.log(2) / 2.0) * \ (2.0 ** b + 1) / (2.0...
bsd-3-clause
depet/scikit-learn
sklearn/decomposition/__init__.py
1
1235
""" The :mod:`sklearn.decomposition` module includes matrix decomposition algorithms, including among others PCA, NMF or ICA. Most of the algorithms of this module can be regarded as dimensionality reduction techniques. """ from .nmf import NMF, ProjectedGradientNMF from .pca import PCA, RandomizedPCA, ProbabilisticPC...
bsd-3-clause
joekasp/ionic_liquids
ionic_liquids/test/test_utils.py
1
5560
#default python modules import os from datetime import datetime #external packages import numpy as np import pandas as pd from sklearn.externals import joblib from sklearn.linear_model import Lasso from sklearn.model_selection import train_test_split, GridSearchCV from sklearn.neural_network import MLPClassifier from s...
mit
dbtsai/spark
dev/sparktestsupport/modules.py
3
17852
# # 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
ptonner/GPy
GPy/models/gplvm.py
8
3049
# Copyright (c) 2012-2014, GPy authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) import numpy as np from .. import kern from ..core import GP, Param from ..likelihoods import Gaussian from .. import util class GPLVM(GP): """ Gaussian Process Latent Variable Model "...
bsd-3-clause
ozansener/tf_base
src/forward_greedy_facility.py
1
6769
# -*- coding: utf-8 -*- """Forward greedy facility location""" import numpy as np import warnings from sklearn.base import BaseEstimator, ClusterMixin, TransformerMixin from sklearn.metrics.pairwise import PAIRWISE_DISTANCE_FUNCTIONS from sklearn.metrics import normalized_mutual_info_score from sklearn.utils import c...
mit
jb1361/RS3GEPredictionModel
predictionTesting/predictOneItem2.py
1
8655
import time import sqlite3 import pandas as pd import numpy as np import scipy as sp from scipy import stats import matplotlib.mlab as mlab import matplotlib.pyplot as plt traindataframes = [] testDataFrame = [] #this defines how many items we are looking at #max = 20 predicted_Item = 0 #def predict_next_day(): #re...
mit
joeyginorio/Markov-Decision-Process
src/GridWorld.py
1
6386
# Joey Velez-Ginorio # Gridworld Implementation # --------------------------------- from MDP import MDP from Grid import Grid from scipy.stats import uniform from scipy.stats import beta from scipy.stats import expon import numpy as np import random import pyprind import matplotlib.pyplot as plt class GridWorld(MDP):...
mit
surhudm/scipy
scipy/signal/signaltools.py
2
115985
# Author: Travis Oliphant # 1999 -- 2002 from __future__ import division, print_function, absolute_import import warnings import threading import sys import timeit from . import sigtools, dlti from ._upfirdn import upfirdn, _UpFIRDn, _output_len from scipy._lib.six import callable from scipy._lib._version import Num...
bsd-3-clause
lbybee/vc_network_learning_project
code/test_ab_net.py
1
1162
from datetime import datetime import pandas as pd import process_data as prd test_inp = [{"c_name": "1", "f_name": "a", "c_mn_group": "1", "inv_date": datetime(2000, 1, 1), "c_success": 1}, {"c_name": "1", "f_name": "b", "c_mn_group": "1", "inv_date": datetime(2000, 1, 1), "c_suc...
gpl-2.0
arielmakestuff/loadlimit
test/unit/cli/test_statsetup.py
1
5917
# -*- coding: utf-8 -*- # test/unit/cli/test_statsetup.py # Copyright (C) 2016 authors and contributors (see AUTHORS file) # # This module is released under the MIT License. """Test StatSetup""" # ============================================================================ # Imports # ================================...
mit
rafaelmds/fatiando
fatiando/inversion/hyper_param.py
6
16629
r""" Classes for hyper parameter estimation (like the regularizing parameter). These classes copy the interface of the standard inversion classes based on :class:`~fatiando.inversion.misfit.Misfit` (i.e., ``solver.config(...).fit().estimate_``). When their ``fit`` method is called, they perform many runs of the invers...
bsd-3-clause
emanuele/jstsp2015
figures.py
1
5427
"""Code to generate figures of the manuscript. Author: Sandro Vega-Pons, Emanuele Olivetti """ import numpy as np import matplotlib.pyplot as plt import pickle import os import scipy.stats as ss sites = ["Beijing_Zang", "Berlin_Margulies", "Cambridge_Buckner", "Cleveland", "Dalla...
mit
UO-CAES/paparazzi
sw/airborne/test/stabilization/compare_ref_quat.py
38
1206
#! /usr/bin/env python from __future__ import division, print_function, absolute_import import numpy as np import matplotlib.pyplot as plt import ref_quat_float import ref_quat_int steps = 512 * 2 ref_eul_res = np.zeros((steps, 3)) ref_quat_res = np.zeros((steps, 3)) ref_quat_float.init() ref_quat_int.init() # re...
gpl-2.0
bmazin/SDR
Projects/FirmwareTests/stream/parsePacketDump.py
1
3552
""" File: parsePacketDump.py Author: Matt Strader """ import matplotlib, time, struct import matplotlib.pyplot as plt import numpy as np from Utils import binTools import sys if len(sys.argv) > 1: path = sys.argv[1] else: path = 'photonDump.bin' with open(path,'rb') as dumpFile: data = dumpFile....
gpl-2.0
rahulsrma26/code-gems
RL/bellman/jackCarRentalCpp.py
1
2830
import warnings import numpy as np import matplotlib.pyplot as plt import seaborn as sns from cppLib.bellman import JacksCarRental def data_formatter(data): def format_coord(x, y): ix, iy = int(x), int(y) v = 'N/A' try: v = data[iy][ix] except IndexError: pa...
mit
tacaswell/bokeh
bokeh/properties.py
4
42855
""" Properties are objects that can be assigned as class level attributes on Bokeh models, to provide automatic serialization and validation. For example, the following defines a model that has integer, string, and list[float] properties:: class Model(HasProps): foo = Int bar = String baz ...
bsd-3-clause
BhallaLab/moose
moose-core/tests/python/test_rdesigneur_random_syn_input.py
2
1402
# -*- coding: utf-8 -*- from __future__ import print_function, division # This example demonstrates random (Poisson) synaptic input to a cell. # Copyright (C) Upinder S. Bhalla NCBS 2018 # Released under the terms of the GNU Public License V3. No warranty. # Changelog: # Thursday 20 September 2018 09:53:27 AM IST # - ...
gpl-3.0
toastedcornflakes/scikit-learn
sklearn/ensemble/tests/test_iforest.py
9
6928
""" Testing for Isolation Forest algorithm (sklearn.ensemble.iforest). """ # Authors: Nicolas Goix <nicolas.goix@telecom-paristech.fr> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # License: BSD 3 clause import numpy as np from sklearn.utils.testing import assert_array_equal from sklearn.u...
bsd-3-clause
Garrett-R/scikit-learn
examples/datasets/plot_iris_dataset.py
283
1928
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= The Iris Dataset ========================================================= This data sets consists of 3 different types of irises' (Setosa, Versicolour, and Virginica) petal and sepal length, stored in a 150x4 numpy...
bsd-3-clause
bbfamily/abu
abupy/TradeBu/ABuTradeProxy.py
1
14496
# -*- encoding:utf-8 -*- """ 交易执行代理模块 """ from __future__ import print_function from __future__ import absolute_import from __future__ import division from contextlib import contextmanager from functools import total_ordering from enum import Enum import numpy as np import pandas as pd from . import ABuTradeDra...
gpl-3.0
mattions/TimeScales
helpers/plotter_walker_calcium.py
1
2618
import matplotlib.pyplot as plt import os from helpers.plotter import DoublePlotter, StimulPlotter import neuronvisio.manager filename = 'storage.h5' stimulated_spines = ['spine554', 'spine555', 'spine556', 'spine558', 'spine559', 'spine560', 'spine562', 'spine563', 'spin...
bsd-3-clause
mlindauer/AutoFolio
autofolio/selector/joint_regression.py
1
4040
import logging import traceback import numpy as np import pandas as pd from ConfigSpace.hyperparameters import CategoricalHyperparameter, \ UniformFloatHyperparameter, UniformIntegerHyperparameter from ConfigSpace.conditions import EqualsCondition, InCondition from ConfigSpace.configuration_space import Configura...
bsd-2-clause
burgerdev/hostload
test/testOpSVM.py
1
3635
import unittest import numpy as np import vigra from sklearn.svm import SVC from sklearn.svm import SVR from lazyflow.graph import Graph from tsdl.classifiers import OpSVMTrain from tsdl.classifiers import OpSVMPredict class TestOpSVM(unittest.TestCase): def setUp(self): X = np.array([[-1, -1], [-2, ...
mit
ycaihua/scikit-learn
examples/decomposition/plot_pca_vs_fa_model_selection.py
30
4516
#!/usr/bin/python # -*- coding: utf-8 -*- """ ================================================================= Model selection with Probabilistic (PCA) and Factor Analysis (FA) ================================================================= Probabilistic PCA and Factor Analysis are probabilistic models. The conseq...
bsd-3-clause
miloharper/neural-network-animation
matplotlib/streamplot.py
11
19119
""" Streamline plotting for 2D vector fields. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import six from six.moves import xrange import numpy as np import matplotlib import matplotlib.cm as cm import matplotlib.colors as mcolors import matplotlib....
mit
aditiiyer/CERR
CERR_core/ModelImplementationLibrary/SegmentationModels/ModelDependencies/MR_Lung_TumorAware/run_code.py
1
5022
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Wed May 31 23:10:12 2017 @author: jiangj1 """ #!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Wed May 31 15:58:04 2017 @author: jiangj1 """ #!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Sun Apr 30 11:30:40 2017 @author: cc...
lgpl-2.1
hilario/trep
src/discopt/doptimizer.py
1
22991
import time import datetime import numpy as np import trep import dlqr import numpy.linalg from numpy import dot try: import matplotlib.pyplot as pyplot pyplot_available = True except ImportError: pyplot_available = False class DOptimizerMonitor(object): """ This is the base class for Optimizer...
gpl-3.0
cowlicks/blaze
blaze/compute/tests/test_pandas_compute.py
2
28576
from __future__ import absolute_import, division, print_function import pytest from datetime import datetime, timedelta import numpy as np import pandas as pd import pandas.util.testing as tm from pandas import DataFrame, Series from string import ascii_lowercase from blaze.compute.core import compute from blaze....
bsd-3-clause
ocefpaf/ulmo
ulmo/cpc/drought/core.py
1
11079
""" ulmo.cpc.drought.core ~~~~~~~~~~~~~~~~~~~~~ This module provides direct access to `Climate Predicition Center`_ `Weekly Drought Index`_ dataset. .. _Climate Prediction Center: http://www.cpc.ncep.noaa.gov/ .. _Weekly Drought Index: http://www.cpc.ncep.noaa.gov/products/analysis_monitoring/...
bsd-3-clause
stephenslab/dsc2
src/query_jupyter.py
1
5969
#!/usr/bin/env python __author__ = "Gao Wang" __copyright__ = "Copyright 2016, Stephens lab" __email__ = "gaow@uchicago.edu" __license__ = "MIT" import os import json def get_home_doc(db, description): return ''' This page displays contents of database `{0}.db` generated by [this DSC]({0}.html). {1} '''.format( ...
mit
bsipocz/ginga
ginga/cmap.py
1
507604
# # cmap.py -- color maps for fits viewing # # Eric Jeschke (eric@naoj.org) # # Copyright (c) Eric R. Jeschke. All rights reserved. # This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. # from __future__ import print_function import numpy from ginga.util.six.move...
bsd-3-clause
MrNuggelz/sklearn-glvq
sklearn_lvq/tests/test_docstring_parameters.py
1
7619
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Raghav RV <rvraghav93@gmail.com> # License: BSD 3 clause import inspect import sys import warnings import importlib from pkgutil import walk_packages from inspect import getsource, isabstract from sklearn.base import signature from sklearn.utils....
bsd-3-clause
jeffersonfparil/GTWAS_POOL_RADseq_SIM
BACKUP_SCRIPTS_20170930/basisPlots_GWAS_ROC.py
2
3740
#!/usr/bin/env python import os, subprocess, sys, math import pandas import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from collections import Counter from sklearn import metrics #from statsmodels.formula.api import ols import scipy workDIR = sys.argv[1] phenotypeFile = sys.arg...
gpl-3.0
OshynSong/scikit-learn
sklearn/cluster/tests/test_dbscan.py
176
12155
""" Tests for DBSCAN clustering algorithm """ import pickle import numpy as np from scipy.spatial import distance from scipy import sparse from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing im...
bsd-3-clause
pprett/sklearn_pycon2014
notebooks/solutions/05_eigen_faces.py
1
1221
from sklearn.datasets import fetch_olivetti_faces from sklearn.decomposition import PCA faces = fetch_olivetti_faces() X = faces.data pca = PCA(n_components=100).fit(X) # set up the figure fig = plt.figure(figsize=(6, 6)) # figure size in inches fig.subplots_adjust(left=0, right=1, bottom=0, top=1, hspace=0.05, wsp...
bsd-3-clause
pratapvardhan/pandas
pandas/tests/indexes/multi/test_indexing.py
2
11610
# -*- coding: utf-8 -*- from datetime import timedelta import numpy as np import pytest import pandas as pd import pandas.util.testing as tm from pandas import (Categorical, CategoricalIndex, Index, IntervalIndex, MultiIndex, date_range) from pandas.compat import lrange from pandas.core.indexes....
bsd-3-clause
goulu/Goulib
tests/test_Goulib_image.py
1
21217
from nose.tools import assert_equal from nose import SkipTest # lines above are inserted automatically by pythoscope. Line below overrides them from Goulib.tests import * # pylint: disable=wildcard-import, unused-wildcard-import from Goulib.image import * # pylint: disable=wildcard-import, unused-wildcard-import fr...
lgpl-3.0
drpjm/udacity-mle-project1
boston_housing.py
1
7856
"""Load the Boston dataset and examine its target (label) distribution.""" # (c) 2015 Patrick Martin and Udacity # MIT License # Load libraries import numpy as np import pylab as pl import sklearn as skl from sklearn import datasets from sklearn.tree import DecisionTreeRegressor ################################ ### A...
mit
lilleswing/deepchem
examples/bace/bace_rf.py
5
4200
"""This example implements RF experiments from https://pubs.acs.org/doi/abs/10.1021/acs.jcim.6b00290""" import sys import os import deepchem import deepchem as dc import tempfile, shutil from bace_datasets import load_bace from deepchem.hyper import HyperparamOpt from sklearn.ensemble import RandomForestRegressor from ...
mit
andrewcmyers/tensorflow
tensorflow/contrib/learn/python/learn/estimators/debug_test.py
46
32817
# 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 applica...
apache-2.0
mlyundin/scikit-learn
sklearn/externals/joblib/parallel.py
79
35628
""" Helpers for embarrassingly parallel code. """ # Author: Gael Varoquaux < gael dot varoquaux at normalesup dot org > # Copyright: 2010, Gael Varoquaux # License: BSD 3 clause from __future__ import division import os import sys import gc import warnings from math import sqrt import functools import time import thr...
bsd-3-clause
thinrope/GNU_parallel
src/optional/python/tests/test_loader.py
4
1533
import pandas as pd import unittest from gnuparallel import load result_dir = '../../testresults' class TestLoader(unittest.TestCase): def test_basics(self): df = load(result_dir) self.assertEqual(set(df.columns), set(['a', 'b', 'resfile', '_stream'])) self.assertEqual(df.shape[0], 4) ...
gpl-3.0
ClaudioNahmad/Servicio-Social
Parametros/CosmoMC/CosmoMC-master/python/setup.py
1
1503
#!/usr/bin/env python from __future__ import absolute_import import io import re import os try: from setuptools import setup except ImportError: from distutils.core import setup def find_version(): version_file = io.open(os.path.join(os.path.dirname(__file__), 'getdist/__init__.py')).read() version_m...
gpl-3.0
ClimbsRocks/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
MTgeophysics/mtpy
examples/scripts/ModEM_PlotRMS_by_site.py
1
1089
# -*- coding: utf-8 -*- """ Created on Tue Oct 04 13:13:29 2016 @author: Alison Kirkby Plot root-mean-square misfit (RMS across all periods) at each site """ import os.path as op import os os.chdir(r'C:/mtpywin/mtpy') #from mtpy.imaging.plot_response import PlotResponse from mtpy.modeling.modem import Residual impo...
gpl-3.0
kushalbhola/MyStuff
Practice/PythonApplication/env/Lib/site-packages/pandas/core/indexing.py
1
85223
import textwrap from typing import Tuple import warnings import numpy as np from pandas._libs.indexing import _NDFrameIndexerBase from pandas._libs.lib import item_from_zerodim from pandas.errors import AbstractMethodError from pandas.util._decorators import Appender from pandas.core.dtypes.common import ( ensur...
apache-2.0
hlin117/statsmodels
statsmodels/examples/ex_pandas.py
29
4021
# -*- coding: utf-8 -*- """Examples using Pandas """ from __future__ import print_function from statsmodels.compat.python import zip from datetime import datetime import numpy as np from pandas import DataFrame, Series, datetools import statsmodels.api as sm import statsmodels.tsa.api as tsa data = sm.datasets....
bsd-3-clause
natasasdj/OpenWPM
analysis/07_jpeg_pix_size.py
1
5197
import os import sqlite3 import pandas as pd import matplotlib.pyplot as plt from matplotlib.colors import LogNorm from matplotlib.ticker import FuncFormatter def thousands(x, pos): if x>=1e9: return '%.1fB' % (x*1e-9) elif x>=1e6: return '%.1fM' % (x*1e-6) elif x>=1e3: return '%.1f...
gpl-3.0
kuntzer/SALSA-public
absolute_maps/resources/figures.py
2
1647
''' figures.py ========================= AIM: Provide several specific functions to save beautiful figures INPUT: function depend OUTPUT: function depend CMD: To include: import resources.figures as figures ISSUES: <none known> REQUIRES: standard python libraries, specific libraries in resources/ REMARKS: in gene...
bsd-3-clause
weinbe58/QuSpin
examples/notebooks/GPE.py
2
5907
from __future__ import print_function, division import sys,os # line 4 and line 5 below are for development purposes and can be removed qspin_path = os.path.join(os.getcwd(),"../../") sys.path.insert(0,qspin_path) # from quspin.operators import hamiltonian # Hamiltonians and operators from quspin.basis import boson_bas...
bsd-3-clause
AtsushiHashimoto/fujino_mthesis
tools/module/ontology.py
1
1123
# _*_ coding: utf-8 -*- import pandas as pd def load_food_synonym(synonym_path, key="swing", seasoning=True): """ input synonym_path: full path of synonym.tsv key: setting of dictionary of result; "swing" swing->concept "concept" concept->swing seasoning: use seasoning? output dictionay ...
bsd-2-clause
ningchi/scikit-learn
sklearn/tree/export.py
6
15622
""" This module defines export functions for decision trees. """ # Authors: Gilles Louppe <g.louppe@gmail.com> # Peter Prettenhofer <peter.prettenhofer@gmail.com> # Brian Holt <bdholt1@gmail.com> # Noel Dawe <noel@dawe.me> # Satrajit Gosh <satrajit.ghosh@gmail.com> # Trevor...
bsd-3-clause
dhruv13J/scikit-learn
examples/linear_model/plot_logistic_path.py
349
1195
#!/usr/bin/env python """ ================================= Path with L1- Logistic Regression ================================= Computes path on IRIS dataset. """ print(__doc__) # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD 3 clause from datetime import datetime import numpy as np import...
bsd-3-clause
P1R/cinves
TrabajoFinal/tubo350cm/Experimentos-04-2015/TvsFreq-FM.py
1
1237
import numpy as np import matplotlib.pyplot as plt #la frecuencia de la modulada FM es de 50 hz en todas las variaciones de la portadora Freq=np.array([20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,210,220,230,240,250,260]); DeltaTemp=np.array([0.5,1.2,3.2,4.1,2.3,2.0,1.8,0.8,0.2,1.2,2.3,4.1,8.5,3...
apache-2.0
cshallue/models
research/fivo/experimental/summary_utils.py
4
13834
# Copyright 2018 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
fivejjs/pybasicbayes
examples/animation.py
2
1504
from __future__ import division from __future__ import print_function import numpy as np import numpy.random as npr from matplotlib import pyplot as plt plt.ion() from pybasicbayes import models, distributions ############### # load data # ############### data = np.loadtxt('data.txt') plt.figure() plt.plot(data[...
mit
sonnyhu/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
DanielAndreasen/SWEET-Cat
checkDuplicates.py
1
4561
import pandas as pd import numpy as np import warnings from clint.textui import colored warnings.simplefilter("ignore") class Sweetcat: """Load SWEET-Cat database""" def __init__(self): # self.fname_sc = 'WEBSITE_online_EU-NASA_full_database.rdb' self.fname_sc = 'WEBSITE_online_EU-NASA_full_d...
mit
ethz-asl/segmatch
segmappy/bin/plot_reconstructions.py
1
5540
from __future__ import print_function from builtins import input import numpy as np import os import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import random from sklearn import metrics import ensure_segmappy_is_installed from segmappy import Dataset from segmappy.tools.import_export import load_...
bsd-3-clause
MikeDacre/mike_tools
python/ldlink_pairs.py
1
11433
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Investigate linkage disequilibrium between pairs of SNPs. Uses the LDLink API to search for pairs of SNPs and builds a simple class (SNP_Pair) with the results. Info ---- Author: Michael D Dacre, mike.dacre@gmail.com Organization: Stanford University License: MIT Lice...
unlicense
pratapvardhan/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
hasecbinusr/pysal
pysal/esda/join_counts.py
6
6826
""" Spatial autocorrelation for binary attributes """ __author__ = "Sergio J. Rey <srey@asu.edu> , Luc Anselin <luc.anselin@asu.edu>" from ..weights.spatial_lag import lag_spatial from .tabular import _univariate_handler import numpy as np __all__ = ['Join_Counts'] PERMUTATIONS = 999 class Join_Counts(object): ...
bsd-3-clause
abhisg/scikit-learn
doc/sphinxext/gen_rst.py
106
40198
""" Example generation for the scikit learn Generate the rst files for the examples by iterating over the python example files. Files that generate images should start with 'plot' """ from __future__ import division, print_function from time import time import ast import os import re import shutil import traceback i...
bsd-3-clause
shaypal5/s3bp
s3bp/core.py
1
18767
"""This package enables saving and loading of python objects to disk while also backing to S3 storage. """ import os import datetime import ntpath # to extract file name from path, OS-independent import traceback # for printing full stacktraces of errors import concurrent.futures # for asynchronous file uploads im...
mit
fabianp/scikit-learn
examples/applications/wikipedia_principal_eigenvector.py
233
7819
""" =============================== Wikipedia principal eigenvector =============================== A classical way to assert the relative importance of vertices in a graph is to compute the principal eigenvector of the adjacency matrix so as to assign to each vertex the values of the components of the first eigenvect...
bsd-3-clause
rachelalbert/image-analogies-python
image_analogies.py
1
9936
import os import pickle import time import warnings import matplotlib.pyplot as plt import numpy as np from algorithms import create_index, compute_feature_array, extract_pixel_feature, best_approximate_match, \ best_coherence_match, compute_distance from config import setup_vars, save_metadat...
mit
lbarnett/BirdID
phow_birdid_mser.py
1
16736
#!/usr/bin/env python """ Python rewrite of http: //www.vlfeat.org/applications/caltech-101-code.html """ from os.path import exists, isdir, basename, join, splitext from os import makedirs from glob import glob from random import sample, seed from scipy import ones, mod, arange, array, where, ndarray, hstack, linspac...
gpl-2.0
carrillo/scikit-learn
sklearn/linear_model/tests/test_least_angle.py
98
20870
from nose.tools import assert_equal import numpy as np from scipy import linalg from sklearn.cross_validation import train_test_split from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_less from sklearn.utils.testing impor...
bsd-3-clause
jm-begon/scikit-learn
examples/decomposition/plot_pca_vs_lda.py
182
1743
""" ======================================================= Comparison of LDA and PCA 2D projection of Iris dataset ======================================================= The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour and Virginica) with 4 attributes: sepal length, sepal width, petal length a...
bsd-3-clause
kapteyn-astro/kapteyn
doc/source/EXAMPLES/mu_channelmosaic.py
1
1638
from kapteyn import maputils from matplotlib import pylab as plt # This is our function to convert velocity from m/s to km/s def fx(x): return x/1000.0 # Create an object from the FITSimage class: fitsobj = maputils.FITSimage('ngc6946.fits') specaxnum = fitsobj.proj.specaxnum lonaxnum = fitsobj.proj.lonaxnum lataxn...
bsd-3-clause
waynenilsen/statsmodels
statsmodels/graphics/regressionplots.py
20
39579
'''Partial Regression plot and residual plots to find misspecification Author: Josef Perktold License: BSD-3 Created: 2011-01-23 update 2011-06-05 : start to convert example to usable functions 2011-10-27 : docstrings ''' from statsmodels.compat.python import lrange, string_types, lzip, range import numpy as np imp...
bsd-3-clause
bert9bert/statsmodels
statsmodels/tools/parallel.py
32
2180
"""Parallel utility function using joblib copied from https://github.com/mne-tools/mne-python Author: Alexandre Gramfort <gramfort@nmr.mgh.harvard.edu> License: Simplified BSD changes for statsmodels (Josef Perktold) - try import from joblib directly, (doesn't import all of sklearn) """ from __future__ import print...
bsd-3-clause