repo_name stringlengths 7 90 | path stringlengths 5 191 | copies stringlengths 1 3 | size stringlengths 4 6 | content stringlengths 976 581k | license stringclasses 15
values |
|---|---|---|---|---|---|
liberatorqjw/scikit-learn | sklearn/linear_model/omp.py | 11 | 29513 | """Orthogonal matching pursuit algorithms
"""
# Author: Vlad Niculae
#
# License: BSD 3 clause
import warnings
from distutils.version import LooseVersion
import numpy as np
from scipy import linalg
from scipy.linalg.lapack import get_lapack_funcs
from .base import LinearModel, _pre_fit
from ..base import RegressorM... | bsd-3-clause |
cbmoore/statsmodels | statsmodels/iolib/tests/test_table.py | 26 | 7319 | import numpy as np
import unittest
from statsmodels.iolib.table import SimpleTable, default_txt_fmt
from statsmodels.iolib.table import default_latex_fmt
from statsmodels.iolib.table import default_html_fmt
import pandas
from statsmodels.regression.linear_model import OLS
ltx_fmt1 = default_latex_fmt.copy()
html_fmt1 ... | bsd-3-clause |
bennames/AeroComBAT-Project | Tutorials/Validations/V8_BEAM_DISPLACEMENT_ROTATIONS_AL_BOX_BEAM.py | 1 | 5894 | # =============================================================================
# HEPHAESTUS VALIDATION 8 - BEAM DISPLACEMENTS AND ROTATIONS SIMPLE AL BOX BEAM
# =============================================================================
# IMPORTS:
import sys
import os
sys.path.append(os.path.abspath('..\..'))
fr... | mit |
ritviksahajpal/LUH2 | LUH2/GLM/process_HYDE.py | 1 | 26619 | import logging
import numpy as np
import os
import pdb
import sys
import matplotlib.pyplot as plt
import palettable
import constants
import pygeoutil.util as util
import plot
# Logging
cur_flname = os.path.splitext(os.path.basename(__file__))[0]
LOG_FILENAME = constants.log_dir + os.sep + 'Log_' + cur_flname + '.txt... | mit |
UPenn-RoboCup/UPennalizers | Lib/Modules/Util/Python/monitor_shm.py | 3 | 2295 | #!/usr/bin/env python
import matplotlib.pyplot as mpl
import numpy as np
from scipy.misc import pilutil
import time
import shm
import os
vcmImage = shm.ShmWrapper('vcmImage181%s' % str(os.getenv('USER')));
def draw_data(rgb, labelA):
mpl.subplot(2,2,1);
mpl.imshow(rgb)
# disp('Received image.')
mpl.subplot(... | gpl-3.0 |
NelisVerhoef/scikit-learn | sklearn/cluster/tests/test_mean_shift.py | 150 | 3651 | """
Testing for mean shift clustering methods
"""
import numpy as np
import warnings
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import asser... | bsd-3-clause |
mhue/scikit-learn | doc/tutorial/text_analytics/solutions/exercise_01_language_train_model.py | 254 | 2253 | """Build a language detector model
The goal of this exercise is to train a linear classifier on text features
that represent sequences of up to 3 consecutive characters so as to be
recognize natural languages by using the frequencies of short character
sequences as 'fingerprints'.
"""
# Author: Olivier Grisel <olivie... | bsd-3-clause |
lsiemens/lsiemens.github.io | theory/fractional_calculus/code/irrational_linearFDE.py | 1 | 1397 | from matplotlib import pyplot
import numpy
C_i = [1, 1, 1]
alpha_i = [0, numpy.pi, numpy.sqrt(2)]
# sum_{i=0}^\infinity C_i \partial_{x}^{\alpha_i} f(x, a) = T f(x, a) = 0
# f_b = e^{e^{b} x - a b}
# T f_b(x, a) = f_b(x, a) (sum_{i=0}^\infinity C_i e^{\alpha_i b})
def f_b(z, a, b):
return numpy.exp(numpy.exp(b... | mit |
iismd17/scikit-learn | sklearn/linear_model/logistic.py | 57 | 65098 | """
Logistic Regression
"""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# Fabian Pedregosa <f@bianp.net>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Manoj Kumar <manojkumarsivaraj334@gmail.com>
# Lars Buitinck
# Simon Wu <s8wu@uwaterloo.ca>
imp... | bsd-3-clause |
0x0all/scikit-learn | sklearn/linear_model/tests/test_theil_sen.py | 234 | 9928 | """
Testing for Theil-Sen module (sklearn.linear_model.theil_sen)
"""
# Author: Florian Wilhelm <florian.wilhelm@gmail.com>
# License: BSD 3 clause
from __future__ import division, print_function, absolute_import
import os
import sys
from contextlib import contextmanager
import numpy as np
from numpy.testing import ... | bsd-3-clause |
gef756/statsmodels | setup.py | 2 | 15932 | """
Much of the build system code was adapted from work done by the pandas
developers [1], which was in turn based on work done in pyzmq [2] and lxml [3].
[1] http://pandas.pydata.org
[2] http://zeromq.github.io/pyzmq/
[3] http://lxml.de/
"""
import os
from os.path import relpath, join as pjoin
import sys
import subp... | bsd-3-clause |
deepfield/ibis | ibis/pandas/execution/arrays.py | 1 | 2066 | import operator
import six
import pandas as pd
from pandas.core.groupby import SeriesGroupBy
import ibis.expr.operations as ops
from ibis.pandas.dispatch import execute_node
@execute_node.register(ops.ArrayLength, pd.Series)
def execute_array_length(op, data, **kwargs):
return data.apply(len)
@execute_node.... | apache-2.0 |
rafaeltg/pydl | pydl/ts/stats.py | 2 | 4655 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import statsmodels.tsa.stattools as stools
from statsmodels.tsa.seasonal import seasonal_decompose
__all__ = ['acf', 'pacf', 'test_stationarity', 'decompose', 'correlated_lags']
def acf(ts, nlags=20, plot=False, ax=None):
"""
Autocorrel... | mit |
jseabold/scikit-learn | sklearn/utils/arpack.py | 265 | 64837 | """
This contains a copy of the future version of
scipy.sparse.linalg.eigen.arpack.eigsh
It's an upgraded wrapper of the ARPACK library which
allows the use of shift-invert mode for symmetric matrices.
Find a few eigenvectors and eigenvalues of a matrix.
Uses ARPACK: http://www.caam.rice.edu/software/ARPACK/
"""
#... | bsd-3-clause |
Nyker510/scikit-learn | examples/model_selection/grid_search_digits.py | 227 | 2665 | """
============================================================
Parameter estimation using grid search with cross-validation
============================================================
This examples shows how a classifier is optimized by cross-validation,
which is done using the :class:`sklearn.grid_search.GridSearc... | bsd-3-clause |
tms1337/fuzzy-classification | python/fuzzy_classification/classifiers/RandomFuzzyTree.old.py | 1 | 17466 | import numpy as np
from math import log, sqrt, ceil
import random
import string
from copy import copy
import pyximport
from tabulate import tabulate
pyximport.install()
from ..util import math_functions
import matplotlib.pyplot as plt
import textwrap
from textwrap import dedent
from multiprocessing import Pool
from ... | mit |
cybernet14/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 |
466152112/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 |
khs26/pele | pele/angleaxis/_otp_bulk.py | 3 | 8496 | import numpy as np
from numpy import cos, sin, pi
#import gmin_ as GMIN
#from pele.potentials import LJ
from pele.angleaxis import RBTopologyBulk, RBSystem, RigidFragmentBulk, RBPotentialWrapper
#from pele.potentials.ljcut import LJCut
from pele.potentials._lj_cpp import LJCutCellLists, LJCut
from pele.angleaxis.bulk... | gpl-3.0 |
lmcinnes/hdbscan | hdbscan/validity.py | 1 | 14453 | import numpy as np
from sklearn.metrics import pairwise_distances
from scipy.spatial.distance import cdist
from ._hdbscan_linkage import mst_linkage_core
from .hdbscan_ import isclose
def all_points_core_distance(distance_matrix, d=2.0):
"""
Compute the all-points-core-distance for all the points of a cluster.... | bsd-3-clause |
vighneshbirodkar/scikit-image | skimage/filters/thresholding.py | 1 | 24806 | import math
import numpy as np
from scipy import ndimage as ndi
from scipy.ndimage import filters as ndif
from collections import OrderedDict
from ..exposure import histogram
from .._shared.utils import assert_nD, warn
__all__ = ['try_all_threshold',
'threshold_adaptive',
'threshold_otsu',
... | bsd-3-clause |
raghavrv/scikit-learn | sklearn/decomposition/tests/test_pca.py | 3 | 23303 | import numpy as np
import scipy as sp
from itertools import product
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_gre... | bsd-3-clause |
BMJHayward/numpy | numpy/core/code_generators/ufunc_docstrings.py | 51 | 90047 | """
Docstrings for generated ufuncs
The syntax is designed to look like the function add_newdoc is being
called from numpy.lib, but in this file add_newdoc puts the docstrings
in a dictionary. This dictionary is used in
numpy/core/code_generators/generate_umath.py to generate the docstrings
for the ufuncs in numpy.co... | bsd-3-clause |
zedoul/AnomalyDetection | test_discretization/gmm_on_data.py | 1 | 1160 | import numpy as np
import matplotlib.pyplot as plt
from sklearn import mixture
import matplotlib.pyplot
import matplotlib.mlab
samples = 100000
data = np.zeros(samples)
mu, sigma = 0.05, 0.015
data[0:samples/2] = np.random.normal(mu, sigma, (samples/2))
mu, sigma = 0.18, 0.01
data[(samples/2):samples] = np.random.n... | mit |
nelson-liu/scikit-learn | sklearn/utils/random.py | 46 | 10523 | # Author: Hamzeh Alsalhi <ha258@cornell.edu>
#
# License: BSD 3 clause
from __future__ import division
import numpy as np
import scipy.sparse as sp
import operator
import array
from sklearn.utils import check_random_state
from sklearn.utils.fixes import astype
from ._random import sample_without_replacement
__all__ =... | bsd-3-clause |
kashif/scikit-learn | examples/neighbors/plot_nearest_centroid.py | 22 | 1803 | """
===============================
Nearest Centroid Classification
===============================
Sample usage of Nearest Centroid classification.
It will plot the decision boundaries for each class.
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
f... | bsd-3-clause |
OICR/PGMLab | external_lib/inchlib_clust-0.1.4/inchlib_clust.py | 3 | 32630 | #coding: utf-8
from __future__ import print_function
import csv, json, copy, re, argparse, os, urllib2
import numpy, scipy, fastcluster, sklearn
import scipy.cluster.hierarchy as hcluster
from sklearn import preprocessing
from scipy import spatial
LINKAGES = ["single", "complete", "average", "centroid", "ward", "med... | gpl-2.0 |
qbilius/streams | streams/envs/hvm.py | 1 | 41094 | import sys, os, hashlib, pickle, tempfile, zipfile, glob
from collections import OrderedDict
import numpy as np
import pandas
import tables
import pymongo
import boto3
import tqdm
import skimage, skimage.io, skimage.transform
from streams.envs.dataset import Dataset
import streams.utils
def get_id(obj):
return ... | gpl-3.0 |
Obus/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 |
xxd3vin/spp-sdk | opt/Python27/Lib/site-packages/numpy/lib/recfunctions.py | 23 | 34483 | """
Collection of utilities to manipulate structured arrays.
Most of these functions were initially implemented by John Hunter for matplotlib.
They have been rewritten and extended for convenience.
"""
import sys
import itertools
import numpy as np
import numpy.ma as ma
from numpy import ndarray, recarray
from nump... | mit |
etkirsch/scikit-learn | sklearn/preprocessing/label.py | 137 | 27165 | # 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>
# Joel Nothman <joel.nothman@gmail.com>
# Hamzeh Alsalhi <ha258@cornell.edu>
# Licens... | bsd-3-clause |
quiltdata/quilt-compiler | api/python/quilt3/bucket.py | 1 | 6268 | """
bucket.py
Contains the Bucket class, which provides several useful functions
over an s3 bucket.
"""
import pathlib
from .data_transfer import copy_file, delete_object, list_object_versions, list_objects, select
from .search_util import search_api
from .util import PhysicalKey, QuiltException, fix_url
class ... | apache-2.0 |
MatthieuBizien/scikit-learn | doc/tutorial/text_analytics/solutions/exercise_02_sentiment.py | 9 | 3127 | """Build a sentiment analysis / polarity model
Sentiment analysis can be casted as a binary text classification problem,
that is fitting a linear classifier on features extracted from the text
of the user messages so as to guess wether the opinion of the author is
positive or negative.
In this examples we will use a ... | bsd-3-clause |
aminert/scikit-learn | sklearn/neighbors/base.py | 115 | 29783 | """Base and mixin classes for nearest neighbors"""
# Authors: Jake Vanderplas <vanderplas@astro.washington.edu>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Sparseness support by Lars Buitinck <L.J.Buitinck@uva.nl>
# Multi-output... | bsd-3-clause |
ocefpaf/cartopy | lib/cartopy/mpl/style.py | 1 | 3856 | # (C) British Crown Copyright 2018 - 2019, Met Office
#
# This file is part of cartopy.
#
# cartopy 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)... | lgpl-3.0 |
TsmileAssassin/stock_discover | tonghuashui_api.py | 2 | 5010 | import json
import urllib.request
from bs4 import BeautifulSoup
from pandas import Series
class TonghuashuiApi(object):
def __init__(self, symbol=None):
self.symbol = symbol
self.__req_url = 'http://basic.10jqka.com.cn/{}/finance.html'.format(symbol)
self.bank_data = None
self.ins... | apache-2.0 |
Akshay0724/scikit-learn | sklearn/tests/test_grid_search.py | 27 | 29492 | """
Testing for grid search module (sklearn.grid_search)
"""
from collections import Iterable, Sized
from sklearn.externals.six.moves import cStringIO as StringIO
from sklearn.externals.six.moves import xrange
from itertools import chain, product
import pickle
import warnings
import sys
import numpy as np
import sci... | bsd-3-clause |
yanlend/scikit-learn | sklearn/linear_model/setup.py | 146 | 1713 | 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('linear_model', parent_package, top_path)
cblas_libs, blas_info = get_blas_info... | bsd-3-clause |
dmnfarrell/epitopemap | modules/pepdata/iedb/mhc.py | 1 | 10090 | # Copyright (c) 2014. Mount Sinai School of Medicine
#
# 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 o... | apache-2.0 |
AlexanderFabisch/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 |
FindHao/CacheSim | test_cache_locking.py | 1 | 1924 | #!/usr/bin/python3
import sys
import re
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
import numpy as np
mapping_ways = [1, 2, 4, 8, 12, 16]
line_size = [32, 64, 128]
swap_style = [0, 1, 2]
class rate:
def __init__(self, cache_size, line_size, way, swap):
self.way = int(way)
self.line_size... | gpl-3.0 |
eqcorrscan/ci.testing | eqcorrscan/core/match_filter.py | 1 | 42423 | #!/usr/bin/python
"""
Functions for network matched-filter detection of seismic data.
Designed to cross-correlate templates generated by template_gen function
with data and output the detections. The central component of this is
the match_template function from the openCV image processing package. This
is a highly op... | lgpl-3.0 |
ObadaJabassini/Python-Interpreter | tests/test.py | 1 | 2039 | import imp
import os
import json
from setuptools import setup, find_packages
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
PACKAGE_DIR = os.path.join(BASE_DIR, 'superset', 'static', 'assets')
PACKAGE_FILE = os.path.join(PACKAGE_DIR, 'package.json')
with open(PACKAGE_FILE) as package_file:
version_string = ... | apache-2.0 |
kundajelab/kundajekode | examples/b_splines_test.py | 1 | 3364 | import os, sys
import numpy as np
import matplotlib.pyplot as plt
import theano
import theano.tensor as TT
def build_B_spline_deg_zero_degree_basis_fns(breaks, x):
"""Build B spline 0 order basis coefficients with knots at 'breaks'.
N_{i,0}(x) = { 1 if u_i <= x < u_{i+1}, 0 otherwise }
"""
expr =... | bsd-3-clause |
FabriceSalvaire/PySpice | issues/issue-164.py | 1 | 2641 | ####################################################################################################
import matplotlib.pyplot as plt
####################################################################################################
import PySpice.Logging.Logging as Logging
logger = Logging.setup_logging()
#######... | gpl-3.0 |
NixaSoftware/CVis | venv/lib/python2.7/site-packages/pandas/core/internals.py | 1 | 192094 | import warnings
import copy
from warnings import catch_warnings
import inspect
import itertools
import re
import operator
from datetime import datetime, timedelta, date
from collections import defaultdict
from functools import partial
import numpy as np
from pandas.core.base import PandasObject
from pandas.core.dtyp... | apache-2.0 |
h2oai/h2o-3 | h2o-py/tests/testdir_algos/gbm/pyunit_gbm_monotone_tweedie.py | 2 | 1808 | import h2o
from h2o.estimators import H2OGradientBoostingEstimator
from tests import pyunit_utils
def gbm_monotone_tweedie_test():
data = h2o.import_file(pyunit_utils.locate("smalldata/gbm_test/autoclaims.csv"))
data = data.drop(['POLICYNO', 'PLCYDATE', 'CLM_FREQ5', 'CLM_FLAG', 'IN_YY'])
train, test = dat... | apache-2.0 |
ClimbsRocks/scikit-learn | examples/plot_kernel_approximation.py | 36 | 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 |
alekseynp/ontario_sunshine_list | clean.py | 1 | 3333 | import re
import pandas as pd
class Cleaner:
def __init__(self):
pass
def run(self, df_dirty):
df_clean = df_dirty.reset_index()
df_clean.drop('index', axis=1, inplace=True)
# The following is very unstable and should be fixed up
df_cl... | mit |
alivecor/tensorflow | tensorflow/examples/learn/text_classification_character_rnn.py | 29 | 4506 | # 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 |
HighEnergyDataScientests/bnpcompetition | feature_analysis/correlation.py | 1 | 1843 | # -----------------------------------------------------------------------------
# Name: correlation
# Purpose: Calculate correlations and covariance
#
#
# -----------------------------------------------------------------------------
"""
Calculate correlations and covariance
"""
import pandas as pd
import numpy as n... | apache-2.0 |
mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/sklearn/ensemble/tests/test_gradient_boosting.py | 21 | 41305 | """
Testing for the gradient boosting module (sklearn.ensemble.gradient_boosting).
"""
import warnings
import numpy as np
from itertools import product
from scipy.sparse import csr_matrix
from scipy.sparse import csc_matrix
from scipy.sparse import coo_matrix
from sklearn import datasets
from sklearn.base import clo... | mit |
jpzk/evopy | evopy/examples/experiments/constraints_dses_dsessvcr/simulate.py | 2 | 2819 | '''
This file is part of evopy.
Copyright 2012 - 2013, Jendrik Poloczek
evopy 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 your
option) any later version.
evopy is di... | gpl-3.0 |
dkoslicki/CMash | scripts/StreamingQueryDNADatabase.py | 1 | 11512 | #! /usr/bin/env python
import khmer
import numpy as np
import os
import sys
import multiprocessing
import pandas as pd
import argparse
from argparse import ArgumentTypeError
import re
import matplotlib.pyplot as plt
import timeit
from itertools import islice
# The following is for ease of development (so I don't need ... | bsd-3-clause |
Evensgn/MNIST-learning | mnist_cnn.py | 1 | 5078 | import numpy as np
import matplotlib.pyplot as plt
GRAY_SCALE_RANGE = 255
import pickle
data_filename = 'data_deskewed.pkl'
print('Loading data from file \'' + data_filename + '\' ...')
with open(data_filename, 'rb') as f:
train_labels = pickle.load(f)
train_images = pickle.load(f)
test_labels = pickle.l... | mit |
timqian/sms-tools | lectures/4-STFT/plots-code/sine-spectrum.py | 24 | 1563 | import matplotlib.pyplot as plt
import numpy as np
from scipy.fftpack import fft, ifft
N = 256
M = 63
f0 = 1000
fs = 10000
A0 = .8
hN = N/2
hM = (M+1)/2
fftbuffer = np.zeros(N)
X1 = np.zeros(N, dtype='complex')
X2 = np.zeros(N, dtype='complex')
x = A0 * np.cos(2*np.pi*f0/fs*np.arange(-hM+1,hM))
plt.figure(1, figsi... | agpl-3.0 |
xiaojingyi/tushare | tushare/stock/trading.py | 1 | 30557 | # -*- coding:utf-8 -*-
"""
交易数据接口
Created on 2014/07/31
@author: Jimmy Liu
@group : waditu
@contact: jimmysoa@sina.cn
"""
from __future__ import division
import time
import json
import lxml.html
from lxml import etree
import pandas as pd
import numpy as np
from tushare.stock import cons as ct
from t... | bsd-3-clause |
sinhrks/scikit-learn | 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 |
mahak/spark | python/pyspark/pandas/data_type_ops/udt_ops.py | 14 | 1092 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | apache-2.0 |
Applied-GeoSolutions/gips | gips/atmosphere.py | 1 | 26295 | #!/usr/bin/env python
################################################################################
# GIPS: Geospatial Image Processing System
#
# AUTHOR: Matthew Hanson
# EMAIL: matt.a.hanson@gmail.com
#
# Copyright (C) 2014-2018 Applied Geosolutions
#
# This program is free software; you can redist... | gpl-3.0 |
gotomypc/scikit-learn | sklearn/feature_selection/variance_threshold.py | 238 | 2594 | # Author: Lars Buitinck <L.J.Buitinck@uva.nl>
# License: 3-clause BSD
import numpy as np
from ..base import BaseEstimator
from .base import SelectorMixin
from ..utils import check_array
from ..utils.sparsefuncs import mean_variance_axis
from ..utils.validation import check_is_fitted
class VarianceThreshold(BaseEstim... | bsd-3-clause |
treycausey/scikit-learn | sklearn/utils/tests/test_shortest_path.py | 12 | 2892 | from collections import defaultdict
import numpy as np
from numpy.testing import assert_array_almost_equal
from sklearn.utils.graph import (graph_shortest_path,
single_source_shortest_path_length)
def floyd_warshall_slow(graph, directed=False):
N = graph.shape[0]
#set nonzer... | bsd-3-clause |
wolfiex/DSMACC-testing | zensemble.py | 1 | 1225 | import pandas as pd
import numpy as np
spinup = 3 # in whole number days
nruns = 2
df = pd.DataFrame(
[
['ii', 'TIME', '0', str(24*60*60*12)],
['ii', 'TEMP', '0', '298'],
['ii', 'LAT', '0', '51.5'],
['ii', 'LON', '0', '0.1'],
['ii', 'JDAY', '0', '173.5'],
['ii', 'H2O', '0', '... | gpl-3.0 |
NixaSoftware/CVis | venv/lib/python2.7/site-packages/pandas/tseries/holiday.py | 5 | 16279 | import warnings
from pandas import DateOffset, DatetimeIndex, Series, Timestamp
from pandas.compat import add_metaclass
from datetime import datetime, timedelta
from dateutil.relativedelta import MO, TU, WE, TH, FR, SA, SU # noqa
from pandas.tseries.offsets import Easter, Day
import numpy as np
def next_monday(dt):... | apache-2.0 |
oliverlee/sympy | sympy/utilities/runtests.py | 9 | 81101 | """
This is our testing framework.
Goals:
* it should be compatible with py.test and operate very similarly
(or identically)
* doesn't require any external dependencies
* preferably all the functionality should be in this file only
* no magic, just import the test file and execute the test functions, that's it
* po... | bsd-3-clause |
jensreeder/scikit-bio | skbio/stats/distance/_bioenv.py | 3 | 9911 | # ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | bsd-3-clause |
treycausey/scikit-learn | sklearn/preprocessing/data.py | 1 | 38124 | # 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>
# License: BSD 3 clause
import numbers
import warnings
import itertools
import numpy as np
from scipy... | bsd-3-clause |
nest/nest-simulator | pynest/examples/clopath_synapse_small_network.py | 8 | 7493 | # -*- coding: utf-8 -*-
#
# clopath_synapse_small_network.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 ... | gpl-2.0 |
chenyyx/scikit-learn-doc-zh | examples/en/linear_model/plot_sparse_logistic_regression_20newsgroups.py | 56 | 4172 | """
=====================================================
Multiclass sparse logisitic regression on newgroups20
=====================================================
Comparison of multinomial logistic L1 vs one-versus-rest L1 logistic regression
to classify documents from the newgroups20 dataset. Multinomial logistic
... | gpl-3.0 |
ilo10/scikit-learn | benchmarks/bench_glmnet.py | 297 | 3848 | """
To run this, you'll need to have installed.
* glmnet-python
* scikit-learn (of course)
Does two benchmarks
First, we fix a training set and increase the number of
samples. Then we plot the computation time as function of
the number of samples.
In the second benchmark, we increase the number of dimensions of... | bsd-3-clause |
linii/ling229-final | metrics/pca_plot.py | 1 | 1204 | #!/usr/bin/python
import sys
import numpy as np
import pylab
from sklearn.decomposition import PCA
def reduce_dim(data, ndim=2):
pca_model = PCA(n_components=ndim)
reduced_data = pca_model.fit_transform(data)
return reduced_data
def plot_reduced_data(data, labels, outfile="metrics/figs/pc... | gpl-3.0 |
varenius/salsa | Developer_notes/Beam_measurements/Beam_2014-10-03/single.py | 1 | 2675 | import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
import numpy as np
# The offset values in Az given to the telescope. Note that
# This does not necesarily mean that the telescope was pointing in this
# direction, since it might not move if the difference is too small.
xdata = [
-20,
-19,
-18,
-17,... | mit |
jat255/hyperspyUI | hyperspyui/plugins/mva.py | 2 | 15334 | # -*- coding: utf-8 -*-
# Copyright 2014-2016 The HyperSpyUI developers
#
# This file is part of HyperSpyUI.
#
# HyperSpyUI 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 |
bjodah/symodesys | symodesys/convenience.py | 1 | 3601 | from __future__ import print_function, division, absolute_import, unicode_literals
import numpy as np
import matplotlib.pyplot as plt
from symodesys.ivp import IVP
from symodesys.integrator import SciPy_IVP_Integrator
plotting_colors = 'k b r g m'.split()
def _get_default_integrator(Integrator=SciPy_IVP_Integrator,... | bsd-2-clause |
MartinDelzant/scikit-learn | sklearn/linear_model/tests/test_omp.py | 272 | 7752 | # Author: Vlad Niculae
# Licence: BSD 3 clause
import numpy as np
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equa... | bsd-3-clause |
sebasvega95/HPC-assignments | CUDA/grayscale/timing.py | 1 | 2425 | from time import time
from os import remove
from matplotlib.image import imread
import json
import subprocess
import numpy as np
import matplotlib.pyplot as plt
def time_a_function(program, args):
start = time()
subprocess.call([program] + [args])
end = time()
return float(end - start)
def clean... | mit |
chatcannon/scipy | scipy/signal/wavelets.py | 67 | 10523 | from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.dual import eig
from scipy.special import comb
from scipy import linspace, pi, exp
from scipy.signal import convolve
__all__ = ['daub', 'qmf', 'cascade', 'morlet', 'ricker', 'cwt']
def daub(p):
"""
The coefficient... | bsd-3-clause |
laszlocsomor/tensorflow | tensorflow/contrib/learn/python/learn/estimators/multioutput_test.py | 136 | 1696 | # 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 |
fengzhyuan/scikit-learn | examples/mixture/plot_gmm_selection.py | 248 | 3223 | """
=================================
Gaussian Mixture Model Selection
=================================
This example shows that model selection can be performed with
Gaussian Mixture Models using information-theoretic criteria (BIC).
Model selection concerns both the covariance type
and the number of components in th... | bsd-3-clause |
bricegnichols/urbansim | urbansim/models/tests/test_regression.py | 5 | 15036 | import os
import tempfile
from StringIO import StringIO
import numpy as np
import numpy.testing as npt
import pandas as pd
import pytest
import statsmodels.formula.api as smf
import yaml
from pandas.util import testing as pdt
from statsmodels.regression.linear_model import RegressionResultsWrapper
from .. import reg... | bsd-3-clause |
calico/basenji | bin/archive/basenji_test_genes.py | 1 | 31621 | #!/usr/bin/env python
# Copyright 2017 Calico LLC
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agr... | apache-2.0 |
giorgiop/scikit-learn | examples/cluster/plot_mini_batch_kmeans.py | 86 | 4092 | """
====================================================================
Comparison of the K-Means and MiniBatchKMeans clustering algorithms
====================================================================
We want to compare the performance of the MiniBatchKMeans and KMeans:
the MiniBatchKMeans is faster, but give... | bsd-3-clause |
TariqAHassan/ZeitSci | analysis/graphs/keywords_graph.py | 1 | 10568 | """
Keyword Visualization Data Processing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Python 3.5
"""
# Imports
import re
import numpy as np
import pandas as pd
import decimal
import babel.numbers
from tqdm import tqdm
from itertools import chain
from unidecode import unidecode
from collections import default... | gpl-3.0 |
jaredweiss/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/legend.py | 69 | 30705 | """
Place a legend on the axes at location loc. Labels are a
sequence of strings and loc can be a string or an integer
specifying the legend location
The location codes are
'best' : 0, (only implemented for axis legends)
'upper right' : 1,
'upper left' : 2,
'lower left' : 3,
'lower right' : 4... | gpl-3.0 |
bert9bert/statsmodels | statsmodels/base/model.py | 1 | 81082 | from __future__ import print_function
from statsmodels.compat.python import iterkeys, lzip, range, reduce
import numpy as np
from scipy import stats
from statsmodels.base.data import handle_data
from statsmodels.tools.data import _is_using_pandas
from statsmodels.tools.tools import recipr, nan_dot
from statsmodels.stat... | bsd-3-clause |
nsat/gnuradio | gr-filter/examples/reconstruction.py | 49 | 5015 | #!/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 |
marcusmueller/gnuradio | gr-filter/examples/reconstruction.py | 7 | 5011 | #!/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 |
dsm054/pandas | pandas/tests/extension/base/__init__.py | 4 | 2015 | """Base test suite for extension arrays.
These tests are intended for third-party libraries to subclass to validate
that their extension arrays and dtypes satisfy the interface. Moving or
renaming the tests should not be done lightly.
Libraries are expected to implement a few pytest fixtures to provide data
for the t... | bsd-3-clause |
ideaplat/Tback | part2.py | 1 | 17015 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import pandas_datareader.data as web
from part1 import apple, start, end
apple['20d-50d'] = apple['20d'] - apple['50d']
apple["Regime"] = np.where(apple['20d-50d'] > 0, 1, 0)
# We have 1's for bullish regimes and 0's for everything else.... | mit |
nikitasingh981/scikit-learn | sklearn/utils/graph.py | 24 | 6326 | """
Graph utilities and algorithms
Graphs are represented with their adjacency matrices, preferably using
sparse matrices.
"""
# Authors: Aric Hagberg <hagberg@lanl.gov>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Jake Vanderplas <vanderplas@astro.washington.edu>
# License: BSD 3 clause
impo... | bsd-3-clause |
jakirkham/bokeh | bokeh/document/tests/test_events.py | 3 | 20263 | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2018, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | bsd-3-clause |
nicholasmalaya/grins | contrib/scripts/plot_thermo.py | 6 | 3066 | import matplotlib
from matplotlib import rc
rc('text',usetex=True)
#matplotlib.use("PDF")
import matplotlib.pyplot as plot
from numpy import loadtxt
import sys
tick_label_fontsize=14
axis_label_fontsize=14
matplotlib.rc('xtick', labelsize=tick_label_fontsize )
matplotlib.rc(('xtick.major','xtick.min... | lgpl-2.1 |
rgommers/scipy | scipy/fft/_basic.py | 12 | 62710 | from scipy._lib.uarray import generate_multimethod, Dispatchable
import numpy as np
def _x_replacer(args, kwargs, dispatchables):
"""
uarray argument replacer to replace the transform input array (``x``)
"""
if len(args) > 0:
return (dispatchables[0],) + args[1:], kwargs
kw = kwargs.copy()... | bsd-3-clause |
MartinSavc/scikit-learn | sklearn/neighbors/tests/test_nearest_centroid.py | 305 | 4121 | """
Testing for the nearest centroid module.
"""
import numpy as np
from scipy import sparse as sp
from numpy.testing import assert_array_equal
from numpy.testing import assert_equal
from sklearn.neighbors import NearestCentroid
from sklearn import datasets
from sklearn.metrics.pairwise import pairwise_distances
# t... | bsd-3-clause |
tobias47n9e/mplstereonet | examples/contour_angelier_data.py | 2 | 2304 | """
Reproduce Figure 5 from Vollmer, 1995 to illustrate different density contouring
methods.
"""
import matplotlib.pyplot as plt
import mplstereonet
import parse_angelier_data
def plot(ax, strike, dip, rake, **kwargs):
ax.rake(strike, dip, rake, 'ko', markersize=2)
ax.density_contour(strike, dip, rake, measu... | mit |
theflofly/tensorflow | tensorflow/contrib/losses/python/metric_learning/metric_loss_ops.py | 3 | 40497 | # Copyright 2017 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 |
mewo2/smoothfft | smooth.py | 1 | 1465 | from __future__ import division
import numpy as np
import scipy.signal
kernel = np.array([[0, 1, 0],
[1, -4, 1],
[0, 1, 0]])
def smooth_fft(u):
"""
A smoothed version of a 2d FFT, based on Moisan (2011)
http://www.math-info.univ-paris5.fr/~moisan/papers/2009-11r.p... | mit |
bjodah/PyLaTeX | pylatex/figure.py | 2 | 3696 | # -*- coding: utf-8 -*-
"""
This module implements the class that deals with graphics.
.. :copyright: (c) 2014 by Jelte Fennema.
:license: MIT, see License for more details.
"""
import os.path
from .utils import fix_filename, make_temp_dir, NoEscape, escape_latex
from .base_classes import UnsafeCommand, Float
f... | mit |
consulo/consulo-python | plugin/src/main/dist/helpers/pydev/pydev_ipython/inputhook.py | 11 | 19160 | # coding: utf-8
"""
Inputhook management for GUI event loop integration.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distribu... | apache-2.0 |
alphaBenj/zipline | tests/data/bundles/test_quandl.py | 5 | 8156 | from __future__ import division
import numpy as np
import pandas as pd
from toolz import merge
import toolz.curried.operator as op
from zipline import get_calendar
from zipline.data.bundles import ingest, load, bundles
from zipline.data.bundles.quandl import (
format_wiki_url,
format_metadata_url,
)
from zipl... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.