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 |
|---|---|---|---|---|---|
hanase/synthpop | synthpop/ipu/ipu.py | 3 | 8117 | # encoding: utf-8
from __future__ import division
import itertools
from collections import OrderedDict
import numpy as np
import pandas as pd
def _drop_zeros(df):
"""
Drop zeros from a DataFrame, returning an iterator over the columns
in the DataFrame.
Yields tuples of (column name, non-zero colum... | bsd-3-clause |
uppsaladatavetare/foobar-api | src/shop/api.py | 1 | 15019 | import logging
import numpy as np
import math
from itertools import accumulate
from datetime import date, timedelta
from django.db import transaction
from django.db.models import Sum
from django.db.models.functions import TruncDay
from django.contrib.contenttypes.models import ContentType
from django.utils import timez... | mit |
redreamality/learning-to-rank | scripts/get_offline_plot.py | 2 | 14047 | #!/usr/bin/env python
# This file is part of Lerot.
#
# Lerot is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Lerot is dist... | gpl-3.0 |
sergeyfarin/pyqt-fit | setup.py | 1 | 2412 | #!/usr/bin/env python
from setuptools import setup
#from path import path
#with (path(__file__).dirname() / 'pyqt_fit' / 'version.txt').open() as f:
#__version__ = f.read().strip()
import os.path
version_filename = os.path.join(os.path.dirname(__file__), 'pyqt_fit', 'version.txt')
with open(version_filename, "... | gpl-3.0 |
yutiansut/QUANTAXIS | QUANTAXIS/QAFactor/localize.py | 2 | 22869 | """
数据本地化方案
1. 更新方式分为两种:全量更新与增量更新
2. 考虑到 tushare 的查询接口太过简陋,同时考虑到查询限制,针对增量更新,作如下假设
- 对 report_type = 1 的财务数据,更新从最新的两期财务报告期开始往后
- 对 report_type = 5,11 的财务数据,增量更新时间为 report_type 最新一起财务报告期往前追溯 3 年
- 对 report_type = 4 的财务数据,也是往前追溯 3 年
"""
import datetime
import time
from typing import List, Tuple, Union
import ... | mit |
xiezhen/brilws | utils/loadrun1tags.py | 1 | 9625 | import sys,logging,base64
import pandas as pd
import numpy as np
from sqlalchemy import *
from sqlalchemy import exc
from ConfigParser import SafeConfigParser
import array
import os
def unpackblobstr(iblobstr,itemtypecode):
if itemtypecode not in ['c','b','B','u','h','H','i','I','l','L','f','d']:
raise Run... | mit |
nicproulx/mne-python | mne/decoding/time_gen.py | 2 | 65441 | # Authors: Jean-Remi King <jeanremi.king@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
# Clement Moutard <clement.moutard@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
import copy
from .base import _set_cv
f... | bsd-3-clause |
smccaffrey/blackboard_automation | tests/client_builds/PHY132_Fall2017/finalTest_V1.py | 2 | 2852 | import selenium
import getpass
import time
import logging as log
import pandas as pd
from selenium import webdriver as wbd
from selenium.webdriver.common.by import By
import sys
sys.path.append('/Users/smccaffrey/Desktop/git/blackboard_automation')
from blackboard_automation import tests
from blackboard_automation im... | apache-2.0 |
pombredanne/bokeh | examples/plotting/file/clustering.py | 6 | 2136 | """ Example inspired by an example from the scikit-learn project:
http://scikit-learn.org/stable/auto_examples/cluster/plot_cluster_comparison.html
"""
import numpy as np
try:
from sklearn import cluster, datasets
from sklearn.preprocessing import StandardScaler
except ImportError:
raise ImportError('This... | bsd-3-clause |
ringw/MetaOMR | metaomr_tests/estimate_imslp_kanungo.py | 1 | 1403 | import env
import gzip
import metaomr
import metaomr.kanungo
import glob
import os.path
import pandas as pd
import numpy as np
from datetime import datetime
import gc
import sys
results = pd.DataFrame()
index = []
path = sys.argv[1]
name = os.path.basename(path)
print name
for i, page in enumerate(sorted(glob.glob(pat... | gpl-3.0 |
dsm054/pandas | scripts/merge-pr.py | 9 | 10324 | #!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Li... | bsd-3-clause |
thombashi/SimpleSQLite | test/test_pandas.py | 1 | 1837 | """
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
import pytest
from simplesqlite import connect_memdb
from ._common import print_test_result
try:
import pandas as pd
PANDAS_IMPORT = True
except ImportError:
PANDAS_IMPORT = False
@pytest.mark.skipif(not PANDAS_IMPORT, reason="r... | mit |
CharlelieMichaud/paparazzi | sw/airborne/test/math/compare_utm_enu.py | 77 | 2714 | #!/usr/bin/env python
from __future__ import division, print_function, absolute_import
import sys
import os
PPRZ_SRC = os.getenv("PAPARAZZI_SRC", "../../../..")
sys.path.append(PPRZ_SRC + "/sw/lib/python")
from pprz_math.geodetic import *
from pprz_math.algebra import DoubleRMat, DoubleEulers, DoubleVect3
from math ... | gpl-2.0 |
srodney/hstsntools | filters.py | 1 | 9454 | # 2014.04.29
# S.Rodney
# HST Filter transmission curves: plotting and such
import numpy as np
from matplotlib import pylab as pl
import os
topdir = os.path.abspath( '.' )
try :
sndataroot = os.environ['SNDATA_ROOT']
os.chdir( sndataroot+'/filters/HST_CANDELS')
w435, f435 = np.loadtxt( 'ACS_WFC_F435W.da... | mit |
ammarkhann/FinalSeniorCode | lib/python2.7/site-packages/pandas/tests/test_algos.py | 3 | 57570 | # -*- coding: utf-8 -*-
import numpy as np
import pytest
from numpy.random import RandomState
from numpy import nan
from datetime import datetime
from itertools import permutations
from pandas import (Series, Categorical, CategoricalIndex,
Timestamp, DatetimeIndex,
Index, Inter... | mit |
TUW-GEO/rt1 | tests/test_surface.py | 1 | 5266 | # -*- coding: utf-8 -*-
import unittest
import numpy as np
import sys
sys.path.append('..')
# from rt1.volume import Rayleigh
# from rt1.rt1 import RT1
from rt1.surface import Isotropic, CosineLobe, HenyeyGreenstein, LinCombSRF, \
HG_nadirnorm
from scipy import special as sc
# import sympy as sp
import matplotl... | apache-2.0 |
superdesk/Live-Blog | documentor/libraries/Sphinx-1.1.3-py3.2/sphinx/ext/inheritance_diagram.py | 2 | 13263 | # -*- coding: utf-8 -*-
r"""
sphinx.ext.inheritance_diagram
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Defines a docutils directive for inserting inheritance diagrams.
Provide the directive with one or more classes or modules (separated
by whitespace). For modules, all of the classes in that module will
... | agpl-3.0 |
AravindRam/ML | Project/code/LogisticRegression.py | 1 | 7356 | from datetime import datetime
import pandas as pd
from sklearn.linear_model import LogisticRegression
import numpy as np
import timeit
from sklearn import preprocessing
from sklearn.cross_validation import train_test_split
from sklearn.metrics import precision_score,accuracy_score,log_loss,recall_score
#train data
Tim... | apache-2.0 |
elkingtonmcb/scikit-learn | examples/decomposition/plot_ica_blind_source_separation.py | 349 | 2228 | """
=====================================
Blind source separation using FastICA
=====================================
An example of estimating sources from noisy data.
:ref:`ICA` is used to estimate sources given noisy measurements.
Imagine 3 instruments playing simultaneously and 3 microphones
recording the mixed si... | bsd-3-clause |
xmnlab/minilab | gui/plotter/multi_chart.py | 1 | 2571 | from __future__ import division, print_function
from matplotlib import pyplot as plt
from matplotlib.ticker import EngFormatter
import numpy as np
import time
def start():
plt.ion()
plt.show()
def stop():
plt.ioff()
def plotter(data_size=100, wait=0.00001):
start()
time = np.arange(0, 1, 1/d... | gpl-3.0 |
beeva-fernandocerezal/rasa_nlu | setup.py | 1 | 1512 | from setuptools import setup
__version__ = None # Avoids IDE errors, but actual version is read from version.py
exec(open('rasa_nlu/version.py').read())
tests_requires = [
"pytest-pep8",
"pytest-services",
"pytest-flask",
"pytest-cov"
]
install_requires = [
"requests",
"pathlib",
"cloud... | apache-2.0 |
PEAT-AI/Automato | Surveillance/infrapix/infrapix.py | 2 | 7093 | #This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#This program is distributed in the hope that it will be useful,
#but WITHO... | gpl-3.0 |
arjoly/scikit-learn | examples/feature_stacker.py | 246 | 1906 | """
=================================================
Concatenating multiple feature extraction methods
=================================================
In many real-world examples, there are many ways to extract features from a
dataset. Often it is beneficial to combine several methods to obtain good
performance. Th... | bsd-3-clause |
lancezlin/ml_template_py | lib/python2.7/site-packages/pandas/tseries/base.py | 7 | 27129 | """
Base and utility classes for tseries type pandas objects.
"""
from datetime import datetime, timedelta
from pandas import compat
from pandas.compat.numpy import function as nv
import numpy as np
from pandas.types.common import (is_integer, is_float,
is_bool_dtype, _ensure_int64,
... | mit |
cmry/shed | omesa/tools/doc2md.py | 2 | 8594 | """Converts sklearn-styled docstrings to markdown."""
from sys import argv
# Author: Chris Emmery
# License: MIT
ERR = '''
- """ used for non-docstring strings.
- Class or function Documentation has newline after opening """.
'''
class Doc2Markdown(object):
"""Documentation to Markdown."""
def ... | mit |
moutai/scikit-learn | sklearn/metrics/tests/test_ranking.py | 32 | 41905 | from __future__ import division, print_function
import numpy as np
from itertools import product
import warnings
from scipy.sparse import csr_matrix
from sklearn import datasets
from sklearn import svm
from sklearn import ensemble
from sklearn.datasets import make_multilabel_classification
from sklearn.random_projec... | bsd-3-clause |
gentilew/Machine-Learning-Pills | Tic-Tac-Toe-Endgame/TicTacToe_Predictor.py | 1 | 5050 | ##############################################################################################################################################################################################
#Created by: Walter Gentile on September 2017
#
#Ver. 1.0
#
#Credits for data: Lichman, M. (2013). UCI Machine Learning Rep... | mit |
wwf5067/statsmodels | statsmodels/duration/tests/test_phreg.py | 10 | 11984 | import os
import numpy as np
from statsmodels.duration.hazard_regression import PHReg
from numpy.testing import (assert_allclose,
assert_equal)
import pandas as pd
# TODO: Include some corner cases: data sets with empty strata, strata
# with no events, entry times after censoring times,... | bsd-3-clause |
AlexSafatli/Pylogeny | setup.py | 1 | 1813 | ''' Installation script for Pylogeny. '''
# Date: Oct 16 2014
# Author: Alex Safatli
# E-mail: safatli@cs.dal.ca
from setuptools import setup, Extension as extension
import os
# Metadata
from pylogeny.__version__ import VERSION
DESCRIP = 'A code framework for phylogenetic tree reconstruction, rearrangement, scori... | gpl-2.0 |
dfolch/pysal | pysal/contrib/pdutilities/dbf_utilities.py | 3 | 5707 | """miscellaneous file manipulation utilities
"""
import numpy as np
import pysal as ps
import pandas as pd
def check_dups(li):
"""checks duplicates in list of ID values
ID values must be read in as a list
__author__ = "Luc Anselin <luc.anselin@asu.edu> "
Arguments
---------
... | bsd-3-clause |
ShawnMurd/MetPy | src/metpy/io/gini.py | 2 | 18313 | # Copyright (c) 2015,2016,2017,2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Tools to process GINI-formatted products."""
import contextlib
from datetime import datetime
from enum import Enum
from io import BytesIO
from itertools import rep... | bsd-3-clause |
RomainBrault/scikit-learn | examples/model_selection/plot_nested_cross_validation_iris.py | 46 | 4415 | """
=========================================
Nested versus non-nested cross-validation
=========================================
This example compares non-nested and nested cross-validation strategies on a
classifier of the iris data set. Nested cross-validation (CV) is often used to
train a model in which hyperparam... | bsd-3-clause |
ZenDevelopmentSystems/scikit-learn | sklearn/tests/test_common.py | 70 | 7717 | """
General tests for all estimators in sklearn.
"""
# Authors: Andreas Mueller <amueller@ais.uni-bonn.de>
# Gael Varoquaux gael.varoquaux@normalesup.org
# License: BSD 3 clause
from __future__ import print_function
import os
import warnings
import sys
import pkgutil
from sklearn.externals.six import PY3
fr... | bsd-3-clause |
KordingLab/spykes | examples/plot_neuropixels_example.py | 2 | 7803 | """
===================
Neuropixels Example
===================
Use spykes to analyze data from UCL's Neuropixels
"""
# Authors: Mayank Agrawal <mayankagrawal96@gmail.com>
#
# License: MIT
########################################################
import numpy as np
import pandas as pd
from spykes.plot.neurovis impor... | mit |
yunfeilu/scikit-learn | sklearn/utils/graph.py | 289 | 6239 | """
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 |
matt2000/becca | becca/ziptie.py | 1 | 21137 | """
The Ziptie class.
"""
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
import becca.tools as tools
import becca.ziptie_numba as nb
class ZipTie(object):
"""
An incremental unsupervised clustering algorithm
Input channels are clustered together into mutually co... | mit |
yuyichao/pyscical | test/test_ode.py | 1 | 10107 | #!/usr/bin/env python
from __future__ import division
import pytest
import numpy as np
from os import path as _path
import pyopencl as cl
import pyopencl.elementwise as cl_elwise
import pyopencl.array as cl_array
from pyopencl.tools import (VectorArg, ScalarArg,
pytest_generate_tests_for_... | gpl-3.0 |
astropy/astropy | astropy/visualization/wcsaxes/frame.py | 8 | 10649 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import abc
from collections import OrderedDict
import numpy as np
from matplotlib import rcParams
from matplotlib.lines import Line2D, Path
from matplotlib.patches import PathPatch
__all__ = ['RectangularFrame1D', 'Spine', 'BaseFrame', 'RectangularFr... | bsd-3-clause |
ThomasBrouwer/BNMTF | experiments/experiments_toy/convergence/nmf_vb.py | 1 | 13601 | """
Recover the toy dataset using VB.
We can plot the MSE, R2 and Rp as it converges, on the entire dataset.
We have I=100, J=80, K=10, and no test data.
We give flatter priors (1/10) than what was used to generate the data (1).
"""
import sys, os
project_location = os.path.dirname(__file__)+"/../../../../"
sys.path... | apache-2.0 |
chrisburr/scikit-learn | sklearn/__check_build/__init__.py | 345 | 1671 | """ Module to give helpful messages to the user that did not
compile the scikit properly.
"""
import os
INPLACE_MSG = """
It appears that you are importing a local scikit-learn source tree. For
this, you need to have an inplace install. Maybe you are in the source
directory and you need to try from another location.""... | bsd-3-clause |
harisbal/pandas | asv_bench/benchmarks/frame_ctor.py | 3 | 2551 | import numpy as np
import pandas.util.testing as tm
from pandas import DataFrame, Series, MultiIndex, Timestamp, date_range
try:
from pandas.tseries.offsets import Nano, Hour
except ImportError:
# For compatibility with older versions
from pandas.core.datetools import * # noqa
class FromDicts(object):
... | bsd-3-clause |
andyraib/data-storage | python_scripts/env/lib/python3.6/site-packages/matplotlib/tests/test_patheffects.py | 3 | 5052 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import numpy as np
from matplotlib.testing.decorators import (image_comparison, cleanup,
knownfailureif)
import matplotlib.pyplot as plt
import matplotlib... | apache-2.0 |
humdings/zipline | zipline/finance/performance/tracker.py | 2 | 18598 | #
# Copyright 2016 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | apache-2.0 |
JasonKessler/scattertext | scattertext/characteristic/DenseRankCharacteristicness.py | 1 | 2339 | import pandas as pd
from scipy.stats import rankdata
from scattertext.Scalers import scale
from scattertext.frequencyreaders.DefaultBackgroundFrequencies import DefaultBackgroundFrequencies
from scattertext.termranking import AbsoluteFrequencyRanker
from scattertext.termscoring.RankDifference import RankDifference
c... | apache-2.0 |
schreiberx/sweet | scripts/normal_modes_compute_exp.py | 1 | 1473 | #!/usr/bin/env python2
import sys
import numpy as np
from mpmath import mp
import matplotlib.pyplot as plt
if len(sys.argv) < 2:
print("Execute with [executable] [input]")
sys.exit(1)
filename = sys.argv[1]
f=open(filename)
headerstr = f.readline()
if headerstr[0] != '#':
print("HEADER not found")
sys.exit(1)
f... | mit |
qusp/orange3 | Orange/widgets/evaluate/owliftcurve.py | 1 | 8065 | """
Lift Curve Widget
-----------------
"""
from collections import namedtuple
import numpy
import sklearn.metrics as skl_metrics
from PyQt4 import QtGui
from PyQt4.QtGui import QColor, QPen
from PyQt4.QtCore import Qt
import pyqtgraph as pg
import Orange
from Orange.widgets import widget, gui, settings
from Orang... | bsd-2-clause |
abbeymiles/aima-python | submissions/Miles/myNN.py | 13 | 3799 | from sklearn import datasets
from sklearn.neural_network import MLPClassifier
import traceback
'''
My bayes into Neural Networks
'''
from submissions.Miles import food
class DataFrame:
data = [] # grid of floating point numbers
feature_names = [] # column names
target = [] # list of the target value... | mit |
nomadcube/scikit-learn | sklearn/feature_extraction/tests/test_image.py | 205 | 10378 | # Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD 3 clause
import numpy as np
import scipy as sp
from scipy import ndimage
from nose.tools import assert_equal, assert_true
from numpy.testing import assert_raises
from sklearn... | bsd-3-clause |
huobaowangxi/scikit-learn | examples/model_selection/plot_confusion_matrix.py | 244 | 2496 | """
================
Confusion matrix
================
Example of confusion matrix usage to evaluate the quality
of the output of a classifier on the iris data set. The
diagonal elements represent the number of points for which
the predicted label is equal to the true label, while
off-diagonal elements are those that ... | bsd-3-clause |
zrhans/pythonanywhere | .virtualenvs/django19/lib/python3.4/site-packages/matplotlib/dates.py | 3 | 52905 | #!/usr/bin/env python
"""
Matplotlib provides sophisticated date plotting capabilities, standing on the
shoulders of python :mod:`datetime`, the add-on modules :mod:`pytz` and
:mod:`dateutil`. :class:`datetime` objects are converted to floating point
numbers which represent time in days since 0001-01-01 UTC, plus 1. ... | apache-2.0 |
jdorvi/CSHORE | extract_adcirc_63/getstationoutput_ontario_crude.py | 1 | 1788 | # coding: utf-8
#Extracts hydrographs from all .63 files in directory folder starting at current directory
def main():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("num")
args = parser.parse_args()
num = int(args.num)
print num
#import modules
import os
import subprocess
i... | apache-2.0 |
rajat1994/scikit-learn | examples/semi_supervised/plot_label_propagation_digits_active_learning.py | 294 | 3417 | """
========================================
Label Propagation digits active learning
========================================
Demonstrates an active learning technique to learn handwritten digits
using label propagation.
We start by training a label propagation model with only 10 labeled points,
then we select the t... | bsd-3-clause |
jtorrents/networkx | examples/drawing/lanl_routes.py | 10 | 2009 | #!/usr/bin/env python
"""
Routes to LANL from 186 sites on the Internet.
This uses Graphviz for layout so you need PyGraphviz or Pydot.
"""
__author__ = """Aric Hagberg (hagberg@lanl.gov)"""
# Copyright (C) 2004-2008
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swar... | bsd-3-clause |
DVegaCapital/zipline | zipline/errors.py | 2 | 11277 | #
# Copyright 2013 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | apache-2.0 |
rec/echomesh | code/python/external/platform/darwin/numpy/lib/polynomial.py | 12 | 37449 | """
Functions to operate on polynomials.
"""
__all__ = ['poly', 'roots', 'polyint', 'polyder', 'polyadd',
'polysub', 'polymul', 'polydiv', 'polyval', 'poly1d',
'polyfit', 'RankWarning']
import re
import warnings
import numpy.core.numeric as NX
from numpy.core import isscalar, abs, finfo, atleas... | mit |
datapythonista/pandas | pandas/tests/scalar/timedelta/test_timedelta.py | 3 | 21525 | """ test the scalar Timedelta """
from datetime import timedelta
import numpy as np
import pytest
from pandas._libs.tslibs import (
NaT,
iNaT,
)
import pandas as pd
from pandas import (
Timedelta,
TimedeltaIndex,
offsets,
to_timedelta,
)
import pandas._testing as tm
class TestTimedeltaUnary... | bsd-3-clause |
mizzao/ggplot | ggplot/themes/theme_538.py | 12 | 3240 | from .theme import theme
import matplotlib as mpl
import matplotlib.pyplot as plt
from numpy import isreal
class theme_538(theme):
"""
Theme for 538.
Copied from CamDavidsonPilon's gist:
https://gist.github.com/CamDavidsonPilon/5238b6499b14604367ac
"""
def __init__(self):
super(... | bsd-2-clause |
NICTA/revrand | demos/profile/revprofile.py | 1 | 1291 | """Some code for profiling revrand."""
import logging
import numpy as np
from sklearn.datasets import load_boston
from sklearn.cross_validation import KFold
from revrand import GeneralisedLinearModel
from revrand.likelihoods import Gaussian
from revrand.basis_functions import LinearBasis, RandomMatern32
from revrand.m... | apache-2.0 |
dennisobrien/bokeh | tests/test_examples.py | 3 | 7377 | from __future__ import absolute_import, print_function
import os
from os.path import basename
import time
import pytest
import subprocess
import signal
from os.path import dirname, exists, split
import six
from bokeh.server.callbacks import NextTickCallback, PeriodicCallback, TimeoutCallback
from bokeh._testing.uti... | bsd-3-clause |
GuessWhoSamFoo/pandas | pandas/tests/io/parser/test_mangle_dupes.py | 2 | 3922 | # -*- coding: utf-8 -*-
"""
Tests that duplicate columns are handled appropriately when parsed by the
CSV engine. In general, the expected result is that they are either thoroughly
de-duplicated (if mangling requested) or ignored otherwise.
"""
import pytest
from pandas.compat import StringIO
from pandas import Dat... | bsd-3-clause |
ghchinoy/tensorflow | tensorflow/contrib/learn/python/learn/learn_io/__init__.py | 42 | 2656 | # 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 |
wyom/sympy | sympy/plotting/tests/test_plot.py | 43 | 8577 | from sympy import (pi, sin, cos, Symbol, Integral, summation, sqrt, log,
oo, LambertW, I, meijerg, exp_polar, Max, Piecewise)
from sympy.plotting import (plot, plot_parametric, plot3d_parametric_line,
plot3d, plot3d_parametric_surface)
from sympy.plotting.plot import unset... | bsd-3-clause |
rrohan/scikit-learn | examples/cluster/plot_lena_segmentation.py | 271 | 2444 | """
=========================================
Segmenting the picture of Lena in regions
=========================================
This example uses :ref:`spectral_clustering` on a graph created from
voxel-to-voxel difference on an image to break this image into multiple
partly-homogeneous regions.
This procedure (spe... | bsd-3-clause |
Windy-Ground/scikit-learn | examples/model_selection/plot_validation_curve.py | 229 | 1823 | """
==========================
Plotting Validation Curves
==========================
In this plot you can see the training scores and validation scores of an SVM
for different values of the kernel parameter gamma. For very low values of
gamma, you can see that both the training score and the validation score are
low. ... | bsd-3-clause |
maxlikely/scikit-learn | examples/plot_kernel_approximation.py | 4 | 7903 | """
==================================================
Explicit feature map approximation for RBF kernels
==================================================
.. currentmodule:: sklearn.kernel_approximation
An example shows how to use :class:`RBFSampler` and :class:`Nystrom` to
appoximate the feature map of an RBF kern... | bsd-3-clause |
mifumagalli/mypython | redshifts/zfit.py | 1 | 48275 | """
Gui to inspect spectra in 1/2D
"""
try:
import Tkinter as tkinter
import tkFont as tkfont
from Tkinter import Tk
import tkFileDialog as filedialog
except:
import tkinter
from tkinter import font as tkfont
from tkinter import Tk
from tkinter import filedialog
from astropy.io import fits
import matplot... | gpl-2.0 |
Adai0808/BuildingMachineLearningSystemsWithPython | ch04/blei_lda.py | 21 | 2601 | # This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
from __future__ import print_function
from wordcloud import create_cloud
try:
from gensim import co... | mit |
Spinmob/spinmob | __init__.py | 1 | 3152 | import os as _os
import sys as _sys
import matplotlib as _mpl
import pylab
# Try to run the qt magic first
try:
if not pylab.get_backend()[0:2] == 'Qt':
get_ipython().run_line_magic('matplotlib', 'qt')
except: pass
import traceback as _traceback
_sys.excepthook = _traceback.print_... | gpl-3.0 |
Unidata/MetPy | v0.7/api/generated/metpy-plots-ctables-1.py | 2 | 1040 | import numpy as np
import matplotlib.pyplot as plt
import metpy.plots.ctables as ctables
def plot_color_gradients(cmap_category, cmap_list, nrows):
fig, axes = plt.subplots(figsize=(7, 6), nrows=nrows)
fig.subplots_adjust(top=.93, bottom=0.01, left=0.32, right=0.99)
axes[0].set_title(cmap_category + ' colo... | bsd-3-clause |
jccaicedo/localization-agent | learn/rl/rlLogParser.py | 1 | 2679 | import os,sys
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import utils as cu
import RLConfig as config
params = cu.loadParams("config caffeLog rlLog outdir")
config.readConfiguration(params["config"])
fig, ax = plt.subplots(nrows=2, ncols=3)
fig.set_size_inches(18.5,10.... | mit |
RPGOne/Skynet | scikit-learn-0.18.1/examples/mixture/plot_concentration_prior.py | 25 | 5631 | """
========================================================================
Concentration Prior Type Analysis of Variation Bayesian Gaussian Mixture
========================================================================
This example plots the ellipsoids obtained from a toy dataset (mixture of three
Gaussians) fitte... | bsd-3-clause |
TomAugspurger/pandas | pandas/tests/frame/indexing/test_insert.py | 2 | 2291 | """
test_insert is specifically for the DataFrame.insert method; not to be
confused with tests with "insert" in their names that are really testing
__setitem__.
"""
import numpy as np
import pytest
from pandas import DataFrame, Index
import pandas._testing as tm
class TestDataFrameInsert:
def test_insert(self):
... | bsd-3-clause |
huongttlan/statsmodels | statsmodels/tsa/arima_process.py | 26 | 30878 | '''ARMA process and estimation with scipy.signal.lfilter
2009-09-06: copied from try_signal.py
reparameterized same as signal.lfilter (positive coefficients)
Notes
-----
* pretty fast
* checked with Monte Carlo and cross comparison with statsmodels yule_walker
for AR numbers are close but not identical to yule... | bsd-3-clause |
kevin-intel/scikit-learn | examples/gaussian_process/plot_gpr_noisy_targets.py | 30 | 3684 | """
=========================================================
Gaussian Processes regression: basic introductory example
=========================================================
A simple one-dimensional regression example computed in two different ways:
1. A noise-free case
2. A noisy case with known noise-level per ... | bsd-3-clause |
biryani/Quacpy | simulation/simulation.py | 1 | 4964 | """
Functions for hamiltonian simulation
"""
import qregister as qr
import qoperator as qo
import auxfun as aux
import numpy as np
import matplotlib.pyplot as plt
def identityop(nbits):
N = np.power(2,nbits)
return qo.Qoperator(nbits,np.asmatrix(np.eye(N)))
def wireswitch(wire1, wire2, nbits):
"""
Switch two wir... | gpl-2.0 |
LucianU/ThinkStats2 | code/chap12soln.py | 68 | 4459 | """This file contains code for use with "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2014 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function
import pandas
import numpy as np
import statsmodels.formula.api as smf
import t... | gpl-3.0 |
google-research/pddm | pddm/utils/helper_funcs.py | 1 | 13233 | # Copyright 2019 Google 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 in writing, ... | apache-2.0 |
Nyker510/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 |
ofgulban/scikit-image | skimage/feature/tests/test_util.py | 35 | 2818 | import numpy as np
try:
import matplotlib.pyplot as plt
except ImportError:
plt = None
from numpy.testing import assert_equal, assert_raises
from skimage.feature.util import (FeatureDetector, DescriptorExtractor,
_prepare_grayscale_input_2D,
_mask... | bsd-3-clause |
sssllliang/BuildingMachineLearningSystemsWithPython | ch05/utils.py | 24 | 7111 | # 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 os
try:
import ujson as json # UltraJSON if available
except:
import json
from matplo... | mit |
clarson469/reinforcementLearning | solutions/n_armed_bandits_nonstationary.py | 1 | 3431 | # modifies the N-armed Bandits problem into a non-stationary one
# that is, where the reward value of the bandit arms shifts randomly
#
# compares the use of a sample-average estimate method (used in previous soutions)
# with a non-stationary one, that weights more recent information / rewards
# more heavily than less ... | mit |
tedunderwood/fiction | bert/evalbert.py | 1 | 7265 | '''
Adapted from code by Thilina Rajapakse
'''
import torch, sys, os
import numpy as np
import pickle
from sklearn.metrics import matthews_corrcoef, confusion_matrix
from torch.utils.data import (DataLoader, RandomSampler, SequentialSampler,
TensorDataset)
from torch.utils.data.distribu... | mit |
spark0001/spark2.1.1 | python/pyspark/sql/context.py | 6 | 23638 | #
# 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 |
dalejung/trtools | trtools/core/tests/test_columns.py | 1 | 6897 | from unittest import TestCase
import itertools
import pandas as pd
import numpy as np
import trtools.util.testing as tm
from trtools.core.columns import MultiIndexGetter, ObjectIndexGetter, LevelWrapper
limit = list(range(10))
stop = list(range(3,7))
target = list(range(10, 20))
sets = itertools.product(limit, stop... | mit |
dan-git/outdoor_bot | vision/nodes/common.py | 10 | 3615 | import numpy as np
import cv2
import os
image_extensions = ['.bmp', '.jpg', '.jpeg', '.png', '.tif', '.tiff', '.pbm', '.pgm', '.ppm']
def splitfn(fn):
path, fn = os.path.split(fn)
name, ext = os.path.splitext(fn)
return path, name, ext
def anorm2(a):
return (a*a).sum(-1)
def anorm(a):
... | bsd-2-clause |
meduz/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 |
natj/bender | paper/figs/FFT.py | 1 | 7451 | import numpy as np
import math
from pylab import *
from palettable.wesanderson import Zissou_5 as wsZ
import matplotlib.ticker as mtick
from scipy.interpolate import interp1d
from scipy.interpolate import griddata
#from sg_filter import savitzky_golay
from scipy.signal import savgol_filter
import scipy.fftpack
def ... | mit |
matthiasplappert/motion_classification | src/toolkit/rnn/base.py | 1 | 1675 | import numpy as np
from sklearn.base import BaseEstimator, ClassifierMixin
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, TimeDistributedDense
from keras.layers.recurrent import LSTM, GRU
from keras.layers.normalization import BatchNormalization
import keras.optimizers as... | mit |
xuewei4d/scikit-learn | sklearn/linear_model/_passive_aggressive.py | 6 | 17375 | # Authors: Rob Zinkov, Mathieu Blondel
# License: BSD 3 clause
from ..utils.validation import _deprecate_positional_args
from ._stochastic_gradient import BaseSGDClassifier
from ._stochastic_gradient import BaseSGDRegressor
from ._stochastic_gradient import DEFAULT_EPSILON
class PassiveAggressiveClassifier(BaseSGDCl... | bsd-3-clause |
leftaroundabout/pyunicorn | pyunicorn/core/grid.py | 1 | 24457 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This file is part of pyunicorn.
# Copyright (C) 2008--2015 Jonathan F. Donges and pyunicorn authors
# URL: <http://www.pik-potsdam.de/members/donges/software>
# License: BSD (3-clause)
"""
Provides classes for analyzing spatially embedded complex networks, handling
multiva... | bsd-3-clause |
frank-tancf/scikit-learn | sklearn/neighbors/tests/test_kd_tree.py | 159 | 7852 | import numpy as np
from numpy.testing import assert_array_almost_equal
from sklearn.neighbors.kd_tree import (KDTree, NeighborsHeap,
simultaneous_sort, kernel_norm,
nodeheap_sort, DTYPE, ITYPE)
from sklearn.neighbors.dist_metrics import Dista... | bsd-3-clause |
chenyyx/scikit-learn-doc-zh | examples/zh/svm/plot_svm_margin.py | 88 | 2540 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
SVM Margins Example
=========================================================
The plots below illustrate the effect the parameter `C` has
on the separation line. A large value of `C` basically tells
our model that w... | gpl-3.0 |
Junji110/elephant | elephant/spike_train_correlation.py | 3 | 25850 | # -*- coding: utf-8 -*-
"""
This modules provides functions to calculate correlations between spike trains.
:copyright: Copyright 2015-2016 by the Elephant team, see AUTHORS.txt.
:license: Modified BSD, see LICENSE.txt for details.
"""
from __future__ import division
import numpy as np
import neo
import quantities as ... | bsd-3-clause |
mcgratta/macfp-db | Liquid_Pool_Fires/NIST_Pool_Fires/Computational_Results/2021/NIST/NIST_NIST_Pool_Fires_plot_results.py | 3 | 1227 | #!/usr/bin/env python3
# McDermott
# Feb 2021
# first, make sure the macfp module directory is in your path
# if not, uncomment the lines below and replace <path to macfp-db>
# with the path (absolute or relative) to your macfp-db repository
import sys
# sys.path.append('<path to macfp-db>/macfp-db/Utilities/')
sys.p... | mit |
mirestrepo/voxels-at-lems | super3d/compute_mean_var.py | 1 | 1331 | import boxm_batch;
import sys;
import optparse;
import os;
import glob;
#import matplotlib.pyplot as plt;
boxm_batch.register_processes();
boxm_batch.register_datatypes();
class dbvalue:
def __init__(self, index, type):
self.id = index # unsigned integer
self.type = type # string
#dir = "/Users/is... | bsd-2-clause |
google/eclipse2017 | src/solar_eclipse_analysis/choose_movie_frames.py | 1 | 5996 | #
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | apache-2.0 |
michaelhuang/QuantSoftwareToolkit | Legacy/quicksim/strategies/MonthlyRebalancing.py | 4 | 2190 | '''
(c) 2011, 2012 Georgia Tech Research Corporation
This source code is released under the New BSD license. Please see
http://wiki.quantsoftware.org/index.php?title=QSTK_License
for license details.
Created on Jan 1, 2011
@author:Drew Bratcher
@contact: dbratcher@gatech.edu
@summary: Contains tutorial for... | bsd-3-clause |
hrjn/scikit-learn | sklearn/utils/tests/test_testing.py | 29 | 7316 | import warnings
import unittest
import sys
from sklearn.utils.testing import (
assert_raises,
assert_less,
assert_greater,
assert_less_equal,
assert_greater_equal,
assert_warns,
assert_no_warnings,
assert_equal,
set_random_state,
assert_raise_message,
ignore_warnings)
from ... | bsd-3-clause |
idbedead/RNA-sequence-tools | RNA_Seq_analysis/make_monocle_data_pdgfra.py | 2 | 6290 | import os
import cPickle as pickle
import pandas as pd
import matplotlib
matplotlib.use('QT4Agg')
import matplotlib.pyplot as plt
import matplotlib.pylab as pl
from matplotlib.ticker import LinearLocator
import seaborn as sns
import numpy as np
from operator import itemgetter
#the file path where gene list will be and... | mit |
ejhumphrey/harmonic-cnn | tests/test_evaluate_predict.py | 1 | 4247 | """
Tests for evalute.predict.predict_one, and evalute.predict.predict_many.
Also serves to make sure all the theano-complied functions for training
and evaluating work when passed some real data.
"""
import logging
import os
import pandas
import pytest
import sys
import hcnn.common.config as C
import hcnn.evaluate.... | isc |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.