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 |
|---|---|---|---|---|---|
jreback/pandas | pandas/tests/frame/methods/test_droplevel.py | 3 | 1236 | import pytest
from pandas import DataFrame, Index, MultiIndex
import pandas._testing as tm
class TestDropLevel:
def test_droplevel(self, frame_or_series):
# GH#20342
cols = MultiIndex.from_tuples(
[("c", "e"), ("d", "f")], names=["level_1", "level_2"]
)
mi = MultiIndex... | bsd-3-clause |
mogeiwang/nest | testsuite/manualtests/test_tsodyks_depr_fac.py | 13 | 1136 | # -*- coding: utf-8 -*-
#
# test_tsodyks_depr_fac.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 L... | gpl-2.0 |
Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/pandas/tools/util.py | 9 | 2780 | import numpy as np
import pandas.lib as lib
import pandas as pd
from pandas.compat import reduce
from pandas.core.index import Index
from pandas.core import common as com
def match(needles, haystack):
haystack = Index(haystack)
needles = Index(needles)
return haystack.get_indexer(needles)
def cartesian... | artistic-2.0 |
ephes/scikit-learn | examples/cluster/plot_color_quantization.py | 297 | 3443 | # -*- coding: utf-8 -*-
"""
==================================
Color Quantization using K-Means
==================================
Performs a pixel-wise Vector Quantization (VQ) of an image of the summer palace
(China), reducing the number of colors required to show the image from 96,615
unique colors to 64, while pre... | bsd-3-clause |
secdev/scapy | scapy/plist.py | 2 | 31226 | # This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) Philippe Biondi <phil@secdev.org>
# This program is published under a GPLv2 license
"""
PacketList: holds several packets and allows to do operations on them.
"""
from __future__ import absolute_import
from _... | gpl-2.0 |
ptoman/icgauge | experiments/kannan_ambili.py | 1 | 2108 | # -*- coding: utf-8 -*-
#!/usr/bin/python
"""
This file contains experimental results related to the
Kannan-Ambili semantic coherence metric.
Usage:
From top level (/path/to/repo/icgauge), issue the command
`python -m experiments.kannan_ambili`
"""
import json
from collections import defaultdict
from matplot... | mit |
alephu5/Soundbyte | environment/lib/python3.3/site-packages/pandas/stats/ols.py | 7 | 39955 | """
Ordinary least squares regression
"""
# pylint: disable-msg=W0201
from pandas.compat import zip, range, StringIO
from itertools import starmap
from pandas import compat
import numpy as np
from pandas.core.api import DataFrame, Series, isnull
from pandas.core.base import StringMixin
from pandas.core.common import... | gpl-3.0 |
ankurankan/scikit-learn | examples/cluster/plot_kmeans_digits.py | 53 | 4524 | """
===========================================================
A demo of K-Means clustering on the handwritten digits data
===========================================================
In this example we compare the various initialization strategies for
K-means in terms of runtime and quality of the results.
As the gr... | bsd-3-clause |
nhejazi/scikit-learn | examples/neighbors/plot_regression.py | 15 | 1402 | """
============================
Nearest Neighbors regression
============================
Demonstrate the resolution of a regression problem
using a k-Nearest Neighbor and the interpolation of the
target using both barycenter and constant weights.
"""
print(__doc__)
# Author: Alexandre Gramfort <alexandre.gramfort@... | bsd-3-clause |
drewejohnson/drewtils | docs/conf.py | 1 | 5093 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# drewtils documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 5 01:45:19 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# a... | mit |
celiafish/VisTrails | vistrails/packages/tabledata/operations.py | 2 | 28158 | try:
import numpy
except ImportError: # pragma: no cover
numpy = None
import re
from vistrails.core.modules.vistrails_module import ModuleError
from .common import TableObject, Table, choose_column, choose_columns
# FIXME use pandas?
def utf8(obj):
if isinstance(obj, bytes):
return obj
elif... | bsd-3-clause |
google-research/google-research | ledge/utils.py | 1 | 2167 | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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 applicab... | apache-2.0 |
google/intelligent_annotation_dialogs | detector.py | 1 | 2744 | # Copyright 2017 Google 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | apache-2.0 |
Jacobsolawetz/trading-with-python | sandbox/spreadCalculations.py | 78 | 1496 | '''
Created on 28 okt 2011
@author: jev
'''
from tradingWithPython import estimateBeta, Spread, returns, Portfolio, readBiggerScreener
from tradingWithPython.lib import yahooFinance
from pandas import DataFrame, Series
import numpy as np
import matplotlib.pyplot as plt
import os
symbols = ['SPY','... | bsd-3-clause |
cybernet14/scikit-learn | examples/covariance/plot_mahalanobis_distances.py | 348 | 6232 | r"""
================================================================
Robust covariance estimation and Mahalanobis distances relevance
================================================================
An example to show covariance estimation with the Mahalanobis
distances on Gaussian distributed data.
For Gaussian dis... | bsd-3-clause |
omnisis/trading-with-python | cookbook/reconstructVXX/reconstructVXX.py | 77 | 3574 | # -*- coding: utf-8 -*-
"""
Reconstructing VXX from futures data
author: Jev Kuznetsov
License : BSD
"""
from __future__ import division
from pandas import *
import numpy as np
import os
class Future(object):
""" vix future class, used to keep data structures simple """
def __init__(self,serie... | bsd-3-clause |
jseabold/statsmodels | statsmodels/datasets/stackloss/data.py | 4 | 1852 | """Stack loss data"""
from statsmodels.datasets import utils as du
__docformat__ = 'restructuredtext'
COPYRIGHT = """This is public domain. """
TITLE = __doc__
SOURCE = """
Brownlee, K. A. (1965), "Statistical Theory and Methodology in
Science and Engineering", 2nd edition, New York:Wiley.
"""
DESCRSHOR... | bsd-3-clause |
aditipawde/TimeTable1 | TimeTable1/try (copy).py | 1 | 3163 | import dataAccessSQLAlchemy as da
import pandas as pd
import random
import numpy as np
print("welcome");
f_join_subject_subjectClassTeacher = da.execquery('select s.subjectId, subjectShortName, totalHrs, eachSlot, c.classId, teacherId from subject s, subjectClassTeacher c where s.subjectId = c.subjectId;')
f_join_sub... | lgpl-3.0 |
rabernat/xray | xarray/core/coordinates.py | 1 | 9856 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import Mapping
from contextlib import contextmanager
import pandas as pd
from . import formatting
from .utils import Frozen
from .merge import (
merge_coords, expand_and_merge_variables, me... | apache-2.0 |
dmitry-r/incubator-airflow | airflow/hooks/hive_hooks.py | 7 | 28649 | # -*- coding: utf-8 -*-
#
# 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, software
... | apache-2.0 |
shibaniahegde/OpenStak_swift | swift/common/middleware/xprofile.py | 36 | 9905 | # Copyright (c) 2010-2012 OpenStack, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | apache-2.0 |
bikong2/scikit-learn | sklearn/manifold/t_sne.py | 52 | 34602 | # Author: Alexander Fabisch -- <afabisch@informatik.uni-bremen.de>
# Author: Christopher Moody <chrisemoody@gmail.com>
# Author: Nick Travers <nickt@squareup.com>
# License: BSD 3 clause (C) 2014
# This is the exact and Barnes-Hut t-SNE implementation. There are other
# modifications of the algorithm:
# * Fast Optimi... | bsd-3-clause |
luo66/scikit-learn | sklearn/manifold/t_sne.py | 48 | 20644 | # Author: Alexander Fabisch -- <afabisch@informatik.uni-bremen.de>
# License: BSD 3 clause (C) 2014
# This is the standard t-SNE implementation. There are faster modifications of
# the algorithm:
# * Barnes-Hut-SNE: reduces the complexity of the gradient computation from
# N^2 to N log N (http://arxiv.org/abs/1301.... | bsd-3-clause |
zorojean/scikit-learn | examples/manifold/plot_manifold_sphere.py | 258 | 5101 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=============================================
Manifold Learning methods on a severed sphere
=============================================
An application of the different :ref:`manifold` techniques
on a spherical data-set. Here one can see the use of
dimensionality reducti... | bsd-3-clause |
466152112/scikit-learn | sklearn/utils/metaestimators.py | 283 | 2353 | """Utilities for meta-estimators"""
# Author: Joel Nothman
# Andreas Mueller
# Licence: BSD
from operator import attrgetter
from functools import update_wrapper
__all__ = ['if_delegate_has_method']
class _IffHasAttrDescriptor(object):
"""Implements a conditional property using the descriptor protocol.
... | bsd-3-clause |
lbishal/scikit-learn | sklearn/manifold/t_sne.py | 13 | 34618 | # Author: Alexander Fabisch -- <afabisch@informatik.uni-bremen.de>
# Author: Christopher Moody <chrisemoody@gmail.com>
# Author: Nick Travers <nickt@squareup.com>
# License: BSD 3 clause (C) 2014
# This is the exact and Barnes-Hut t-SNE implementation. There are other
# modifications of the algorithm:
# * Fast Optimi... | bsd-3-clause |
maniteja123/numpy | numpy/fft/fftpack.py | 12 | 45846 | """
Discrete Fourier Transforms
Routines in this module:
fft(a, n=None, axis=-1)
ifft(a, n=None, axis=-1)
rfft(a, n=None, axis=-1)
irfft(a, n=None, axis=-1)
hfft(a, n=None, axis=-1)
ihfft(a, n=None, axis=-1)
fftn(a, s=None, axes=None)
ifftn(a, s=None, axes=None)
rfftn(a, s=None, axes=None)
irfftn(a, s=None, axes=None... | bsd-3-clause |
MartinPerez/nistats | examples/plot_spm_multimodal_faces.py | 1 | 3482 | """
Minimal script for preprocessing single-subject data (two session)
Author: DOHMATOB Elvis, Bertrand Thirion, 2015
For details on the data, please see:
Henson, R.N., Goshen-Gottstein, Y., Ganel, T., Otten, L.J., Quayle, A.,
Rugg, M.D. Electrophysiological and haemodynamic correlates of face
perception, recognition... | bsd-3-clause |
louisLouL/pair_trading | capstone_env/lib/python3.6/site-packages/pandas/tests/plotting/test_series.py | 6 | 30296 | # coding: utf-8
""" Test cases for Series.plot """
import itertools
import pytest
from datetime import datetime
import pandas as pd
from pandas import Series, DataFrame, date_range
from pandas.compat import range, lrange
import pandas.util.testing as tm
from pandas.util.testing import slow
import numpy as np
from... | mit |
xpspectre/aws-tools | spot_pricing.py | 1 | 6176 | # Usage: specify params (time interval, instance types, avail zones)
# Does: Looks up from cache 1st; fetches results that aren't in the cache
# Check if instance type is present
# Gets present time range: have latest early time thru earliest late time; assumes present time ranges are contiguous
import os
import bo... | mit |
chrisjsewell/PyGauss | pygauss/file_io.py | 1 | 10124 | # -*- coding: utf-8 -*-
"""
Created on Mon May 18 21:01:25 2015
@author: chris sewell
"""
import os, glob
import socket
import errno
import re
import getpass
from io import BytesIO
import paramiko
class Folder(object):
""" an object intended to act as an entry point to a folder path
it will act identic... | gpl-3.0 |
TheBB/badger | tests/test_run.py | 1 | 5308 | from pathlib import Path
import numpy as np
import pandas as pd
from grevling import Case
DATADIR = Path(__file__).parent / 'data'
def read_file(path: Path) -> str:
with open(path, 'r') as f:
return f.read()
def check_df(left, right):
to_remove = [c for c in left.columns if c.startswith('walltim... | agpl-3.0 |
CassioAmador/profile_tcabr | visualization_tools/test_custom_spectrogram_sim2.py | 1 | 2623 | """Compare custom spectrogram with scipy's implementation"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.mlab import specgram
from scipy import signal
import time
import sys
sys.path.insert(0, './../src/')
import custom_spectrogram as cs
fs = 100 # 100 MHz
tem = np.arange(int(8 * fs)) / fs
f... | mit |
mwv/scikit-learn | examples/linear_model/lasso_dense_vs_sparse_data.py | 348 | 1862 | """
==============================
Lasso on dense and sparse data
==============================
We show that linear_model.Lasso provides the same results for dense and sparse
data and that in the case of sparse data the speed is improved.
"""
print(__doc__)
from time import time
from scipy import sparse
from scipy ... | bsd-3-clause |
jjx02230808/project0223 | sklearn/neural_network/tests/test_stochastic_optimizers.py | 146 | 4310 | import numpy as np
from sklearn.neural_network._stochastic_optimizers import (BaseOptimizer,
SGDOptimizer,
AdamOptimizer)
from sklearn.utils.testing import (assert_array_equal, assert_true,
... | bsd-3-clause |
arjoly/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 |
mne-tools/mne-tools.github.io | 0.19/_downloads/c3c432f4bd08791c7b83f3ddb29bcc5b/plot_channel_epochs_image.py | 1 | 2889 | """
=========================================
Visualize channel over epochs as an image
=========================================
This will produce what is sometimes called an event related
potential / field (ERP/ERF) image.
Two images are produced, one with a good channel and one with a channel
that does not show an... | bsd-3-clause |
Fireblend/scikit-learn | sklearn/gaussian_process/gaussian_process.py | 83 | 34544 | # -*- coding: utf-8 -*-
# Author: Vincent Dubourg <vincent.dubourg@gmail.com>
# (mostly translation, see implementation details)
# Licence: BSD 3 clause
from __future__ import print_function
import numpy as np
from scipy import linalg, optimize
from ..base import BaseEstimator, RegressorMixin
from ..metrics... | bsd-3-clause |
Pabsm94/HyperPlume | src/AEM/AEM_plume.py | 1 | 44467 | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 25 19:12:18 2017
@author: pablo
"""
import os
dir_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
import sys
sys.path.append(dir_path) #change to src
from src import np,math,interp1d,Hyperplume,griddata,interp2d,plt
import matpl... | mit |
jrosebr1/imutils | imutils/convenience.py | 1 | 11508 | # author: Adrian Rosebrock
# website: http://www.pyimagesearch.com
# import the necessary packages
import numpy as np
import cv2
import sys
# import any special Python 2.7 packages
if sys.version_info.major == 2:
from urllib import urlopen
# import any special Python 3 packages
elif sys.version_info.major =... | mit |
tmhm/scikit-learn | sklearn/neighbors/tests/test_ball_tree.py | 129 | 10192 | import pickle
import numpy as np
from numpy.testing import assert_array_almost_equal
from sklearn.neighbors.ball_tree import (BallTree, NeighborsHeap,
simultaneous_sort, kernel_norm,
nodeheap_sort, DTYPE, ITYPE)
from sklearn.neighbors.dis... | bsd-3-clause |
rmvanhees/pynadc | scripts/sdmf_calibSMR.py | 1 | 54150 | """
This file is part of pynadc
https://github.com/rmvanhees/pynadc
Calibrate Sciamachy Solar Mean Radiance measurements
Copyright (c) 2016 SRON - Netherlands Institute for Space Research
All Rights Reserved
License: BSD-3-Clause
"""
#
# Code layout:
# SECTION VERSION
# - define various versions of the S/W
# ... | bsd-3-clause |
chrisdev/django-pandas | django_pandas/utils.py | 1 | 2859 | # coding: utf-8
from django.core.cache import cache
from django.utils.encoding import force_text
from django.db.models import Field
def get_model_name(model):
"""
Returns the name of the model
"""
return model._meta.model_name
def replace_from_choices(choices):
def inner(values):
return... | bsd-3-clause |
xwolf12/scikit-learn | examples/applications/plot_model_complexity_influence.py | 323 | 6372 | """
==========================
Model Complexity Influence
==========================
Demonstrate how model complexity influences both prediction accuracy and
computational performance.
The dataset is the Boston Housing dataset (resp. 20 Newsgroups) for
regression (resp. classification).
For each class of models we m... | bsd-3-clause |
pythonvietnam/scikit-learn | examples/linear_model/plot_ard.py | 248 | 2622 | """
==================================================
Automatic Relevance Determination Regression (ARD)
==================================================
Fit regression model with Bayesian Ridge Regression.
See :ref:`bayesian_ridge_regression` for more information on the regressor.
Compared to the OLS (ordinary l... | bsd-3-clause |
fejoa/IVANWorldmapResearch | WorldBuild_Hybrid3d.py | 1 | 7670 | # -*- coding: utf-8 -*-
"""
IVAN Worldmap Research
Copyright (C) Ryan van Herel
Released under the GNU General
Public License
See LICENSING which should be included
along with this file for more details
@author: fejoa
"""
import os
from random import randint
import matplotlib.pyplot as plt
import num... | gpl-2.0 |
gdsglgf/tutorials | python/pillow/show_image.py | 1 | 2746 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
def addSalt(path):
img = np.array(Image.open(path))
#随机生成5000个椒盐
rows,cols,dims = img.shape
print img.shape
print rows, cols, dims
for i in range(5000):
x = np.random.randint(0,ro... | mit |
yl565/statsmodels | statsmodels/duration/tests/test_survfunc.py | 2 | 11876 | import numpy as np
from statsmodels.duration.survfunc import (
SurvfuncRight, survdiff, plot_survfunc,
CumIncidenceRight)
from numpy.testing import assert_allclose
from numpy.testing import dec
import pandas as pd
import os
# If true, the output is written to a multi-page pdf file.
pdf_output = False
try:
... | bsd-3-clause |
toobaz/pandas | pandas/tests/sparse/frame/test_analytics.py | 2 | 1236 | import numpy as np
import pytest
from pandas import DataFrame, SparseDataFrame, SparseSeries
from pandas.util import testing as tm
@pytest.mark.filterwarnings("ignore:Sparse:FutureWarning")
@pytest.mark.xfail(reason="Wrong SparseBlock initialization (GH#17386)")
def test_quantile():
# GH 17386
data = [[1, 1]... | bsd-3-clause |
wizmer/NeuroM | neurom/tests/test_viewer.py | 1 | 5335 | # Copyright (c) 2015, Ecole Polytechnique Federale de Lausanne, Blue Brain Project
# All rights reserved.
#
# This file is part of NeuroM <https://github.com/BlueBrain/NeuroM>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are ... | bsd-3-clause |
hainm/scikit-learn | sklearn/linear_model/tests/test_sparse_coordinate_descent.py | 244 | 9986 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_true
from sklearn.utils.t... | bsd-3-clause |
sangwook236/general-development-and-testing | sw_dev/python/rnd/test/statistics/edward/edward_mixture_density_network.py | 1 | 7356 | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import seaborn as sns
import tensorflow as tf
import edward as ed
from edward.models import Categorical, Mixture, Normal
from scipy import stats
from sklearn.model_sele... | gpl-2.0 |
xwolf12/scikit-learn | examples/ensemble/plot_adaboost_multiclass.py | 354 | 4124 | """
=====================================
Multi-class AdaBoosted Decision Trees
=====================================
This example reproduces Figure 1 of Zhu et al [1] and shows how boosting can
improve prediction accuracy on a multi-class problem. The classification
dataset is constructed by taking a ten-dimensional ... | bsd-3-clause |
detrout/debian-statsmodels | statsmodels/regression/tests/test_quantile_regression.py | 8 | 7766 |
import scipy.stats
import numpy as np
import statsmodels.api as sm
from numpy.testing import assert_allclose, assert_equal, assert_almost_equal
from patsy import dmatrices # pylint: disable=E0611
from statsmodels.regression.quantile_regression import QuantReg
from .results_quantile_regression import (
biweight... | bsd-3-clause |
CTU-IIG/FlexRaySSScheduler | BenchmarkGenerator/Scripts/make_Modified_plot.py | 1 | 4060 | from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib
matplotlib.use("Qt4Agg")
import matplotlib.pyplot as plt
from matplotlib import cm
import argparse
import csv
import os
# python3 make_MV_plot.py --steps 50 SAE_1.txt Results/results_MV_used_for_paper.csv
payloads = 128#15
periods = 4
cla... | gpl-2.0 |
valexandersaulys/airbnb_kaggle_contest | venv/lib/python3.4/site-packages/sklearn/linear_model/tests/test_ridge.py | 6 | 24655 | import numpy as np
import scipy.sparse as sp
from scipy import linalg
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_a... | gpl-2.0 |
moonbury/pythonanywhere | MatplotlibCookbook/Chapter 8/test.py | 3 | 2513 | from gi.repository import Gtk
import numpy
from matplotlib.figure import Figure
from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg
def supershape_radius(phi, a, b, m, n1, n2, n3):
theta = .25 * m * phi
cos = numpy.fabs(numpy.cos(theta) / a) ** n2
sin = numpy.fabs(numpy.sin(theta) / b) ** n3
r =... | gpl-3.0 |
lucidfrontier45/scikit-learn | benchmarks/bench_plot_ward.py | 8 | 1151 | """
Bench the scikit'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 Ward
ward = Ward(n_clusters=3)
n_samples = np.logspace(.5, 3, 9)
n_features = np.logspace(1, 3.5, 7)
N_samples, N_features = np.meshgrid(n_... | bsd-3-clause |
MJuddBooth/pandas | pandas/tests/arrays/categorical/test_indexing.py | 2 | 9775 | # -*- coding: utf-8 -*-
import numpy as np
import pytest
import pandas as pd
from pandas import Categorical, CategoricalIndex, Index, PeriodIndex, Series
import pandas.core.common as com
from pandas.tests.arrays.categorical.common import TestCategorical
import pandas.util.testing as tm
class TestCategoricalIndexing... | bsd-3-clause |
fabeschan/midigeneration | voices.py | 1 | 7844 | import numpy as np
import sys
import analyze, midi, patterns
from data import *
import pprint
import matplotlib.pyplot as plt
pp = pprint.PrettyPrinter(indent=4)
class penalty(object):
def __init__(self):
self.new_voice = 20.0
self.pitch_interval = 1.0
self.silence = 30.0 / 512 # per tick
... | mit |
lbishal/scikit-learn | examples/linear_model/plot_ransac.py | 73 | 1859 | """
===========================================
Robust linear model estimation using RANSAC
===========================================
In this example we see how to robustly fit a linear model to faulty data using
the RANSAC algorithm.
"""
import numpy as np
from matplotlib import pyplot as plt
from sklearn import ... | bsd-3-clause |
nvoron23/statsmodels | statsmodels/tools/parallel.py | 32 | 2180 | """Parallel utility function using joblib
copied from https://github.com/mne-tools/mne-python
Author: Alexandre Gramfort <gramfort@nmr.mgh.harvard.edu>
License: Simplified BSD
changes for statsmodels (Josef Perktold)
- try import from joblib directly, (doesn't import all of sklearn)
"""
from __future__ import print... | bsd-3-clause |
ai-se/XTREE | src/tools/misc.py | 2 | 1959 | from pandas import DataFrame, read_csv, concat
from os import walk
import numpy as np
from pdb import set_trace
import sys
def say(text):
sys.stdout.write(str(text))
def shuffle(df, n=1, axis=0):
df = df.copy()
for _ in range(n):
df.apply(np.random.shuffle, axis=axis)
return df
def cs... | mit |
afraser/CellProfiler-Analyst | cpa/dimensredux.py | 1 | 27869 | #!/usr/bin/env python
# TODO: Add not-classified data functionality, activate url links to 'About'
'''
GUI for visual dimensionality reduction of the data via various methods:
Singular Value Decomposition (Principal Component Analysis)
*A Tutorial on Principal Component Analysis - Jonathon Shlens:
http://www.snl.sa... | gpl-2.0 |
datapythonista/pandas | pandas/tests/io/formats/test_console.py | 9 | 2460 | import locale
import pytest
from pandas._config import detect_console_encoding
class MockEncoding: # TODO(py27): replace with mock
"""
Used to add a side effect when accessing the 'encoding' property. If the
side effect is a str in nature, the value will be returned. Otherwise, the
side effect shou... | bsd-3-clause |
victor-prado/broker-manager | environment/lib/python3.5/site-packages/pandas/tests/test_compat.py | 9 | 2455 | # -*- coding: utf-8 -*-
"""
Testing that functions from compat work as expected
"""
from pandas.compat import (range, zip, map, filter, lrange, lzip, lmap,
lfilter, builtins, iterkeys, itervalues, iteritems,
next)
import pandas.util.testing as tm
class TestBuilti... | mit |
potash/scikit-learn | sklearn/tests/test_multiclass.py | 8 | 25524 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.testing ... | bsd-3-clause |
ashhher3/pylearn2 | pylearn2/cross_validation/tests/test_subset_iterators.py | 49 | 2411 | """
Test subset iterators.
"""
import numpy as np
from pylearn2.testing.skip import skip_if_no_sklearn
def test_validation_k_fold():
"""Test ValidationKFold."""
skip_if_no_sklearn()
from pylearn2.cross_validation.subset_iterators import ValidationKFold
n = 30
# test with indices
cv = Validat... | bsd-3-clause |
khkaminska/scikit-learn | examples/linear_model/plot_multi_task_lasso_support.py | 249 | 2211 | #!/usr/bin/env python
"""
=============================================
Joint feature selection with multi-task Lasso
=============================================
The multi-task lasso allows to fit multiple regression problems
jointly enforcing the selected features to be the same across
tasks. This example simulates... | bsd-3-clause |
pazagra/catkin_ws | src/IL-pipeline/src/coord.py | 1 | 1965 | # import cv2
# import os
# import math
# import matplotlib.pyplot as plt
# import numpy as np
# from NMS import *
# import SVM
# import timeit
# path = "/media/iglu/Data/DatasetIglu"
# save_path_r ="/home/iglu/catkin_ws/src/IL-pipeline/src/Hands/RGB/"
# save_path_d ="/home/iglu/catkin_ws/src/IL-pipeline/src/Hands/Depth... | gpl-3.0 |
Clyde-fare/scikit-learn | examples/linear_model/plot_robust_fit.py | 238 | 2414 | """
Robust linear estimator fitting
===============================
Here a sine function is fit with a polynomial of order 3, for values
close to zero.
Robust fitting is demoed in different situations:
- No measurement errors, only modelling errors (fitting a sine with a
polynomial)
- Measurement errors in X
- M... | bsd-3-clause |
ky822/scikit-learn | examples/decomposition/plot_ica_vs_pca.py | 306 | 3329 | """
==========================
FastICA on 2D point clouds
==========================
This example illustrates visually in the feature space a comparison by
results using two different component analysis techniques.
:ref:`ICA` vs :ref:`PCA`.
Representing ICA in the feature space gives the view of 'geometric ICA':
ICA... | bsd-3-clause |
macks22/scikit-learn | sklearn/setup.py | 225 | 2856 | import os
from os.path import join
import warnings
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
from numpy.distutils.system_info import get_info, BlasNotFoundError
import numpy
libraries = []
if os.name == 'posix':
libraries.appe... | bsd-3-clause |
HIPS/optofit | examples/gp_demo.py | 1 | 7235 | import numpy as np
seed = np.random.randint(2**16)
#seed = 25982
print "Seed: ", seed
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon
from optofit.cneuron.compartment import Compartment
from optofit.cneuron.channels import LeakChannel
from optofit.cneuron.simulate import forward_euler
from opto... | gpl-2.0 |
quheng/scikit-learn | sklearn/feature_selection/tests/test_from_model.py | 244 | 1593 | import numpy as np
import scipy.sparse as sp
from nose.tools import assert_raises, assert_true
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_greater
from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
from sklearn.linear_model import SGD... | bsd-3-clause |
quheng/scikit-learn | sklearn/preprocessing/tests/test_function_transformer.py | 176 | 2169 | from nose.tools import assert_equal
import numpy as np
from sklearn.preprocessing import FunctionTransformer
def _make_func(args_store, kwargs_store, func=lambda X, *a, **k: X):
def _func(X, *args, **kwargs):
args_store.append(X)
args_store.extend(args)
kwargs_store.update(kwargs)
... | bsd-3-clause |
Titan-C/scikit-learn | sklearn/gaussian_process/gaussian_process.py | 17 | 34869 | # -*- coding: utf-8 -*-
# Author: Vincent Dubourg <vincent.dubourg@gmail.com>
# (mostly translation, see implementation details)
# License: BSD 3 clause
from __future__ import print_function
import numpy as np
from scipy import linalg, optimize
from ..base import BaseEstimator, RegressorMixin
from ..metrics... | bsd-3-clause |
flag0010/pop_gen_cnn | data_prep_tricks/generic_tajD.py | 2 | 3383 | from common import *
from itertools import izip
def tajD(N,S,k):
'''N is the number of indv
S is the number of seg. sites
k is the (ave number of pairwise nuc. diffs), e.g. total number of pairwise diffs divided by choose(N,2)
so:
i1 AT|T|GGCG|A|CAG|T
i2 AT|G|GGCG|C|CAG|A
... | gpl-3.0 |
spallavolu/scikit-learn | examples/ensemble/plot_voting_probas.py | 316 | 2824 | """
===========================================================
Plot class probabilities calculated by the VotingClassifier
===========================================================
Plot the class probabilities of the first sample in a toy dataset
predicted by three different classifiers and averaged by the
`VotingC... | bsd-3-clause |
Lab603/PicEncyclopedias | jni-build/jni-build/jni/include/tensorflow/contrib/learn/python/learn/preprocessing/tests/categorical_test.py | 30 | 2249 | # encoding: utf-8
# 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 r... | mit |
sanja7s/SR_Twitter | src_graph/analyze_SR.py | 1 | 3725 | import codecs
from scipy.stats.stats import pearsonr, spearmanr
from collections import defaultdict, OrderedDict
import numpy as np
from scipy.interpolate import UnivariateSpline
import matplotlib.mlab as mlab
from matplotlib import pyplot as plt
f_in = "graph_data_with_SR.tab"
f_out = "mention_graph_with_SR_undirecte... | mit |
wdm0006/pyculiarity | pyculiarity/detect_ts.py | 1 | 10466 | # -*- coding: utf-8 -*-
from collections import namedtuple
import datetime
import copy
from past.builtins import basestring
from pandas import DataFrame, to_datetime
from pandas.lib import Timestamp
import numpy as np
from pyculiarity.date_utils import get_gran
from pyculiarity.detect_anoms import detect_anoms
Direc... | gpl-3.0 |
jjs0sbw/CSPLN | apps/scaffolding/mac/web2py/web2py.app/Contents/Resources/lib/python2.7/matplotlib/backends/backend_template.py | 3 | 8679 | """
This is a fully functional do nothing backend to provide a template to
backend writers. It is fully functional in that you can select it as
a backend with
import matplotlib
matplotlib.use('Template')
and your matplotlib scripts will (should!) run without error, though
no output is produced. This provides a ... | gpl-3.0 |
robin-lai/scikit-learn | benchmarks/bench_plot_omp_lars.py | 266 | 4447 | """Benchmarks of orthogonal matching pursuit (:ref:`OMP`) versus least angle
regression (:ref:`least_angle_regression`)
The input data is mostly low rank but is a fat infinite tail.
"""
from __future__ import print_function
import gc
import sys
from time import time
import numpy as np
from sklearn.linear_model impo... | bsd-3-clause |
dchabot/bluesky | bluesky/broker_callbacks.py | 1 | 2716 | from dataportal import DataBroker as db, get_events
import filestore
import filestore.api as fsapi
from metadatastore.commands import run_start_given_uid, descriptors_by_start
import matplotlib.pyplot as plt
from xray_vision.backend.mpl.cross_section_2d import CrossSection
from .callbacks import CallbackBase
class Li... | bsd-3-clause |
equialgo/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 |
yandex/rep | tests/test_factory_reg.py | 1 | 3000 | from __future__ import division, print_function, absolute_import
from sklearn.ensemble import RandomForestRegressor, AdaBoostRegressor
from sklearn.metrics import mean_squared_error
import numpy
from rep.data import LabeledDataStorage
from rep.metaml import RegressorsFactory
from six.moves import cPickle
from rep.rep... | apache-2.0 |
cavestruz/L500analysis | plotting/profiles/K_evolution/plot_K_r200m.py | 1 | 2587 | from L500analysis.data_io.get_cluster_data import GetClusterData
from L500analysis.utils.utils import aexp2redshift
from L500analysis.plotting.tools.figure_formatting import *
from L500analysis.plotting.profiles.tools.profiles_percentile \
import *
from L500analysis.utils.constants import rbins
from derived_field_f... | mit |
atgreen/RTEMS | testsuites/tmtests/tmcontext01/plot.py | 14 | 1341 | #
# Copyright (c) 2014 embedded brains GmbH. All rights reserved.
#
# The license and distribution terms for this file may be
# found in the file LICENSE in this distribution or at
# http://www.rtems.org/license/LICENSE.
#
import libxml2
from libxml2 import xmlNode
import matplotlib.pyplot as plt
doc = libxml2.parseF... | gpl-2.0 |
networks-lab/metaknowledge | metaknowledge/tests/test_recordcollection.py | 2 | 26484 | #Written by Reid McIlroy-Young for Dr. John McLevey, University of Waterloo 2015
import unittest
import metaknowledge
import metaknowledge.WOS
import os
import filecmp
import networkx as nx
disableJournChecking = True
class TestRecordCollection(unittest.TestCase):
@classmethod
def setUpClass(cls):
met... | gpl-2.0 |
nesterione/scikit-learn | examples/neighbors/plot_approximate_nearest_neighbors_hyperparameters.py | 227 | 5170 | """
=================================================
Hyper-parameters of Approximate Nearest Neighbors
=================================================
This example demonstrates the behaviour of the
accuracy of the nearest neighbor queries of Locality Sensitive Hashing
Forest as the number of candidates and the numb... | bsd-3-clause |
Ernestyj/PyStudy | finance/TradingAlgo.py | 1 | 5732 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.finance as finance
import zipline as zp
import math
from datetime import datetime
from zipline import TradingAlgorithm
class MyTradingAlog(TradingAlgorithm):
def __init__(self):... | apache-2.0 |
CompPhysics/ComputationalPhysics2 | doc/BookChapters/figures/plotEnergies.py | 10 | 1487 | import sys
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
try:
dataFileName = sys.argv[1]
except IndexError:
print("USAGE: python plotEnergies.py 'filename'")
sys.exit(0)
HFEnergy3 = 3.161921401722216
HFEnergy6 = 20.71924844033019
numPart... | cc0-1.0 |
michalkurka/h2o-3 | h2o-py/tests/testdir_algos/glm/pyunit_pubdev_6999_glm_interaction_NA.py | 2 | 7181 | from __future__ import division
from __future__ import print_function
from past.utils import old_div
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.glm import H2OGeneralizedLinearEstimator
import pandas as pd
import numpy as np
# test missing_value handling for ... | apache-2.0 |
kdwink/intellij-community | python/helpers/pydev/pydev_ipython/inputhook.py | 52 | 18411 | # 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 |
pianomania/scikit-learn | examples/classification/plot_lda.py | 142 | 2419 | """
====================================================================
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 |
AlexRobson/nilmtk | nilmtk/elecmeter.py | 5 | 30305 | from __future__ import print_function, division
from warnings import warn
from collections import namedtuple
from copy import deepcopy
from itertools import izip
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import random
from .preprocessing import Clip
from .stats import TotalEnergy, GoodSecti... | apache-2.0 |
luo66/scikit-learn | sklearn/utils/validation.py | 30 | 24618 | """Utilities for input validation"""
# Authors: Olivier Grisel
# Gael Varoquaux
# Andreas Mueller
# Lars Buitinck
# Alexandre Gramfort
# Nicolas Tresegnie
# License: BSD 3 clause
import warnings
import numbers
import numpy as np
import scipy.sparse as sp
from ..externals i... | bsd-3-clause |
code-for-india/sahana_shelter_worldbank | modules/tests/smoke/broken_links.py | 5 | 26739 | """ Sahana Eden Test Framework
@copyright: 2011-2014 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, incl... | mit |
sanketloke/scikit-learn | sklearn/linear_model/sag.py | 29 | 11291 | """Solvers for Ridge and LogisticRegression using SAG algorithm"""
# Authors: Tom Dupre la Tour <tom.dupre-la-tour@m4x.org>
#
# Licence: BSD 3 clause
import numpy as np
import warnings
from ..exceptions import ConvergenceWarning
from ..utils import check_array
from ..utils.extmath import row_norms
from .base import ... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.