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
mlyundin/scikit-learn
sklearn/datasets/mlcomp.py
289
3855
# Copyright (c) 2010 Olivier Grisel <olivier.grisel@ensta.org> # License: BSD 3 clause """Glue code to load http://mlcomp.org data as a scikit.learn dataset""" import os import numbers from sklearn.datasets.base import load_files def _load_document_classification(dataset_path, metadata, set_=None, **kwargs): if ...
bsd-3-clause
andaag/scikit-learn
examples/feature_selection/plot_rfe_with_cross_validation.py
226
1384
""" =================================================== Recursive feature elimination with cross-validation =================================================== A recursive feature elimination example with automatic tuning of the number of features selected with cross-validation. """ print(__doc__) import matplotlib.p...
bsd-3-clause
B3AU/waveTree
examples/bicluster/plot_spectral_biclustering.py
7
2010
""" ============================================= 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
liangz0707/scikit-learn
benchmarks/bench_tree.py
297
3617
""" To run this, you'll need to have installed. * scikit-learn Does two benchmarks First, we fix a training set, increase the number of samples to classify and plot number of classified samples as a function of time. In the second benchmark, we increase the number of dimensions of the training set, classify a sam...
bsd-3-clause
mac389/at-risk-agents
analyze-abm.py
1
8030
import os, json,re import numpy as np import Graphics as artist import matplotlib.pyplot as plt plt.switch_backend('Agg') from matplotlib import rcParams from optparse import OptionParser from scipy.stats import percentileofscore,scoreatpercentile rcParams['text.usetex'] = True parser = OptionParser(usage="usage:...
mit
rseubert/scikit-learn
sklearn/neighbors/approximate.py
3
21294
"""Approximate nearest neighbor search""" # Author: Maheshakya Wijewardena <maheshakya.10@cse.mrt.ac.lk> # Joel Nothman <joel.nothman@gmail.com> import numpy as np import warnings from scipy import sparse from .base import KNeighborsMixin, RadiusNeighborsMixin from ..base import BaseEstimator from ..utils.va...
bsd-3-clause
thientu/scikit-learn
sklearn/utils/arpack.py
265
64837
""" This contains a copy of the future version of scipy.sparse.linalg.eigen.arpack.eigsh It's an upgraded wrapper of the ARPACK library which allows the use of shift-invert mode for symmetric matrices. Find a few eigenvectors and eigenvalues of a matrix. Uses ARPACK: http://www.caam.rice.edu/software/ARPACK/ """ #...
bsd-3-clause
scollis/EGU16
cluster/profile_mpi0/ipython_console_config.py
4
21693
# Configuration file for ipython-console. c = get_config() #------------------------------------------------------------------------------ # ZMQTerminalIPythonApp configuration #------------------------------------------------------------------------------ # ZMQTerminalIPythonApp will inherit config from: TerminalIP...
bsd-3-clause
plotly/python-api
packages/python/plotly/plotly/matplotlylib/mplexporter/utils.py
1
11907
""" Utility Routines for Working with Matplotlib Objects ==================================================== """ import itertools import io import base64 import numpy as np import warnings import matplotlib from matplotlib.colors import colorConverter from matplotlib.path import Path from matplotlib.markers import ...
mit
morrisonwudi/zipline
tests/test_algorithm_gen.py
18
7339
# # 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
pratapvardhan/scikit-learn
sklearn/ensemble/voting_classifier.py
11
8661
""" Soft Voting/Majority Rule classifier. This module contains a Soft Voting/Majority Rule classifier for classification estimators. """ # Authors: Sebastian Raschka <se.raschka@gmail.com>, # Gilles Louppe <g.louppe@gmail.com> # # Licence: BSD 3 clause import numpy as np from ..base import BaseEstimator f...
bsd-3-clause
to266/hyperspy
hyperspy/drawing/_widgets/scalebar.py
2
5335
# -*- coding: utf-8 -*- # Copyright 2007-2016 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
bthirion/scikit-learn
sklearn/metrics/cluster/tests/test_bicluster.py
394
1770
"""Testing for bicluster metrics module""" import numpy as np from sklearn.utils.testing import assert_equal, assert_almost_equal from sklearn.metrics.cluster.bicluster import _jaccard from sklearn.metrics import consensus_score def test_jaccard(): a1 = np.array([True, True, False, False]) a2 = np.array([T...
bsd-3-clause
ndingwall/scikit-learn
sklearn/cluster/tests/test_k_means.py
1
44177
"""Testing for K-means""" import re import sys import numpy as np from scipy import sparse as sp from threadpoolctl import threadpool_limits import pytest from sklearn.utils._testing import assert_array_equal from sklearn.utils._testing import assert_array_almost_equal from sklearn.utils._testing import assert_allcl...
bsd-3-clause
miaecle/deepchem
deepchem/models/tests/test_reload.py
1
1303
""" Test reload for trained models. """ __author__ = "Bharath Ramsundar" __copyright__ = "Copyright 2016, Stanford University" __license__ = "MIT" import unittest import tempfile import numpy as np import deepchem as dc import tensorflow as tf from sklearn.ensemble import RandomForestClassifier class TestReload(unit...
mit
arthurmensch/modl
modl/decomposition/dict_fact.py
1
28827
import atexit from concurrent.futures import ThreadPoolExecutor from math import log, ceil from tempfile import TemporaryFile import numpy as np import scipy import time from sklearn.base import BaseEstimator, TransformerMixin from sklearn.utils import check_array, check_random_state, gen_batches from sklearn.utils.va...
bsd-2-clause
stiebels/letor_to_pandas_converter
Converter.py
1
2061
import pandas as pd class Letor_Converter(object): ''' Class Converter implements parsing from original letor txt files to pandas data frame representation. ''' def __init__(self, path): ''' Arguments: path: path to letor txt file ''' s...
mit
paulperry/quant
vti_agg_7030.py
1
2066
''' A Basic Markowitz portfolio of Stocks and Bonds. Change it from 50/50 to 60/40 or 70/30. ''' from __future__ import division import datetime import pytz import pandas as pd from zipline.api import order_target_percent def initialize(context): set_long_only() set_symbol_lookup_date('2005-01-01') c...
mit
zaxtax/scikit-learn
sklearn/cluster/__init__.py
364
1228
""" The :mod:`sklearn.cluster` module gathers popular unsupervised clustering algorithms. """ from .spectral import spectral_clustering, SpectralClustering from .mean_shift_ import (mean_shift, MeanShift, estimate_bandwidth, get_bin_seeds) from .affinity_propagation_ import affinity_propagati...
bsd-3-clause
jmschrei/pomegranate
tests/test_markov_network.py
1
18046
# test_bayes_net.py # Authors: Jacob Schreiber <jmschreiber91@gmail.com> ''' These are unit tests for the Markov network model of pomegranate. ''' from __future__ import division from pomegranate import JointProbabilityTable from pomegranate import MarkovNetwork from pomegranate.io import DataGenerator from pomegran...
mit
breznak/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_ps.py
69
50262
""" A PostScript backend, which can produce both PostScript .ps and .eps """ from __future__ import division import glob, math, os, shutil, sys, time def _fn_name(): return sys._getframe(1).f_code.co_name try: from hashlib import md5 except ImportError: from md5 import md5 #Deprecated in 2.5 from tempfile im...
agpl-3.0
nbfigueroa/daft
examples/galex.py
7
2540
""" The GALEX Photon Catalog ======================== This is the Hogg \& Schiminovich model for how photons turn into counts in the GALEX satellite data stream. Note the use of relative positioning. """ from matplotlib import rc rc("font", family="serif", size=12) rc("text", usetex=True) import daft pgm = daft.PGM...
mit
Wittlich/DAT210x-Python
Module2/assignment4.py
1
1354
import pandas as pd # TODO: Load up the table, and extract the dataset # out of it. If you're having issues with this, look # carefully at the sample code provided in the reading df = pd.read_html('http://www.espn.com/nhl/statistics/player/_/stat/points/sort/points/year/2015/seasontype/2')[0] # TODO: Rename the colum...
mit
Tong-Chen/scikit-learn
sklearn/metrics/cluster/__init__.py
312
1322
""" The :mod:`sklearn.metrics.cluster` submodule contains evaluation metrics for cluster analysis results. There are two forms of evaluation: - supervised, which uses a ground truth class values for each sample. - unsupervised, which does not and measures the 'quality' of the model itself. """ from .supervised import ...
bsd-3-clause
nixingyang/Kaggle-Face-Verification
Digit Recognizer/solution.py
1
3642
import numpy as np np.random.seed(666666) from keras.callbacks import EarlyStopping, ModelCheckpoint from keras.layers import Convolution2D, MaxPooling2D from keras.layers import Dense, Dropout, Activation, Flatten from keras.layers.advanced_activations import PReLU from keras.layers.normalization import BatchNormaliz...
mit
spbguru/repo1
external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_qt4.py
69
20664
from __future__ import division import math import os import sys import matplotlib from matplotlib import verbose from matplotlib.cbook import is_string_like, onetrue from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \ FigureManagerBase, FigureCanvasBase, NavigationToolbar2, IdleEvent, curso...
gpl-3.0
Winand/pandas
pandas/core/dtypes/cast.py
2
36135
""" routings for casting """ from datetime import datetime, timedelta import numpy as np import warnings from pandas._libs import tslib, lib from pandas._libs.tslib import iNaT from pandas.compat import string_types, text_type, PY3 from .common import (_ensure_object, is_bool, is_integer, is_float, ...
bsd-3-clause
saullocastro/pyNastran
pyNastran/op2/tables/oes_stressStrain/complex/oes_rods.py
1
11149
from __future__ import (nested_scopes, generators, division, absolute_import, print_function, unicode_literals) from six import iteritems from six.moves import range import numpy as np from numpy import zeros, array_equal, allclose from pyNastran.op2.tables.oes_stressStrain.real.oes_objects imp...
lgpl-3.0
toobaz/pandas
pandas/tests/groupby/test_nth.py
2
16800
import numpy as np import pytest import pandas as pd from pandas import DataFrame, Index, MultiIndex, Series, Timestamp, isna from pandas.util.testing import assert_frame_equal, assert_series_equal def test_first_last_nth(df): # tests for first / last / nth grouped = df.groupby("A") first = grouped.first...
bsd-3-clause
abhitopia/tensorflow
tensorflow/python/estimator/inputs/queues/feeding_functions_test.py
58
9375
# 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
fyfcauc/android_external_chromium-org
chrome/test/nacl_test_injection/buildbot_chrome_nacl_stage.py
26
11131
#!/usr/bin/python # 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. """Do all the steps required to build and test against nacl.""" import optparse import os.path import re import shutil import subproc...
bsd-3-clause
DeveloperJose/Vision-Rat-Brain
feature_matching_v1/graph.py
2
2648
# -*- coding: utf-8 -*- import pylab as plt import numpy as np from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg from PyQt5.QtWidgets import QSizePolicy class Graph(FigureCanvasQTAgg): def __init__(self, parent=None, width=10, height=10, dpi=100): figure = plt.Figure(figsize=(width, height)...
mit
kcyu2014/ml_project2
project2/utils/images2patches.py
1
5530
""" This module processes the dataset Massachusetts obained from https://www.cs.toronto.edu/~vmnih/data/. The original dataset contains sattelite images of Massachusetts and its surroundings. The images are ofsize 1500x1500, 3 channels, TIFF format. The dataset also contains separate labels for roads and buildings. Th...
mit
shareactorIO/pipeline
source.ml/jupyterhub.ml/notebooks/zz_old/TensorFlow/SkFlow_DEPRECATED/text_classification_character_cnn.py
6
3495
# Copyright 2015-present Scikit Flow 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...
apache-2.0
FRESNA/PyPSA
pypsa/stats.py
1
8034
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Post-solving statistics of network. This module contains functions to anaylize an optimized network. Basic information of network can be summarized as well as constraint gaps can be double-checked. """ from .descriptors import (expand_series, get_switchable_as_dense a...
gpl-3.0
facom/Sinfin
db/test.py
1
1814
#-*-coding:utf-8-*- from sinfin import * from matplotlib import use,font_manager as fm use('Agg') from matplotlib import colors,ticker,patches,pylab as plt from matplotlib.pyplot import cm from matplotlib.font_manager import FontProperties from matplotlib.transforms import offset_copy from numpy import * # CONNECT TO ...
gpl-3.0
toobaz/pandas
pandas/tests/io/formats/test_to_latex.py
2
19273
import codecs from datetime import datetime import pytest import pandas as pd from pandas import DataFrame, Series from pandas.util import testing as tm class TestToLatex: def test_to_latex_filename(self, float_frame): with tm.ensure_clean("test.tex") as path: float_frame.to_latex(path) ...
bsd-3-clause
mjirik/lisa
experiments/precise_liver_statistics.py
1
8637
#! /usr/bin/python # -*- coding: utf-8 -*- """ Experiment s \"barevným\" modelem jater. Pro spuštění zkuste help: python experiments/20130919_liver_statistics.py --help Měřené vlastnosti se přidávají do get_features(). Pro přidání dalších dat, editujte příslušný yaml soubor. """ # import funkcí z jiného adresáře i...
bsd-3-clause
JT5D/scikit-learn
sklearn/preprocessing/tests/test_imputation.py
2
11013
import numpy as np from scipy import sparse from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_not_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_false from sklearn.utils.testing im...
bsd-3-clause
sthenc/nc_packer
visual/mfcc_visualize.py
1
2726
#!/usr/bin/python import numpy as np import matplotlib as ml import matplotlib.pyplot as plt import features import scipy.io.wavfile as wav from wav2mfcc import wav2mfcc #if __name__ == "__main__": datadir = '/mnt/data/Fer/diplomski/nc_packer/test_data/PCCdata16kHz/devel/isolated/' cleandir = 'clean/' lilnois...
mit
dsm054/pandas
pandas/plotting/_style.py
2
5527
# being a bit too dynamic # pylint: disable=E1101 from __future__ import division import warnings from contextlib import contextmanager import numpy as np from pandas.core.dtypes.common import is_list_like from pandas.compat import lrange, lmap import pandas.compat as compat def _get_standard_colors(num_colors=Non...
bsd-3-clause
doublsky/MLProfile
benchmark/bench_bayes.py
1
1231
""" Benchmark Naive Bayes """ from util import * import numpy as np import argparse from time import time from sklearn import naive_bayes import sys if __name__ == '__main__': parser = argparse.ArgumentParser(description="Benchmark naive bayes.") parser.add_argument('-ns', default=1000000, type=int, ...
mit
ychfan/tensorflow
tensorflow/python/estimator/canned/linear_testing_utils.py
20
67865
# 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
alvarofierroclavero/scikit-learn
examples/model_selection/plot_train_error_vs_test_error.py
349
2577
""" ========================= Train error vs Test error ========================= Illustration of how the performance of an estimator on unseen data (test data) is not the same as the performance on training data. As the regularization increases the performance on train decreases while the performance on test is optim...
bsd-3-clause
iamshang1/Projects
Papers/HiSAN/tf_hisan_multigpu.py
1
14655
import os import numpy as np import tensorflow as tf from tensorflow.python.client import device_lib import sys import time from sklearn.metrics import f1_score import random class hisan_multigpu(object): def __init__(self,embedding_matrix,num_classes,max_sents,max_words,attention_heads=8, attent...
mit
ycopin/spectrogrism
spectrogrism/snifs.py
1
4440
# -*- coding: utf-8 -*- # Time-stamp: <2016-03-23 00:19 ycopin@lyonovae03.in2p3.fr> """ snifs ----- SNIFS optical configuration and utilities. """ from __future__ import division, print_function, absolute_import __author__ = "Yannick Copin <y.copin@ipnl.in2p3.fr>" import warnings import numpy as N if __name__ ==...
lgpl-3.0
ashiklom/studyGroup
lessons/RISE/demoUtilities.py
2
3183
import numpy as np import matplotlib as mp import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D def plotSetup(xmin = -3.0, xmax = 3.0, ymin = -3.0, ymax = 3.0, size=(6,6)): """ refactored version of ut.plotSetup to hide as much as possible when showing code basics of 2D plot setup d...
apache-2.0
mojoboss/scikit-learn
examples/linear_model/plot_ols_ridge_variance.py
387
2060
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Ordinary Least Squares and Ridge Regression Variance ========================================================= Due to the few points in each dimension and the straight line that linear regression uses to follow thes...
bsd-3-clause
koningrobot/sparse-coding-theano
example.py
2
1895
import random import math import numpy as np import scipy.io import matplotlib.pyplot as plt import matplotlib.cm as cm import logging logging.basicConfig(level=logging.WARNING) import sparse_coding as sc def onto_unit(x): a = np.min(x) b = np.max(x) return (x - a) / (b - a) def visualize_patches(B): ...
mit
astrolitterbox/SAMI
utils.py
1
6843
from __future__ import division import numpy as np from astropy.coordinates.distances import Distance import matplotlib.pyplot as plt import pyfits import db import pyfits from string import * from astroML.plotting import hist from geom import getIncl def simple_plot(x, y, vel, filename): fig = plt.figure(figsize=(1...
gpl-2.0
ishank08/scikit-learn
examples/svm/plot_rbf_parameters.py
26
8016
''' ================== RBF SVM parameters ================== This example illustrates the effect of the parameters ``gamma`` and ``C`` of the Radial Basis Function (RBF) kernel SVM. Intuitively, the ``gamma`` parameter defines how far the influence of a single training example reaches, with low values meaning 'far' a...
bsd-3-clause
josh314/squinty
train-agglo.py
1
2487
################################################################ # Cluster reduction of pixel data # # Usage: python2 train-agglo.py <training data> [options] # # Builds the a data transformer (FeatureAgglomeration clusting object) which # reduces problem dimension #Parse command line options and arguments #Do this be...
mit
john5223/airflow
airflow/hooks/base_hook.py
9
1407
from builtins import object import logging import random from airflow import settings from airflow.models import Connection from airflow.utils import AirflowException class BaseHook(object): """ Abstract base class for hooks, hooks are meant as an interface to interact with external systems. MySqlHook, H...
apache-2.0
CloverHealth/airflow
tests/hooks/test_hive_hook.py
2
16206
# -*- 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
rbdavid/Distance_matrix
Test_Case1/plotting_functions.py
4
13432
#!/Library/Frameworks/Python.framework/Versions/2.7/bin/python # USAGE: # from fn_plotting.py import * # PREAMBLE: import numpy as np import sys import os import matplotlib.pyplot as plt import matplotlib.colors as mcolors import matplotlib as mpl from matplotlib.ticker import NullFormatter stdev = np.std sqrt = np....
gpl-3.0
scollis/AGU_2016
scripts/tmatrix_par.py
1
5013
import pyart import netCDF4 import numpy as np import platform from matplotlib import pyplot as plt from glob import glob import os from datetime import datetime from scipy import interpolate import fnmatch import matplotlib.dates as mdates from pytmatrix.tmatrix import TMatrix, Scatterer from pytmatrix.tmatrix_psd imp...
bsd-3-clause
geodynamics/burnman
misc/benchmarks/benchmark.py
3
29420
from __future__ import absolute_import # This file is part of BurnMan - a thermoelastic and thermodynamic toolkit for the Earth and Planetary Sciences # Copyright (C) 2012 - 2015 by the BurnMan team, released under the GNU # GPL v2 or later. import os.path import sys sys.path.insert(1, os.path.abspath('../..')) impor...
gpl-2.0
nikitasingh981/scikit-learn
sklearn/neighbors/tests/test_approximate.py
30
19128
""" Testing for the approximate neighbor search using Locality Sensitive Hashing Forest module (sklearn.neighbors.LSHForest). """ # Author: Maheshakya Wijewardena, Joel Nothman import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_a...
bsd-3-clause
chrisburr/scikit-learn
examples/plot_multioutput_face_completion.py
330
3019
""" ============================================== Face completion with a multi-output estimators ============================================== This example shows the use of multi-output estimator to complete images. The goal is to predict the lower half of a face given its upper half. The first column of images sho...
bsd-3-clause
sclc/NAEF
exp_scripts/worker_exp_160606_isc16.py
1
33697
""" Experiment Diary 2016-06-06 for ISC 2016 """ import sys import math import matplotlib.pyplot as plt from scipy import io import numpy as np from scipy.sparse.linalg import * from scipy.sparse import * sys.path.append("../src/") from worker import Worker from native_conjugate_gradient import NativeConjugateGradien...
gpl-3.0
rvraghav93/scikit-learn
sklearn/gaussian_process/gaussian_process.py
17
34869
# -*- coding: utf-8 -*- # Author: Vincent Dubourg <vincent.dubourg@gmail.com> # (mostly translation, see implementation details) # License: BSD 3 clause from __future__ import print_function import numpy as np from scipy import linalg, optimize from ..base import BaseEstimator, RegressorMixin from ..metrics...
bsd-3-clause
loretoparisi/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/delaunay/interpolate.py
73
7068
import numpy as np from matplotlib._delaunay import compute_planes, linear_interpolate_grid, nn_interpolate_grid from matplotlib._delaunay import nn_interpolate_unstructured __all__ = ['LinearInterpolator', 'NNInterpolator'] def slice2gridspec(key): """Convert a 2-tuple of slices to start,stop,steps for x and y....
agpl-3.0
xyguo/scikit-learn
examples/model_selection/plot_train_error_vs_test_error.py
349
2577
""" ========================= Train error vs Test error ========================= Illustration of how the performance of an estimator on unseen data (test data) is not the same as the performance on training data. As the regularization increases the performance on train decreases while the performance on test is optim...
bsd-3-clause
duncanwp/iris
lib/iris/tests/test_quickplot.py
1
7759
# (C) British Crown Copyright 2010 - 2018, Met Office # # This file is part of Iris. # # Iris is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option) any l...
lgpl-3.0
doubaoatthu/UWRoutingSystem
dt.py
1
1669
from sklearn import tree from sklearn.externals.six import StringIO from IPython.display import Image import os import pydot import numpy preference = [] label = [] with open("../data/survey.txt") as f: contents = f.readlines() for content in contents: content = content[1:-2] content = content.replace("\"","") ...
mit
lbishal/scikit-learn
sklearn/linear_model/coordinate_descent.py
8
76416
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Olivier Grisel <olivier.grisel@ensta.org> # Gael Varoquaux <gael.varoquaux@inria.fr> # # License: BSD 3 clause import sys import warnings from abc import ABCMeta, abstractmethod import n...
bsd-3-clause
pulkitag/caffe-python-layers
streetview_data_group_rots.py
1
13622
import caffe import numpy as np import argparse, pprint from multiprocessing import Pool import scipy.misc as scm from os import path as osp import my_pycaffe_io as mpio import my_pycaffe as mp from easydict import EasyDict as edict from transforms3d.transforms3d import euler as t3eu import street_label_utils as slu i...
bsd-3-clause
zblz/naima
src/naima/model_fitter.py
1
10519
# Licensed under a 3-clause BSD style license - see LICENSE.rst import astropy.units as u import numpy as np from .core import _prefit, lnprobmodel from .extern.validator import validate_array from .plot import _plot_data_to_ax, color_cycle from .utils import sed_conversion, validate_data_table __all__ = ["Interactiv...
bsd-3-clause
ssorgatem/qiime
scripts/plot_taxa_summary.py
15
12355
#!/usr/bin/env python # File created on 19 Jan 2011 from __future__ import division __author__ = "Jesse Stombaugh" __copyright__ = "Copyright 2011, The QIIME project" __credits__ = ["Jesse Stombaugh", "Julia Goodrich", "Justin Kuczynski", "John Chase", "Jose Antonio Navas Molina"] __license__ = "GPL" __...
gpl-2.0
pivotalsoftware/pymadlib
setup.py
1
4378
from setuptools import setup, find_packages from distutils.util import convert_path import os,sys from fnmatch import fnmatchcase # Provided as an attribute, so you can append to these instead # of replicating them: standard_exclude = ('*.py', '*.pyc', '*$py.class', '*~', '.*', '*.bak') standard_exclude_directories = ...
bsd-2-clause
FNCS/ns-3.22
src/flow-monitor/examples/wifi-olsr-flowmon.py
108
7439
# -*- Mode: Python; -*- # Copyright (c) 2009 INESC Porto # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, #...
gpl-2.0
Xevaquor/the-art-of-ai
ann/ml_plot.py
1
1759
# -*- coding: utf-8 -*- """ The art of an Artificial Intelligence http://art-of-ai.com https://github.com/Xevaquor/the-art-of-ai Module in this version does not handle w = [0,0,0] or w = [_, _, 0] properly """ __author__ = 'xevaquor' __license__ = 'MIT' import numpy as np import matplotlib.pyplot as plt def init_c...
gpl-3.0
Nyker510/scikit-learn
examples/cross_decomposition/plot_compare_cross_decomposition.py
142
4761
""" =================================== Compare cross decomposition methods =================================== Simple usage of various cross decomposition algorithms: - PLSCanonical - PLSRegression, with multivariate response, a.k.a. PLS2 - PLSRegression, with univariate response, a.k.a. PLS1 - CCA Given 2 multivari...
bsd-3-clause
SKA-ScienceDataProcessor/algorithm-reference-library
deprecated_code/workflows/mpi/plot-results.py
1
2132
#!/usr/bim/python # Script to plot the performance/scaling results import os import sys sys.path.append(os.path.join('..', '..')) results_dir = './results/timing-csd3/dask' #from matplotlib import pylab #pylab.rcParams['figure.figsize'] = (12.0, 12.0) #pylab.rcParams['image.cmap'] = 'rainbow' import numpy from ...
apache-2.0
hunter-cameron/Bioinformatics
job_scripts/plate_scrapes/checkm/compare_checkm.py
1
1571
import argparse import sys import pandas as pd def read_data_table(data_f): """ Converts raw CheckM data into a data frame. Should have an option to accept a .csv file from CheckM """ # return a df with the first column as an index and the first row as headers return pd.read_csv(data_f, sep="...
mit
joernhees/scikit-learn
sklearn/tests/test_multioutput.py
23
12429
from __future__ import division import numpy as np import scipy.sparse as sp from sklearn.utils import shuffle from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing import assert_false from sklearn.utils.testing import assert_raises_regex from s...
bsd-3-clause
pompiduskus/scikit-learn
doc/tutorial/text_analytics/skeletons/exercise_02_sentiment.py
256
2406
"""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
judaba13/GenrePredictor
dtCV.py
1
4618
''' CS4780 Final Project Post Pruning and Cross Validation @author: Kelsey Duncan ked83 ''' from matplotlib import pyplot as plt from dt import * import random #get data trainData, testData = getData() depths = range(2, 33) testAccuracies = [] testPrecisions = [] trainAccuracies = [] trainPrecisions = [] #train a tr...
apache-2.0
smrjan/seldon-server
python/seldon/pipeline/tests/test_util.py
2
2599
import unittest from .. import util as sutils from .. import basic_transforms as bt import pandas as pd import json import os.path from sklearn.pipeline import Pipeline from sklearn.externals import joblib import logging class Test_PipelineWrapper(unittest.TestCase): def _create_test_json(self,fname,as_list=False...
apache-2.0
davidgbe/scikit-learn
sklearn/linear_model/stochastic_gradient.py
130
50966
# Authors: Peter Prettenhofer <peter.prettenhofer@gmail.com> (main author) # Mathieu Blondel (partial_fit support) # # License: BSD 3 clause """Classification and regression using Stochastic Gradient Descent (SGD).""" import numpy as np import scipy.sparse as sp from abc import ABCMeta, abstractmethod from ...
bsd-3-clause
danche354/Sequence-Labeling
ner/senna-hash-2-pos-chunk-gazetteer-128-64.py
1
7761
from keras.models import Model from keras.layers import Input, Masking, Dense, LSTM from keras.layers import Dropout, TimeDistributed, Bidirectional, merge from keras.layers.embeddings import Embedding from keras.utils import np_utils import numpy as np import pandas as pd import sys import math import os from dateti...
mit
sahg/PyTOPKAPI
pytopkapi/results_analysis/plot_Qsim_Qobs_Rain.py
2
3658
import datetime as dt from configparser import SafeConfigParser import h5py import numpy as np import matplotlib.pyplot as plt from matplotlib.dates import date2num import pytopkapi.utils as ut def run(ini_file='plot_Qsim_Qobs_Rain.ini'): config = SafeConfigParser() config.read(ini_file) print('Read the ...
bsd-3-clause
neilhan/python_cv_learning
05-segment_grabcut/run_me.py
1
7745
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This code testing the segmenting images using GrabCut method. This code testing the segmenting images using GrabCut method. Author: Neil Han ! This sample code is a copy from https://github.com/Itseez/opencv/blob/master/samples/python2/grabcut.py @ 2013-11-29 The orig...
bsd-3-clause
pratapvardhan/scikit-learn
sklearn/gaussian_process/gpc.py
42
31571
"""Gaussian processes classification.""" # Authors: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de> # # License: BSD 3 clause import warnings from operator import itemgetter import numpy as np from scipy.linalg import cholesky, cho_solve, solve from scipy.optimize import fmin_l_bfgs_b from scipy.special import erf...
bsd-3-clause
xuewei4d/scikit-learn
sklearn/datasets/tests/test_openml.py
5
51973
"""Test the openml loader. """ import gzip import json import numpy as np import os import re import scipy.sparse import sklearn import pytest from sklearn import config_context from sklearn.datasets import fetch_openml from sklearn.datasets._openml import (_open_openml_url, _arff...
bsd-3-clause
actlea/TopicalCrawler
TopicalCrawl/TopicalCrawl/classifier/increment_classifier.py
1
2474
#!/usr/bin/env python # encoding: utf-8 """ @version: ?? @author: phpergao @license: Apache Licence @file: increment_classifier.py @time: 16-4-15 上午10:18 """ from base import * from sklearn.externals import joblib import os import numpy as np import re from collections import Counter from collections import Counter...
gpl-3.0
danielhrisca/asammdf
asammdf/signal.py
1
50266
# -*- coding: utf-8 -*- """ asammdf *Signal* class module for time correct signal processing """ import logging from textwrap import fill import numpy as np from numpy.core.defchararray import encode from .blocks import v2_v3_blocks as v3b from .blocks import v4_blocks as v4b from .blocks.conversion_utils import fro...
lgpl-3.0
nmayorov/scikit-learn
examples/svm/plot_weighted_samples.py
95
1943
""" ===================== SVM: Weighted samples ===================== Plot decision function of a weighted dataset, where the size of points is proportional to its weight. The sample weighting rescales the C parameter, which means that the classifier puts more emphasis on getting these points right. The effect might ...
bsd-3-clause
steveryb/pyprocrustes
visualise.py
1
1106
import matplotlib as mpl from mpl_toolkits.mplot3d import Axes3D import numpy as np import matplotlib.pyplot as plt import Procrustes def load_curve_data(filename): with open(filename) as f: line = f.readline() data = line.split(",") version = data[0] num_points = data[1] dat...
bsd-2-clause
tuanavu/deep-learning-a-z
DeepLearningA-Z/02-supervised-deep-learning/01-Artificial-Neural-Networks-ANN/Artificial_Neural_Networks/ann.py
5
2306
# Artificial Neural Network # Installing Theano # pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git # Installing Tensorflow # pip install tensorflow # Installing Keras # pip install --upgrade keras # Part 1 - Data Preprocessing # Importing the libraries import numpy as np import matplotlib.pyp...
mit
iosonofabio/singlet
setup.py
1
2579
#!/usr/bin/env python # vim: fdm=indent ''' author: Fabio Zanini date: 08/08/17 content: Setup script for singlet ''' import sys import os from distutils.log import INFO as logINFO if ((sys.version_info[0] < 3) or (sys.version_info[0] == 3 and sys.version_info[1] < 4)): sys.stderr.write("Error in s...
mit
Akshay0724/scikit-learn
examples/calibration/plot_calibration_multiclass.py
95
6971
""" ================================================== 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
astraw/pairs2groups
pairs2groups/__init__.py
1
13702
"""find homogeneous groups of items based on pairwise information A motivating example -------------------- Suppose you have performed several experiments from four treatments (treatments 1,2,3, and 4). From each treatment, you have collected many independent samples. The question is into what groups of 'statisticall...
mit
saimn/astropy
astropy/visualization/wcsaxes/transforms.py
8
5762
# Licensed under a 3-clause BSD style license - see LICENSE.rst # Note: This file incldues code dervived from pywcsgrid2 # # This file contains Matplotlib transformation objects (e.g. from pixel to world # coordinates, but also world-to-world). import abc import numpy as np from matplotlib.path import Path from ma...
bsd-3-clause
Bihaqo/exp-machines
src/objectives/logistic.py
1
2008
""" Utils related to the logistic regression. """ import numpy as np from sklearn.linear_model import LogisticRegression def log1pexp(x): """log(1 + exp(x))""" return np.logaddexp(0, x) def sigmoid(x): return 1.0 / log1pexp(-x) def binary_logistic_loss(linear_o, y): """Returns a vector of logistic l...
mit
andrescv/BehavioralCloning
utils.py
1
2382
''' _ _ _ _ _ | | | | |_(_) |___ | |_| | _| | (_-< \___/ \__|_|_/__/ Behavioral Cloning Project Utilities ''' import os import h5py import numpy as np from scipy.misc import imresize from sklearn.utils import shuffle try: from sklearn.model_selection import train_test_split except ImportEr...
mit
ChanderG/scikit-learn
sklearn/datasets/tests/test_20news.py
280
3045
"""Test the 20news downloader, if the data is available.""" import numpy as np import scipy.sparse as sp from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_true from sklearn.utils.testing import SkipTest from sklearn import datasets def test_20news(): try: data = dat...
bsd-3-clause
abhisg/scikit-learn
examples/ensemble/plot_forest_importances.py
168
1793
""" ========================================= Feature importances with forests of trees ========================================= This examples shows the use of forests of trees to evaluate the importance of features on an artificial classification task. The red bars are the feature importances of the forest, along wi...
bsd-3-clause
rpmunoz/DECam
data_reduction/pipeline_python/decam_pipeline.py
1
1303
#! /usr/bin/env python import warnings warnings.filterwarnings("ignore") import sys,os import os.path import time import subprocess import numpy as np import pyfits import multiprocessing, Queue import ctypes import matplotlib.pyplot as plt import scipy.interpolate from astropy.convolution import convolve, convolve_f...
apache-2.0
harisbal/pandas
pandas/tests/extension/json/array.py
2
6299
"""Test extension array for storing nested data in a pandas container. The JSONArray stores lists of dictionaries. The storage mechanism is a list, not an ndarray. Note: We currently store lists of UserDicts (Py3 only). Pandas has a few places internally that specifically check for dicts, and does non-scalar things ...
bsd-3-clause