repo_name stringlengths 9 55 | path stringlengths 7 120 | copies stringlengths 1 3 | size stringlengths 4 6 | content stringlengths 1.02k 169k | license stringclasses 12
values |
|---|---|---|---|---|---|
Jwuthri/Mozinor | mozinor/preprocess/transformer/fill.py | 1 | 6094 | # -*- coding: utf-8 -*-
"""
Created on July 2017
@author: JulienWuthrich
"""
import logging
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
from mozinor.preprocess.settings import logger
class FillNaN(object):
"""Module to fill NaN thx to a clustering approach."""
def __init__(self, dat... | mit |
cyberphox/MissionPlanner | Lib/site-packages/numpy/lib/function_base.py | 53 | 108301 | __docformat__ = "restructuredtext en"
__all__ = ['select', 'piecewise', 'trim_zeros', 'copy', 'iterable',
'percentile', 'diff', 'gradient', 'angle', 'unwrap', 'sort_complex',
'disp', 'extract', 'place', 'nansum', 'nanmax', 'nanargmax',
'nanargmin', 'nanmin', 'vectorize', 'asarray_chkfinite', 'av... | gpl-3.0 |
macks22/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 |
mhvk/astropy | astropy/visualization/wcsaxes/axislabels.py | 8 | 4732 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from matplotlib import rcParams
from matplotlib.text import Text
import matplotlib.transforms as mtransforms
from .frame import RectangularFrame
class AxisLabels(Text):
def __init__(self, frame, minpad=1, *args, **kwargs):
... | bsd-3-clause |
bmazin/ARCONS-pipeline | util/ObsFile.py | 1 | 114785 | #!/bin/python
'''
Author: Matt Strader Date: August 19, 2012
The class ObsFile is an interface to observation files. It provides methods for typical ways of accessing and viewing observation data. It can also load and apply wavelength and flat calibration. With calibrations loaded, it can write the obs file ... | gpl-2.0 |
gfyoung/pandas | scripts/validate_unwanted_patterns.py | 2 | 13580 | #!/usr/bin/env python3
"""
Unwanted patterns test cases.
The reason this file exist despite the fact we already have
`ci/code_checks.sh`,
(see https://github.com/pandas-dev/pandas/blob/master/ci/code_checks.sh)
is that some of the test cases are more complex/imposible to validate via regex.
So this file is somewhat a... | bsd-3-clause |
toastedcornflakes/scikit-learn | sklearn/datasets/__init__.py | 72 | 3807 | """
The :mod:`sklearn.datasets` module includes utilities to load datasets,
including methods to load and fetch popular reference datasets. It also
features some artificial data generators.
"""
from .base import load_diabetes
from .base import load_digits
from .base import load_files
from .base import load_iris
from .... | bsd-3-clause |
RayMick/scikit-learn | sklearn/cluster/mean_shift_.py | 96 | 15434 | """Mean shift clustering algorithm.
Mean shift clustering aims to discover *blobs* in a smooth density of
samples. It is a centroid based algorithm, which works by updating candidates
for centroids to be the mean of the points within a given region. These
candidates are then filtered in a post-processing stage to elim... | bsd-3-clause |
samzhang111/scikit-learn | examples/linear_model/plot_bayesian_ridge.py | 248 | 2588 | """
=========================
Bayesian Ridge Regression
=========================
Computes a Bayesian Ridge Regression on a synthetic dataset.
See :ref:`bayesian_ridge_regression` for more information on the regressor.
Compared to the OLS (ordinary least squares) estimator, the coefficient
weights are slightly shift... | bsd-3-clause |
uwescience/pulse2percept | pulse2percept/stimuli/images.py | 1 | 23652 | """`ImageStimulus`, `LogoBVL`, `LogoUCSB`"""
from os.path import dirname, join
import numpy as np
from copy import deepcopy
import matplotlib.pyplot as plt
from matplotlib.axes import Subplot
from skimage import img_as_float32
from skimage.io import imread, imsave
from skimage.color import rgba2rgb, rgb2gray
from skim... | bsd-3-clause |
bloyl/mne-python | examples/visualization/ssp_projs_sensitivity_map.py | 20 | 1256 | """
==================================
Sensitivity map of SSP projections
==================================
This example shows the sources that have a forward field
similar to the first SSP vector correcting for ECG.
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
import ma... | bsd-3-clause |
andaag/scikit-learn | sklearn/preprocessing/data.py | 113 | 56747 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Eric Martin <eric@ericmart.in>
# License: BSD 3 clause
from itertools import chain, combina... | bsd-3-clause |
mikebenfield/scikit-learn | sklearn/decomposition/base.py | 23 | 5656 | """Principal Component Analysis Base Classes"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Denis A. Engemann <denis-alexander.engemann@inria.fr>
# Kyle Kastner <kastnerkyle@gmail.com>
... | bsd-3-clause |
williamgilpin/rk4 | rk4_poincare.py | 1 | 1762 | from matplotlib.pyplot import *
from scipy import *
from numpy import *
# a simple Runge-Kutta integrator for multiple dependent variables and one independent variable
def rungekutta4(yprime, time, y0):
# yprime is a list of functions, y0 is a list of initial values of y
# time is a list of t-values at which ... | mit |
mne-tools/mne-tools.github.io | 0.20/_downloads/f32a43d5ff22f0bd4aa430d2d5d4de0b/plot_compute_mne_inverse_raw_in_label.py | 19 | 1693 | """
.. _example-sLORETA:
=============================================
Compute sLORETA inverse solution on raw data
=============================================
Compute sLORETA inverse solution on raw dataset restricted
to a brain label and stores the solution in stc files for
visualisation.
"""
# Author: Alexandre... | bsd-3-clause |
billy-inn/scikit-learn | benchmarks/bench_plot_ward.py | 290 | 1260 | """
Benchmark scikit-learn's Ward implement compared to SciPy's
"""
import time
import numpy as np
from scipy.cluster import hierarchy
import pylab as pl
from sklearn.cluster import AgglomerativeClustering
ward = AgglomerativeClustering(n_clusters=3, linkage='ward')
n_samples = np.logspace(.5, 3, 9)
n_features = n... | bsd-3-clause |
sdiazpier/nest-simulator | pynest/nest/tests/test_get_set.py | 10 | 21354 | # -*- coding: utf-8 -*-
#
# test_get_set.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 2 of the License, o... | gpl-2.0 |
rhyolight/nupic.research | projects/sequence_classification/util_functions.py | 11 | 11219 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2016, 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 progra... | gpl-3.0 |
alphaBenj/zipline | tests/data/test_dispatch_bar_reader.py | 5 | 12612 | # Copyright 2016 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | apache-2.0 |
prasnko/ml | DecisionTrees/DecisionTree.py | 1 | 11953 | #-------------------------------------------------------------------------------
# Name: Decision Trees
# Purpose: Machine Learning Homework 1
#
# Author: PRASANNA
#
# Created: 04/02/2013
# Copyright: (c) PRASANNA 2013
# Licence: PVK
#-----------------------------------------------------------... | mit |
aewhatley/scikit-learn | sklearn/manifold/tests/test_spectral_embedding.py | 216 | 8091 | from nose.tools import assert_true
from nose.tools import assert_equal
from scipy.sparse import csr_matrix
from scipy.sparse import csc_matrix
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
from nose.tools import assert_raises
from nose.plugins.skip import SkipTest
from sk... | bsd-3-clause |
Aurora0001/LearnProgrammingBot | main.py | 1 | 13523 | #!/usr/bin/python2
from __future__ import print_function
from sklearn.pipeline import make_union
from sklearn.base import TransformerMixin
from sklearn.feature_extraction.text import TfidfVectorizer
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine
from sklearn import svm
import numpy as np... | mit |
anparser/anparser | anparser/anparser.py | 1 | 22050 | # -*- coding: utf-8 -*-
"""
anparser - an Open Source Android Artifact Parser
Copyright (C) 2015 Chapin Bryce
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at... | gpl-3.0 |
yevheniyc/Autodidact | 1u_Challenges/nwd_project/nwd_challenge_yev.py | 2 | 4365 | import csv
import pandas as pd
import logging
from nameparser import HumanName
LOG_FILE = 'logs/log.txt'
# clean previous logs from log file
open(LOG_FILE, 'w').close()
logging.basicConfig(filename=LOG_FILE, level=logging.DEBUG)
class FileParser:
"""Parse the file following specified instructions."""
def __i... | mit |
yask123/scikit-learn | sklearn/preprocessing/tests/test_data.py | 71 | 38516 | import warnings
import numpy as np
import numpy.linalg as la
from scipy import sparse
from distutils.version import LooseVersion
from sklearn.utils.testing import assert_almost_equal, clean_warning_registry
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_array_equal... | bsd-3-clause |
jiajunshen/partsNet | pnet/permutation_mm.py | 1 | 9041 | from __future__ import division, print_function, absolute_import
import numpy as np
import itertools as itr
import amitgroup as ag
from scipy.special import logit
from scipy.misc import logsumexp
from sklearn.base import BaseEstimator
import time
class PermutationMM(BaseEstimator):
"""
A Bernoulli mixture mode... | bsd-3-clause |
CognitiveRobotics/rpg_svo | svo_analysis/src/svo_analysis/analyse_trajectory.py | 17 | 8764 | #!/usr/bin/python
import os
import yaml
import argparse
import numpy as np
import matplotlib.pyplot as plt
import svo_analysis.tum_benchmark_tools.associate as associate
import vikit_py.transformations as transformations
import vikit_py.align_trajectory as align_trajectory
from matplotlib import rc
rc('font',**{'famil... | gpl-3.0 |
trankmichael/scikit-learn | sklearn/decomposition/truncated_svd.py | 199 | 7744 | """Truncated SVD for sparse matrices, aka latent semantic analysis (LSA).
"""
# Author: Lars Buitinck <L.J.Buitinck@uva.nl>
# Olivier Grisel <olivier.grisel@ensta.org>
# Michael Becker <mike@beckerfuffle.com>
# License: 3-clause BSD.
import numpy as np
import scipy.sparse as sp
try:
from scipy.sp... | bsd-3-clause |
maciejkula/scipy | scipy/spatial/_plotutils.py | 18 | 4033 | from __future__ import division, print_function, absolute_import
import numpy as np
from scipy.lib.decorator import decorator as _decorator
__all__ = ['delaunay_plot_2d', 'convex_hull_plot_2d', 'voronoi_plot_2d']
@_decorator
def _held_figure(func, obj, ax=None, **kw):
import matplotlib.pyplot as plt
if ax ... | bsd-3-clause |
Koheron/zynq-sdk | examples/alpha250-4/fft/python/test_noise_floor.py | 2 | 1169 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Measure the noise floor of the ADC and ADC + DAC
'''
import numpy as np
import os
import time
import matplotlib.pyplot as plt
from fft import FFT
from koheron import connect
host = os.getenv('HOST', '192.168.1.50')
client = connect(host, 'fft', restart=False)
driver... | mit |
fierval/retina | DiabeticRetinopathy/Refactoring/kobra/dr/image_reader.py | 1 | 1244 | import numpy as np
import pandas as pd
from os import path
import cv2
class ImageReader(object):
'''
Reads images and their masks
'''
def __init__(self, root, im_file, masks_dir, gray_scale = False):
self._im_file = path.join(root, im_file)
self._masks_dir = masks_dir
assert (... | mit |
jni/networkx | examples/graph/napoleon_russian_campaign.py | 44 | 3216 | #!/usr/bin/env python
"""
Minard's data from Napoleon's 1812-1813 Russian Campaign.
http://www.math.yorku.ca/SCS/Gallery/minard/minard.txt
"""
__author__ = """Aric Hagberg (hagberg@lanl.gov)"""
# Copyright (C) 2006 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <sw... | bsd-3-clause |
CGATOxford/proj029 | Proj029Pipelines/PipelineMetaomics.py | 1 | 44215 | ####################################################
####################################################
# functions and classes used in conjunction with
# pipeline_metaomics.py
####################################################
####################################################
# import libraries
import sys
impo... | bsd-3-clause |
robbymeals/scikit-learn | examples/cluster/plot_affinity_propagation.py | 349 | 2304 | """
=================================================
Demo of affinity propagation clustering algorithm
=================================================
Reference:
Brendan J. Frey and Delbert Dueck, "Clustering by Passing Messages
Between Data Points", Science Feb. 2007
"""
print(__doc__)
from sklearn.cluster impor... | bsd-3-clause |
brynpickering/calliope | calliope/test/test_example_models.py | 1 | 15368 | import os
import shutil
import pytest
from pytest import approx
import pandas as pd
import calliope
from calliope.test.common.util import check_error_or_warning
class TestModelPreproccesing:
def test_preprocess_national_scale(self):
calliope.examples.national_scale()
def test_preprocess_time_cluste... | apache-2.0 |
madmax983/h2o-3 | h2o-py/tests/testdir_algos/gbm/pyunit_DEPRECATED_ecologyGBM.py | 3 | 4166 | import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
import numpy as np
from sklearn import ensemble
from sklearn.metrics import roc_auc_score
def ecologyGBM():
#Log.info("Importing ecology_model.csv data...\n")
ecology_train = h2o.import_file(path=pyunit_utils.locat... | apache-2.0 |
huzq/scikit-learn | examples/model_selection/plot_grid_search_refit_callable.py | 25 | 3648 | """
==================================================
Balance model complexity and cross-validated score
==================================================
This example balances model complexity and cross-validated score by
finding a decent accuracy within 1 standard deviation of the best accuracy
score while minimis... | bsd-3-clause |
neurospin/pylearn-epac | epac/sklearn_plugins/estimators.py | 1 | 11147 | """
Estimator wrap ML procedure into EPAC Node. To be EPAC compatible, one should
inherit from BaseNode and implement the "transform" method.
InternalEstimator and LeafEstimator aim to provide automatic wrapper to objects
that implement fit and predict methods.
@author: edouard.duchesnay@cea.fr
@author: jinpeng.li@ce... | bsd-3-clause |
maminian/skewtools | scripts/hist_panels.py | 1 | 1838 | import scripts.skewtools as st
from numpy import linspace,unique,shape,size,abs,argmin,mod
import glob
import matplotlib.pyplot as pyplot
import sys
fl = glob.glob(sys.argv[1])
fl.sort()
Pes = st.gatherDataFromFiles(fl,'Peclet')
aratios = st.gatherDataFromFiles(fl,'aratio')
hcs = st.gatherDataFromFiles... | gpl-3.0 |
JeffAbrahamson/gtd | cluster_tfidf_example.py | 1 | 6537 | #!/usr/bin/env python3
"""Cluster data by tf-idf.
"""
from __future__ import print_function
from lib_gtd import gtd_load
from sklearn import metrics
from sklearn.decomposition import TruncatedSVD
from sklearn.feature_extraction.text import HashingVectorizer
from sklearn.feature_extraction.text import TfidfTransform... | gpl-2.0 |
heplesser/nest-simulator | pynest/examples/brette_gerstner_fig_3d.py | 8 | 3010 | # -*- coding: utf-8 -*-
#
# brette_gerstner_fig_3d.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 2 of the ... | gpl-2.0 |
phobson/statsmodels | statsmodels/tsa/base/tests/test_datetools.py | 28 | 5620 | from datetime import datetime
import numpy.testing as npt
from statsmodels.tsa.base.datetools import (_date_from_idx,
_idx_from_dates, date_parser, date_range_str, dates_from_str,
dates_from_range, _infer_freq, _freq_to_pandas)
from pandas import DatetimeIndex, PeriodIndex
def test_date... | bsd-3-clause |
ninotoshi/tensorflow | tensorflow/contrib/learn/python/learn/estimators/dnn.py | 1 | 13706 | """Deep Neural Network estimators."""
# Copyright 2015-present The 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/li... | apache-2.0 |
xiyuw123/Tax-Calculator | taxcalc/calculate.py | 1 | 9178 | import pandas as pd
from pandas import DataFrame
import math
import numpy as np
from .utils import *
from .functions import *
from .parameters import Parameters
from .records import Records
all_cols = set()
def add_df(alldfs, df):
for col in df.columns:
if col not in all_cols:
all_cols.add(col... | mit |
Ensembles/ert | python/tests/ert/enkf/export/test_export_join.py | 2 | 4035 | from ert.enkf.export import DesignMatrixReader, SummaryCollector, GenKwCollector, MisfitCollector
from ert.test import ExtendedTestCase, ErtTestContext
import pandas
import numpy
import os
def dumpDesignMatrix(path):
with open(path, "w") as dm:
dm.write("REALIZATION EXTRA_FLOAT_COLUMN EXTRA_INT_COLUMN EXTR... | gpl-3.0 |
xiaoxiaoyao/PythonApplication1 | PythonApplication1/自己的小练习/HLS/RandomStores.py | 2 | 6100 |
# 读取数据,上传服务器时,请修改此行为对应的文件位置
filePath=r'F:\\OneDrive\\华莱士\\Documents\\门店监控项目\\市场组织架构收集\\城市-营运-督导-门店.csv'
from flask import Flask
# 时间
import datetime
import pandas,numpy.random
numpy.random.seed(int(datetime.datetime.now().strftime("%j")))
fl = pandas.read_csv(filePath).astype('str').sample(frac=1,random_state=numpy... | unlicense |
laszlocsomor/tensorflow | tensorflow/contrib/learn/python/learn/learn_io/__init__.py | 79 | 2464 | # 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 |
TomAugspurger/pandas | pandas/tests/arrays/sparse/test_combine_concat.py | 8 | 2651 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays.sparse import SparseArray
class TestSparseArrayConcat:
@pytest.mark.parametrize("kind", ["integer", "block"])
def test_basic(self, kind):
a = SparseArray([1, 0, 0, 2], kind=kind)
b = Spar... | bsd-3-clause |
Minhmo/tardis | tardis/gui/widgets.py | 5 | 52003 | import os
if os.environ.get('QT_API', None)=='pyqt':
from PyQt4 import QtGui, QtCore
elif os.environ.get('QT_API', None)=='pyside':
from PySide import QtGui, QtCore
else:
raise ImportError('QT_API was not set! Please exit the IPython console\n'
' and at the bash prompt use : \n\n export QT_API=pysid... | bsd-3-clause |
lowlevel86/wakefulness-forecaster | display/graph.py | 1 | 1982 | import datetime
import time
import matplotlib.pyplot as plt
from mvtrialanderror import *
true = 1
false = 0
valueToTargetSum = 0
minsInDay = 60*24
#find points along a line using x coordinates
def xCutsLine(x1Line, x2Line, y1Line, y2Line, xCutLocs):
xLine = []
yLine = []
for cutLoc in xCutLocs:
xLine.append(c... | mit |
tosolveit/scikit-learn | sklearn/svm/setup.py | 321 | 3157 | 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
config = Configuration('svm', parent_package, top_path)
config.add_subpackage('tests')
# Section L... | bsd-3-clause |
Leberwurscht/Python-Guitar-Transcription-Aid | Analyze.py | 1 | 1678 | #!/usr/bin/env python
import gtk, numpy, scipy.ndimage
import matplotlib
import matplotlib.backends.backend_gtkcairo as mpl_backend
def get_power(data):
# apply window
window = numpy.hanning(len(data))
data *= window
# fft
power = numpy.abs(numpy.fft.rfft(data))**2.
return power
def smooth(array, window=3)... | gpl-3.0 |
navijo/FlOYBD | DataMining/weather/weatherFunctions.py | 2 | 10114 | import pyspark
import os.path
import numpy as np
import pandas as pd
import time
import json
from cylinders import CylindersKml
from pyspark import SparkContext, SparkConf
from pyspark.sql import SQLContext
from pyspark.sql.functions import max, min, col, avg, count
from collections import defaultdict
from cassandra.c... | mit |
bsipocz/glue | glue/clients/histogram_client.py | 1 | 10954 | import numpy as np
from ..core.client import Client
from ..core import message as msg
from ..core.data import Data
from ..core.subset import RangeSubsetState
from ..core.exceptions import IncompatibleDataException, IncompatibleAttribute
from ..core.edit_subset_mode import EditSubsetMode
from .layer_artist import Histo... | bsd-3-clause |
mne-tools/mne-tools.github.io | stable/_downloads/63cab32016602394f025dbe0ed7f501b/30_filtering_resampling.py | 10 | 13855 | # -*- coding: utf-8 -*-
"""
.. _tut-filter-resample:
Filtering and resampling data
=============================
This tutorial covers filtering and resampling, and gives examples of how
filtering can be used for artifact repair.
We begin as always by importing the necessary Python modules and loading some
:ref:`exam... | bsd-3-clause |
kmunve/TSanalysis | Crocus/crocus_forcing_nc.py | 1 | 36359 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from netCDF4 import Dataset, num2date
from string import Template
from datetime import datetime
'''
Create a forcing netcdf file for the snow pack model Crocus.
'''
class CrocusForcing:
def __init__(self, no_points=1, filename=No... | mit |
ombt/analytics | books/python_for_data_analysis/mine/ch1/ex1.py | 1 | 1424 | #!/usr/bin/python
#
# general libs
#
import sys
#
# data analysis libs
#
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import scipy
#
from collections import defaultdict, Counter
#
# path to book data
#
BD_PATH = "/home/ombt/sandbox/analytics/books/python_for_data_analysis/mine/pydata-book-1st-... | mit |
eg-zhang/scikit-learn | sklearn/feature_selection/tests/test_rfe.py | 209 | 11733 | """
Testing Recursive feature elimination
"""
import warnings
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
from nose.tools import assert_equal, assert_true
from scipy import sparse
from sklearn.feature_selection.rfe import RFE, RFECV
from sklearn.datasets import load_iris,... | bsd-3-clause |
dwettstein/pattern-recognition-2016 | ip/doc_processor.py | 1 | 4822 | import os
from glob import glob
import matplotlib.pyplot as plt
from skimage.io import imread
from ip.features import compute_features
from ip.preprocess import word_preprocessor
from utils.fio import get_config, get_absolute_path, parse_svg, path2polygon
from utils.image import crop
from utils.transcription import g... | mit |
jameshensman/VFF | experiments/mcmc_pines/plot_pines.py | 1 | 2449 | # Copyright 2016 James Hensman
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | apache-2.0 |
Ramanujakalyan/Inherit | choosing-k-in-kmeans/gap_stats.py | 25 | 7550 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
__author__="Josh Montague"
__license__="MIT License"
# Modified from:
# (c) 2014 Reid Johnson
#
# Modified from:
# (c) 2013 Mikael Vejdemo-Johansson
# BSD License
#
#
# The gap statistic is defined by Tibshirani, Walther, Hastie in:
# Estimating the number of clusters i... | unlicense |
sandeepdsouza93/TensorFlow-15712 | tensorflow/contrib/learn/python/learn/grid_search_test.py | 27 | 2080 | # 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 |
Obus/scikit-learn | examples/linear_model/plot_logistic_path.py | 349 | 1195 | #!/usr/bin/env python
"""
=================================
Path with L1- Logistic Regression
=================================
Computes path on IRIS dataset.
"""
print(__doc__)
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD 3 clause
from datetime import datetime
import numpy as np
import... | bsd-3-clause |
PubuduSaneth/genome4d | juicebox2hibrowse_v2.py | 1 | 3871 |
# coding: utf-8
# # Read juicebox dump output and reformat to 7 column format
# ## Juicebox dump output format - Input of the program
# <pre>
# chr1:start chr2:start Normalized_interactions
# 10000 10000 311.05484
# 10000 20000 92.60087
# 20000 20000 296.0056
# 10000 30000 47.701942
# </pre>
# ## 7 column format - ... | gpl-3.0 |
schreiberx/sweet | doc/rexi/rexi_with_laplace/lap-rexi-tests/lapel.py | 1 | 1906 |
import sys
import os
import warnings
import numpy as np
import math
import matplotlib.pyplot as plt
from nilt import *
from nilt_constant import *
#Constant function reconstrution
def constant_recon(dt, trunc=0):
#Test function
def fhat(s):
return 1/s
nend = 256
nini = 32
nstore = in... | mit |
NUAAXXY/globOpt | evaluation/compareMappedGraphs.py | 2 | 2422 | import packages.project as project
import packages.primitive as primitive
import packages.processing
import packages.relationGraph as relgraph
import packages.io
import argparse
import matplotlib.pyplot as plt
import networkx as nx
from networkx.algorithms import isomorphism
import numpy as np
import unitTests.relatio... | apache-2.0 |
ycool/apollo | modules/tools/prediction/data_pipelines/cruise_models.py | 3 | 5231 | ###############################################################################
# Copyright 2018 The Apollo 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
#
# h... | apache-2.0 |
Traecp/MCA_GUI | McaGUI_v18.py | 3 | 73468 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
import scipy.ndimage
from scipy import stats
from scipy.fftpack import fft, fftfreq, fftshift
import os, sys
import gc
from os import listdir
from os.path import isfile,join
import gtk
import matplotlib as mpl
import matplotlib.pyplot as plt
#mpl.use('GtkAgg'... | gpl-2.0 |
ElDeveloper/qiita | qiita_db/meta_util.py | 2 | 20723 | r"""
Util functions (:mod: `qiita_db.meta_util`)
===========================================
..currentmodule:: qiita_db.meta_util
This module provides utility functions that use the ORM objects. ORM objects
CANNOT import from this file.
Methods
-------
..autosummary::
:toctree: generated/
get_lat_longs
"""... | bsd-3-clause |
anonymouscontributor/cnr | cnr/LossFunctions.py | 1 | 28917 | '''
A collection of LossFunction classes
@date: May 7, 2015
'''
import numpy as np
import os, ctypes, uuid
from _ctypes import dlclose
from subprocess import call
from matplotlib import pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import axes3d
from scipy.linalg import orth, eigh
from scipy.integ... | mit |
BDannowitz/polymath-progression-blog | jlab-hackathon/loadCode.py | 1 | 3811 | #!/usr/bin/env python
#
#
# ex_toy4
#
# Building on toy3 example, this adds drift distance
# information to the pixel color. It also adds a
# random z-vertex position in addition to the phi
# angle.
#
# The network is defined with 2 branches to calculate
# the phi and z. They share a common input layer and
# initial ... | gpl-2.0 |
bachiraoun/fullrmc | Constraints/PairDistributionConstraints.py | 1 | 71823 | """
PairDistributionConstraints contains classes for all constraints related
to experimental pair distribution functions.
.. inheritance-diagram:: fullrmc.Constraints.PairDistributionConstraints
:parts: 1
"""
# standard libraries imports
from __future__ import print_function
import itertools, inspect, copy, os, re... | agpl-3.0 |
BiaDarkia/scikit-learn | sklearn/linear_model/tests/test_base.py | 33 | 17862 | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
#
# License: BSD 3 clause
import numpy as np
from scipy import sparse
from scipy import linalg
from itertools import product
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils... | bsd-3-clause |
srslynow/legal-text-mining | to_vector_data.py | 1 | 2895 | import os
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.preprocessing import MultiLabelBinarizer
from sklearn.multioutput import MultiOutputClassifier
from sklearn.ensemble import RandomForestClassifier
import numpy as np
import glob
# path variables
xmls_path = r'E:\Datasets\rechts... | gpl-3.0 |
vshtanko/scikit-learn | benchmarks/bench_plot_approximate_neighbors.py | 85 | 6377 | """
Benchmark for approximate nearest neighbor search using
locality sensitive hashing forest.
There are two types of benchmarks.
First, accuracy of LSHForest queries are measured for various
hyper-parameters and index sizes.
Second, speed up of LSHForest queries compared to brute force
method in exact nearest neigh... | bsd-3-clause |
fashandge/partools | setup.py | 1 | 2311 | #!/usr/bin/env python
#from distutils.core import setup
from codecs import open
import re
import os
from os import path
from setuptools import setup, find_packages
def read(*names, **kwargs):
with open(
os.path.join(os.path.dirname(__file__), *names),
encoding=kwargs.get("encoding", "utf8")
) ... | apache-2.0 |
moutai/scikit-learn | examples/text/mlcomp_sparse_document_classification.py | 33 | 4515 | """
========================================================
Classification of text documents: using a MLComp dataset
========================================================
This is an example showing how the scikit-learn can be used to classify
documents by topics using a bag-of-words approach. This example uses
a s... | bsd-3-clause |
petebachant/scipy | doc/source/tutorial/examples/normdiscr_plot1.py | 84 | 1547 | import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
npoints = 20 # number of integer support points of the distribution minus 1
npointsh = npoints / 2
npointsf = float(npoints)
nbound = 4 #bounds for the truncated normal
normbound = (1 + 1 / npointsf) * nbound #actual bounds of truncated normal
... | bsd-3-clause |
kiyoto/statsmodels | statsmodels/datasets/tests/test_utils.py | 26 | 1697 | import os
import sys
from statsmodels.datasets import get_rdataset, webuse, check_internet
from numpy.testing import assert_, assert_array_equal, dec
cur_dir = os.path.dirname(os.path.abspath(__file__))
def test_get_rdataset():
# smoke test
if sys.version_info[0] >= 3:
#NOTE: there's no way to test bo... | bsd-3-clause |
JonWel/CoolProp | wrappers/Python/CoolProp/Plots/SimpleCyclesCompression.py | 3 | 8420 | # -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import numpy as np
import CoolProp
from .Common import process_fluid_state
from .SimpleCycles import BaseCycle, StateContainer
class BaseCompressionCycle(BaseCycle):
"""A thermodynamic cycle for vapour compression processes.... | mit |
victorbergelin/scikit-learn | sklearn/cluster/bicluster.py | 211 | 19443 | """Spectral biclustering algorithms.
Authors : Kemal Eren
License: BSD 3 clause
"""
from abc import ABCMeta, abstractmethod
import numpy as np
from scipy.sparse import dia_matrix
from scipy.sparse import issparse
from . import KMeans, MiniBatchKMeans
from ..base import BaseEstimator, BiclusterMixin
from ..external... | bsd-3-clause |
DTasev/rnd | py/lasso_selection.py | 1 | 2807 | from __future__ import print_function
from six.moves import input
import numpy as np
from matplotlib.widgets import LassoSelector
from matplotlib.path import Path
class SelectFromCollection(object):
"""Select indices from a matplotlib collection using `LassoSelector`.
Selected indices are sav... | gpl-3.0 |
maximus009/kaggle-galaxies | try_convnet_cc_multirotflip_3x69r45_pysex.py | 7 | 17508 | import numpy as np
# import pandas as pd
import theano
import theano.tensor as T
import layers
import cc_layers
import custom
import load_data
import realtime_augmentation as ra
import time
import csv
import os
import cPickle as pickle
from datetime import datetime, timedelta
# import matplotlib.pyplot as plt
# plt.i... | bsd-3-clause |
justincassidy/scikit-learn | sklearn/cluster/tests/test_hierarchical.py | 230 | 19795 | """
Several basic tests for hierarchical clustering procedures
"""
# Authors: Vincent Michel, 2010, Gael Varoquaux 2012,
# Matteo Visconti di Oleggio Castello 2014
# License: BSD 3 clause
from tempfile import mkdtemp
import shutil
from functools import partial
import numpy as np
from scipy import sparse
from... | bsd-3-clause |
ehogan/iris | docs/iris/src/userguide/regridding_plots/regridded_to_global_area_weighted.py | 17 | 1646 |
from __future__ import (absolute_import, division, print_function)
from six.moves import (filter, input, map, range, zip) # noqa
import iris
import iris.analysis
import iris.plot as iplt
import matplotlib.pyplot as plt
import matplotlib.colors
import numpy as np
global_air_temp = iris.load_cube(iris.sample_data_pat... | lgpl-3.0 |
NunoEdgarGub1/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 |
iyounus/incubator-systemml | src/main/python/tests/test_mllearn_numpy.py | 4 | 8902 | #!/usr/bin/python
#-------------------------------------------------------------
#
# 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 f... | apache-2.0 |
ozak/geopandas | geopandas/plotting.py | 1 | 19833 | from __future__ import print_function
from distutils.version import LooseVersion
import warnings
import numpy as np
import pandas as pd
def _flatten_multi_geoms(geoms, colors=None):
"""
Returns Series like geoms and colors, except that any Multi geometries
are split into their components and colors are re... | bsd-3-clause |
parejkoj/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 |
nwillemse/nctrader | examples/pandas_examples/test_pandas_examples.py | 1 | 2703 | """
Test examples
One example can be test individually using:
$ nosetests -s -v examples/test_examples.py:TestExamples.test_strategy_backtest
"""
import os
import unittest
from nctrader import settings
import examples.pandas_examples.pandas_bar_display_prices_backtest
import examples.pandas_examples.pandas_tick_str... | mit |
dingliumath/quant-econ | examples/illustrates_lln.py | 7 | 1802 | """
Filename: illustrates_lln.py
Authors: John Stachurski and Thomas J. Sargent
Visual illustration of the law of large numbers.
"""
import random
import numpy as np
from scipy.stats import t, beta, lognorm, expon, gamma, poisson
import matplotlib.pyplot as plt
n = 100
# == Arbitrary collection of distributions == ... | bsd-3-clause |
theandygross/CancerData | src/Processing/InitializeMut.py | 1 | 3444 | """
Created on Jul 2, 2013
@author: agross
Mutation calls are extracted from the annotated MAF files obtained
from Firehose and filtered to include only non-silent mutations. Each
case is associated with a binary vector in which each position
represents a gene; the position is set to 1 if the gene is observed
to harb... | mit |
pkruskal/scikit-learn | sklearn/datasets/lfw.py | 141 | 19372 | """Loader for the Labeled Faces in the Wild (LFW) dataset
This dataset is a collection of JPEG pictures of famous people collected
over the internet, all details are available on the official website:
http://vis-www.cs.umass.edu/lfw/
Each picture is centered on a single face. The typical task is called
Face Veri... | bsd-3-clause |
talbrecht/pism_pik | site-packages/PISM/util.py | 1 | 3498 | # Copyright (C) 2011, 2012, 2013, 2015, 2016 David Maxwell and Constantine Khroulev
#
# This file is part of PISM.
#
# PISM is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (... | gpl-3.0 |
zfrenchee/pandas | pandas/tests/frame/test_block_internals.py | 2 | 19846 | # -*- coding: utf-8 -*-
from __future__ import print_function
import pytest
from datetime import datetime, timedelta
import itertools
from numpy import nan
import numpy as np
from pandas import (DataFrame, Series, Timestamp, date_range, compat,
option_context)
from pandas.compat import StringIO... | bsd-3-clause |
rosswhitfield/mantid | qt/applications/workbench/workbench/plotting/test/test_figureerrorsmanager.py | 3 | 5733 | # Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2019 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# T... | gpl-3.0 |
jmlon/PythonTutorials | pandas/logAnalyzer.py | 1 | 2734 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Read an apache log file into a Pandas Dataframe.
Analyze the data, produce graphs for the analysis.
Author: Jorge Londoño
Date: 2018-01-12
'''
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from dateutil.parser import *
def apacheDatePars... | gpl-3.0 |
JohannesHoppe/docker-ubuntu-vnc-desktop | noVNC/utils/json2graph.py | 46 | 6674 | #!/usr/bin/env python
'''
Use matplotlib to generate performance charts
Copyright 2011 Joel Martin
Licensed under MPL-2.0 (see docs/LICENSE.MPL-2.0)
'''
# a bar plot with errorbars
import sys, json, pprint
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
def usage... | apache-2.0 |
FrancoisRheaultUS/dipy | dipy/stats/analysis.py | 2 | 10573 |
import os
import numpy as np
from scipy.spatial import cKDTree
from scipy.ndimage.interpolation import map_coordinates
from scipy.spatial.distance import mahalanobis
from dipy.utils.optpkg import optional_package
from dipy.io.utils import save_buan_profiles_hdf5
from dipy.segment.clustering import QuickBundles
from d... | bsd-3-clause |
wasade/qiime | qiime/compare_categories.py | 1 | 7151 | #!/usr/bin/env python
from __future__ import division
__author__ = "Jai Ram Rideout"
__copyright__ = "Copyright 2012, The QIIME project"
__credits__ = ["Jai Ram Rideout", "Michael Dwan", "Logan Knecht",
"Damien Coy", "Levi McCracken"]
__license__ = "GPL"
__version__ = "1.8.0-dev"
__maintainer__ = "Jai R... | gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.