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 |
|---|---|---|---|---|---|
crowd-ai/post-processing-experiments | exampleInference.py | 1 | 5166 | """
Adapted from the inference.py to demonstate the usage of the util functions.
"""
import sys
import numpy as np
import pydensecrf.densecrf as dcrf
import ipdb
# Get im{read,write} from somewhere.
try:
from cv2 import imread, imwrite
except ImportError:
# Note that, sadly, skimage unconditionally import scip... | mit |
pp-mo/iris | docs/iris/example_code/Meteorology/lagged_ensemble.py | 2 | 5965 | """
Seasonal ensemble model plots
=============================
This example demonstrates the loading of a lagged ensemble dataset from the
GloSea4 model, which is then used to produce two types of plot:
* The first shows the "postage stamp" style image with an array of 14 images,
one for each ensemble member wit... | lgpl-3.0 |
ycaihua/scikit-learn | sklearn/metrics/tests/test_regression.py | 31 | 3010 | from __future__ import division, print_function
import numpy as np
from itertools import product
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.metri... | bsd-3-clause |
lioritan/Thesis | problems/ohsumedTitleOnlyMulticlassRun.py | 1 | 4202 | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 12 11:04:46 2014
@author: liorf
"""
from numpy import *
from matplotlib.mlab import find
import cPickle
import alg10_ficuslike as alg
from sklearn.cross_validation import StratifiedKFold
from alg10_ficuslike import ig_ratio
def feature_select_ig(trn, trn_lbl, tst, fract... | gpl-2.0 |
jiangzhonglian/MachineLearning | src/py3.x/ml/8.Regression/sklearn-regression-demo.py | 1 | 5674 | #!/usr/bin/python
# coding:utf8
'''
Created on Jan 8, 2011
Update on 2017-05-18
Author: Peter Harrington/小瑶
GitHub: https://github.com/apachecn/AiLearning
'''
# Isotonic Regression 等式回归
print(__doc__)
# Author: Nelle Varoquaux <nelle.varoquaux@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
#... | gpl-3.0 |
yanlend/scikit-learn | benchmarks/bench_plot_fastkmeans.py | 294 | 4676 | from __future__ import print_function
from collections import defaultdict
from time import time
import numpy as np
from numpy import random as nr
from sklearn.cluster.k_means_ import KMeans, MiniBatchKMeans
def compute_bench(samples_range, features_range):
it = 0
results = defaultdict(lambda: [])
chun... | bsd-3-clause |
wwf5067/statsmodels | statsmodels/sandbox/examples/thirdparty/findow_0.py | 33 | 2147 | # -*- coding: utf-8 -*-
"""A quick look at volatility of stock returns for 2009
Just an exercise to find my way around the pandas methods.
Shows the daily rate of return, the square of it (volatility) and
a 5 day moving average of the volatility.
No guarantee for correctness.
Assumes no missing values.
colors of lines... | bsd-3-clause |
wuchaozju/Beautify | data_loader.py | 1 | 8475 | import sqlite3
import urllib2, urllib
import time
import xml.etree.ElementTree as ET
import numpy as np
import random
from matplotlib import pyplot as plt
'''
https://www.flickr.com/services/api/flickr.photos.search.html
An example request: https://www.flickr.com/services/rest/?api_key=9b35acbf22d3e28bc60bfc68417ed1... | gpl-3.0 |
tachylyte/HydroGeoPy | EXAMPLES/exampleMonteCarlo1.py | 1 | 1218 | # Simple test of probabilistic modelling
# Calculates time to break through assuming plug flow
from simplehydro import *
from monte_carlo import *
from conversion import *
import matplotlib.pyplot as plt
# Probabilistic
I = 100001 # Number of iterations
K = Loguniform(1e-8, 1e-7, I) #... | bsd-2-clause |
AIML/scikit-learn | examples/gaussian_process/plot_gp_regression.py | 253 | 4054 | #!/usr/bin/python
# -*- coding: utf-8 -*-
r"""
=========================================================
Gaussian Processes regression: basic introductory example
=========================================================
A simple one-dimensional regression exercise computed in two different ways:
1. A noise-free cas... | bsd-3-clause |
twareproj/tware | refind/result.py | 2 | 2790 | #!/usr/bin/python
import json
import pandas as pd
class Result():
def __init__(self, task, complete):
self.task = task
self.complete = complete
self.timestamp = 0
def to_json(self):
raise NotImplementedError()
class ClassifyResult(Result):
def __init__(self, task, complete... | apache-2.0 |
jseabold/scikit-learn | sklearn/linear_model/tests/test_sparse_coordinate_descent.py | 244 | 9986 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_true
from sklearn.utils.t... | bsd-3-clause |
GaussDing/jieba | test/extract_topic.py | 65 | 1463 | import sys
sys.path.append("../")
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn import decomposition
import jieba
import time
import glob
import sys
import os
import random
if len(sys.argv)<2:
print("usage: extract_topic.py di... | mit |
ufbmi/onefl-deduper | onefl/hash_generator.py | 1 | 10500 | """
Goal: Store functions used for converting PHI data into hashed strings
@authors:
Andrei Sura <sura.andrei@gmail.com>
"""
import os
import sys
import pandas as pd
import multiprocessing as mp
import traceback
from dateutil import parser as dp
from onefl.rules import AVAILABLE_RULES_MAP as rulz
from onefl impor... | mit |
belemizz/mimic2_tools | clinical_db/get_sample/mimic2.py | 1 | 50774 | import psycopg2
import getpass
import numpy as np
import mutil.mycsv
from mutil import Cache, p_info, is_number, include_any_number
from collections import Counter
from datetime import timedelta
from datetime import datetime
from sklearn.linear_model import LinearRegression
import os
cont_dir = '../data/matdata/'
fi... | mit |
akionakamura/scikit-learn | examples/linear_model/plot_ridge_path.py | 254 | 1655 | """
===========================================================
Plot Ridge coefficients as a function of the regularization
===========================================================
Shows the effect of collinearity in the coefficients of an estimator.
.. currentmodule:: sklearn.linear_model
:class:`Ridge` Regressi... | bsd-3-clause |
ElDeveloper/scikit-learn | examples/gaussian_process/plot_gpr_co2.py | 9 | 5718 | """
========================================================
Gaussian process regression (GPR) on Mauna Loa CO2 data.
========================================================
This example is based on Section 5.4.3 of "Gaussian Processes for Machine
Learning" [RW2006]. It illustrates an example of complex kernel engine... | bsd-3-clause |
georgek/KAT | scripts/kat_plot_colormaps.py | 2 | 50542 | #!/usr/bin/env python3
# New matplotlib colormaps by Nathaniel J. Smith, Stefan van der Walt,
# and (in the case of viridis) Eric Firing.
#
# This file and the colormaps in it are released under the CC0 license /
# public domain dedication. We would appreciate credit if you use or
# redistribute these colormaps, but d... | gpl-3.0 |
mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/sklearn/manifold/locally_linear.py | 3 | 26540 | """Locally Linear Embedding"""
# Author: Fabian Pedregosa -- <fabian.pedregosa@inria.fr>
# Jake Vanderplas -- <vanderplas@astro.washington.edu>
# License: BSD 3 clause (C) INRIA 2011
import numpy as np
from scipy.linalg import eigh, svd, qr, solve
from scipy.sparse import eye, csr_matrix
from scipy.sparse.li... | mit |
Ziqi-Li/bknqgis | bokeh/bokeh/util/serialization.py | 2 | 11282 | '''
Functions for helping with serialization and deserialization of
Bokeh objects.
Certain NunPy array dtypes can be serialized to a binary format for
performance and efficiency. The list of supported dtypes is:
{binary_array_types}
'''
from __future__ import absolute_import
import logging
log = logging.getLogger(_... | gpl-2.0 |
mjlong/openmc | tests/test_mgxs_library_no_nuclides/test_mgxs_library_no_nuclides.py | 2 | 2644 | #!/usr/bin/env python
import os
import sys
import glob
import hashlib
sys.path.insert(0, os.pardir)
from testing_harness import PyAPITestHarness
import openmc
import openmc.mgxs
class MGXSTestHarness(PyAPITestHarness):
def _build_inputs(self):
# The openmc.mgxs module needs a summary.h5 file
sel... | mit |
mlyundin/scikit-learn | examples/gaussian_process/gp_diabetes_dataset.py | 223 | 1976 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
========================================================================
Gaussian Processes regression: goodness-of-fit on the 'diabetes' dataset
========================================================================
In this example, we fit a Gaussian Process model onto... | bsd-3-clause |
linucks/textclass | sklearn_combine_vocab_features.py | 1 | 4365 | #!/usr/bin/env ccp4-python
'''
Created on 19 Feb 2017
@author: jmht
'''
import cPickle
import numpy as np
from sklearn.feature_extraction.text import TfidfTransformer
#from sklearn.preprocessing import StandardScaler, MinMaxScaler
from sklearn.pipeline import Pipeline, FeatureUnion
from sklearn.ensemble import Ra... | mit |
mtrbean/scipy | scipy/interpolate/fitpack2.py | 20 | 60995 | """
fitpack --- curve and surface fitting with splines
fitpack is based on a collection of Fortran routines DIERCKX
by P. Dierckx (see http://www.netlib.org/dierckx/) transformed
to double routines by Pearu Peterson.
"""
# Created by Pearu Peterson, June,August 2003
from __future__ import division, print_function, abs... | bsd-3-clause |
toobaz/pandas | asv_bench/benchmarks/timeseries.py | 1 | 12187 | from datetime import timedelta
import dateutil
import numpy as np
from pandas import to_datetime, date_range, Series, DataFrame, period_range
from pandas.tseries.frequencies import infer_freq
try:
from pandas.plotting._matplotlib.converter import DatetimeConverter
except ImportError:
from pandas.tseries.conve... | bsd-3-clause |
aaltay/beam | sdks/python/apache_beam/io/parquetio.py | 1 | 20574 | #
# 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 |
jadielam/object-detection-tensorflow | faster_rcnn/demo.py | 2 | 4544 | import tensorflow as tf
import matplotlib.pyplot as plt
import numpy as np
import os, sys, cv2
import argparse
import os.path as osp
import glob
this_dir = osp.dirname(__file__)
print(this_dir)
from lib.networks.factory import get_network
from lib.fast_rcnn.config import cfg
from lib.fast_rcnn.test import im_detect
f... | mit |
kylecorry31/KyPy | kypy/mathematics/__init__.py | 1 | 13567 | __author__ = 'Kyle'
import math
import re
import matplotlib.pyplot as plt
import numpy as np
class Variable:
"""Represent a variable as a class."""
def __init__(self, coef, exp):
"""Set coefficient and exponent."""
self.coef = coef
self.exp = exp
def __str__(self):
"""C... | mit |
kenshay/ImageScript | ProgramData/SystemFiles/Python/share/doc/networkx-2.2/examples/drawing/plot_unix_email.py | 3 | 2421 | #!/usr/bin/env python
"""
==========
Unix Email
==========
Create a directed graph, allowing multiple edges and self loops, from
a unix mailbox. The nodes are email addresses with links
that point from the sender to the receivers. The edge data
is a Python email.Message object which contains all of
the email message... | gpl-3.0 |
cl4rke/scikit-learn | sklearn/preprocessing/tests/test_label.py | 48 | 18419 | import numpy as np
from scipy.sparse import issparse
from scipy.sparse import coo_matrix
from scipy.sparse import csc_matrix
from scipy.sparse import csr_matrix
from scipy.sparse import dok_matrix
from scipy.sparse import lil_matrix
from sklearn.utils.multiclass import type_of_target
from sklearn.utils.testing impor... | bsd-3-clause |
ver228/tierpsy-tracker | tierpsy/features/open_worm_analysis_toolbox/prefeatures/normalized_worm.py | 1 | 28389 | # -*- coding: utf-8 -*-
"""
This module defines the NormalizedWorm class
"""
import numpy as np
import scipy.io
import copy
import warnings
import os
from .. import config, utils
from .basic_worm import WormPartition
from .basic_worm import BasicWorm
from .pre_features import WormParsing
from .pre_features_helpers... | mit |
zakkum42/Bosch | src/03-feature_engineering/nn_iterative_regressor_for_numeric_features_prefilled.py | 1 | 14392 | #
# Build regressor for numeric fields
# Use time and categorical fields when available
#
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import pickle
import os.path
from datetime import datetime
from sklearn.metrics import mean_squared_error
from sklearn.m... | apache-2.0 |
benoitsteiner/tensorflow-xsmm | tensorflow/python/estimator/inputs/queues/feeding_functions.py | 20 | 19127 | # 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 |
leonardolepus/pubmad | toolbox/miscellaneous/evaluate_all.py | 3 | 1865 | import re
import pickle
import os
from matplotlib import pyplot as plt
import scipy.stats as stats
import networkx as nx
from kegg_kgml_parser.parse_KGML import KGML2Graph
kegg_fs = os.listdir('kegg')
kegg_fs = ['kegg/'+i for i in kegg_fs if re.match('hsa04012.xml', i)]
keggs = []
for kegg_f in kegg_fs:
kegg = K... | gpl-2.0 |
MohammedWasim/scikit-learn | sklearn/datasets/twenty_newsgroups.py | 126 | 13591 | """Caching loader for the 20 newsgroups text classification dataset
The description of the dataset is available on the official website at:
http://people.csail.mit.edu/jrennie/20Newsgroups/
Quoting the introduction:
The 20 Newsgroups data set is a collection of approximately 20,000
newsgroup documents,... | bsd-3-clause |
deepesch/scikit-learn | sklearn/ensemble/tests/test_voting_classifier.py | 140 | 6926 | """Testing for the boost module (sklearn.ensemble.boost)."""
import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.linear_model import LogisticRegression
from sklearn.naive_bayes import GaussianNB
from sklearn.ensemble import RandomForestCl... | bsd-3-clause |
qeedquan/misc_utilities | math/controls/forcing-function-simple.py | 1 | 1090 | # should match the matlab script
# but we do it symbolicly
import sys
import sympy as sym
import numpy as np
from sympy.abc import s,t,x,y,z
from sympy.integrals import inverse_laplace_transform
import matplotlib.pyplot as plt
# Transfer function
G = 1/(s+1)
# Laplace transform of step, sin, ramp
U1 = sym.exp(-s)/s
U... | mit |
jairideout/scikit-bio | skbio/stats/distance/tests/test_base.py | 4 | 25571 | # ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | bsd-3-clause |
lakshayg/tensorflow | tensorflow/examples/tutorials/input_fn/boston.py | 76 | 2920 | # 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 |
DeepVoltaire/Dstl-Satellite-Imagery-Feature-Detection | src/Preprocessing.py | 1 | 23986 | # Creating training and validation splits for the satellite data.
import matplotlib
matplotlib.use("Pdf")
import matplotlib.pyplot as plt
from datetime import datetime
import numpy as np
import random
import tifffile as tiff
import os
import pdb
import logging
from shapely.wkt import loads
import cv2
import pandas as ... | mit |
gereon/trading-with-python | cookbook/workingWithDatesAndTime.py | 77 | 1551 | # -*- coding: utf-8 -*-
"""
Created on Sun Oct 16 17:45:02 2011
@author: jev
"""
import time
import datetime as dt
from pandas import *
from pandas.core import datetools
# basic functions
print 'Epoch start: %s' % time.asctime(time.gmtime(0))
print 'Seconds from epoch: %.2f' % time.time()
t... | bsd-3-clause |
bundgus/python-playground | matplotlib-playground/examples/user_interfaces/interactive.py | 1 | 8198 | #!/usr/bin/env python
"""Multithreaded interactive interpreter with GTK and Matplotlib support.
WARNING:
As of 2010/06/25, this is not working, at least on Linux.
I have disabled it as a runnable script. - EF
Usage:
pyint-gtk.py -> starts shell with gtk thread running separately
pyint-gtk.py -pylab [filename]... | mit |
wanggang3333/scikit-learn | examples/svm/plot_svm_nonlinear.py | 268 | 1091 | """
==============
Non-linear SVM
==============
Perform binary classification using non-linear SVC
with RBF kernel. The target to predict is a XOR of the
inputs.
The color map illustrates the decision function learned by the SVC.
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from sklearn imp... | bsd-3-clause |
panmari/tensorflow | tensorflow/examples/skflow/text_classification_cnn.py | 1 | 3611 | # 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 |
ddcampayo/polyFEM | tools/contours_alpha.py | 1 | 1032 | #!/usr/bin/python
import pylab as pl
def grid(x, y, z , resX=90, resY=90):
"Convert 3 column data to matplotlib grid"
xi = pl.linspace(min(x), max(x), resX)
yi = pl.linspace(min(y), max(y), resY)
Z = pl.griddata(x, y, z, xi, yi , interp='linear')
X, Y = pl.meshgrid(xi, yi )
return X, Y, Z
pl.... | gpl-3.0 |
plowman/python-mcparseface | models/syntaxnet/tensorflow/tensorflow/examples/tutorials/word2vec/word2vec_basic.py | 7 | 8957 | # Copyright 2015 Google Inc. 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 applicable law or a... | apache-2.0 |
htygithub/bokeh | examples/plotting/file/boxplot.py | 2 | 2275 | import numpy as np
import pandas as pd
from bokeh.plotting import figure, show, output_file
# Generate some synthetic time series for six different categories
cats = list("abcdef")
yy = np.random.randn(2000)
g = np.random.choice(cats, 2000)
for i, l in enumerate(cats):
yy[g == l] += i // 2
df = pd.DataFrame(dict(s... | bsd-3-clause |
giorgiop/scikit-learn | sklearn/utils/random.py | 46 | 10523 | # Author: Hamzeh Alsalhi <ha258@cornell.edu>
#
# License: BSD 3 clause
from __future__ import division
import numpy as np
import scipy.sparse as sp
import operator
import array
from sklearn.utils import check_random_state
from sklearn.utils.fixes import astype
from ._random import sample_without_replacement
__all__ =... | bsd-3-clause |
jeffery-do/Vizdoombot | doom/lib/python3.5/site-packages/matplotlib/legend.py | 8 | 38696 | """
The legend module defines the Legend class, which is responsible for
drawing legends associated with axes and/or figures.
.. important::
It is unlikely that you would ever create a Legend instance manually.
Most users would normally create a legend via the
:meth:`~matplotlib.axes.Axes.legend` function... | mit |
openfisca/openfisca-france-indirect-taxation | openfisca_france_indirect_taxation/examples/transports/depenses_par_categories/plot_depenses_par_strate.py | 4 | 1693 | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 18 11:11:34 2015
@author: thomas.douenne
"""
# L'objectif est de calculer, pour chaque zone de résidence "strate", les dépenses moyennes en carburants.
# L'analyse peut être affinée afin de comparer les dépenses en diesel et en essence.
# On constate que pour les deux ca... | agpl-3.0 |
esi-mineset/spark | python/pyspark/sql/tests.py | 1 | 218184 | # -*- encoding: 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 |
MJuddBooth/pandas | pandas/tests/indexes/multi/test_set_ops.py | 2 | 11567 | # -*- coding: utf-8 -*-
import numpy as np
import pytest
import pandas as pd
from pandas import MultiIndex, Series
import pandas.util.testing as tm
@pytest.mark.parametrize("case", [0.5, "xxx"])
@pytest.mark.parametrize("sort", [None, False])
@pytest.mark.parametrize("method", ["intersection", "union",
... | bsd-3-clause |
neuroidss/cloudbrain | src/cloudbrain/modules/sinks/pyplot.py | 3 | 3591 | import json
import logging
import matplotlib.pyplot as plt
import numpy as np
from cloudbrain.modules.interface import ModuleInterface
_LOGGER = logging.getLogger(__name__)
class PyPlotSink(ModuleInterface):
def __init__(self,
subscribers,
publishers,
channel... | agpl-3.0 |
walterst/qiime | qiime/group.py | 15 | 35019 | #!/usr/bin/env python
"""This module contains functions useful for obtaining groupings."""
__author__ = "Jai Ram Rideout"
__copyright__ = "Copyright 2011, The QIIME project"
__credits__ = ["Jai Ram Rideout",
"Greg Caporaso",
"Jeremy Widmann"]
__license__ = "GPL"
__version__ = "1.9.1-dev"... | gpl-2.0 |
endolith/waveform_analysis | waveform_analysis/weighting_filters/ITU_R_468_weighting.py | 2 | 2711 | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 20 2016
@author: endolith@gmail.com
Poles and zeros were calculated in Maxima from circuit component values which
are listed in:
https://www.itu.int/dms_pubrec/itu-r/rec/bs/R-REC-BS.468-4-198607-I!!PDF-E.pdf
http://www.beis.de/Elektronik/AudioMeasure/WeightingFilters.htm... | mit |
paulruvolo/ThinkStats2 | code/timeseries.py | 66 | 18035 | """This file contains code for use with "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2014 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function
import pandas
import numpy as np
import statsmodels.formula.api as smf
import st... | gpl-3.0 |
ThomasMiconi/nupic.research | projects/sequence_prediction/mackey_glass/visualize_results.py | 13 | 1819 | #!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | agpl-3.0 |
dingocuster/scikit-learn | sklearn/metrics/cluster/supervised.py | 207 | 27395 | """Utilities to evaluate the clustering performance of models
Functions named as *_score return a scalar value to maximize: the higher the
better.
"""
# Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Wei LI <kuantkid@gmail.com>
# Diego Molla <dmolla-aliod@gmail.com>
# License: BSD 3 clause
fr... | bsd-3-clause |
Becksteinlab/GromacsWrapper | setup.py | 1 | 2523 | # setuptools installation of GromacsWrapper
# Copyright (c) 2008-2011 Oliver Beckstein <orbeckst@gmail.com>
# Released under the GNU Public License 3 (or higher, your choice)
#
# See the files INSTALL and README for details or visit
# https://github.com/Becksteinlab/GromacsWrapper
from __future__ import with_statement
... | gpl-3.0 |
turbomanage/training-data-analyst | blogs/lightning/ltgpred/trainer/train_skl.py | 2 | 4327 | #!/usr/bin/env python
"""Train model to predict lightning using scikit-learn.
Copyright Google Inc.
2018 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 Un... | apache-2.0 |
daniel-severo/dask-ml | dask_ml/decomposition/truncated_svd.py | 1 | 7968 | import dask.array as da
from dask import compute
from sklearn.base import BaseEstimator, TransformerMixin
from ..utils import svd_flip
class TruncatedSVD(BaseEstimator, TransformerMixin):
def __init__(self, n_components=2, algorithm="tsqr", n_iter=5,
random_state=None, tol=0.):
"""Dimens... | bsd-3-clause |
pyspace/pyspace | pySPACE/missions/nodes/visualization/feature_vector_vis.py | 2 | 18462 | """ Visualize :class:`~pySPACE.resources.data_types.feature_vector.FeatureVector` elements"""
import itertools
import os
import warnings
import pylab
import numpy
from collections import defaultdict
from pySPACE.resources.data_types.prediction_vector import PredictionVector
from pySPACE.tools.filesystem import create_d... | bsd-3-clause |
DiegoCorrea/ouvidoMusical | apps/similarities/Cosine/analyzer/benchmark.py | 1 | 3165 | import matplotlib.pyplot as plt
import logging
import os
from apps.CONSTANTS import START_VALIDE_RUN, TOTAL_RUN, GRAPH_SET_COLORS_LIST
from apps.similarities.Cosine.benchmark.models import BenchCosine_SongTitle
logger = logging.getLogger(__name__)
def all_time_gLine(size_list):
logger.info("[Start Bench Cosine ... | mit |
sambitgaan/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_wx.py | 69 | 77038 | from __future__ import division
"""
backend_wx.py
A wxPython backend for matplotlib, based (very heavily) on
backend_template.py and backend_gtk.py
Author: Jeremy O'Donoghue (jeremy@o-donoghue.com)
Derived from original copyright work by John Hunter
(jdhunter@ace.bsd.uchicago.edu)
Copyright (C) Jeremy O'Don... | agpl-3.0 |
Titan-C/scikit-learn | examples/feature_selection/plot_rfe_with_cross_validation.py | 161 | 1380 | """
===================================================
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 |
binghongcha08/pyQMD | GWP/QTGB/wft.py | 1 | 1271 | ##!/usr/bin/python
import numpy as np
import pylab as plt
import seaborn as sns
sns.set_context('poster')
#plt.subplot(1,1,1)
dat = np.genfromtxt(fname='wf0.dat')
data = np.genfromtxt(fname='wft.dat')
pot = np.genfromtxt(fname='pes.dat')
#data1 = np.genfromtxt(fname='../spo/1.0.3/wft3.dat')
#dat = np.genfromtxt(... | gpl-3.0 |
mdepasca/miniature-adventure | classes_dir/test.py | 1 | 11828 | import lightcurve
import supernova
import supernova_fit
import numpy as np
import os
import sys
import time
import argparse
import subprocess
warnings.filterwarnings(
'error',
message=".*divide by zero encountered in double_scalars.*",
category=RuntimeWarning
)
from math import sqrt
if __name__ == '_... | unlicense |
BiaDarkia/scikit-learn | benchmarks/bench_plot_svd.py | 72 | 2914 | """Benchmarks of Singular Value Decomposition (Exact and Approximate)
The data is mostly low rank but is a fat infinite tail.
"""
import gc
from time import time
import numpy as np
from collections import defaultdict
import six
from scipy.linalg import svd
from sklearn.utils.extmath import randomized_svd
from sklear... | bsd-3-clause |
cainiaocome/scikit-learn | examples/cluster/plot_kmeans_stability_low_dim_dense.py | 338 | 4324 | """
============================================================
Empirical evaluation of the impact of k-means initialization
============================================================
Evaluate the ability of k-means initializations strategies to make
the algorithm convergence robust as measured by the relative stan... | bsd-3-clause |
lutianming/spark-test | scripts/plot3d.py | 1 | 1103 | #!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sys import argv
import math
def plot(data, surface=None):
pos = data[:, 0] > 0
neg = data[:, 0] <= 0
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.scatter(data[pos, 1], data[... | gpl-2.0 |
ogasawaraShinnosuke/ds | src/plot.py | 1 | 1067 | import pandas as pd
from matplotlib import pyplot as plt
from abc import ABCMeta, abstractmethod
class Plot(metaclass=ABCMeta):
@abstractmethod
def show(self):
plt.show()
class CsvPlot(Plot):
"""
cp = CsvPlot('./resources/{}.csv')
cp.plots(['nikkei01',
'nikkei2007',
... | mit |
hainm/scikit-learn | examples/feature_selection/plot_feature_selection.py | 249 | 2827 | """
===============================
Univariate Feature Selection
===============================
An example showing univariate feature selection.
Noisy (non informative) features are added to the iris data and
univariate feature selection is applied. For each feature, we plot the
p-values for the univariate feature s... | bsd-3-clause |
AIML/scikit-learn | examples/ensemble/plot_partial_dependence.py | 249 | 4456 | """
========================
Partial Dependence Plots
========================
Partial dependence plots show the dependence between the target function [1]_
and a set of 'target' features, marginalizing over the
values of all other features (the complement features). Due to the limits
of human perception the size of t... | bsd-3-clause |
h-mayorquin/M2_complexity_thesis | Analysis/receptive_field_graph_experiment_example.py | 1 | 2436 | import numpy as np
import cPickle
import matplotlib.pyplot as plt
import os
from matplotlib.colors import LinearSegmentedColormap
from mpl_toolkits.axes_grid1 import make_axes_locatable
## Files
images_folder = './data/'
kernels_folder = './kernels/'
real = ''
stimuli_type_sparse = 'SparseNoise'
stimuli_type_dense = '... | bsd-2-clause |
samzhang111/scikit-learn | sklearn/semi_supervised/label_propagation.py | 35 | 15442 | # coding=utf8
"""
Label propagation in the context of this module refers to a set of
semisupervised classification algorithms. In the high level, these algorithms
work by forming a fully-connected graph between all points given and solving
for the steady-state distribution of labels at each point.
These algorithms per... | bsd-3-clause |
Djabbz/scikit-learn | examples/semi_supervised/plot_label_propagation_versus_svm_iris.py | 286 | 2378 | """
=====================================================================
Decision boundary of label propagation versus SVM on the Iris dataset
=====================================================================
Comparison for decision boundary generated on iris dataset
between Label Propagation and SVM.
This demon... | bsd-3-clause |
BorisJeremic/Real-ESSI-Examples | education_examples/_Chapter_Modeling_and_Simulation_Examples_Static_Examples/Contact_Normal_Interface_Behaviour_HardContact_Nonlinear_Hardening_Shear_Model/plot.py | 8 | 1187 | #!/usr/bin/python
import h5py
import matplotlib.pylab as plt
import sys
import numpy as np;
# Go over each feioutput and plot each one.
thefile = "Monotonic_Contact_Behaviour_Adding_Normal_Load.h5.feioutput";
finput = h5py.File(thefile)
# Read the time and displacement
times = finput["time"][:]
shear_strain_x = fi... | cc0-1.0 |
enigmampc/catalyst | tests/pipeline/test_statistical.py | 1 | 32635 | """
Tests for statistical pipeline terms.
"""
from numpy import (
arange,
full,
full_like,
nan,
where,
)
from pandas import (
DataFrame,
date_range,
Int64Index,
Timestamp,
)
from pandas.util.testing import assert_frame_equal
from scipy.stats import linregress, pearsonr, spearmanr
fr... | apache-2.0 |
CalvinNeo/Melotation | pitching/audio.py | 1 | 6521 | #coding:utf8
import numpy as np
import wave, scipy
from scipy.io import wavfile
# include entire numpy/scipy/matplotlib suite to avoid namespace pollute
import pylab as pl
import matplotlib.pyplot as plt
import math
from ada_config import *
from note import *
def test_pitching(config, sr, data, show_outstanding_leve... | apache-2.0 |
CTiPKA/scikit-flask | app.py | 1 | 4008 | import numpy as np
from flask import Flask, request, jsonify
from sklearn.preprocessing import LabelBinarizer
from sklearn.metrics import recall_score
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Flask Dockerized'
@app.route('/recall_score', methods=['GET'])
def metric1():
y_true = [0, 1, ... | bsd-3-clause |
huzq/scikit-learn | sklearn/linear_model/_sag.py | 3 | 12823 | """Solvers for Ridge and LogisticRegression using SAG algorithm"""
# Authors: Tom Dupre la Tour <tom.dupre-la-tour@m4x.org>
#
# License: BSD 3 clause
import warnings
import numpy as np
from ._base import make_dataset
from ._sag_fast import sag32, sag64
from ..exceptions import ConvergenceWarning
from ..utils import... | bsd-3-clause |
psykohack/crowdsource-platform | fixtures/createJson.py | 16 | 2463 | __author__ = 'Megha'
# Script to transfer csv containing data about various models to json
# Input csv file constituting of the model data
# Output json file representing the csv data as json object
# Assumes model name to be first line
# Field names of the model on the second line
# Data seperated by __DELIM__
# Examp... | mit |
djnugent/mavlink | pymavlink/tools/mavgraph.py | 18 | 9628 | #!/usr/bin/env python
'''
graph a MAVLink log file
Andrew Tridgell August 2011
'''
import sys, struct, time, os, datetime
import math, re
import matplotlib
from math import *
from pymavlink.mavextra import *
# cope with rename of raw_input in python3
try:
input = raw_input
except NameError:
pass
colourmap =... | lgpl-3.0 |
matthewjwoodruff/moeasensitivity | contour/contour.py | 1 | 3395 | """
Copyright (C) 2013 Matthew Woodruff
This script 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 later version.
This script is distributed in th... | lgpl-3.0 |
ankurankan/scikit-learn | sklearn/__init__.py | 12 | 2540 | """
Machine learning module for Python
==================================
sklearn is a Python module integrating classical machine
learning algorithms in the tightly-knit world of scientific Python
packages (numpy, scipy, matplotlib).
It aims to provide simple and efficient solutions to learning problems
that are acc... | bsd-3-clause |
ch3ll0v3k/scikit-learn | sklearn/utils/__init__.py | 132 | 14185 | """
The :mod:`sklearn.utils` module includes various utilities.
"""
from collections import Sequence
import numpy as np
from scipy.sparse import issparse
import warnings
from .murmurhash import murmurhash3_32
from .validation import (as_float_array,
assert_all_finite,
... | bsd-3-clause |
markro49/integration-test2 | make_heatmaps.py | 2 | 1723 | import sys, os, shutil
from PIL import Image
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import numpy as np
def main(file_name):
print("Opening {}".format(file_name))
w,h = 10, 10
matrix = [[0 for x in range(w)] for y in range(h)]
with open(file_name, 'r') as f:
content = f.readli... | mit |
lotrus28/TaboCom | qiime_16s/add_pseudocounts_normalize.py | 1 | 2074 | import copy
import re
import sys
import numpy as np
import pandas as pd
def add_pseudocounts(counts_path):
def get_low_high_taxes(tax, all):
hier = ['k__', 'p__', 'c__', 'o__', 'f__', 'g__', 's__']
tax_lvl = str(tax).split('__')[-2][-1] + '__'
if tax_lvl == 'k__':
immediate_... | apache-2.0 |
jorge2703/scikit-learn | sklearn/cluster/tests/test_birch.py | 342 | 5603 | """
Tests for the birch clustering algorithm.
"""
from scipy import sparse
import numpy as np
from sklearn.cluster.tests.common import generate_clustered_data
from sklearn.cluster.birch import Birch
from sklearn.cluster.hierarchical import AgglomerativeClustering
from sklearn.datasets import make_blobs
from sklearn.l... | bsd-3-clause |
catalyst-cooperative/pudl | src/pudl/transform/__init__.py | 1 | 3986 | """
Modules implementing the "Transform" step of the PUDL ETL pipeline.
Each module in this subpackage transforms the tabular data associated with a
single data source from the PUDL :ref: `data-sources`. This process begins
with a dictionary of "raw" :class:`pandas.DataFrame` objects produced by the
corresponding data... | mit |
ArtisteHsu/jetson-tk1-r21.3-kernel | scripts/tracing/dma-api/plotting.py | 96 | 4043 | """Ugly graph drawing tools"""
import matplotlib.pyplot as plt
import matplotlib.cm as cmap
#import numpy as np
from matplotlib import cbook
# http://stackoverflow.com/questions/4652439/is-there-a-matplotlib-equivalent-of-matlabs-datacursormode
class DataCursor(object):
"""A simple data cursor widget that displays... | gpl-2.0 |
newemailjdm/scipy | scipy/signal/windows.py | 32 | 53971 | """The suite of window functions."""
from __future__ import division, print_function, absolute_import
import warnings
import numpy as np
from scipy import special, linalg
from scipy.fftpack import fft
from scipy._lib.six import string_types
__all__ = ['boxcar', 'triang', 'parzen', 'bohman', 'blackman', 'nuttall',
... | bsd-3-clause |
davidpng/FCS_Database | tests/test_ML_input_IO.py | 1 | 2316 | """
Test Merged Feature IO functions
"""
import logging
import warnings
from os import path
import datetime
import numpy as np
import pandas as pd
import pickle
from __init__ import TestBase, datadir, write_csv
from FlowAnal.Feature_IO import Feature_IO
from FlowAnal.MergedFeatures_IO import MergedFeatures_IO
from Fl... | gpl-3.0 |
tsarouch/python_minutes | exports/google_sheets.py | 2 | 2367 |
import pandas as pd
import numpy as np
import json
import gspread
from oauth2client.client import SignedJwtAssertionCredentials
class GoogleSheetExporter(object):
def __init__(self):
pass
def get_credentials(self, credentials_json):
json_key = json.load(open(credentials_json))
scope ... | gpl-2.0 |
MatthieuBizien/scikit-learn | sklearn/linear_model/ransac.py | 17 | 17164 | # coding: utf-8
# Author: Johannes Schönberger
#
# License: BSD 3 clause
import numpy as np
import warnings
from ..base import BaseEstimator, MetaEstimatorMixin, RegressorMixin, clone
from ..utils import check_random_state, check_array, check_consistent_length
from ..utils.random import sample_without_replacement
fr... | bsd-3-clause |
boomsbloom/dtm-fmri | DTM/for_gensim/lib/python2.7/site-packages/matplotlib/tests/test_colors.py | 3 | 20848 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
from matplotlib.externals import six
import itertools
from distutils.version import LooseVersion as V
from nose.tools import assert_raises, assert_equal, assert_true
import numpy as np
from numpy.testing.util... | mit |
AnasGhrab/scikit-learn | examples/plot_kernel_ridge_regression.py | 230 | 6222 | """
=============================================
Comparison of kernel ridge regression and SVR
=============================================
Both kernel ridge regression (KRR) and SVR learn a non-linear function by
employing the kernel trick, i.e., they learn a linear function in the space
induced by the respective k... | bsd-3-clause |
ishank08/scikit-learn | sklearn/neighbors/tests/test_kde.py | 26 | 5518 | import numpy as np
from sklearn.utils.testing import (assert_allclose, assert_raises,
assert_equal)
from sklearn.neighbors import KernelDensity, KDTree, NearestNeighbors
from sklearn.neighbors.ball_tree import kernel_norm
from sklearn.pipeline import make_pipeline
from sklearn.dataset... | bsd-3-clause |
jopohl/urh | src/urh/awre/Histogram.py | 1 | 4022 | from collections import defaultdict
import numpy as np
from urh.awre.CommonRange import CommonRange
from urh.cythonext import awre_util
class Histogram(object):
"""
Create a histogram based on the equalness of vectors
"""
def __init__(self, vectors, indices=None, normalize=True, debug=False):
... | gpl-3.0 |
Tong-Chen/scikit-learn | sklearn/neighbors/tests/test_nearest_centroid.py | 23 | 3120 | """
Testing for the nearest centroid module.
"""
import numpy as np
from scipy import sparse as sp
from numpy.testing import assert_array_equal
from numpy.testing import assert_equal
from sklearn.neighbors import NearestCentroid
from sklearn import datasets
from sklearn.metrics.pairwise import pairwise_distances
# t... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.