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 |
|---|---|---|---|---|---|
loli/sklearn-ensembletrees | sklearn/metrics/tests/test_score_objects.py | 5 | 8592 | import pickle
import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_raises_regexp
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import ignore_warnings
from sklearn.metrics import (f1... | bsd-3-clause |
assad2012/ggplot | ggplot/tests/test_basic.py | 12 | 9308 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
from six.moves import xrange
from nose.tools import assert_equal, assert_true, assert_raises
from . import get_assert_same_ggplot, cleanup
assert_same_ggplot = get_assert_same_ggplot(__file__)
from ggplot im... | bsd-2-clause |
kaichogami/scikit-learn | sklearn/utils/tests/test_linear_assignment.py | 421 | 1349 | # Author: Brian M. Clapper, G Varoquaux
# License: BSD
import numpy as np
# XXX we should be testing the public API here
from sklearn.utils.linear_assignment_ import _hungarian
def test_hungarian():
matrices = [
# Square
([[400, 150, 400],
[400, 450, 600],
[300, 225, 300]],
... | bsd-3-clause |
elin-moco/metrics | metrics/mocotw/views.py | 1 | 2772 | """Example views. Feel free to delete this app."""
import json
import logging
from django.http import HttpResponse
import pandas as pd
import numpy as np
from django.shortcuts import render
import commonware
from django.template.loader import render_to_string
from datetime import datetime
log = commonware.log.getLog... | bsd-3-clause |
pv/scikit-learn | examples/linear_model/plot_sgd_weighted_samples.py | 344 | 1458 | """
=====================
SGD: Weighted samples
=====================
Plot decision function of a weighted dataset, where the size of points
is proportional to its weight.
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model
# we create 20 points
np.random.seed(0)
X ... | bsd-3-clause |
srio/shadow3-scripts | COMSOL/test1.py | 1 | 2706 |
# https://numerical-analysis.readthedocs.io/en/latest/Interpolation/2D_Interpolation.html
# Setup
# %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
params = {'font.size' : 14,
'figure.figsize':(15.0, 8.0),
'lines.linewidth': 2.,
'lines.marke... | mit |
CodeFanatic23/newsBehavior | quick_scraper.py | 1 | 3846 | import scrapy
from bs4 import BeautifulSoup
import sys
import os
import _pickle as pickle
import pandas as pd
from .scrape_with_bs4 import *
import datetime
class ContentSpider(scrapy.Spider):
name = "yolo"
handle_httpstatus_list = [i for i in range(100,999) if i!=200]
BASE_PATH = os.path.dirname(os.path.a... | mit |
gnieboer/tensorflow | tensorflow/contrib/learn/python/learn/tests/dataframe/dataframe_test.py | 62 | 3753 | # 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 |
ryanpdwyer/teensyio | teensyio/__init__.py | 1 | 7217 | # -*- coding: utf-8 -*-
"""
============================
teensyio
============================
"""
import matplotlib as mpl
mpl.use('Qt4Agg')
import socket
import serial
import io
import matplotlib.pyplot as plt
from matplotlib import animation
import numpy as np
from serial.tools.list_ports import comports
import ti... | mit |
bikong2/scikit-learn | sklearn/feature_extraction/hashing.py | 183 | 6155 | # Author: Lars Buitinck <L.J.Buitinck@uva.nl>
# License: BSD 3 clause
import numbers
import numpy as np
import scipy.sparse as sp
from . import _hashing
from ..base import BaseEstimator, TransformerMixin
def _iteritems(d):
"""Like d.iteritems, but accepts any collections.Mapping."""
return d.iteritems() if... | bsd-3-clause |
wattlebird/pystruct | examples/plot_ssvm_objective_curves.py | 5 | 2606 | """
==================================
SSVM Convergence Curves
==================================
Showing the relation between cutting plane and primal objectives,
as well as the different algorithms.
We use exact inference here, so the plots are easier to interpret.
As this is a small toy example, it is hard to gener... | bsd-2-clause |
AlexanderFabisch/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 |
matthiasplappert/hmmlearn | hmmlearn/tests/test_base.py | 4 | 7022 | from __future__ import print_function
from unittest import TestCase
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
from sklearn.utils.extmath import logsumexp
from hmmlearn import hmm
rng = np.random.RandomState(0)
np.seterr(all='warn')
class TestBaseHMM(TestCase):
... | bsd-3-clause |
laurakurup/census-api | census_api.py | 1 | 8612 | '''
Last Updated June 30, 2015
by Laura Kurup
https://github.com/laurakurup
Description: Create a pandas dataframe and csv file from the U.S. Census
Decennial Census API, which offers access to population data by sex, age,
race, etc. and housing data by occupancy, vacancy status, and tenure.
Documentat... | mit |
jordan-melendez/buqeyemodel | gsum/tests/test.py | 1 | 6151 | import numpy as np
import scipy as sp
from scipy.stats import multivariate_normal
# import unittest
from gsum import ConjugateGaussianProcess
from gsum.helpers import *
from gsum.helpers import pivoted_cholesky
from gsum.cutils import pivoted_cholesky as pivoted_cholesky_cython
from sklearn.gaussian_process import Ga... | mit |
BigDataforYou/movie_recommendation_workshop_1 | big_data_4_you_demo_1/venv/lib/python2.7/site-packages/pandas/sparse/panel.py | 1 | 18704 | """
Data structures for sparse float data. Life is made simpler by dealing only
with float64 data
"""
# pylint: disable=E1101,E1103,W0231
import warnings
from pandas.compat import lrange, zip
from pandas import compat
import numpy as np
from pandas.core.index import Index, MultiIndex, _ensure_index
from pandas.core.... | mit |
harish2rb/pyGeoNet | pygeonet_v1.0/pygeonet_processing.py | 1 | 49204 | #! /usr/bin/env python
# pygeonet_processing.py
# Run this file after setting up folder structure
# in pygeonet_parameters.py
import sys
import os
from osgeo import gdal,osr,ogr
import statsmodels.api as sm
import numpy as np
from time import clock
import pygeonet_prepare as Parameters
import pygeonet_defaults as defa... | gpl-3.0 |
0x0all/scikit-learn | examples/cluster/plot_lena_compress.py | 271 | 2229 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Vector Quantization Example
=========================================================
The classic image processing example, Lena, an 8-bit grayscale
bit-depth, 512 x 512 sized image, is used here to illustrate
how ... | bsd-3-clause |
ChanChiChoi/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 |
robintw/scikit-image | doc/examples/plot_line_hough_transform.py | 14 | 4465 | r"""
=============================
Straight line Hough transform
=============================
The Hough transform in its simplest form is a `method to detect straight lines
<http://en.wikipedia.org/wiki/Hough_transform>`__.
In the following example, we construct an image with a line intersection. We
then use the Ho... | bsd-3-clause |
EvenStrangest/tensorflow | tensorflow/examples/skflow/iris_custom_decay_dnn.py | 3 | 1749 | # 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 |
ryandougherty/mwa-capstone | MWA_Tools/build/matplotlib/examples/axes_grid/scatter_hist.py | 8 | 1582 | import numpy as np
import matplotlib.pyplot as plt
# the random data
x = np.random.randn(1000)
y = np.random.randn(1000)
fig = plt.figure(1, figsize=(5.5,5.5))
from mpl_toolkits.axes_grid1 import make_axes_locatable
# the scatter plot:
axScatter = plt.subplot(111)
axScatter.scatter(x, y)
axScatter.set_aspect(1.)
... | gpl-2.0 |
dsquareindia/scikit-learn | sklearn/utils/tests/test_seq_dataset.py | 79 | 2497 | # Author: Tom Dupre la Tour <tom.dupre-la-tour@m4x.org>
#
# License: BSD 3 clause
import numpy as np
from numpy.testing import assert_array_equal
import scipy.sparse as sp
from sklearn.utils.seq_dataset import ArrayDataset, CSRDataset
from sklearn.datasets import load_iris
from sklearn.utils.testing import assert_eq... | bsd-3-clause |
r-mart/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 |
plissonf/scikit-learn | examples/svm/plot_weighted_samples.py | 188 | 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 |
mainyanim/eyetoai | findings/jsonify.py | 1 | 13398 | import pandas as pd
import random
import json
from openpyxl import load_workbook
import pymongo
# define values check and append to arr
# define probability array
# read excel
df = pd.read_excel("output.xlsx")
wb = load_workbook('output.xlsx')
ws = wb.get_sheet_by_name('Sheet1') # Define worksheet
def get_dic_fro... | mit |
jmargeta/scikit-learn | examples/svm/plot_iris.py | 4 | 1951 | """
==================================================
Plot different SVM classifiers in the iris dataset
==================================================
Comparison of different linear SVM classifiers on the iris dataset. It
will plot the decision surface for four different SVM classifiers.
"""
print(__doc__)
imp... | bsd-3-clause |
dialounke/pylayers | pylayers/antprop/channel.py | 1 | 179616 | # -*t coding:Utf-8 -*-
"""
.. currentmodule:: pylayers.antprop.channel
.. autosummary::
:members:
"""
from __future__ import print_function
import doctest
import pdb
import numpy as np
import numpy.ma as ma
import numpy.linalg as la
import scipy as sp
import scipy.signal as si
import pylab as plt
import struct as... | mit |
IssamLaradji/scikit-learn | examples/plot_johnson_lindenstrauss_bound.py | 13 | 7459 | """
=====================================================================
The Johnson-Lindenstrauss bound for embedding with random projections
=====================================================================
The `Johnson-Lindenstrauss lemma`_ states that any high dimensional
dataset can be randomly projected in... | bsd-3-clause |
pyro-ppl/numpyro | examples/prodlda.py | 1 | 12097 | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
"""
Example: ProdLDA
================
In this example, we will follow [1] to implement the ProdLDA topic model from
Autoencoding Variational Inference For Topic Models by Akash Srivastava and Charles
Sutton [2]. This model returns cons... | apache-2.0 |
ryokbys/nap | nappy/fitpot/analyze_samples.py | 1 | 7436 | #!/usr/bin/env python
"""
Analyze energies and forces (stresses?) of specified samples.
The sample directory name should start with 'smpl_' and
the name follows before the second '_' is used for coloring.
Usage:
analyze_samples.py [options] DIRS [DIRS...]
Options:
-h, --help Show this message and exit.
--graph... | mit |
YeoLab/gscripts | gscripts/rnaseq/splicing_modality.py | 1 | 3374 | __author__ = 'Olga'
import pymc as pm
import pandas as pd
from collections import Counter
def _assign_modality_from_estimate(mean_alpha, mean_beta):
"""
Given estimated alpha and beta parameters from an Markov Chain Monte Carlo
run, assign a modality.
"""
# check if one parameter is much larger t... | mit |
sauloal/cnidaria | scripts/venv/lib/python2.7/site-packages/pandas/sparse/array.py | 5 | 16980 | """
SparseArray data structure
"""
from __future__ import division
# pylint: disable=E1101,E1103,W0231
from numpy import nan, ndarray
import numpy as np
from pandas.core.base import PandasObject
import pandas.core.common as com
from pandas import compat, lib
from pandas.compat import range
from pandas._sparse impor... | mit |
caidongyun/BuildingMachineLearningSystemsWithPython | ch02/stump.py | 24 | 1604 | # This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
from sklearn.datasets import load_iris
data = load_iris()
features = data.data
labels = data.target_nam... | mit |
tosolveit/scikit-learn | examples/exercises/plot_cv_diabetes.py | 231 | 2527 | """
===============================================
Cross-validation on diabetes Dataset Exercise
===============================================
A tutorial exercise which uses cross-validation with linear models.
This exercise is used in the :ref:`cv_estimators_tut` part of the
:ref:`model_selection_tut` section of ... | bsd-3-clause |
MechCoder/scikit-learn | sklearn/svm/tests/test_svm.py | 33 | 35916 | """
Testing for Support Vector Machine module (sklearn.svm)
TODO: remove hard coded numerical results when possible
"""
import numpy as np
import itertools
from numpy.testing import assert_array_equal, assert_array_almost_equal
from numpy.testing import assert_almost_equal
from numpy.testing import assert_allclose
fro... | bsd-3-clause |
charanpald/sandbox | sandbox/util/Evaluator.py | 1 | 12323 |
import numpy
from sandbox.util.Parameter import Parameter
#TODO: Test this file
class Evaluator(object):
"""
A class to evaluate machine learning performance.
"""
def __init__(self):
pass
@staticmethod
def evaluateBinary1DLabels(testY, predY):
numEvaluations = 6
ev... | gpl-3.0 |
yaukwankiu/twstocks | mark1.py | 1 | 9719 | # -*- coding: utf8 -*-
############################
# imports
import time
import datetime
import urllib2
import re
import os
import pickle
import numpy as np
import matplotlib.pyplot as plt
############################
# defining the parameters
currentPriceRegex = re.compile(r'(?<=\<td\ align\=\"center\"\ bgcolor\... | cc0-1.0 |
rajat1994/scikit-learn | sklearn/utils/validation.py | 67 | 24013 | """Utilities for input validation"""
# Authors: Olivier Grisel
# Gael Varoquaux
# Andreas Mueller
# Lars Buitinck
# Alexandre Gramfort
# Nicolas Tresegnie
# License: BSD 3 clause
import warnings
import numbers
import numpy as np
import scipy.sparse as sp
from ..externals i... | bsd-3-clause |
emmanuelle/scikits.image | doc/examples/applications/plot_geometric.py | 2 | 3213 | """
===============================
Using geometric transformations
===============================
In this example, we will see how to use geometric transformations in the context
of image processing.
"""
import math
import numpy as np
import matplotlib.pyplot as plt
from skimage import data
from skimage import tra... | bsd-3-clause |
madjelan/scikit-learn | sklearn/mixture/tests/test_gmm.py | 200 | 17427 | import unittest
import copy
import sys
from nose.tools import assert_true
import numpy as np
from numpy.testing import (assert_array_equal, assert_array_almost_equal,
assert_raises)
from scipy import stats
from sklearn import mixture
from sklearn.datasets.samples_generator import make_spd_ma... | bsd-3-clause |
anguoyang/SMQTK | python/smqtk/content_description/colordescriptor/colordescriptor.py | 1 | 42778 | import abc
import logging
import json
import math
import mimetypes
import multiprocessing
import multiprocessing.pool
import numpy
import os
import os.path as osp
import pyflann
import sklearn.cluster
import sys
import tempfile
import smqtk_config
from smqtk.content_description import ContentDescriptor
from smqtk.uti... | bsd-3-clause |
tapomayukh/projects_in_python | classification/Classification_with_HMM/Single_Contact_Classification/Variable_Stiffness_Variable_Velocity/HMM/with 1.2s/hmm_crossvalidation_force_motion_20_states_scaled_wrt_all_data.py | 1 | 41652 | # Hidden Markov Model Implementation
import pylab as pyl
import numpy as np
import matplotlib.pyplot as pp
#from enthought.mayavi import mlab
import scipy as scp
import scipy.ndimage as ni
import roslib; roslib.load_manifest('sandbox_tapo_darpa_m3')
import rospy
#import hrl_lib.mayavi2_util as mu
import hrl_lib.viz ... | mit |
LukeC92/iris | lib/iris/tests/unit/quickplot/test_points.py | 11 | 2168 | # (C) British Crown Copyright 2014 - 2016, 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 |
IssamLaradji/scikit-learn | sklearn/covariance/tests/test_robust_covariance.py | 31 | 3340 | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Virgile Fritsch <virgile.fritsch@inria.fr>
#
# License: BSD 3 clause
import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_alm... | bsd-3-clause |
glennq/scikit-learn | examples/text/hashing_vs_dict_vectorizer.py | 93 | 3243 | """
===========================================
FeatureHasher and DictVectorizer Comparison
===========================================
Compares FeatureHasher and DictVectorizer by using both to vectorize
text documents.
The example demonstrates syntax and speed only; it doesn't actually do
anything useful with the e... | bsd-3-clause |
kushalbhola/MyStuff | Practice/PythonApplication/env/Lib/site-packages/pandas/tests/io/parser/test_index_col.py | 2 | 5308 | """
Tests that the specified index column (a.k.a "index_col")
is properly handled or inferred during parsing for all of
the parsers defined in parsers.py
"""
from io import StringIO
import pytest
from pandas import DataFrame, Index, MultiIndex
import pandas.util.testing as tm
@pytest.mark.parametrize("with_header",... | apache-2.0 |
liberatorqjw/scikit-learn | sklearn/semi_supervised/label_propagation.py | 15 | 15050 | # 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 |
rseubert/scikit-learn | sklearn/feature_extraction/image.py | 32 | 17167 | """
The :mod:`sklearn.feature_extraction.image` submodule gathers utilities to
extract features from images.
"""
# Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Olivier Grisel
# Vlad Niculae
# License: BSD 3 clause
fro... | bsd-3-clause |
bdh1011/wau | venv/lib/python2.7/site-packages/pandas/tests/test_common.py | 1 | 35517 | # -*- coding: utf-8 -*-
import collections
from datetime import datetime
import re
import sys
import nose
from nose.tools import assert_equal
import numpy as np
from pandas.tslib import iNaT, NaT
from pandas import Series, DataFrame, date_range, DatetimeIndex, Timestamp, Float64Index
from pandas import compat
from pan... | mit |
leesavide/pythonista-docs | Documentation/matplotlib/examples/user_interfaces/embedding_in_tk.py | 9 | 1419 | #!/usr/bin/env python
import matplotlib
matplotlib.use('TkAgg')
from numpy import arange, sin, pi
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
# implement the default mpl key bindings
from matplotlib.backend_bases import key_press_handler
from matplotlib.figure import Fig... | apache-2.0 |
kenshay/ImageScripter | ProgramData/SystemFiles/Python/Lib/site-packages/pandas/io/stata.py | 7 | 82769 | """
Module contains tools for processing Stata files into DataFrames
The StataReader below was originally written by Joe Presbrey as part of PyDTA.
It has been extended and improved by Skipper Seabold from the Statsmodels
project who also developed the StataWriter and was finally added to pandas in
a once again improv... | gpl-3.0 |
francisc0garcia/autonomous_bicycle | test/test_csv_conversion.py | 1 | 2233 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import pandas as pd
import glob, os
root = '/home/pach0/Documents/autonomous_bicycle/code/src/autonomous_bicycle/bags/csv/test_velocity_5/'
pattern = "*.csv"
text_common = 'test_velocity_5-bicycle-'
# get CSV files
files = glob.glob(root + pattern)
# define desired col... | apache-2.0 |
TaylorOshan/pysal | pysal/esda/geary.py | 5 | 8394 | """
Geary's C statistic for spatial autocorrelation
"""
__author__ = "Sergio J. Rey <srey@asu.edu> "
import numpy as np
import scipy.stats as stats
from .. import weights
from .tabular import _univariate_handler
__all__ = ['Geary']
class Geary(object):
"""
Global Geary C Autocorrelation statistic
Param... | bsd-3-clause |
louisLouL/pair_trading | capstone_env/lib/python3.6/site-packages/pandas/tests/indexes/period/test_construction.py | 6 | 19404 | import pytest
import numpy as np
import pandas as pd
import pandas.util.testing as tm
import pandas.core.indexes.period as period
from pandas.compat import lrange, PY3, text_type, lmap
from pandas import (Period, PeriodIndex, period_range, offsets, date_range,
Series, Index)
class TestPeriodIndex... | mit |
MicrosoftGenomics/FaST-LMM | fastlmm/association/lrt.py | 1 | 13901 | import copy
import pdb
import scipy.linalg as LA
import scipy as SP
import numpy as NP
import logging as LG
import scipy.optimize as opt
import scipy.stats as ST
import scipy.special as SS
import os
import sys
from fastlmm.pyplink.plink import *
from pysnptools.util.pheno import *
from fastlmm.util.mingrid import *
fro... | apache-2.0 |
luiscape/fts-collector | ckan_loading/produce_csvs.py | 1 | 5186 | """
Can be used to produce the following CSV files for upload into CKAN:
- sectors.csv
- countries.csv
- organizations.csv
- emergencies.csv (for a given country)
- appeals.csv (for a given country)
- projects.csv (for a given country, based on appeals)
- contributions.csv (for given country, based on eme... | unlicense |
pandas-ml/pandas-ml | pandas_ml/skaccessors/isotonic.py | 3 | 1174 | #!/usr/bin/env python
from pandas_ml.core.accessor import _AccessorMethods
class IsotonicMethods(_AccessorMethods):
"""
Accessor to ``sklearn.isotonic``.
"""
_module_name = 'sklearn.isotonic'
@property
def IsotonicRegression(self):
"""``sklearn.isotonic.IsotonicRegress... | bsd-3-clause |
guorendong/iridium-browser-ubuntu | native_client/buildbot/buildbot_pnacl.py | 2 | 10251 | #!/usr/bin/python
# Copyright (c) 2013 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
from buildbot_lib import (
BuildContext, BuildStatus, Command, ParseStandardCommandLine,
RemoveScons... | bsd-3-clause |
csae1152/seizure-prediction | seizure_prediction/cross_validation/kfold_strategy.py | 3 | 4173 | import numpy as np
import sklearn
from seizure_prediction.cross_validation.sequences import collect_sequence_ranges_from_meta
class KFoldStrategy:
"""
Create a k-fold strategy focused on preictal segments. The idea is to create a small number of folds
that maximise coverage of the training set. Small numbe... | mit |
PatrickOReilly/scikit-learn | sklearn/decomposition/__init__.py | 76 | 1490 | """
The :mod:`sklearn.decomposition` module includes matrix decomposition
algorithms, including among others PCA, NMF or ICA. Most of the algorithms of
this module can be regarded as dimensionality reduction techniques.
"""
from .nmf import NMF, ProjectedGradientNMF, non_negative_factorization
from .pca import PCA, Ra... | bsd-3-clause |
ithemal/Ithemal | learning/pytorch/ithemal/run_ithemal.py | 1 | 14450 | import sys
import os
sys.path.append(os.path.join(os.environ['ITHEMAL_HOME'], 'learning', 'pytorch'))
import argparse
import time
import torch
import torch.multiprocessing as mp
torch.backends.cudnn.enabled = False
from utils import messages
import models.losses as ls
import models.train as tr
from tqdm import tqdm
fr... | mit |
pratapvardhan/scikit-learn | examples/ensemble/plot_voting_probas.py | 316 | 2824 | """
===========================================================
Plot class probabilities calculated by the VotingClassifier
===========================================================
Plot the class probabilities of the first sample in a toy dataset
predicted by three different classifiers and averaged by the
`VotingC... | bsd-3-clause |
remenska/rootpy | rootpy/plotting/root2matplotlib.py | 1 | 28571 | # Copyright 2012 the rootpy developers
# distributed under the terms of the GNU General Public License
"""
This module provides functions that allow the plotting of ROOT histograms and
graphs with `matplotlib <http://matplotlib.org/>`_.
If you just want to save image files and don't want matplotlib to attempt to
creat... | gpl-3.0 |
rseubert/scikit-learn | sklearn/decomposition/tests/test_factor_analysis.py | 11 | 3064 | # Author: Christian Osendorfer <osendorf@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Licence: BSD3
import numpy as np
from sklearn.utils.testing import assert_warns
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing im... | bsd-3-clause |
justincassidy/scikit-learn | sklearn/manifold/tests/test_locally_linear.py | 232 | 4761 | from itertools import product
from nose.tools import assert_true
import numpy as np
from numpy.testing import assert_almost_equal, assert_array_almost_equal
from scipy import linalg
from sklearn import neighbors, manifold
from sklearn.manifold.locally_linear import barycenter_kneighbors_graph
from sklearn.utils.testi... | bsd-3-clause |
hammerlab/mhcflurry | test/test_class1_pan.py | 1 | 3833 | """
Tests for training and predicting using Class1 pan-allele models.
"""
import logging
logging.getLogger('tensorflow').disabled = True
logging.getLogger('matplotlib').disabled = True
from sklearn.metrics import roc_auc_score
import pandas
from numpy.testing import assert_, assert_equal
from mhcflurry import Class1... | apache-2.0 |
arijitt/HiBench | bin/report_gen_plot.py | 22 | 5011 | #!/usr/bin/env python
#coding: utf-8
import sys, os, re
from pprint import pprint
from collections import defaultdict, namedtuple
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib.cm as cmx
import numpy as np
RecordRaw=namedtuple("RecordRaw", ... | apache-2.0 |
RomainBrault/scikit-learn | sklearn/neural_network/tests/test_stochastic_optimizers.py | 146 | 4310 | import numpy as np
from sklearn.neural_network._stochastic_optimizers import (BaseOptimizer,
SGDOptimizer,
AdamOptimizer)
from sklearn.utils.testing import (assert_array_equal, assert_true,
... | bsd-3-clause |
Clyde-fare/scikit-learn | examples/ensemble/plot_adaboost_twoclass.py | 347 | 3268 | """
==================
Two-class AdaBoost
==================
This example fits an AdaBoosted decision stump on a non-linearly separable
classification dataset composed of two "Gaussian quantiles" clusters
(see :func:`sklearn.datasets.make_gaussian_quantiles`) and plots the decision
boundary and decision scores. The di... | bsd-3-clause |
abonaca/gary | gary/dynamics/tests/helpers.py | 1 | 4730 | # coding: utf-8
""" Test helpers """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os
import sys
# Third-party
import astropy.coordinates as coord
import astropy.units as u
import matplotlib.pyplot as plt
import numpy as np
# Project
from .... | mit |
xyguo/scikit-learn | examples/neighbors/plot_kde_1d.py | 347 | 5100 | """
===================================
Simple 1D Kernel Density Estimation
===================================
This example uses the :class:`sklearn.neighbors.KernelDensity` class to
demonstrate the principles of Kernel Density Estimation in one dimension.
The first plot shows one of the problems with using histogram... | bsd-3-clause |
mikebenfield/scikit-learn | sklearn/ensemble/tests/test_iforest.py | 16 | 8439 | """
Testing for Isolation Forest algorithm (sklearn.ensemble.iforest).
"""
# Authors: Nicolas Goix <nicolas.goix@telecom-paristech.fr>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# License: BSD 3 clause
import numpy as np
from sklearn.utils.fixes import euler_gamma
from sklearn.utils.test... | bsd-3-clause |
jslhs/clFFT | src/scripts/perf/plotPerformance.py | 2 | 11532 | # ########################################################################
# Copyright 2013 Advanced Micro Devices, 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.apach... | apache-2.0 |
hypergravity/hrs | song/measure_xdrift.py | 1 | 4877 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 3 23:10:05 2016
@author: cham
"""
import sys
import ccdproc
import matplotlib.pyplot as plt
import numpy as np
from astropy.io import fits
from astropy.table import Table, Column
from matplotlib import rcParams
from tqdm import trange
from hrs i... | bsd-3-clause |
arjunkhode/ASP | lectures/05-Sinusoidal-model/plots-code/spectral-peaks.py | 22 | 1159 | import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import hamming, triang, blackmanharris
from scipy.fftpack import fft, ifft
import math
import sys, os, functools, time
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/'))
import dftModel as DFT
impo... | agpl-3.0 |
chriscrosscutler/scikit-image | doc/examples/plot_blob.py | 18 | 2796 | """
==============
Blob Detection
==============
Blobs are bright on dark or dark on bright regions in an image. In
this example, blobs are detected using 3 algorithms. The image used
in this case is the Hubble eXtreme Deep Field. Each bright dot in the
image is a star or a galaxy.
Laplacian of Gaussian (LoG)
-------... | bsd-3-clause |
fabianp/scikit-learn | examples/cluster/plot_kmeans_assumptions.py | 270 | 2040 | """
====================================
Demonstration of k-means assumptions
====================================
This example is meant to illustrate situations where k-means will produce
unintuitive and possibly unexpected clusters. In the first three plots, the
input data does not conform to some implicit assumptio... | bsd-3-clause |
istellartech/OpenTsiolkovsky | bin/stat_datapoint_extend.py | 1 | 3877 | #!/usr/bin/python
import numpy as np
import pandas as pd
import os
import json
import sys
import multiprocessing as mp
def read_data_points(arg):
[id_proc, Nproc, input_directory, input_file_template, number_of_sample, sample_points] = arg
fo_buff = ["" for i in range(len(sample_points.keys()))]
shou = ... | mit |
svebk/DeepSentiBank_memex | ISIweakLabels/read_hdfs_attributes.py | 1 | 5089 | import os
import os.path as osp
import json
import pickle
import MySQLdb
import random
import datetime
import struct
from sklearn import svm
import numpy as np
global_var = json.load(open('../global_var_all.json'))
isthost=global_var['ist_db_host']
istuser=global_var['ist_db_user']
istpwd=global_var['ist_db_pwd']
istd... | bsd-2-clause |
akail/fiplanner | fiplanner/fiplanner.py | 1 | 8360 | # -*- coding: utf-8 -*-
"""
fiplanner.fiplanner
~~~~~~~~~~~~~~~~~~~
This module implements the central Planning tool
:copyright: (c) 2017 Andrew Kail
:license: BSD, see LICENSE for more details
"""
import datetime as dt
import logging
import pprint
import pandas as pd
import matplotlib.pyplot as... | bsd-3-clause |
mohsinjuni/androguard | elsim/elsim/elsim.py | 37 | 16175 | # This file is part of Elsim
#
# Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr>
# All rights reserved.
#
# Elsim 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, ... | apache-2.0 |
scikit-multilearn/scikit-multilearn | skmultilearn/ensemble/tests/test_rakeld.py | 1 | 1966 | import unittest
from sklearn.naive_bayes import GaussianNB
from sklearn.svm import SVC
from skmultilearn.ensemble import RakelD
from skmultilearn.tests.classifier_basetest import ClassifierBaseTest
TEST_LABELSET_SIZE = 3
class RakelDTest(ClassifierBaseTest):
def get_rakeld_with_svc(self):
return Rakel... | bsd-2-clause |
PythonBootCampIAG-USP/NASA_PBC2015 | Day_01/05_Basemap/bcbm1.py | 2 | 10253 | #!/usr/bin/env python
# Purpose : Python Boot Camp - Basemap Teaching Program 1.
# Ensure that environment variable PYTHONUNBUFFERED=yes
# This allows STDOUT and STDERR to both be logged in chronological order
import sys # platform, args, run tools
import os # platform, ... | mit |
farodin91/servo | tests/heartbeats/process_logs.py | 139 | 16143 | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import argparse
import matplotlib.pyplot as plt
import numpy as np
import os
from os import path
... | mpl-2.0 |
prisae/empymod | tests/test_utils.py | 1 | 45461 | import pytest
import numpy as np
from numpy.testing import assert_allclose
# Optional import
try:
import scooby
except ImportError:
scooby = False
from empymod import utils, filters
def test_emarray():
out = utils.EMArray(3)
assert out.amp() == 3
assert out.pha() == 0
assert out.real == 3
... | apache-2.0 |
Sunhick/ThinkStats2 | code/hinc_soln.py | 67 | 4296 | """This file contains code used in "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 numpy as np
import pandas
import hinc
import thinkplot
import thinkstats2
""... | gpl-3.0 |
Windy-Ground/scikit-learn | benchmarks/bench_sample_without_replacement.py | 397 | 8008 | """
Benchmarks for sampling without replacement of integer.
"""
from __future__ import division
from __future__ import print_function
import gc
import sys
import optparse
from datetime import datetime
import operator
import matplotlib.pyplot as plt
import numpy as np
import random
from sklearn.externals.six.moves i... | bsd-3-clause |
murali-munna/scikit-learn | examples/applications/plot_outlier_detection_housing.py | 243 | 5577 | """
====================================
Outlier detection on a real data set
====================================
This example illustrates the need for robust covariance estimation
on a real data set. It is useful both for outlier detection and for
a better understanding of the data structure.
We selected two sets o... | bsd-3-clause |
OGGM/oggm | oggm/core/massbalance.py | 1 | 50774 | """Mass-balance models"""
# Built ins
import logging
# External libs
import cftime
import numpy as np
import pandas as pd
import netCDF4
from scipy.interpolate import interp1d
from scipy import optimize as optimization
# Locals
import oggm.cfg as cfg
from oggm.cfg import SEC_IN_YEAR, SEC_IN_MONTH
from oggm.utils import... | bsd-3-clause |
jklenzing/pysat | pysat/tests/test_omni_hro.py | 2 | 6792 | import datetime as dt
import numpy as np
import pandas as pds
import pysat
from pysat.instruments import omni_hro
class TestOMNICustom():
def setup(self):
"""Runs before every method to create a clean testing setup."""
# Load a test instrument
self.testInst = pysat.Instrument('pysat', '... | bsd-3-clause |
jjx02230808/project0223 | sklearn/decomposition/tests/test_truncated_svd.py | 73 | 6086 | """Test truncated SVD transformer."""
import numpy as np
import scipy.sparse as sp
from sklearn.decomposition import TruncatedSVD
from sklearn.utils import check_random_state
from sklearn.utils.testing import (assert_array_almost_equal, assert_equal,
assert_raises, assert_greater,
... | bsd-3-clause |
dboyliao/Scipy_Numpy_Learning | python_examples/scikits_412_ex1.py | 2 | 1181 | import numpy as np
import scipy.ndimage as ndimage
import skimage.morphology as morph
import matplotlib.pyplot as plt
# Generating data points with a non-uniform background
x = np.random.uniform(low=0, high=200, size=20).astype(int)
y = np.random.uniform(low=0, high=400, size=20).astype(int)
# Creating image with no... | mit |
robbymeals/scikit-learn | sklearn/feature_selection/tests/test_base.py | 170 | 3666 | 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 |
alexandrovteam/curatr | mcf_standard_browser/standards_review/tasks.py | 1 | 15528 | import logging
import sys
import traceback
import dateutil
import pandas as pd
import pymzml
from celery import shared_task
from celery.schedules import crontab
from celery.task import periodic_task
from standards_review.models import Adduct, FragmentationSpectrum, Xic, LcInfo, MsInfo, InstrumentInfo
from standards_re... | apache-2.0 |
madjelan/scikit-learn | doc/datasets/mldata_fixture.py | 367 | 1183 | """Fixture module to skip the datasets loading when offline
Mock urllib2 access to mldata.org and create a temporary data folder.
"""
from os import makedirs
from os.path import join
import numpy as np
import tempfile
import shutil
from sklearn import datasets
from sklearn.utils.testing import install_mldata_mock
fr... | bsd-3-clause |
realisticus/data-science-from-scratch | code/visualizing_data.py | 58 | 5116 | import matplotlib.pyplot as plt
from collections import Counter
def make_chart_simple_line_chart(plt):
years = [1950, 1960, 1970, 1980, 1990, 2000, 2010]
gdp = [300.2, 543.3, 1075.9, 2862.5, 5979.6, 10289.7, 14958.3]
# create a line chart, years on x-axis, gdp on y-axis
plt.plot(years, gdp, color='gr... | unlicense |
fdion/stemgraphic | stemgraphic/alpha.py | 1 | 95126 | # -*- coding: utf-8 -*-
""" stemgraphic.alpha.
BRAND NEW in V.0.5.0!
Stemgraphic provides a complete set of functions to handle everything related to stem-and-leaf plots. alpha is a
module of the stemgraphic package to add support for categorical and text variables.
The module also adds functionality to handle whol... | mit |
c-m/Licenta | src/nn.py | 1 | 7522 | # neural network models for data learning
import matplotlib.pyplot as plt
import numpy as np
from data_loader import load_grades, preprocess_data
from sklearn.metrics import confusion_matrix, hamming_loss, brier_score_loss, log_loss
from sklearn.metrics import mean_absolute_error, mean_squared_error, median_absolute_... | mit |
bkendzior/scipy | scipy/interpolate/ndgriddata.py | 39 | 7457 | """
Convenience interface to N-D interpolation
.. versionadded:: 0.9
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from .interpnd import LinearNDInterpolator, NDInterpolatorBase, \
CloughTocher2DInterpolator, _ndim_coords_from_arrays
from scipy.spatial import cKDTree
_... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.