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 |
|---|---|---|---|---|---|
dseaton/edx2bigquery | edx2bigquery/make_roles.py | 1 | 8964 | #!/usr/bin/python
#
# File: make_user_info_combo.py
# Date: 23-Jan-17
# Author: G. Lopez
#
# make single JSON file containing edX SQL information from:
#
# rolesaccess.csv ( courseaccessrole )
# rolesdisc.csv ( client_role_users )
#
# one line is generated for each user.
#
# This will be used to generate role... | gpl-2.0 |
aringh/odl | odl/contrib/solvers/spdhg/examples/ROF_1k2_primal.py | 1 | 15456 | # Copyright 2014-2018 The ODL contributors
#
# This file is part of ODL.
#
# 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 https://mozilla.org/MPL/2.0/.
"""An example of using the SPDHG algorithm t... | mpl-2.0 |
endolith/scikit-image | doc/examples/numpy_operations/plot_view_as_blocks.py | 7 | 2216 | """
============================
Block views on images/arrays
============================
This example illustrates the use of `view_as_blocks` from
`skimage.util.shape`. Block views can be incredibly useful when one
wants to perform local operations on non-overlapping image patches.
We use `astronaut` from `skimage... | bsd-3-clause |
alexsavio/scikit-learn | sklearn/datasets/tests/test_kddcup99.py | 59 | 1336 | """Test kddcup99 loader. Only 'percent10' mode is tested, as the full data
is too big to use in unit-testing.
The test is skipped if the data wasn't previously fetched and saved to
scikit-learn data folder.
"""
import errno
from sklearn.datasets import fetch_kddcup99
from sklearn.utils.testing import assert_equal, S... | bsd-3-clause |
rodorad/spark-tk | regression-tests/sparktkregtests/testcases/frames/frame_binary_classification_test.py | 13 | 9995 | # vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# 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 require... | apache-2.0 |
ldirer/scikit-learn | sklearn/datasets/tests/test_mldata.py | 384 | 5221 | """Test functionality of mldata fetching utilities."""
import os
import shutil
import tempfile
import scipy as sp
from sklearn import datasets
from sklearn.datasets import mldata_filename, fetch_mldata
from sklearn.utils.testing import assert_in
from sklearn.utils.testing import assert_not_in
from sklearn.utils.test... | bsd-3-clause |
desihub/desispec | py/desispec/scripts/fibercrosstalk.py | 1 | 11872 | """
desispec.scripts.trace_shifts
=============================
"""
from __future__ import absolute_import, division
import sys,os
import argparse
import numpy as np
from scipy.signal import fftconvolve
from astropy.table import Table
import matplotlib.pyplot as plt
import scipy.ndimage
from desiutil.log import get_l... | bsd-3-clause |
joshloyal/scikit-learn | sklearn/linear_model/stochastic_gradient.py | 16 | 50617 | # Authors: Peter Prettenhofer <peter.prettenhofer@gmail.com> (main author)
# Mathieu Blondel (partial_fit support)
#
# License: BSD 3 clause
"""Classification and regression using Stochastic Gradient Descent (SGD)."""
import numpy as np
from abc import ABCMeta, abstractmethod
from ..externals.joblib import ... | bsd-3-clause |
smartscheduling/scikit-learn-categorical-tree | sklearn/cross_validation.py | 3 | 57208 | """
The :mod:`sklearn.cross_validation` module includes utilities for cross-
validation and performance evaluation.
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>,
# Gael Varoquaux <gael.varoquaux@normalesup.org>,
# Olivier Grisel <olivier.grisel@ensta.org>
# License: BSD 3 clause
from... | bsd-3-clause |
samzhang111/scikit-learn | examples/covariance/plot_covariance_estimation.py | 250 | 5070 | """
=======================================================================
Shrinkage covariance estimation: LedoitWolf vs OAS and max-likelihood
=======================================================================
When working with covariance estimation, the usual approach is to use
a maximum likelihood estimator,... | bsd-3-clause |
smartscheduling/scikit-learn-categorical-tree | benchmarks/bench_isotonic.py | 268 | 3046 | """
Benchmarks of isotonic regression performance.
We generate a synthetic dataset of size 10^n, for n in [min, max], and
examine the time taken to run isotonic regression over the dataset.
The timings are then output to stdout, or visualized on a log-log scale
with matplotlib.
This alows the scaling of the algorith... | bsd-3-clause |
ChileanVirtualObservatory/ASYDO | examples/experiments/demos/attic/moldetect.py | 1 | 7745 | import pickle
import numpy as np
from scipy import signal
import math
from matplotlib import pyplot as plt
from asydo import factory, vu, db
import astropy
from mpl_toolkits.mplot3d import Axes3D
from sklearn.cluster import AffinityPropagation
from sklearn.cluster import KMeans
from sklearn import metrics
fwhm_bords=(... | gpl-2.0 |
bmmalone/as-auto-sklearn | as_auto_sklearn/validate_as_auto_sklearn.py | 1 | 3239 | #! /usr/bin/env python3
import argparse
import numpy as np
import pandas as pd
import yaml
import misc.pandas_utils as pandas_utils
import misc.parallel as parallel
import misc.utils as utils
from aslib_scenario.aslib_scenario import ASlibScenario
from autofolio.validation.validate import Validator
import logging
... | mit |
liangz0707/scikit-learn | sklearn/tests/test_cross_validation.py | 31 | 46699 | """Test the cross_validation module"""
from __future__ import division
import warnings
import numpy as np
from scipy.sparse import coo_matrix
from scipy.sparse import csr_matrix
from scipy import stats
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.test... | bsd-3-clause |
jblupus/PyLoyaltyProject | old/experimentos/experimentos.py | 1 | 7083 | from os import mkdir
from os.path import exists
import numpy as np
import pandas as pd
from sklearn.utils import shuffle
from old.project import CassandraUtils
from old.project import get_time
RTD_STS_KEY = 'retweetedStatus'
MT_STS_KEY = 'userMentionEntities'
PATH = '/home/joao/Dev/Data/Twitter/'
FRIENDS_PATH = '/ho... | bsd-2-clause |
ryanjmccall/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/figure.py | 69 | 38331 | """
The figure module provides the top-level
:class:`~matplotlib.artist.Artist`, the :class:`Figure`, which
contains all the plot elements. The following classes are defined
:class:`SubplotParams`
control the default spacing of the subplots
:class:`Figure`
top level container for all plot elements
"""
impo... | gpl-3.0 |
fengzhyuan/scikit-learn | sklearn/utils/multiclass.py | 83 | 12343 |
# Author: Arnaud Joly, Joel Nothman, Hamzeh Alsalhi
#
# License: BSD 3 clause
"""
Multi-class / multi-label utility function
==========================================
"""
from __future__ import division
from collections import Sequence
from itertools import chain
from scipy.sparse import issparse
from scipy.sparse.... | bsd-3-clause |
xwolf12/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 |
cg31/tensorflow | tensorflow/python/client/notebook.py | 33 | 4608 | # Copyright 2015 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 |
carlsonp/kaggle-TrulyNative | processURLS_serial.py | 1 | 1688 | from __future__ import print_function
import re, os, sys
from bs4 import BeautifulSoup
import pandas as pd
import numpy as np
from urlparse import urlparse
import networkx as nx
import matplotlib.pyplot as plt
#https://pypi.python.org/pypi/etaprogress/
from etaprogress.progress import ProgressBar
#337304 total HTML fi... | gpl-3.0 |
victorbergelin/scikit-learn | examples/cross_decomposition/plot_compare_cross_decomposition.py | 142 | 4761 | """
===================================
Compare cross decomposition methods
===================================
Simple usage of various cross decomposition algorithms:
- PLSCanonical
- PLSRegression, with multivariate response, a.k.a. PLS2
- PLSRegression, with univariate response, a.k.a. PLS1
- CCA
Given 2 multivari... | bsd-3-clause |
ryanbaumann/athletedataviz | mapbox-exp/ADV-update-utils/update-activities.py | 1 | 8517 | # Goal - Select all segments in a given lat/long bounds using the Strava API
# Problem - API only reuturns top 10 segments in bound
import stravalib
import pandas as pd
import numpy as np
import os
from sqlalchemy import create_engine
from polyline.codec import PolylineCodec
from datetime import datetime
import json
im... | mit |
kjung/scikit-learn | sklearn/decomposition/tests/test_sparse_pca.py | 160 | 6028 | # Author: Vlad Niculae
# License: BSD 3 clause
import sys
import numpy as np
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import SkipTest
from sklearn.utils.testing import ass... | bsd-3-clause |
aruneral01/autokit | autokit/hpsklearn/vkmeans.py | 6 | 2032 | import numpy as np
from sklearn.cluster import KMeans
class ColumnKMeans(object):
def __init__(self,
n_clusters,
init='k-means++',
n_init=10,
max_iter=300,
tol=1e-4,
precompute_distances=True,
verbose=0,
random_state=None,
copy_x=True,
... | mit |
xwolf12/scikit-learn | sklearn/decomposition/dict_learning.py | 104 | 44632 | """ Dictionary learning
"""
from __future__ import print_function
# Author: Vlad Niculae, Gael Varoquaux, Alexandre Gramfort
# License: BSD 3 clause
import time
import sys
import itertools
from math import sqrt, ceil
import numpy as np
from scipy import linalg
from numpy.lib.stride_tricks import as_strided
from ..b... | bsd-3-clause |
spectralDNS/spectralDNS | demo/Vortices2D.py | 2 | 2458 | """
2D test case with three vortices
"""
from numpy import zeros, exp, pi, loadtxt, allclose, where
import matplotlib.pyplot as plt
from shenfun import Array
from spectralDNS import config, get_solver, solve
def initialize(U, X, U_hat, K_over_K2, T, **context):
w = exp(-((X[0]-pi)**2+(X[1]-pi+pi/4)**2)/(0.2)) \
... | lgpl-3.0 |
jseabold/statsmodels | statsmodels/regression/tests/test_theil.py | 5 | 13499 | # -*- coding: utf-8 -*-
"""
Created on Mon May 05 17:29:56 2014
Author: Josef Perktold
"""
import os
import numpy as np
import pandas as pd
import pytest
from numpy.testing import assert_allclose
from statsmodels.regression.linear_model import OLS, GLS
from statsmodels.sandbox.regression.penalized import TheilGLS... | bsd-3-clause |
charanpald/wallhack | wallhack/clusterexp/ProcessClusterResults.py | 1 | 16354 |
"""
Dump out some graphs
"""
import os
import sys
import logging
import numpy
import itertools
import matplotlib.pyplot as plt
from apgl.graph import *
from sandbox.util.PathDefaults import PathDefaults
numpy.random.seed(21)
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
numpy.set_printoptions(suppress=... | gpl-3.0 |
mhue/scikit-learn | examples/text/hashing_vs_dict_vectorizer.py | 284 | 3265 | """
===========================================
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 |
EigenPro/EigenPro-tensorflow | utils.py | 1 | 6070 | import gc
import numpy as np
import tensorflow as tf
import time
from keras import backend as K
from keras.layers import Lambda, Input
from keras.models import Model
from sklearn.decomposition import TruncatedSVD
from layers import KernelEmbedding
def add_index(X):
"""Append sample index as the last feature to d... | mit |
NYUDataBootcamp/Materials | Code/Python/bootcamp_examples.py | 1 | 8047 | """
Examples for Data Bootcamp course (data input and graphics)
**Warning**
Web data access will change in the near future, when Pandas spins
off the web access tools into a new package.
http://pandas.pydata.org/pandas-docs/stable/remote_data.html
Repository of materials (including this file):
* https://github.com/NY... | mit |
rs2/pandas | pandas/core/indexes/numeric.py | 1 | 13816 | from typing import Any
import numpy as np
from pandas._libs import index as libindex, lib
from pandas._typing import Dtype, Label
from pandas.util._decorators import cache_readonly, doc
from pandas.core.dtypes.cast import astype_nansafe
from pandas.core.dtypes.common import (
is_bool,
is_bool_dtype,
is_d... | bsd-3-clause |
thombashi/pytablereader | docs/make_readme.py | 1 | 1915 | #!/usr/bin/env python3
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
import sys
from path import Path
from readmemaker import ReadmeMaker
PROJECT_NAME = "pytablereader"
OUTPUT_DIR = ".."
def write_examples(maker):
maker.set_indent_level(0)
maker.write_chapter("Examples")
ex... | mit |
tbs1980/hmf | scripts/transfer_limits.py | 1 | 7746 | """
This script calculates the transfer function using all four transfer fits for
different values of the density parameters, testing if realistic results are
returned.
It seems that CAMB uses the physical constants to actual do most of the
calculations -- ie. bounds in density space are constant with omegab_h2 etc,... | mit |
dshen1/trading-with-python | lib/interactiveBrokers/histData.py | 76 | 6472 | '''
Created on May 8, 2013
Copyright: Jev Kuznetsov
License: BSD
Module for downloading historic data from IB
'''
import ib
import pandas as pd
from ib.ext.Contract import Contract
from ib.opt import ibConnection, message
import logger as logger
from pandas import DataFrame, Index
import os
imp... | bsd-3-clause |
bnyu/InvertedPendulm | Pole.py | 1 | 4570 | import numpy as np
from sympy import *
import random
import matplotlib
import matplotlib.pyplot as plt
matplotlib.use('TkAgg')
# 对比轨迹图
def track(y1, y2, y3, t):
time = np.arange(0, t)
angle1 = y1[:, 0]
angle_velocity1 = y1[:, 1]
position1 = y1[:, 2]
velocity1 = y1[:, 3]
angle2 = y2[:, 0]
a... | lgpl-3.0 |
kevin-intel/scikit-learn | sklearn/feature_extraction/_dict_vectorizer.py | 3 | 14539 | # Authors: Lars Buitinck
# Dan Blanchard <dblanchard@ets.org>
# License: BSD 3 clause
from array import array
from collections.abc import Mapping, Iterable
from operator import itemgetter
from numbers import Number
import numpy as np
import scipy.sparse as sp
from ..base import BaseEstimator, TransformerMix... | bsd-3-clause |
catalla/AYDABTU | feature_analyzer/legacy/make_scattersLegacy.py | 1 | 5080 | import vizQuery as vq
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import sys
import json
from sklearn import preprocessing
import itertools as it
from scipy.stats import linregress
from sklearn.cross_validation import train_test_split
#Read Query File
query_file = open(sys.argv[1], "r")
#Ge... | mit |
davidsamu/seal | seal/object/unit.py | 1 | 30916 | # -*- coding: utf-8 -*-
"""
Class representing a (spike sorted) unit (single or multi).
@author: David Samu
"""
import warnings
import numpy as np
import pandas as pd
from quantities import s, ms, us, deg, Hz
from seal.util import util, constants
from seal.object.rate import Rate
from seal.object.spikes import Spik... | gpl-3.0 |
Berkeley-BORIS/BORIS_Code | boris/eyeparse.py | 1 | 7967 | """
Classes to parse NDS files and create pandas DataFrames to hold eyetracking information.
"""
import numpy as np
import pandas as pd
class EyeDataParser(object):
def __init__(self, data_fpath):
self.data_fpath = data_fpath
# Make dictionaries to hold our data with repitions as keys
s... | mit |
Wikidata/StrepHit | strephit/classification/classify.py | 1 | 4650 | # -*- encoding: utf-8 -*-
import json
import logging
import click
from sklearn.externals import joblib
from strephit.commons.classification import apply_custom_classification_rules, reverse_gazetteer
from strephit.commons import parallel
logger = logging.getLogger(__name__)
class SentenceClassifier:
""" Super... | gpl-3.0 |
renaud/neuroNER | analysis/br x markers matrix.py | 1 | 1277 |
# coding: utf-8
# In[10]:
'''
Computes matrix brain_region x marker_genes
'''
import ijson
from collections import defaultdict
matrix_dict = defaultdict(dict)
#f = open('neuroner_20160122s_index_sample2.json')
f = open('/Users/richarde/data/neuroner/neuroner_20160122s_index.json') # data in https://dl.dropboxuserc... | lgpl-3.0 |
bearing/dosenet-analysis | statistic.py | 1 | 2043 | import csv
import io
import urllib.request
import numpy as np
import os
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from datetime import datetime
from datetime import timedelta
from matplotlib.dates import date2num
def findNearestDate(alist,date,delta):
#Binary search to find the ... | mit |
hsuantien/scikit-learn | examples/classification/plot_lda.py | 164 | 2224 | """
====================================================================
Normal and Shrinkage Linear Discriminant Analysis for classification
====================================================================
Shows how shrinkage improves classification.
"""
from __future__ import division
import numpy as np
import... | bsd-3-clause |
platinhom/ManualHom | Coding/Python/scipy-html-0.16.1/generated/scipy-stats-bernoulli-1.py | 1 | 1028 | from scipy.stats import bernoulli
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1, 1)
# Calculate a few first moments:
p = 0.3
mean, var, skew, kurt = bernoulli.stats(p, moments='mvsk')
# Display the probability mass function (``pmf``):
x = np.arange(bernoulli.ppf(0.01, p),
bernoulli.ppf(0.99... | gpl-2.0 |
drammock/mne-python | mne/viz/backends/_pysurfer_mayavi.py | 4 | 22433 | """
Core visualization operations based on Mayavi.
Actual implementation of _Renderer and _Projection classes.
"""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Denis Engemann <denis.engemann@gmail.com>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Eric Larson <larson.eric... | bsd-3-clause |
anielsen001/scipy | scipy/misc/common.py | 19 | 11415 | """
Functions which are common and require SciPy Base and Level 1 SciPy
(special, linalg)
"""
from __future__ import division, print_function, absolute_import
import numpy
import numpy as np
from numpy import (exp, log, asarray, arange, newaxis, hstack, product, array,
zeros, eye, poly1d, r_, froms... | bsd-3-clause |
sarahgrogan/scikit-learn | sklearn/naive_bayes.py | 70 | 28476 | # -*- coding: utf-8 -*-
"""
The :mod:`sklearn.naive_bayes` module implements Naive Bayes algorithms. These
are supervised learning methods based on applying Bayes' theorem with strong
(naive) feature independence assumptions.
"""
# Author: Vincent Michel <vincent.michel@inria.fr>
# Minor fixes by Fabian Pedre... | bsd-3-clause |
SamHames/scikit-image | skimage/viewer/utils/core.py | 1 | 6964 | import warnings
import numpy as np
from ..qt import qt_api
try:
import matplotlib as mpl
from matplotlib.figure import Figure
from matplotlib import _pylab_helpers
from matplotlib.colors import LinearSegmentedColormap
if not qt_api is None:
from matplotlib.backends.backend_qt4 import Figu... | bsd-3-clause |
plang85/tinkerbell | tinkerbell/app/plot.py | 1 | 3134 | import numpy as np
from matplotlib import pyplot as plt
import logging as log
plt.style.use('ggplot')
STYLEFALLBACK = {'linestyle': 'solid', 'linewidth': 2, 'alpha': 0.7}
TOMPLSTYLE = {'p': {'marker': 'x', 'linestyle': 'None'}, 'l': STYLEFALLBACK,
'ls': {'linestyle': 'dashed', 'linewidth': 2, 'alpha': 0.7},
'lgol... | unlicense |
ishanic/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 |
russel1237/scikit-learn | sklearn/linear_model/tests/test_coordinate_descent.py | 1 | 25116 | # Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD 3 clause
from sys import version_info
import numpy as np
from scipy import interpolate, sparse
from copy import deepcopy
from sklearn.datasets import load_boston
from sklearn.utils.testing ... | bsd-3-clause |
fabioticconi/scikit-learn | examples/linear_model/plot_ols_ridge_variance.py | 387 | 2060 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Ordinary Least Squares and Ridge Regression Variance
=========================================================
Due to the few points in each dimension and the straight
line that linear regression uses to follow thes... | bsd-3-clause |
chengsoonong/crowdastro | crowdastro/import_data.py | 1 | 34208 | """Imports and standardises data into crowdastro.
Matthew Alger
The Australian National University
2016
"""
import argparse
import csv
import hashlib
import logging
import os
from astropy.coordinates import SkyCoord
import astropy.io.fits
from astropy.io import ascii
import astropy.utils.exceptions
import astropy.wcs... | mit |
wenxichen/tensorflow_yolo2 | yolo1_pretrain.py | 1 | 3255 | import cv2
import os
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import cm
import argparse
import sys
import tensorflow as tf
alpha = 0.1
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial)
def bias_variable(shape):
initia... | mit |
M4573R/BuildingMachineLearningSystemsWithPython | ch12/image-classification.py | 21 | 3109 | # 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
import mahotas as mh
import numpy as np
from glob import glob
from jug import TaskGenerator
# We need ... | mit |
vsoch/pe-predictive | pefinder/utils.py | 1 | 2949 | from logman import logger
import os
import pandas
import sys
######################################################################################
# Supporting functions
######################################################################################
def load_reports(reports_path,report_field=None,id_field=No... | mit |
beiko-lab/gengis | bin/Lib/site-packages/numpy/linalg/linalg.py | 1 | 64922 | """Lite version of scipy.linalg.
Notes
-----
This module is a lite version of the linalg.py module in SciPy which
contains high-level Python interface to the LAPACK library. The lite
version only accesses the following LAPACK functions: dgesv, zgesv,
dgeev, zgeev, dgesdd, zgesdd, dgelsd, zgelsd, dsyevd, zheevd... | gpl-3.0 |
msmbuilder/msmbuilder | msmbuilder/tests/test_kernel_approximation.py | 9 | 1158 | from __future__ import absolute_import
import numpy as np
from numpy.testing import assert_array_almost_equal
from sklearn.kernel_approximation import Nystroem as NystroemR
from msmbuilder.decomposition.kernel_approximation import Nystroem, LandmarkNystroem
def test_nystroem_vs_sklearn():
np.random.seed(42)
... | lgpl-2.1 |
courtarro/gnuradio | gr-filter/examples/synth_filter.py | 58 | 2552 | #!/usr/bin/env python
#
# Copyright 2010,2012,2013 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 ... | gpl-3.0 |
jlrandulfe/UviSpace | uvispace/uvisensor/resources/sim_kalman.py | 1 | 5146 | #!/usr/bin/env python
"""Executable module for simulating the Kalman filter class"""
# Standard libraries
import sys
# Third party libraries
import matplotlib.pyplot as plt
import numpy as np
# Local libraries
try:
import uvisensor.kalmanfilter as kalmanfilter
except ImportError:
# Exit program if the settings ... | gpl-3.0 |
ryanjmccall/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/fontconfig_pattern.py | 72 | 6429 | """
A module for parsing and generating fontconfig patterns.
See the `fontconfig pattern specification
<http://www.fontconfig.org/fontconfig-user.html>`_ for more
information.
"""
# Author : Michael Droettboom <mdroe@stsci.edu>
# License : matplotlib license (PSF compatible)
# This class is defined here because it m... | gpl-3.0 |
walterreade/scikit-learn | sklearn/neighbors/classification.py | 7 | 14366 | """Nearest Neighbor Classification"""
# Authors: Jake Vanderplas <vanderplas@astro.washington.edu>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Sparseness support by Lars Buitinck
# Multi-output support by Arnaud Joly <a.joly@ul... | bsd-3-clause |
rajegannathan/grasp-lift-eeg-cat-dog-solution-updated | python-packages/mne-python-0.10/mne/tests/test_source_space.py | 1 | 26905 | from __future__ import print_function
import os
import os.path as op
from nose.tools import assert_true, assert_raises
from nose.plugins.skip import SkipTest
import numpy as np
from numpy.testing import assert_array_equal, assert_allclose, assert_equal
import warnings
from mne.datasets import testing
from mne import ... | bsd-3-clause |
MartinSavc/scikit-learn | sklearn/metrics/cluster/unsupervised.py | 230 | 8281 | """ Unsupervised evaluation metrics. """
# Authors: Robert Layton <robertlayton@gmail.com>
#
# License: BSD 3 clause
import numpy as np
from ...utils import check_random_state
from ..pairwise import pairwise_distances
def silhouette_score(X, labels, metric='euclidean', sample_size=None,
random... | bsd-3-clause |
fengzhyuan/scikit-learn | examples/linear_model/plot_sgd_separating_hyperplane.py | 260 | 1219 | """
=========================================
SGD: Maximum margin separating hyperplane
=========================================
Plot the maximum margin separating hyperplane within a two-class
separable dataset using a linear Support Vector Machines classifier
trained using SGD.
"""
print(__doc__)
import numpy as n... | bsd-3-clause |
shangwuhencc/scikit-learn | examples/plot_johnson_lindenstrauss_bound.py | 127 | 7477 | r"""
=====================================================================
The Johnson-Lindenstrauss bound for embedding with random projections
=====================================================================
The `Johnson-Lindenstrauss lemma`_ states that any high dimensional
dataset can be randomly projected i... | bsd-3-clause |
laurentgo/arrow | python/pyarrow/tests/test_table.py | 1 | 47250 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 |
airanmehr/bio | Scripts/Miscellaneous/CSE280A/Assigmant3.py | 1 | 6350 | '''
Copyleft Jan 15, 2016 Arya Iranmehr, PhD Student, Bafna Lab, UC San Diego, Email: airanmehr@gmail.com
'''
import pygraphviz as pg
import os; home=os.path.expanduser('~') +'/'
import numpy as np
import pandas as pd
def problem2():
n=5
k=int(min(n, 2*np.ceil(np.log(n))))
print k
W=np.zero... | mit |
ilayn/scipy | scipy/spatial/_spherical_voronoi.py | 5 | 13698 | """
Spherical Voronoi Code
.. versionadded:: 0.18.0
"""
#
# Copyright (C) Tyler Reddy, Ross Hemsley, Edd Edmondson,
# Nikolai Nowaczyk, Joe Pitt-Francis, 2015.
#
# Distributed under the same BSD license as SciPy.
#
import warnings
import numpy as np
import scipy
from . import _voronoi
from scipy.spat... | bsd-3-clause |
gfyoung/pandas | pandas/tests/series/methods/test_between.py | 4 | 1197 | import numpy as np
from pandas import Series, bdate_range, date_range, period_range
import pandas._testing as tm
class TestBetween:
# TODO: redundant with test_between_datetime_values?
def test_between(self):
series = Series(date_range("1/1/2000", periods=10))
left, right = series[[2, 7]]
... | bsd-3-clause |
theilmbh/RenderGR | relray_wh.py | 1 | 4938 | import scipy as sp
import numpy as np
import numpy.linalg as LA
from scipy.integrate import ode
import pylab as plt
import matplotlib.image as mpimg
from joblib import Parallel, delayed
import warnings
#coordinate system: t, r, theta, phi
# black hole at 0, 0, 0
# screen at 100, 0, 0
m = 1
rs = 2*m
b = 10
def sc_me... | gpl-2.0 |
shahankhatch/scikit-learn | sklearn/ensemble/weight_boosting.py | 71 | 40664 | """Weight Boosting
This module contains weight boosting estimators for both classification and
regression.
The module structure is the following:
- The ``BaseWeightBoosting`` base class implements a common ``fit`` method
for all the estimators in the module. Regression and classification
only differ from each ot... | bsd-3-clause |
rrohan/scikit-learn | sklearn/svm/tests/test_svm.py | 70 | 31674 | """
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 scipy import sparse
from nose.tools im... | bsd-3-clause |
datapythonista/pandas | pandas/tests/util/test_hashing.py | 1 | 11216 | import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Index,
MultiIndex,
Series,
)
import pandas._testing as tm
from pandas.core.util.hashing import hash_tuples
from pandas.util import (
hash_array,
hash_pandas_object,
)
@pytest.fixture(
params=[
Ser... | bsd-3-clause |
wiki2014/Learning-Summary | alps/cts/apps/CameraITS/tests/scene1/test_param_noise_reduction.py | 1 | 5711 | # Copyright 2013 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | gpl-3.0 |
adi-foundry/nycodex | nycodex/scrape/tests/test_dataset_columns.py | 1 | 2051 | from collections import OrderedDict
import pandas as pd
import pytest
from nycodex import db
from nycodex.scrape.dataset import dataset_columns
from nycodex.scrape.exceptions import SocrataTypeError
def test_dataset_columns_dtype_inference():
df = pd.DataFrame(
OrderedDict([
("SMALLINT", ["1... | apache-2.0 |
dsullivan7/scikit-learn | examples/plot_kernel_approximation.py | 262 | 8004 | """
==================================================
Explicit feature map approximation for RBF kernels
==================================================
An example illustrating the approximation of the feature map
of an RBF kernel.
.. currentmodule:: sklearn.kernel_approximation
It shows how to use :class:`RBFSa... | bsd-3-clause |
gotomypc/scikit-learn | sklearn/utils/extmath.py | 142 | 21102 | """
Extended math utilities.
"""
# Authors: Gael Varoquaux
# Alexandre Gramfort
# Alexandre T. Passos
# Olivier Grisel
# Lars Buitinck
# Stefan van der Walt
# Kyle Kastner
# License: BSD 3 clause
from __future__ import division
from functools import partial
import ... | bsd-3-clause |
khkaminska/scikit-learn | sklearn/cluster/tests/test_dbscan.py | 176 | 12155 | """
Tests for DBSCAN clustering algorithm
"""
import pickle
import numpy as np
from scipy.spatial import distance
from scipy import sparse
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing im... | bsd-3-clause |
FRESNA/PyPSA | test/test_lpf_against_pypower.py | 1 | 2380 | from __future__ import absolute_import
import pypsa
#NB: this test doesn't work for other cases because transformer tap
#ratio and phase angle not supported for lpf
from pypower.api import ppoption, runpf, case30 as case
from pypower.ppver import ppver
from distutils.version import StrictVersion
pypower_version = ... | gpl-3.0 |
esatel/ADCPy | adcpy/transect_preprocessor.py | 1 | 8786 | # -*- coding: utf-8 -*-
"""Example preprocessor ADCP files for ADCPRdiWorkhorseData compatible raw/netcdf files
Driver script that is designed find and load raw ADCP observations from a
designated directory, and perform certain processing task on them, optionally
saving the reuslts to ADCPData netcdf format, and/or pa... | mit |
ky822/scikit-learn | sklearn/kernel_approximation.py | 258 | 17973 | """
The :mod:`sklearn.kernel_approximation` module implements several
approximate kernel feature maps base on Fourier transforms.
"""
# Author: Andreas Mueller <amueller@ais.uni-bonn.de>
#
# License: BSD 3 clause
import warnings
import numpy as np
import scipy.sparse as sp
from scipy.linalg import svd
from .base im... | bsd-3-clause |
potash/scikit-learn | examples/manifold/plot_lle_digits.py | 138 | 8594 | """
=============================================================================
Manifold learning on handwritten digits: Locally Linear Embedding, Isomap...
=============================================================================
An illustration of various embeddings on the digits dataset.
The RandomTreesEmbed... | bsd-3-clause |
liyu1990/sklearn | sklearn/feature_extraction/dict_vectorizer.py | 234 | 12267 | # Authors: Lars Buitinck
# Dan Blanchard <dblanchard@ets.org>
# License: BSD 3 clause
from array import array
from collections import Mapping
from operator import itemgetter
import numpy as np
import scipy.sparse as sp
from ..base import BaseEstimator, TransformerMixin
from ..externals import six
from ..ext... | bsd-3-clause |
great-expectations/great_expectations | tests/integration/fixtures/yellow_trip_data_pandas_fixture/one_multi_batch_request_one_validator.py | 1 | 2778 | import numpy as np
from great_expectations.core.batch import BatchRequest
from great_expectations.data_context.data_context import DataContext
from great_expectations.datasource.data_connector.batch_filter import (
BatchFilter,
build_batch_filter,
)
from great_expectations.validator.validation_graph import Met... | apache-2.0 |
Tong-Chen/scikit-learn | examples/neighbors/plot_classification.py | 8 | 1769 | """
================================
Nearest Neighbors Classification
================================
Sample usage of Nearest Neighbors classification.
It will plot the decision boundaries for each class.
"""
print(__doc__)
import numpy as np
import pylab as pl
from matplotlib.colors import ListedColormap
from sklea... | bsd-3-clause |
glouppe/scikit-learn | examples/semi_supervised/plot_label_propagation_structure.py | 45 | 2433 | """
==============================================
Label Propagation learning a complex structure
==============================================
Example of LabelPropagation learning a complex internal structure
to demonstrate "manifold learning". The outer circle should be
labeled "red" and the inner circle "blue". Be... | bsd-3-clause |
pypot/ek_book | ch_04/pu_learning_test.py | 1 | 2489 | #_*_ coding: utf8 _*_
from pu_learning import *
import sklearn
from sklearn import datasets
from sklearn.linear_model import LogisticRegression
from sklearn.naive_bayes import BernoulliNB
import cPickle as pickle
import numpy
import random
__CONF_MAKE_NEW_DATA__ = False
SAMPLE_CNT = 10000
TRAIN_P... | mit |
samzhang111/scikit-learn | sklearn/metrics/pairwise.py | 8 | 45133 | # -*- coding: utf-8 -*-
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Robert Layton <robertlayton@gmail.com>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Philippe Gervais <philippe.gervais@inria.fr>
# Lars Buitinck ... | bsd-3-clause |
taynaud/sparkit-learn | splearn/linear_model/logistic.py | 2 | 6215 | # encoding: utf-8
import numpy as np
import scipy.sparse as sp
from sklearn.linear_model import LogisticRegression
from ..utils.validation import check_rdd
from .base import SparkLinearModelMixin
class SparkLogisticRegression(LogisticRegression, SparkLinearModelMixin):
"""Distributed implementation of scikit-l... | apache-2.0 |
pkhorrami4/make_chen_dataset | code/fix_face_misses.py | 1 | 8669 | import argparse
from glob import glob
import os
import shutil
import sys
import numpy
import matplotlib.pyplot as plt
import dlib
import skimage.transform
def copy_files_to_save_dir(input_path, save_path):
print 'Copying files to save_path.'
print 'Input path: %s' % input_path
print 'Save_path: %s' % save... | gpl-3.0 |
OTAkeys/RIOT | tests/pkg_emlearn/generate_digit.py | 11 | 1304 | #!/usr/bin/env python3
"""Generate a binary file from a sample image of the MNIST dataset.
Pixel of the sample are stored as float32, images have size 8x8.
"""
import os
import argparse
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn import datase... | lgpl-2.1 |
xguse/bokeh | bokeh/charts/builder/tests/test_step_builder.py | 33 | 2495 | """ This is the Bokeh charts testing interface.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with thi... | bsd-3-clause |
imcgreer/simqso | sdss/ebossfit.py | 1 | 11294 | #!/usr/bin/env python
import os,sys
import numpy as np
from sklearn.mixture import GaussianMixture
from astropy.table import Table
from astropy.coordinates import SkyCoord
from astropy import units as u
def make_coreqso_table(dr14qso,ebosstarg):
if isinstance(dr14qso,str):
dr14qso = Table.read(dr14qso)
... | bsd-3-clause |
cdegroc/scikit-learn | examples/decomposition/plot_sparse_coding.py | 4 | 3808 | """
===========================================
Sparse coding with a precomputed dictionary
===========================================
Transform a signal as a sparse combination of Ricker wavelets. This example
visually compares different sparse coding methods using the
:class:`sklearn.decomposition.SparseCoder` esti... | bsd-3-clause |
amolkahat/pandas | pandas/tests/dtypes/test_concat.py | 3 | 1999 | # -*- coding: utf-8 -*-
import pytest
import pandas.core.dtypes.concat as _concat
from pandas import (
Index, DatetimeIndex, PeriodIndex, TimedeltaIndex, Series, Period)
@pytest.mark.parametrize('to_concat, expected', [
# int/float/str
([['a'], [1, 2]], ['i', 'object']),
([[3, 4], [1, 2]], ['i']),
... | bsd-3-clause |
danche354/Sequence-Labeling | ner_BIOES/senna-raw-hash-2-pos-chunk-gazetteer-128-64-rmsprop5.py | 1 | 8494 | from keras.models import Model
from keras.layers import Input, Masking, Dense, LSTM
from keras.layers import Dropout, TimeDistributed, Bidirectional, merge
from keras.layers.embeddings import Embedding
from keras.utils import np_utils
from keras.optimizers import RMSprop
import numpy as np
import pandas as pd
import ... | mit |
StephanEwen/incubator-flink | flink-python/pyflink/table/tests/test_pandas_udf.py | 2 | 18009 | ################################################################################
# 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... | apache-2.0 |
jht0664/Utility_python_gromacs | python/fit_tmass.py | 1 | 5639 | #!/usr/bin/env python3
# ver 0.1 - coding python by Hyuntae Jung on 03/19/2018
import argparse
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description='fitting local density profile with gaussian function')
## args
parser.add_argument('-i', '--input', default='t... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.