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
huzq/scikit-learn
examples/tree/plot_tree_regression_multioutput.py
67
1990
""" =================================================================== Multi-output Decision Tree Regression =================================================================== An example to illustrate multi-output regression with decision tree. The :ref:`decision trees <tree>` is used to predict simultaneously the ...
bsd-3-clause
jmschrei/scikit-learn
sklearn/linear_model/ridge.py
1
46693
""" Ridge regression """ # Author: Mathieu Blondel <mathieu@mblondel.org> # Reuben Fletcher-Costin <reuben.fletchercostin@gmail.com> # Fabian Pedregosa <fabian@fseoane.net> # Michael Eickenberg <michael.eickenberg@nsup.org> # License: BSD 3 clause from abc import ABCMeta, abstractmethod impor...
bsd-3-clause
siddharthteotia/arrow
python/pyarrow/tests/test_convert_pandas.py
1
57443
# -*- coding: utf-8 -*- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "...
apache-2.0
lmallin/coverage_test
python_venv/lib/python2.7/site-packages/pandas/tests/sparse/test_pivot.py
21
2390
import numpy as np import pandas as pd import pandas.util.testing as tm class TestPivotTable(object): def setup_method(self, method): self.dense = pd.DataFrame({'A': ['foo', 'bar', 'foo', 'bar', 'foo', 'bar', 'foo', 'foo'], 'B': ...
mit
e-q/scipy
scipy/spatial/_geometric_slerp.py
20
7668
from __future__ import division, print_function, absolute_import __all__ = ['geometric_slerp'] import warnings import numpy as np from scipy.spatial.distance import euclidean def _geometric_slerp(start, end, t): # create an orthogonal basis using QR decomposition basis = np.vstack([start, end]) Q, R = ...
bsd-3-clause
jreback/pandas
pandas/tests/arrays/boolean/test_function.py
1
3536
import numpy as np import pytest import pandas as pd import pandas._testing as tm @pytest.mark.parametrize( "ufunc", [np.add, np.logical_or, np.logical_and, np.logical_xor] ) def test_ufuncs_binary(ufunc): # two BooleanArrays a = pd.array([True, False, None], dtype="boolean") result = ufunc(a, a) ...
bsd-3-clause
kbrannan/PyHSPF
src/pyhspf/forecasting/extract_timeseries.py
2
7323
#!/usr/bin/env python # # extract_NRCM.py # David J. Lampert # # extracts the grid point for a watershed from the preprocessed NRCM data import os, shutil, pickle, datetime, numpy from multiprocessing import Pool, cpu_count from matplotlib import pyplot, path, patches from shapefile import Reader def ins...
bsd-3-clause
SiccarPoint/landlab
setup.py
1
3672
#! /usr/bin/env python #from ez_setup import use_setuptools #use_setuptools() from setuptools import setup, find_packages, Extension from setuptools.command.install import install from setuptools.command.develop import develop from distutils.extension import Extension import sys ext_modules = [ Extension('land...
mit
theilmbh/klusta-pipeline
klusta_pipeline/utils.py
1
7720
import os import glob import itertools import numpy as np import h5py as h5 from scipy import interpolate from random import sample from klusta_pipeline import MAX_CHANS import datetime as dt from sklearn.linear_model import LinearRegression def validate_merge(import_list,omit): mat_data = [] chans = ['Port_%i...
bsd-3-clause
Jimmy-Morzaria/scikit-learn
sklearn/utils/fixes.py
11
12057
"""Compatibility fixes for older version of python, numpy and scipy If you add content to this file, please give the version of the package at which the fixe is no longer needed. """ # Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org> # Gael Varoquaux <gael.varoquaux@normalesup.org> # ...
bsd-3-clause
brainstorm/bcbio-nextgen
bcbio/bam/coverage.py
3
6315
""" calculate coverage across a list of regions """ import os import six import pandas as pd import pybedtools from bcbio import utils from bcbio.utils import rbind, file_exists from bcbio.provenance import do from bcbio.distributed.transaction import file_transaction import bcbio.pipeline.datadict as dd from bcbio.p...
mit
ammarkhann/FinalSeniorCode
lib/python2.7/site-packages/pandas/tests/indexes/timedeltas/test_setops.py
15
2556
import numpy as np import pandas as pd import pandas.util.testing as tm from pandas import TimedeltaIndex, timedelta_range, Int64Index class TestTimedeltaIndex(object): _multiprocess_can_split_ = True def test_union(self): i1 = timedelta_range('1day', periods=5) i2 = timedelta_range('3day',...
mit
thetomcraig/redwood
examples/clown/client.py
1
14889
#!/usr/bin/env python """" Because this code had few to no comments, I have commented out and added only lines from the Ss pricing client.py file to get everything running. I will attempt to do some superficial commenting, but for a more comprehensively c=docuumented example, look to Ss pricing - that is small e...
isc
adamgreenhall/scikit-learn
sklearn/covariance/tests/test_graph_lasso.py
272
5245
""" Test the graph_lasso module. """ import sys import numpy as np from scipy import linalg from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_array_less from sklearn.covariance import (graph_lasso, GraphLasso, GraphLassoCV, empirical_...
bsd-3-clause
larsmans/scikit-learn
sklearn/neighbors/tests/test_ball_tree.py
30
9727
import numpy as np from numpy.testing import assert_array_almost_equal from sklearn.neighbors.ball_tree import (BallTree, NeighborsHeap, simultaneous_sort, kernel_norm, nodeheap_sort, DTYPE, ITYPE) from sklearn.neighbors.dist_metrics impo...
bsd-3-clause
ericpre/hyperspy
hyperspy/drawing/widget.py
1
37678
# -*- coding: utf-8 -*- # Copyright 2007-2021 The HyperSpy developers # # This file is part of HyperSpy. # # HyperSpy 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...
gpl-3.0
blancha/abcngspipelines
utils/ensemblbedgraphtoucscbedgraph.py
1
1481
#!/usr/bin/env python3 # Version 1.0 # Author Alexis Blanchet-Cohen # Date: 12/04/2014 import argparse import os import pandas import util config = util.readConfigurationFiles() parser = argparse.ArgumentParser(description='Converts bedgraph files in Ensembl format to UCSC format.') parser.add_argument("-e", "--ens...
gpl-3.0
samueljackson92/major-project
src/mia/plotting.py
1
14059
""" Various plotting utility functions. """ import logging import os.path import matplotlib.pyplot as plt import matplotlib.cm as cm import numpy as np import pandas as pd import seaborn as sns from mpl_toolkits.mplot3d import Axes3D from skimage import io, transform from mia.utils import transform_2d logger = logg...
mit
AshishBora/csgm
src/compressed_sensing.py
1
8437
"""Compressed sensing main script""" # pylint: disable=C0301,C0103,C0111 from __future__ import division import os from argparse import ArgumentParser import numpy as np import utils def main(hparams): # Set up some stuff accoring to hparams hparams.n_input = np.prod(hparams.image_shape) utils.set_num_m...
mit
wlamond/scikit-learn
benchmarks/bench_plot_omp_lars.py
72
4514
"""Benchmarks of orthogonal matching pursuit (:ref:`OMP`) versus least angle regression (:ref:`least_angle_regression`) The input data is mostly low rank but is a fat infinite tail. """ from __future__ import print_function import gc import sys from time import time import six import numpy as np from sklearn.linea...
bsd-3-clause
GGiecold/Keras_playground
src/multiclass_classification.py
1
3573
#!/usr/bin/env python from __future__ import print_function from time import sleep from keras import layers, models from keras.optimizers import RMSprop from keras.utils import to_categorical import matplotlib.pyplot as plt import numpy as np __author__ = 'Gregory Giecold' __copyright__ = 'Copyright 2017-2022 Gre...
mit
ortylp/scipy
scipy/stats/_multivariate.py
35
69253
# # Author: Joris Vankerschaver 2013 # from __future__ import division, print_function, absolute_import import numpy as np import scipy.linalg from scipy.misc import doccer from scipy.special import gammaln, psi, multigammaln from scipy._lib._util import check_random_state __all__ = ['multivariate_normal', 'dirichle...
bsd-3-clause
abhishekkrthakur/scikit-learn
sklearn/tests/test_grid_search.py
9
28430
""" 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
hfegetude/EjerciciosMicroondas
tema3/ej6/smithpy.py
1
6300
import numpy as np import matplotlib.pyplot as plt def cart2pol(x, y): theta = np.arctan2(y, x) rho = np.hypot(x, y) return theta, rho def pol2cart(theta, rho): x = rho * np.cos(theta) y = rho * np.sin(theta) return x, y def add_radius(x, y, r ): ang, mod = cart2pol(x, y) return pol2c...
gpl-3.0
timothy1191xa/project-epsilon-1
code/utils/scripts/noise-pca_script.py
3
13899
""" This script is used to design the design matrix for our linear regression. We explore the influence of linear and quadratic drifts on the model performance. Script for the raw data. Run with: python noise-pca_script.py from this directory """ from __future__ import print_function, division import sys, os,...
bsd-3-clause
rabernat/xray
xarray/core/dataset.py
1
129317
from __future__ import absolute_import from __future__ import division from __future__ import print_function import functools from collections import Mapping, defaultdict from distutils.version import LooseVersion from numbers import Number import warnings import sys import numpy as np import pandas as pd from . imp...
apache-2.0
genehughes/trading-with-python
cookbook/getDataFromYahooFinance.py
77
1391
# -*- coding: utf-8 -*- """ Created on Sun Oct 16 18:37:23 2011 @author: jev """ from urllib import urlretrieve from urllib2 import urlopen from pandas import Index, DataFrame from datetime import datetime import matplotlib.pyplot as plt sDate = (2005,1,1) eDate = (2011,10,1) symbol = 'SPY' fNa...
bsd-3-clause
scikit-optimize/scikit-optimize.github.io
0.8/_downloads/fafa416932f350631f99d023396799bd/sklearn-gridsearchcv-replacement.py
1
7094
""" ========================================== Scikit-learn hyperparameter search wrapper ========================================== Iaroslav Shcherbatyi, Tim Head and Gilles Louppe. June 2017. Reformatted by Holger Nahrstaedt 2020 .. currentmodule:: skopt Introduction ============ This example assumes basic famili...
bsd-3-clause
dancingdan/tensorflow
tensorflow/contrib/metrics/python/kernel_tests/histogram_ops_test.py
24
9587
# 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
dgwakeman/mne-python
examples/inverse/plot_lcmv_beamformer.py
18
2801
""" ====================================== Compute LCMV beamformer on evoked data ====================================== Compute LCMV beamformer solutions on evoked dataset for three different choices of source orientation and stores the solutions in stc files for visualisation. """ # Author: Alexandre Gramfort <alex...
bsd-3-clause
NagabhushanS/DataMining
GithubStarringDataset/classifier.py
1
1394
from sklearn import tree from sklearn import svm from sklearn.ensemble import RandomForestClassifier from sklearn.feature_extraction import DictVectorizer from sklearn import preprocessing import numpy as np from numpy import genfromtxt, savetxt import csv def tokenize(dataset): data = [] for x in dataset: sample ...
gpl-2.0
gotomypc/scikit-learn
sklearn/utils/tests/test_multiclass.py
128
12853
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
nvoron23/scikit-learn
examples/model_selection/grid_search_text_feature_extraction.py
253
4158
""" ========================================================== 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 do...
bsd-3-clause
CDSFinance/zipline
tests/test_algorithm.py
3
60805
# # Copyright 2014 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
NixaSoftware/CVis
venv/lib/python2.7/site-packages/pandas/tests/io/parser/mangle_dupes.py
10
3591
# -*- coding: utf-8 -*- """ Tests that duplicate columns are handled appropriately when parsed by the CSV engine. In general, the expected result is that they are either thoroughly de-duplicated (if mangling requested) or ignored otherwise. """ from pandas.compat import StringIO from pandas import DataFrame import p...
apache-2.0
lancezlin/ml_template_py
lib/python2.7/site-packages/sklearn/linear_model/tests/test_base.py
83
15089
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # # License: BSD 3 clause import numpy as np from scipy import sparse from scipy import linalg from itertools import product from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils...
mit
colincsl/TemporalConvolutionalNetworks
code/metrics.py
1
15302
import numpy as np import scipy from numba import jit, int64, boolean import utils import sklearn.metrics as sm from functools import partial from collections import OrderedDict class ComputeMetrics: metric_types = ["accuracy", "edit_score", "overlap_f1"] # metric_types = ["macro_accuracy", "acc_per_class"]...
mit
pelikanchik/edx-platform
docs/en_us/developers/source/conf.py
2
6591
# -*- coding: utf-8 -*- #pylint: disable=C0103 #pylint: disable=W0622 #pylint: disable=W0212 #pylint: disable=W0613 import sys, os from path import path on_rtd = os.environ.get('READTHEDOCS', None) == 'True' sys.path.append('../../../../') from docs.shared.conf import * # Add any paths that contain templates here...
agpl-3.0
ch3ll0v3k/scikit-learn
sklearn/ensemble/weight_boosting.py
97
40773
"""Weight Boosting This module contains weight boosting estimators for both classification and regression. The module structure is the following: - The ``BaseWeightBoosting`` base class implements a common ``fit`` method for all the estimators in the module. Regression and classification only differ from each ot...
bsd-3-clause
stormsson/procedural_city_generation_wrapper
vendor/josauder/procedural_city_generation/additional_stuff/pickletools.py
2
2373
def save_vertexlist(vertex_list, name="output", savefig=0): print("Output is being saved.") import os path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) import pickle try: with open(path+"/temp/"+name, "wb") as f: import sys if sys.version[0] == "2":...
mpl-2.0
arabenjamin/scikit-learn
sklearn/tests/test_kernel_approximation.py
244
7588
import numpy as np from scipy.sparse import csr_matrix from sklearn.utils.testing import assert_array_equal, assert_equal, assert_true from sklearn.utils.testing import assert_not_equal from sklearn.utils.testing import assert_array_almost_equal, assert_raises from sklearn.utils.testing import assert_less_equal from ...
bsd-3-clause
hugobowne/scikit-learn
examples/missing_values.py
71
3055
""" ====================================================== Imputing missing values before building an estimator ====================================================== This example shows that imputing the missing values can give better results than discarding the samples containing any missing value. Imputing does not ...
bsd-3-clause
tanayz/Kaggle
HB_ML_Challenge/test_xgboost.py
1
4623
import csv import sys import numpy as np import scipy as sp import xgboost as xgb import sklearn.cross_validation as cv def AMS(s, b): ''' Approximate median significance: s = true positive rate b = false positive rate ''' assert s >= 0 assert b >= 0 bReg = 10. return np.sq...
apache-2.0
kdebrab/pandas
pandas/io/sas/sasreader.py
14
2558
""" Read SAS sas7bdat or xport files. """ from pandas import compat from pandas.io.common import _stringify_path def read_sas(filepath_or_buffer, format=None, index=None, encoding=None, chunksize=None, iterator=False): """ Read SAS files stored as either XPORT or SAS7BDAT format files. Param...
bsd-3-clause
liangz0707/scikit-learn
examples/ensemble/plot_gradient_boosting_oob.py
230
4762
""" ====================================== Gradient Boosting Out-of-Bag estimates ====================================== Out-of-bag (OOB) estimates can be a useful heuristic to estimate the "optimal" number of boosting iterations. OOB estimates are almost identical to cross-validation estimates but they can be compute...
bsd-3-clause
Eric89GXL/mne-python
tutorials/stats-sensor-space/plot_stats_cluster_erp.py
8
5793
""" =========================================================================== Visualising statistical significance thresholds on EEG data =========================================================================== MNE-Python provides a range of tools for statistical hypothesis testing and the visualisation of the re...
bsd-3-clause
endolith/numpy
doc/source/reference/random/performance.py
14
2599
from collections import OrderedDict from timeit import repeat import pandas as pd import numpy as np from numpy.random import MT19937, PCG64, Philox, SFC64 PRNGS = [MT19937, PCG64, Philox, SFC64] funcs = OrderedDict() integers = 'integers(0, 2**{bits},size=1000000, dtype="uint{bits}")' funcs['32-bit Unsigned Ints']...
bsd-3-clause
bdh1011/wau
venv/lib/python2.7/site-packages/pandas/tseries/plotting.py
1
7368
""" Period formatters and locators adapted from scikits.timeseries by Pierre GF Gerard-Marchant & Matt Knox """ #!!! TODO: Use the fact that axis can have units to simplify the process from matplotlib import pylab from pandas.tseries.period import Period from pandas.tseries.offsets import DateOffset import pandas.tser...
mit
rtmilbourne/augur-core
tests/consensus/runtests.py
4
20659
#!/usr/bin/env python # -*- coding: utf-8 -*- """Augur consensus tests. To run consensus, call the Serpent functions in this order: interpolate center tokenize covariance loop max_components: blank loop max_iterations: loadings latent deflate score reputation_delta weighted_delta select_sc...
gpl-3.0
Djabbz/scikit-learn
sklearn/decomposition/base.py
313
5647
"""Principal Component Analysis Base Classes""" # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Denis A. Engemann <d.engemann@fz-juelich.de> # Kyle Kastner <kastnerkyle@gmail.com> # # Licen...
bsd-3-clause
lokeshpancharia/BuildingMachineLearningSystemsWithPython
ch02/chapter.py
17
4700
# This code is supporting material for the book # Building Machine Learning Systems with Python # by Willi Richert and Luis Pedro Coelho # published by PACKT Publishing # # It is made available under the MIT License from matplotlib import pyplot as plt import numpy as np # We load the data with load_iris from sklear...
mit
chenyyx/scikit-learn-doc-zh
examples/en/cluster/plot_dbscan.py
39
2534
# -*- 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...
gpl-3.0
yavalvas/yav_com
build/matplotlib/setupext.py
1
66954
from __future__ import print_function, absolute_import from distutils import sysconfig from distutils import version from distutils.core import Extension import glob import io import multiprocessing import os import re import subprocess import sys import warnings from textwrap import fill PY3 = (sys.version_info[0] ...
mit
Newmu/dcgan_code
svhn/svhn_semisup_analysis.py
1
5842
import sys sys.path.append('..') import os import json from time import time import numpy as np from tqdm import tqdm from sklearn.externals import joblib from sklearn import metrics from sklearn.linear_model import LogisticRegression as LR from sklearn.svm import LinearSVC as LSVC import theano import theano.tensor...
mit
OpenSourcePolicyCenter/PolicyBrain
webapp/apps/btax/views.py
2
17171
import json import traceback import sys import btax import taxcalc import datetime from django.utils import timezone import logging from os import path from urllib.parse import urlparse, parse_qs from ipware.ip import get_real_ip from django.core import serializers from django.http import Http404, HttpResponse, JsonR...
mit
mlperf/training_results_v0.6
Intel/benchmarks/minigo/implementations/tensorflow/oneoffs/sharp_positions.py
7
16295
# Copyright 2018 Google LLC # # 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 writing, ...
apache-2.0
HyperloopTeam/FullOpenMDAO
cantera-2.0.2/samples/python/reactors/reactor1_sim/reactor1.py
1
1814
""" Constant-pressure, adiabatic kinetics simulation. """ import sys from Cantera import * from Cantera.Reactor import * from Cantera.Func import * from Cantera import rxnpath gri3 = GRI30() gri3.set(T = 1001.0, P = OneAtm, X = 'H2:2,O2:1,N2:4') r = Reactor(gri3) env = Reservoir(Air()) # Define a wall betwee...
gpl-2.0
fw1121/pannenkoek
setup.py
1
1884
from setuptools import setup, find_packages from setuptools.command.install import install from codecs import open from os import path # Get the long description from the relevant file here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-8') as f: long_descriptio...
mit
hippke/TTV-TDV-exomoons
create_figures/kombiplot_systems_vii,viii,ix.py
1
9521
"""n-body simulator to derive TDV+TTV diagrams of planet-moon configurations. Credit for part of the source is given to https://github.com/akuchling/50-examples/blob/master/gravity.rst Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License """ import numpy import math import matplotlib.pylab as plt...
mit
lquirosd/TFM
ILA/code/process_results.py
1
3727
import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from scipy import misc import scipy.ndimage as ndi import imgPage_float as imgPage import sys, argparse #--- To handle console arguments import matplotlib.patches as patches import bbox try: import cPickle as pickle except: ...
apache-2.0
kkozarev/mwacme
MS_Inspect_menu_version/Graph_Panel.py
1
24139
########################################################################### ############################ Graph_Panel ############################## ########################################################################### import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt import numpy as n...
gpl-2.0
chengsoonong/crowdastro
examples/active_crowd_example.py
1
3000
import logging import os.path import sys import matplotlib.pyplot as plt import numpy import sklearn.cluster import sklearn.datasets sys.path.insert(1, os.path.join('..')) import crowdastro.crowd.yan_sparse as yan_sparse logging.captureWarnings(True) # Generate some data. n_annotators, n_dim, n_samples = 4, 2, 50 x...
mit
JPFrancoia/scikit-learn
examples/gaussian_process/plot_gpr_noisy_targets.py
64
3706
""" ========================================================= Gaussian Processes regression: basic introductory example ========================================================= A simple one-dimensional regression example computed in two different ways: 1. A noise-free case 2. A noisy case with known noise-level per ...
bsd-3-clause
schets/scikit-learn
benchmarks/bench_plot_approximate_neighbors.py
85
6377
""" Benchmark for approximate nearest neighbor search using locality sensitive hashing forest. There are two types of benchmarks. First, accuracy of LSHForest queries are measured for various hyper-parameters and index sizes. Second, speed up of LSHForest queries compared to brute force method in exact nearest neigh...
bsd-3-clause
jmargeta/scikit-learn
sklearn/tree/tests/test_tree.py
3
20849
""" Testing for the tree module (sklearn.tree). """ import numpy as np from numpy.testing import assert_array_equal from numpy.testing import assert_array_almost_equal from numpy.testing import assert_almost_equal from numpy.testing import assert_equal from nose.tools import assert_raises from sklearn import tree fro...
bsd-3-clause
RuwanT/merck
data_preprocessing.py
1
2734
""" convert the merck data-set suitable to be fead to the CNN 1) remove columns that does not appear in both training and test 2) normalize the activation to have zero mean and 1 std (z-score) 3) rescale the features to 0-1 by dividing each column by its training max or y = log(x+1) """ import pandas as pd import nu...
mit
RachitKansal/scikit-learn
examples/bicluster/plot_spectral_biclustering.py
403
2011
""" ============================================= A demo of the Spectral Biclustering algorithm ============================================= This example demonstrates how to generate a checkerboard dataset and bicluster it using the Spectral Biclustering algorithm. The data is generated with the ``make_checkerboard`...
bsd-3-clause
YihaoLu/pyfolio
pyfolio/pos.py
1
5498
# # Copyright 2015 Quantopian, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
apache-2.0
vrkrishn/FBHacks
app_referance.py
1
6016
from flask import Flask,render_template, request, session, g, redirect, url_for,abort from flask_wtf import Form from flask import send_file from functools import wraps, update_wrapper #from wtforms import StringField, SubmitField #from wtforms.validators import Required from codes.TweetAnalytics import TweetAnalytic...
mit
nwjs/chromium.src
tools/perf/cli_tools/pinboard/pinboard.py
1
15175
# Copyright 2019 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import argparse import filecmp import json import logging from logging import handlers import os import posixpath import shutil import subprocess from core....
bsd-3-clause
boland1992/SeisSuite
seissuite/spacing/pointshape.py
6
2729
# -*- coding: utf-8 -*- """ Created on Mon Jun 20 12:28:32 2015 @author: boland """ import sys sys.path.append("/home/boland/Anaconda/lib/python2.7/site-packages") import fiona import shapefile from shapely import geometry import numpy as np import matplotlib.pyplot as plt import pyproj import datetime from matplotli...
gpl-3.0
Jonekee/chromium.src
chrome/test/data/nacl/gdb_rsp.py
99
2431
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # This file is based on gdb_rsp.py file from NaCl repository. import re import socket import time def RspChecksum(data): checksum = 0 for char in ...
bsd-3-clause
thuml/HashNet
caffe/python/detect.py
36
5734
#!/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...
mit
Vishruit/DDP_models
code/anim_hist_options.py
1
6754
""" ================= Animated subplots ================= This example uses subclassing, but there is no reason that the proper function couldn't be set up and then use FuncAnimation. The code is long, but not really complex. The length is due solely to the fact that there are a total of 9 lines that need to be change...
gpl-3.0
Windy-Ground/scikit-learn
sklearn/utils/tests/test_seq_dataset.py
93
2471
# Author: Tom Dupre la Tour <tom.dupre-la-tour@m4x.org> # # License: BSD 3 clause import numpy as np import scipy.sparse as sp from sklearn.utils.seq_dataset import ArrayDataset, CSRDataset from sklearn.datasets import load_iris from numpy.testing import assert_array_equal from nose.tools import assert_equal iris =...
bsd-3-clause
whn09/tensorflow
tensorflow/examples/learn/iris_custom_model.py
50
2613
# 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
jkarnows/scikit-learn
examples/cluster/plot_ward_structured_vs_unstructured.py
320
3369
""" =========================================================== Hierarchical clustering: structured vs unstructured ward =========================================================== Example builds a swiss roll dataset and runs hierarchical clustering on their position. For more information, see :ref:`hierarchical_clus...
bsd-3-clause
cdmbi/PCM
Method_SamplingData.py
3
2034
# -*- coding: utf-8 -*- """ Created on Fri Jul 18 12:18:21 2014 @author: Fujitsu """ def PCA(X, Expect_ext): from sklearn.decomposition import PCA pca = PCA(n_components=2) Xtrans = pca.fit_transform(X) labels = [] for Var in Xtrans: if Var[0] >= 0 and Var[1] >= 0: ...
gpl-2.0
mataevs/persondetector
detection/roc.py
1
5932
__author__ = 'mataevs' import classifier from classifier import * import detection_checker import utils import tester_hog import cascade_tester from sklearn.metrics import roc_curve, auc import matplotlib.pyplot as plt import numpy import optical_flow def get_images(c, img_path, scales, subwindow=None): totalWind...
mit
dmitryduev/pypride
setup.py
1
2704
#!/usr/bin/env python """ Created on Fri Aug 14 15:34:38 2015 @author: Dmitry A. Duev """ from __future__ import division, absolute_import # compile fortran code using f2py from numpy.distutils.core import Extension import os # fortran module to be compiled with f2py: vintflib = Extension(name = 'vintflib', ...
gpl-2.0
IssamLaradji/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
keflavich/agpy
doc/conf.py
6
9638
# -*- coding: utf-8 -*- # # agpy documentation build configuration file, created by # sphinx-quickstart on Wed Dec 21 22:31:14 2011. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All co...
mit
Data-Analysis-Team/Data-Analysis-Platform_V0.1
Fault Diagnosis/app/main/views.py
1
13926
from flask import render_template,redirect,request,url_for,flash,session from . import main from flask_wtf import FlaskForm as Form from .forms import NameForm,Get_Data_Submit,Samping_Submit,Missing_Process_Submit,Describe_Statistics_Submit,\ Pearson_cal_Submit,Hist_Graph,Selected_1,Selected_2,MultipleSelect,Neural...
apache-2.0
luamct/WebSci14
features/color/basic_colors.py
1
4278
''' Created on Aug 7, 2013 @author: luamct ''' import numpy as np from matplotlib.colors import ColorConverter colormap = {'blue': '#0000DD', 'brown': '#842121', 'gray': '#808080', 'purple': '#800080', 'yellow': '#e5e500', 'pink': '#ff69b4', 'black': '#000000', 'orange': '#ffa500', 'green': '#00DD00', ...
gpl-3.0
anteverse/suono
poc.py
1
2500
""" Proof of concept of the wave detection """ from scipy.fftpack import fft from scipy.signal import convolve import numpy as np import matplotlib.pyplot as plt import math def find_peaks(Y, sign='-', alpha=-0.1, threshold=2.0): if sign == '+': Y = -Y # Get derivative derivation_vector = [1, 0,...
mit
ishanic/scikit-learn
examples/linear_model/plot_multi_task_lasso_support.py
249
2211
#!/usr/bin/env python """ ============================================= Joint feature selection with multi-task Lasso ============================================= The multi-task lasso allows to fit multiple regression problems jointly enforcing the selected features to be the same across tasks. This example simulates...
bsd-3-clause
aurix/lammps-induced-dipole-polarization-pair-style
python/examples/matplotlib_plot.py
22
2270
#!/usr/bin/env python -i # preceding line should have path for Python on your machine # matplotlib_plot.py # Purpose: plot Temp of running LAMMPS simulation via matplotlib # Syntax: plot.py in.lammps Nfreq Nsteps compute-ID # in.lammps = LAMMPS input script # Nfreq = plot data point every this many ...
gpl-2.0
jeffery-do/Vizdoombot
doom/lib/python3.5/site-packages/matplotlib/tests/test_labeled_data_unpacking.py
7
17219
from __future__ import (absolute_import, division, print_function) from nose.tools import (assert_raises, assert_equal) from nose.plugins.skip import SkipTest try: # 3.2+ versions from nose.tools import assert_regex, assert_not_regex except ImportError: try: # 2.7 versions from nose.tools ...
mit
kedaio/tushare
tushare/datayes/market.py
17
15547
# -*- coding:utf-8 -*- """ 通联数据 Created on 2015/08/24 @author: Jimmy Liu @group : waditu @contact: jimmysoa@sina.cn """ from pandas.compat import StringIO import pandas as pd from tushare.util import vars as vs from tushare.util.common import Client from tushare.util import upass as up class Market(): def _...
bsd-3-clause
adpozuelo/Master
HPC/PRA/stats.py
1
2456
# Antonio Díaz Pozuelo - adpozuelo@uoc.edu # HPC_PRA - Energy-Potential N-Body Problem (Lennard Jones Interaction Potential) # Statistical study # Python 3.6 import sys import re import numpy as np import matplotlib.pyplot as plt import csv def readData(filename): with open(filename) as csvfile: ...
gpl-3.0
EtienneCmb/brainpipe
brainpipe/system/dataframe.py
1
4503
import pandas as pd from warnings import warn import numpy as n class pdTools(object): """Tools for pandas DataFrame Syntax: - To search if arg1 is in column1: >>> keep = ('column1', arg1) - AND condition for ar1 and arg2 in column1: >>> keep = ('column1', [arg1, 2]) ...
gpl-3.0
derkling/trappy
trappy/wa/results.py
1
5153
# Copyright 2015-2015 ARM Limited # # 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 w...
apache-2.0
ammarkhann/FinalSeniorCode
lib/python2.7/site-packages/IPython/testing/iptestcontroller.py
14
18314
# -*- coding: utf-8 -*- """IPython Test Process Controller This module runs one or more subprocesses which will actually run the IPython test suite. """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import print_function import argparse import ...
mit
msrconsulting/atm-py
atmPy/for_removal/APS/APS.py
6
2064
# -*- coding: utf-8 -*- """ This module is out of date! @author: htelg """ import pandas as pd from atmPy.aerosols.size_distr import sizedistribution from atmPy.for_removal.tools import diameter_binning def load_PMEL_APS(fname): na_values = [u'StartDateTime', u'Dp_1', u'Dp_2', u'Dp_3', u'Dp_4', u'Dp_5', u'Dp_6'...
mit
hschovanec-usgs/magpy
magpy/gui/magpy_gui.py
1
186304
#!/usr/bin/env python from __future__ import print_function import wx from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.backends.backend_wx import NavigationToolbar2Wx from matplotlib.figure import Figure try: # Necessary for wx2.8.11.0 from wx.lib.pubsub import setu...
gpl-3.0
miaecle/deepchem
examples/muv/muv_sklearn.py
6
1156
""" Script that trains Sklearn multitask models on MUV dataset. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import os import shutil import numpy as np import deepchem as dc from deepchem.molnet import load_muv from sklearn.ensemble import RandomFore...
mit
subodhchhabra/pandashells
pandashells/bin/p_linspace.py
3
1427
#! /usr/bin/env python # standard library imports import sys # NOQA import sys to allow for mocking sys.argv in tests import argparse import textwrap from pandashells.lib import module_checker_lib, arg_lib module_checker_lib.check_for_modules(['pandas']) from pandashells.lib import io_lib import numpy as np impor...
bsd-2-clause
svaksha/COD
setup.py
1
2336
#!/usr/bin/env python3 ############################################################################### # Copyright © 2013, SVAKSHA (https://github.com/svaksha) AllRightsReserved. # License: AGPLv3 License <http://www.gnu.org/licenses/agpl.html> # All copies must retain this permission notice with the copyright notice. ...
mit
robjstan/python-enzymegraph
example/enzymegraph-example.py
1
6370
# coding: utf-8 # # python-enzymegraph # A Python package for generating models of enzymes under the quasi-steady-state assumption (QSSA). # # ## Requirements # Currently tested with only Python 3.4. # # Requires [sympy](https://github.com/sympy/sympy). # # ## Installation # pip install git+git://github.com/robjs...
mit
cosmonaut/chess_analog_daq
analog_daq.py
1
16785
import comedi as c import os import select import struct import numpy as np import math import collections import itertools #import matplotlib.animation as ma from matplotlib.figure import Figure #from matplotlib.backends.backend_gtk3cairo import FigureCanvasGTK3Cairo as FigureCanvas from matplotlib.backends.backend...
mit