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 |
|---|---|---|---|---|---|
rvraghav93/scikit-learn | examples/ensemble/plot_gradient_boosting_regression.py | 58 | 2510 | """
============================
Gradient Boosting regression
============================
Demonstrate Gradient Boosting on the Boston housing dataset.
This example fits a Gradient Boosting model with least squares loss and
500 regression trees of depth 4.
"""
print(__doc__)
# Author: Peter Prettenhofer <peter.prett... | bsd-3-clause |
MartinDelzant/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 |
OSSHealth/ghdata | workers/insight_worker/insight_worker.py | 1 | 35224 | #SPDX-License-Identifier: MIT
from multiprocessing import Process, Queue
from urllib.parse import urlparse
import requests, sys
import pandas as pd
import sqlalchemy as s
from sqlalchemy.ext.automap import automap_base
from sqlalchemy import MetaData, and_
import statistics, logging, os, json, time
import numpy as np
i... | mit |
LeandroPessoa/pipelinecreator | pipelinecreator/share/doc/networkx-1.11/examples/graph/knuth_miles.py | 34 | 2952 | #!/usr/bin/env python
"""
An example using networkx.Graph().
miles_graph() returns an undirected graph over the 128 US cities from
the datafile miles_dat.txt. The cities each have location and population
data. The edges are labeled with the distance betwen the two cities.
This example is described in Section 1.1 in ... | gpl-3.0 |
cmu-db/cmdbac | analysis/cluster/cluster.py | 2 | 32869 | # -*- coding: utf-8 -*-
# @Author: Zeyuan Shang
# @Date: 2016-07-20 01:09:51
# @Last Modified by: Zeyuan Shang
# @Last Modified time: 2016-10-20 01:39:45
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
... | apache-2.0 |
peter-kiechle/tactile-sensors | python/classification/predict_boost_python.py | 1 | 5404 | # -*- coding: utf-8 -*-
import os, inspect
import cairo
from PIL import Image
import numpy as np
from sklearn.externals import joblib
def show_image(imagefile, prediction_label, score_str):
# Byte-order
# PIL: RGBA
# Cairo: ARGB (... | gpl-3.0 |
oche-jay/vEQ-benchmark | vEQ_ssim/vEQ_ssim.py | 1 | 17701 | '''
Created on 1 Jul 2015
@author: oche
'''
from __future__ import unicode_literals
import sys
import argparse
import os
import logging
import traceback
from util import validURLMatch, validYoutubeURLMatch
import subprocess
from subprocess import Popen
import re
from os.path import expanduser
from youtube_dl.utils im... | gpl-2.0 |
ifuding/Kaggle | TCCC/Code/philly/PoolGRU.py | 1 | 10263 | import numpy as np
import pandas as pd
import sklearn
import tensorflow as tf
from sklearn import feature_extraction, ensemble, decomposition, pipeline
from sklearn.model_selection import KFold
# from textblob import TextBlob
from nfold_train import nfold_train, models_eval
import time
from time import gmtime, strftime... | apache-2.0 |
TMiguelT/PandasSchema | test/test_column.py | 1 | 2051 | import unittest
import pandas as pd
from pandas_schema import Column
from pandas_schema.validation import CanConvertValidation, LeadingWhitespaceValidation, TrailingWhitespaceValidation
class SingleValidationColumn(unittest.TestCase):
"""
Test a column with one single validation
"""
NAME = 'col1'
... | gpl-3.0 |
cl4rke/scikit-learn | examples/semi_supervised/plot_label_propagation_digits.py | 268 | 2723 | """
===================================================
Label Propagation digits: Demonstrating performance
===================================================
This example demonstrates the power of semisupervised learning by
training a Label Spreading model to classify handwritten digits
with sets of very few labels.... | bsd-3-clause |
QuLogic/cartopy | lib/cartopy/mpl/clip_path.py | 2 | 2441 | # Copyright Cartopy Contributors
#
# This file is part of Cartopy and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
import warnings
import matplotlib.path as mpath
import numpy as np
def intersection_point(p0, p1, p2, p3):
"""
... | lgpl-3.0 |
lenovor/scikit-learn | sklearn/tests/test_grid_search.py | 68 | 28778 | """
Testing for grid search module (sklearn.grid_search)
"""
from collections import Iterable, Sized
from sklearn.externals.six.moves import cStringIO as StringIO
from sklearn.externals.six.moves import xrange
from itertools import chain, product
import pickle
import sys
import numpy as np
import scipy.sparse as sp
... | bsd-3-clause |
raphaelvalentin/qtlayout | syntax/interpolate/plotting/xyplot31.py | 1 | 5961 | from libarray import shape
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
from matplotlib.figure import SubplotParams
from matplotlib.ticker import MaxNLocator
from os.path import isfile
class plot(object):
def __init__(self, **kwargs):
self.dpi = kwargs.get('dpi', 100)
... | gpl-2.0 |
endlessm/chromium-browser | tools/perf/experimental/representative_perf_test_limit_adjuster/adjust_upper_limits.py | 1 | 6824 | # 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.
from __future__ import print_function
import json
import os
import sys
import shutil
import subprocess
import tempfile
CHROMIUM_PATH = os.path.join(os.path... | bsd-3-clause |
manipopopo/tensorflow | tensorflow/contrib/metrics/python/ops/metric_ops.py | 5 | 176655 | # 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 |
linearregression/airflow | airflow/hooks/hive_hooks.py | 1 | 13958 | import csv
import logging
import subprocess
from tempfile import NamedTemporaryFile
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from hive_service import ThriftHive
import pyhs2
from airflow.utils import AirflowException
from airflow.hooks.b... | apache-2.0 |
aabadie/scikit-learn | examples/cluster/plot_mean_shift.py | 351 | 1793 | """
=============================================
A demo of the mean-shift clustering algorithm
=============================================
Reference:
Dorin Comaniciu and Peter Meer, "Mean Shift: A robust approach toward
feature space analysis". IEEE Transactions on Pattern Analysis and
Machine Intelligence. 2002. ... | bsd-3-clause |
richardwolny/sms-tools | lectures/09-Sound-description/plots-code/centroid.py | 23 | 1086 | import numpy as np
import matplotlib.pyplot as plt
import essentia.standard as ess
M = 1024
N = 1024
H = 512
fs = 44100
spectrum = ess.Spectrum(size=N)
window = ess.Windowing(size=M, type='hann')
centroid = ess.Centroid(range=fs/2.0)
x = ess.MonoLoader(filename = '../../../sounds/speech-male.wav', sampleRate = fs)()
c... | agpl-3.0 |
torbjoernk/pySDC | examples/spiraling_particle/playground.py | 2 | 3840 | from __future__ import division
from subprocess import call
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
from pySDC import CollocationClasses as collclass
from examples.spiraling_particle.ProblemClass import planewave_single
from pySDC.datatype_classes.particles import particles, field... | bsd-2-clause |
rseubert/scikit-learn | examples/linear_model/plot_ransac.py | 250 | 1673 | """
===========================================
Robust linear model estimation using RANSAC
===========================================
In this example we see how to robustly fit a linear model to faulty data using
the RANSAC algorithm.
"""
import numpy as np
from matplotlib import pyplot as plt
from sklearn import ... | bsd-3-clause |
goodfeli/pylearn2 | pylearn2/train_extensions/roc_auc.py | 15 | 4888 | """
TrainExtension subclass for calculating ROC AUC scores on monitoring
dataset(s), reported via monitor channels.
"""
__author__ = "Steven Kearnes"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "3-clause BSD"
__maintainer__ = "Steven Kearnes"
import numpy as np
try:
from sklearn.metrics im... | bsd-3-clause |
yavalvas/yav_com | build/matplotlib/lib/mpl_examples/animation/bayes_update.py | 7 | 1478 | # update a distribution based on new data.
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as ss
from matplotlib.animation import FuncAnimation
class UpdateDist(object):
def __init__(self, ax, prob=0.5):
self.success = 0
self.prob = prob
self.line, = ax.plot([], [], 'k... | mit |
junwucs/h2o-3 | h2o-py/tests/testdir_algos/deeplearning/pyunit_anomaly_largeDeepLearning.py | 5 | 1565 | import sys
sys.path.insert(1,"../../../")
import h2o, tests
def anomaly():
print "Deep Learning Anomaly Detection MNIST"
train = h2o.import_file(h2o.locate("bigdata/laptop/mnist/train.csv.gz"))
test = h2o.import_file(h2o.locate("bigdata/laptop/mnist/test.csv.gz"))
predictors = range(0,784)
... | apache-2.0 |
pianomania/scikit-learn | examples/cluster/plot_dict_face_patches.py | 337 | 2747 | """
Online learning of a dictionary of parts of faces
==================================================
This example uses a large dataset of faces to learn a set of 20 x 20
images patches that constitute faces.
From the programming standpoint, it is interesting because it shows how
to use the online API of the sciki... | bsd-3-clause |
xuewei4d/scikit-learn | sklearn/__check_build/__init__.py | 57 | 1681 | """ Module to give helpful messages to the user that did not
compile scikit-learn properly.
"""
import os
INPLACE_MSG = """
It appears that you are importing a local scikit-learn source tree. For
this, you need to have an inplace install. Maybe you are in the source
directory and you need to try from another location.... | bsd-3-clause |
jjx02230808/project0223 | sklearn/gaussian_process/gaussian_process.py | 17 | 34896 | # -*- coding: utf-8 -*-
# Author: Vincent Dubourg <vincent.dubourg@gmail.com>
# (mostly translation, see implementation details)
# Licence: 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 |
lcy-seso/Paddle | python/paddle/v2/dataset/uci_housing.py | 7 | 4064 | # Copyright (c) 2016 PaddlePaddle 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 applic... | apache-2.0 |
vshtanko/scikit-learn | examples/feature_stacker.py | 246 | 1906 | """
=================================================
Concatenating multiple feature extraction methods
=================================================
In many real-world examples, there are many ways to extract features from a
dataset. Often it is beneficial to combine several methods to obtain good
performance. Th... | bsd-3-clause |
sofiane87/lasagne-GAN | bigan/bigan_root.py | 1 | 18323 | from __future__ import print_function
from keras.datasets import mnist
from keras.layers import Input, Dense, Reshape, Flatten, Dropout, multiply, GaussianNoise
from keras.layers import BatchNormalization, Activation, Embedding, ZeroPadding2D
from keras.layers import MaxPooling2D, concatenate
from keras.layers.advance... | mit |
mbayon/TFG-MachineLearning | vbig/lib/python2.7/site-packages/pandas/io/json/json.py | 6 | 24553 | # pylint: disable-msg=E1101,W0613,W0603
import os
import numpy as np
import pandas._libs.json as json
from pandas._libs.tslib import iNaT
from pandas.compat import StringIO, long, u
from pandas import compat, isnull
from pandas import Series, DataFrame, to_datetime, MultiIndex
from pandas.io.common import get_filepath... | mit |
ivandga/sportspassCourses | write_sportspass_angebot_sqlite.py | 1 | 2042 | import sqlite3
import os
import time
import datetime
import random
import matplotlib.pylab as plt
import read_line_angebot as rla
import scrap_sportspass_htmlsource as ssss
"""
2017.05.13 - ivandga
From the .txt file of the scrapped data,
creates a sqlite database
--
"""
def create_table(cursor):
... | mit |
kdebrab/pandas | asv_bench/benchmarks/categoricals.py | 2 | 6555 | import warnings
import numpy as np
import pandas as pd
import pandas.util.testing as tm
try:
from pandas.api.types import union_categoricals
except ImportError:
try:
from pandas.types.concat import union_categoricals
except ImportError:
pass
from .pandas_vb_common import setup # noqa
cla... | bsd-3-clause |
JosmanPS/scikit-learn | sklearn/__check_build/__init__.py | 345 | 1671 | """ Module to give helpful messages to the user that did not
compile the scikit properly.
"""
import os
INPLACE_MSG = """
It appears that you are importing a local scikit-learn source tree. For
this, you need to have an inplace install. Maybe you are in the source
directory and you need to try from another location.""... | bsd-3-clause |
Ziqi-Li/bknqgis | geopandas/geopandas/tests/test_geocode.py | 2 | 5056 | from __future__ import absolute_import
from fiona.crs import from_epsg
import pandas as pd
import pandas.util.testing as tm
from shapely.geometry import Point
import geopandas as gpd
import pytest
from geopandas import GeoSeries
from geopandas.tools import geocode, reverse_geocode
from geopandas.tools.geocoding impor... | gpl-2.0 |
ML-KULeuven/socceraction | tests/spadl/test_wyscout.py | 1 | 7607 | import os
import pandas as pd
from socceraction.spadl import config as spadl
from socceraction.spadl import wyscout as wy
from socceraction.spadl.base import SPADLSchema
from socceraction.spadl.wyscout import (
WyscoutCompetitionSchema,
WyscoutEventSchema,
WyscoutGameSchema,
WyscoutPlayerSchema,
W... | mit |
preinh/gmpe-smtk | smtk/trellis/trellis_plots.py | 1 | 30457 | #!/usr/bin/env/python
# LICENSE
#
# Copyright (c) 2010-2014, GEM Foundation, G. Weatherill, M. Pagani,
# D. Monelli.
#
# The Hazard Modeller's Toolkit is free software: you can redistribute
# it and/or modify it under the terms of the GNU Affero General Public
# License as published by the Free Software Foundation, eit... | agpl-3.0 |
brodoll/sms-tools | lectures/08-Sound-transformations/plots-code/sineModelTimeScale-functions.py | 24 | 2725 | import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import hamming, hanning, triang, blackmanharris, resample
from scipy.fftpack import fft, ifft, fftshift
import sys, os, functools, time, math
from scipy.interpolate import interp1d
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__... | agpl-3.0 |
MohammedWasim/scikit-learn | examples/exercises/plot_cv_digits.py | 232 | 1206 | """
=============================================
Cross-validation on Digits Dataset Exercise
=============================================
A tutorial exercise using Cross-validation with an SVM on the Digits dataset.
This exercise is used in the :ref:`cv_generators_tut` part of the
:ref:`model_selection_tut` section... | bsd-3-clause |
chuckgu/Alphabeta | tensorflow/Xproject_tf.py | 1 | 18742 | # -*- coding: utf-8 -*-
import os
import time
import pandas as pd
import numpy as np
from nltk.tokenize import sent_tokenize,word_tokenize
#from keras.utils import np_utils
import cPickle
#import tensorflow.python.platform
import tensorflow as tf
from tensorflow.models.rnn import rnn_cell
from konlpy.tag import Twit... | gpl-3.0 |
mhostetter/gnuradio | gr-utils/python/utils/plot_data.py | 59 | 5818 | #
# Copyright 2007,2008,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# any later ve... | gpl-3.0 |
MVilstrup/simple_neural_network | python/test_adaline_clear_data.py | 1 | 2264 | import pandas as pd
import matplotlib.pyplot as plt
from evaluate import plot_decision_regions
from time import sleep
import numpy as np
from classifier import Adaline
# The data downloaded is the classical example of iris flower calssification
data_file = pd.read_csv('https://archive.ics.uci.edu/ml/machine-learning-d... | mit |
ekansa/open-context-jupyter | opencontext/api.py | 1 | 28345 | import codecs
import copy
import hashlib
import json
import os
import requests
import numpy as numpy
import pandas as pd
from datetime import date
from slugify import slugify
from time import sleep
class OpenContextAPI():
''' Interacts with the Open Context API
to get lists of records for analysis
... | mit |
MattNolanLab/ei-attractor | grid_cell_model/simulations/007_noise/figures/cosyne2015-poster/config.py | 1 | 5110 | '''Configuration file for the FENS2014 poster figures.'''
from __future__ import absolute_import, print_function
import matplotlib.ticker as ti
scale_factor = 2.5
tick_width = 1. * scale_factor
tick_len = 6. * scale_factor
def get_config():
return _config
_config = {
'scale_factor': scale_factor,
#... | gpl-3.0 |
justincassidy/scikit-learn | examples/neighbors/plot_approximate_nearest_neighbors_scalability.py | 225 | 5719 | """
============================================
Scalability of Approximate Nearest Neighbors
============================================
This example studies the scalability profile of approximate 10-neighbors
queries using the LSHForest with ``n_estimators=20`` and ``n_candidates=200``
when varying the number of sa... | bsd-3-clause |
boomsbloom/dtm-fmri | DTM/for_gensim/lib/python2.7/site-packages/sklearn/tree/export.py | 35 | 16873 | """
This module defines export functions for decision trees.
"""
# Authors: Gilles Louppe <g.louppe@gmail.com>
# Peter Prettenhofer <peter.prettenhofer@gmail.com>
# Brian Holt <bdholt1@gmail.com>
# Noel Dawe <noel@dawe.me>
# Satrajit Gosh <satrajit.ghosh@gmail.com>
# Trevor... | mit |
ouening/python-code | python2/basemap绘制中国省份.py | 1 | 1383 |
#-*- coding: utf-8 -*-
import time
start = time.clock()
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from matplotlib.patches import Polygon
fig = plt.figure()
ax1 = fig.add_axes([0.1,0.1,0.8,0.8])
bmap = Basemap(llcrnrlon=87.33,
llcrnrla... | mit |
animeshkuzur/Web-Mapping | display.py | 1 | 1946 | import networkx as nx
import matplotlib.pyplot as plt
import MySQLdb
def add_nodes():
nodes = set()
conn = MySQLdb.connect("localhost","root","password","database")
c = conn.cursor()
r = c.execute("""SELECT id FROM dump""")
for row in c.fetchall():
nodes.add(row[0])
c.close()
return nodes
def add_edges(... | mit |
anaderi/lhcb_trigger_ml | hep_ml/experiments/categorical.py | 1 | 15745 | from __future__ import division, print_function, absolute_import
from hep_ml.commonutils import check_sample_weight, check_arrays
from hep_ml.experiments import fasttree
import numpy
from sklearn.base import BaseEstimator, RegressorMixin, ClassifierMixin
from collections import OrderedDict
from hep_ml.losses import Bin... | mit |
mjgrav2001/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 |
fabioticconi/scikit-learn | examples/preprocessing/plot_robust_scaling.py | 85 | 2698 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Robust Scaling on Toy Data
=========================================================
Making sure that each Feature has approximately the same scale can be a
crucial preprocessing step. However, when data contains o... | bsd-3-clause |
kashif/scikit-learn | sklearn/feature_selection/tests/test_base.py | 143 | 3670 | import numpy as np
from scipy import sparse as sp
from nose.tools import assert_raises, assert_equal
from numpy.testing import assert_array_equal
from sklearn.base import BaseEstimator
from sklearn.feature_selection.base import SelectorMixin
from sklearn.utils import check_array
class StepSelector(SelectorMixin, Ba... | bsd-3-clause |
andnovar/ggplot | ggplot/stats/stat_density.py | 12 | 1690 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
import pandas as pd
from scipy.stats import gaussian_kde
from ggplot.utils import make_iterable_ntimes
from ggplot.utils.exceptions import GgplotError
from .stat import stat
# TODO: switch t... | bsd-2-clause |
kaichogami/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 |
Eric-Gaudiello/tensorflow_dev | tensorflow_home/tensorflow_venv/lib/python3.4/site-packages/numpy/core/function_base.py | 41 | 6518 | from __future__ import division, absolute_import, print_function
__all__ = ['logspace', 'linspace']
from . import numeric as _nx
from .numeric import result_type, NaN
def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None):
"""
Return evenly spaced numbers over a specified interval.
... | gpl-3.0 |
winklerand/pandas | pandas/core/indexes/multi.py | 1 | 100793 |
# pylint: disable=E1101,E1103,W0232
import datetime
import warnings
from sys import getsizeof
import numpy as np
from pandas._libs import index as libindex, lib, Timestamp
from pandas.compat import range, zip, lrange, lzip, map
from pandas.compat.numpy import function as nv
from pandas import compat
from pandas.cor... | bsd-3-clause |
kekraft/golden_eye | src/pong_vision/src/circle_detection.py | 1 | 3233 | #!/usr/bin/env python
import sys
import cv2
import numpy as np
import matplotlib.pyplot as plt
import copy
import sift
class Circle_Detect:
def __init__(self, image):
self.image = image
self.dp = 1
self.minDist = 20
self.param1 = 50
self.param2 = 30
self.minRad... | bsd-2-clause |
alexis-roche/nipy | examples/labs/need_data/tmin_statistic.py | 4 | 4041 | #!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import print_function
__doc__ = """
Example where the result of the min of two contrasts is computed and displayed.
This is based on the Localizer dataset, in which we ... | bsd-3-clause |
cgre-aachen/gempy | gempy/utils/geogrid.py | 1 | 25931 | '''Module with classes and methods to analyse and process exported geomodel grids
Created on 21/03/2014
@author: Florian Wellmann (some parts originally developed by Erik Schaeffer)
'''
import numpy as np
#import pynoddy
import subprocess
import os.path
import platform
try:
import matplotlib.pyplot as plt
except I... | lgpl-3.0 |
richardseifert/Hydra_pipeline | libs/extract.py | 1 | 8713 | import numpy as np
import matplotlib.pyplot as plt
plt.ion()
from fitstools import mask_fits, row_avg, manage_dtype, common_header, pad_array, display
from spectra import spectrum, interp_add, rmean_spectra, scale_spectra
from astropy.io import fits
class fibers:
def __init__(self, init_spectra={}, init_header=Non... | mit |
rajat1994/scikit-learn | benchmarks/bench_covertype.py | 154 | 7296 | """
===========================
Covertype dataset benchmark
===========================
Benchmark stochastic gradient descent (SGD), Liblinear, and Naive Bayes, CART
(decision tree), RandomForest and Extra-Trees on the forest covertype dataset
of Blackard, Jock, and Dean [1]. The dataset comprises 581,012 samples. It ... | bsd-3-clause |
billy-inn/scikit-learn | sklearn/ensemble/gradient_boosting.py | 126 | 65552 | """Gradient Boosted Regression Trees
This module contains methods for fitting gradient boosted regression trees for
both classification and regression.
The module structure is the following:
- The ``BaseGradientBoosting`` base class implements a common ``fit`` method
for all the estimators in the module. Regressio... | bsd-3-clause |
michaelerule/neurotools | graphics/matplotlib.py | 1 | 2744 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
from __future__ import absolute_import
from __future__ import with_statement
from __future__ import division
from __future__ import print_function
'''
Collected utilities for direct pixel rendering via matplotlib
It is difficult to write pixels directly in python.
One trick ... | gpl-3.0 |
cameronlai/ml-class-python | solutions/ex7/ex7_sklearn.py | 1 | 4371 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import matplotlib.cm as cm
import scipy.io as sio
from sklearn.cluster import KMeans
from ex7 import findClosestCentroids, computeCentroids
from ex7_utility import plotProgresskMeans
## Machine Learning Online Class - Exercise 7: Princ... | mit |
Gadal/sympy | sympy/interactive/printing.py | 31 | 15830 | """Tools for setting up printing in interactive sessions. """
from __future__ import print_function, division
import sys
from distutils.version import LooseVersion as V
from io import BytesIO
from sympy import latex as default_latex
from sympy import preview
from sympy.core.compatibility import integer_types
from sy... | bsd-3-clause |
Sentient07/scikit-learn | sklearn/covariance/tests/test_graph_lasso.py | 33 | 6157 | """ 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.utils.testing import assert_warns_message
from sklearn.covariance import (graph_lasso, GraphLasso, G... | bsd-3-clause |
PMBio/mtSet | mtSet/pycore/utils/preprocessCore.py | 1 | 11617 | import sys
sys.path.append('./../../..')
import matplotlib
matplotlib.use('PDF')
import pylab as PL
import os
import subprocess
import pdb
import sys
import numpy as NP
import numpy.linalg as LA
from optparse import OptionParser
import time
import mtSet.pycore.modules.multiTraitSetTest as MTST
from mtSet.pycore.utils.r... | apache-2.0 |
bloyl/mne-python | tutorials/epochs/30_epochs_metadata.py | 10 | 7730 | """
.. _tut-epochs-metadata:
Working with Epoch metadata
===========================
This tutorial shows how to add metadata to `~mne.Epochs` objects, and
how to use :ref:`Pandas query strings <pandas:indexing.query>` to select and
plot epochs based on metadata properties.
For this tutorial we'll use a different dat... | bsd-3-clause |
dhruv13J/scikit-learn | benchmarks/bench_plot_neighbors.py | 287 | 6433 | """
Plot the scaling of the nearest neighbors algorithms with k, D, and N
"""
from time import time
import numpy as np
import pylab as pl
from matplotlib import ticker
from sklearn import neighbors, datasets
def get_data(N, D, dataset='dense'):
if dataset == 'dense':
np.random.seed(0)
return np.... | bsd-3-clause |
aphearin/AstroHackWeek2015 | day3-machine-learning/solutions/linear_models.py | 14 | 1188 | from pprint import pprint
from sklearn.grid_search import GridSearchCV
from sklearn.datasets import load_digits
from sklearn.cross_validation import train_test_split
from sklearn.svm import LinearSVC
digits = load_digits()
X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target % 2)
grid = Gri... | gpl-2.0 |
kaichogami/scikit-learn | sklearn/tests/test_calibration.py | 62 | 12288 | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# License: BSD 3 clause
import numpy as np
from scipy import sparse
from sklearn.utils.testing import (assert_array_almost_equal, assert_equal,
assert_greater, assert_almost_equal,
... | bsd-3-clause |
a113n/bcbio-nextgen | bcbio/heterogeneity/loh.py | 2 | 15794 | """Summarize amplification and loss of heterozygosity (LOH) from heterogeneity callers.
Provides high level summaries of calls in regions of interest.
"""
import csv
import collections
import os
import decimal
import uuid
import pandas as pd
import six
from six import StringIO
import toolz as tz
import yaml
from bcb... | mit |
f3r/scikit-learn | examples/feature_selection/plot_feature_selection.py | 95 | 2847 | """
===============================
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 |
Nyker510/scikit-learn | examples/cluster/plot_color_quantization.py | 297 | 3443 | # -*- coding: utf-8 -*-
"""
==================================
Color Quantization using K-Means
==================================
Performs a pixel-wise Vector Quantization (VQ) of an image of the summer palace
(China), reducing the number of colors required to show the image from 96,615
unique colors to 64, while pre... | bsd-3-clause |
scienceopen/dmcutils | tests/TestHDF5writeRace.py | 1 | 1108 | #!/usr/bin/env python
"""
testing possible pytables vs h5py race on write/append
"""
from tempfile import mkstemp
from pathlib import Path
import h5py
from pandas import Series
import numpy as np
def test_h5race(outfn: Path, N: int):
assert isinstance(N, int)
ticks = np.random.randint(0, N, N)
flist = [P... | gpl-3.0 |
soravux/pms | pms.py | 1 | 7603 | #!/usr/bin/env python
import argparse
import json
import pickle
import numpy as np
from scipy.misc import imread
from scipy import sparse
from scipy import optimize
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import mesh
def getImage(filename):
"""Open image file in greyscale m... | mit |
kashif/scikit-learn | sklearn/cross_decomposition/tests/test_pls.py | 42 | 14316 | import numpy as np
from sklearn.utils.testing import (assert_array_almost_equal,
assert_array_equal, assert_true,
assert_raise_message)
from sklearn.datasets import load_linnerud
from sklearn.cross_decomposition import pls_, CCA
from nose.tools impor... | bsd-3-clause |
phdowling/scikit-learn | examples/text/document_clustering.py | 230 | 8356 | """
=======================================
Clustering text documents using k-means
=======================================
This is an example showing how the scikit-learn can be used to cluster
documents by topics using a bag-of-words approach. This example uses
a scipy.sparse matrix to store the features instead of ... | bsd-3-clause |
ericmjl/bokeh | examples/models/file/trail.py | 1 | 4605 | from math import atan2, cos, radians, sin, sqrt
import numpy as np
import scipy.ndimage as im
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.models import (Column, ColumnDataSource, GMapOptions, GMapPlot,
Grid, Label, Line, LinearAxis, PanTool, Patches,
... | bsd-3-clause |
jdhp-sap/sap-cta-data-pipeline | utils/plot_execution_time_boxplot2.py | 2 | 4275 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Make statistics on score files (stored in JSON files).
"""
import common_functions as common
import argparse
import json
import os
import matplotlib.pyplot as plt
import numpy as np
def extract_data_list(json_dict, key, exclude_aborted, aborted_only):
io_list... | mit |
Mctigger/KagglePlanetPytorch | nn_semisupervised_resnet_18.py | 1 | 5877 | import os
import sys
from itertools import chain
import numpy as np
import pandas as pd
import torchvision.models
import torch.nn.functional as F
import torch.optim as optim
from torch import nn
from torch.utils.data import DataLoader
from torchsample.callbacks import CSVLogger, LearningRateScheduler
from callbacks... | mit |
RTHMaK/RPGOne | scipy-2017-sklearn-master/notebooks/figures/plot_rbf_svm_parameters.py | 19 | 2018 | import matplotlib.pyplot as plt
import numpy as np
from sklearn.svm import SVC
from sklearn.datasets import make_blobs
from .plot_2d_separator import plot_2d_separator
def make_handcrafted_dataset():
# a carefully hand-designed dataset lol
X, y = make_blobs(centers=2, random_state=4, n_samples=30)
y[np.ar... | apache-2.0 |
RachitKansal/scikit-learn | sklearn/cluster/birch.py | 207 | 22706 | # Authors: Manoj Kumar <manojkumarsivaraj334@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Joel Nothman <joel.nothman@gmail.com>
# License: BSD 3 clause
from __future__ import division
import warnings
import numpy as np
from scipy import sparse
from math import sqrt
fro... | bsd-3-clause |
glouppe/scikit-learn | examples/svm/plot_oneclass.py | 80 | 2338 | """
==========================================
One-class SVM with non-linear kernel (RBF)
==========================================
An example using a one-class SVM for novelty detection.
:ref:`One-class SVM <svm_outlier_detection>` is an unsupervised
algorithm that learns a decision function for novelty detection:
... | bsd-3-clause |
jreback/pandas | pandas/tests/plotting/test_style.py | 6 | 5203 | import pytest
from pandas import Series
pytest.importorskip("matplotlib")
from pandas.plotting._matplotlib.style import get_standard_colors
pytestmark = pytest.mark.slow
class TestGetStandardColors:
@pytest.mark.parametrize(
"num_colors, expected",
[
(3, ["red", "green", "blue"]),
... | bsd-3-clause |
jseabold/statsmodels | statsmodels/tsa/regime_switching/tests/test_markov_switching.py | 5 | 12243 | """
General tests for Markov switching models
Author: Chad Fulton
License: BSD-3
"""
import numpy as np
from numpy.testing import assert_equal, assert_allclose, assert_raises
import pandas as pd
from statsmodels.tools.numdiff import approx_fprime_cs
from statsmodels.tsa.regime_switching import markov_switching
def... | bsd-3-clause |
mbrucher/AudioTK | tests/Python/Preamplifier/PyATKPreamplifier_tube2_filter_test.py | 1 | 5968 | #!/usr/bin/env python
from ATK.Core import DoubleInPointerFilter, DoubleOutPointerFilter
from ATK.Tools import DoubleOversampling6points5order_32Filter, DoubleOversampling6points5order_16Filter, DoubleOversampling6points5order_8Filter, DoubleOversampling6points5order_4Filter, DoubleDecimationFilter
from ATK.EQ import ... | bsd-3-clause |
jqmviegas/jqm_cvi | tests/cvi_dev.py | 1 | 1675 | #! D:\Anaconda3
# -*- coding: utf-8 -*-
__author__ = "Joaquim Viegas"
#==============================================================================
# Description
#==============================================================================
import jqmcvi.basec as jqmcvi
import jqmcvi.base as jqmcvin
... | mit |
pyro-ppl/numpyro | examples/hmcecs.py | 1 | 5870 | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
"""
Example: Hamiltonian Monte Carlo with Energy Conserving Subsampling
===================================================================
This example illustrates the use of data subsampling in HMC using Energy Conserving Subsamplin... | apache-2.0 |
brentp/crystal | doc/source/conf.py | 2 | 8875 | # -*- coding: utf-8 -*-
#
# crystal documentation build configuration file, created by
# sphinx-quickstart on Mon Sep 8 11:12:44 2014.
#
# 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.
#
# A... | mit |
richardwolny/sms-tools | lectures/03-Fourier-properties/plots-code/linearity.py | 26 | 1183 | import matplotlib.pyplot as plt
import numpy as np
from scipy.io.wavfile import read
from scipy.fftpack import fft, ifft
a = 0.5
b = 1.0
k1 = 20
k2 = 25
N = 128
x1 = a*np.exp(1j*2*np.pi*k1/N*np.arange(N))
x2 = b*np.exp(1j*2*np.pi*k2/N*np.arange(N))
plt.figure(1, figsize=(9.5, 7))
plt.subplot(321)
plt.title('x1 (amp=.... | agpl-3.0 |
ebernhardson/l2r | code/feature_distance.py | 1 | 5217 | # -*- coding: utf-8 -*-
"""
@author: Chenglong Chen <c.chenglong@gmail.com>
@brief: distance features
"""
import re
import sys
import string
import numpy as np
import pandas as pd
import config
from utils import dist_utils, ngram_utils, nlp_utils
from utils import logging_utils, time_utils, table_utils
from feature... | mit |
pompiduskus/scikit-learn | sklearn/cluster/setup.py | 263 | 1449 | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD 3 clause
import os
from os.path import join
import numpy
from sklearn._build_utils import get_blas_info
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
cblas_libs, blas_info = ... | bsd-3-clause |
andyraib/data-storage | python_scripts/env/lib/python3.6/site-packages/pandas/stats/tests/test_ols.py | 7 | 37033 | """
Unit test suite for OLS and PanelOLS classes
"""
# pylint: disable-msg=W0212
# flake8: noqa
from __future__ import division
from datetime import datetime
from pandas import compat
from distutils.version import LooseVersion
import nose
import numpy as np
from pandas import date_range, bdate_range
from pandas.co... | apache-2.0 |
dursk/pyfolio | pyfolio/tests/test_pos.py | 5 | 4028 | from unittest import TestCase
from collections import OrderedDict
from pandas import (
Series,
DataFrame,
date_range,
Timestamp
)
from pandas.util.testing import (assert_frame_equal,
assert_series_equal)
from numpy import (
absolute,
arange,
zeros_like,
)
f... | apache-2.0 |
pulinagrawal/nupic | src/nupic/research/monitor_mixin/plot.py | 20 | 5229 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2014-2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This p... | agpl-3.0 |
lbdreyer/iris | docs/iris/gallery_tests/gallerytest_util.py | 3 | 2503 | # Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""
Provides context managers which are fundamental to the ability
to run the gallery tests.
"""
import contextlib
import os... | lgpl-3.0 |
gramhagen/ml-toolbox | misc/tools.py | 2 | 6650 | import pandas as pd
import psutil
from sklearn import metrics
from subprocess import Popen, PIPE
import time
def benchmark(cmd, step=0.5, print_results=False):
""" capture memory and timing benchmarks
Args:
cmd (str): shell string to execute
step (float): amount of time in seconds to wait bet... | mit |
kdaily/altanalyze | misopy/sashimi_plot/plot_utils/plot_gene.py | 1 | 29067 | ##
## Draw gene structure from a GFF file
##
import os, sys, operator, subprocess
import math
import pysam
import glob
from pylab import *
from matplotlib.patches import PathPatch
from matplotlib.path import Path
import misopy
import misopy.gff_utils as gff_utils
import misopy.sam_utils as sam_utils
from misopy.sash... | apache-2.0 |
sherazkasi/SabreSoftware | Lib/site-packages/scipy/signal/waveforms.py | 55 | 11609 | # Author: Travis Oliphant
# 2003
#
# Feb. 2010: Updated by Warren Weckesser:
# Rewrote much of chirp()
# Added sweep_poly()
from numpy import asarray, zeros, place, nan, mod, pi, extract, log, sqrt, \
exp, cos, sin, polyval, polyint
def sawtooth(t, width=1):
"""
Return a periodic sawtooth waveform.
... | gpl-3.0 |
ricorx7/donkey | config.py | 1 | 3102 | """
CAR CONFIG
This file is read by your car application's manage.py script to change the car
performance.
EXAMPLE
-----------
import dk
cfg = dk.load_config(config_path='~/d2/config.py')
print(cfg.CAMERA_RESOLUTION)
"""
import os
#PATHS
CAR_PATH = PACKAGE_PATH = os.path.dirname(os.path.realpath(__file__))
DATA_P... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.