repo_name stringlengths 7 65 | path stringlengths 5 185 | copies stringlengths 1 4 | size stringlengths 4 6 | content stringlengths 977 990k | license stringclasses 14
values | hash stringlengths 32 32 | line_mean float64 7.18 99.4 | line_max int64 31 999 | alpha_frac float64 0.25 0.95 | ratio float64 1.5 7.84 | autogenerated bool 1
class | config_or_test bool 2
classes | has_no_keywords bool 2
classes | has_few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
yarikoptic/pystatsmodels | statsmodels/sandbox/distributions/try_pot.py | 5 | 2283 | # -*- coding: utf-8 -*-
"""
Created on Wed May 04 06:09:18 2011
@author: josef
"""
import numpy as np
def mean_residual_life(x, frac=None, alpha=0.05):
'''emprirical mean residual life or expected shortfall
Parameters
----------
todo: check formula for std of mean
doesn't include case for all ... | bsd-3-clause | 7131197cd7ebe67e4dc1a93738974f68 | 30.273973 | 155 | 0.619799 | 3.023841 | false | false | false | false |
yarikoptic/pystatsmodels | statsmodels/examples/l1_demo/demo.py | 3 | 13517 | from optparse import OptionParser
import statsmodels.api as sm
import scipy as sp
from scipy import linalg
from scipy import stats
import pdb
# pdb.set_trace()
docstr = """
Demonstrates l1 regularization for likelihood models.
Use different models by setting mode = mnlogit, logit, or probit.
Examples
-------
$ pytho... | bsd-3-clause | 6ca53a0bae4d22236bd45be554894b30 | 37.076056 | 83 | 0.620256 | 3.466786 | false | false | false | false |
yarikoptic/pystatsmodels | statsmodels/datasets/grunfeld/data.py | 3 | 2696 | """Grunfeld (1950) Investment Data"""
__docformat__ = 'restructuredtext'
COPYRIGHT = """This is public domain."""
TITLE = __doc__
SOURCE = """This is the Grunfeld (1950) Investment Data.
The source for the data was the original 11-firm data set from Grunfeld's Ph.D.
thesis recreated by Kleiber and Zeile... | bsd-3-clause | 009ff21023652e3644e1d80681cc34e4 | 28.955556 | 79 | 0.671736 | 3.378446 | false | false | false | false |
yarikoptic/pystatsmodels | examples/example_rlm.py | 2 | 3080 | """
Robust Linear Models
Notes
-----
The syntax for the arguments will be shortened to accept string arguments
in the future.
"""
import numpy as np
import statsmodels.api as sm
import matplotlib.pyplot as plt
from statsmodels.sandbox.regression.predstd import wls_prediction_std
#Estimating RLM
#--------------
# Lo... | bsd-3-clause | 7bc1c78c2ed8830be8b1ccc8aca647db | 28.615385 | 79 | 0.661688 | 2.652885 | false | false | false | false |
yarikoptic/pystatsmodels | statsmodels/sandbox/survival2.py | 35 | 17924 | #Kaplan-Meier Estimator
import numpy as np
import numpy.linalg as la
import matplotlib.pyplot as plt
from scipy import stats
from statsmodels.iolib.table import SimpleTable
class KaplanMeier(object):
"""
KaplanMeier(...)
KaplanMeier(data, endog, exog=None, censoring=None)
Create an object of... | bsd-3-clause | 52ec49ecb1078ededdcf77e362f01971 | 34.91984 | 84 | 0.483765 | 3.637175 | false | true | false | false |
yarikoptic/pystatsmodels | statsmodels/sandbox/regression/penalized.py | 4 | 12034 | # -*- coding: utf-8 -*-
"""linear model with Theil prior probabilistic restrictions, generalized Ridge
Created on Tue Dec 20 00:10:10 2011
Author: Josef Perktold
License: BSD-3
open issues
* selection of smoothing factor, strength of prior, cross validation
* GLS, does this really work this way
* None of inherited r... | bsd-3-clause | b8ccc613ab41c7ed13b0aa17e0ac537b | 32.151515 | 110 | 0.609855 | 3.077749 | false | false | false | false |
yarikoptic/pystatsmodels | statsmodels/miscmodels/nonlinls.py | 3 | 9316 | '''Non-linear least squares
Author: Josef Perktold based on scipy.optimize.curve_fit
'''
import numpy as np
from scipy import optimize
from statsmodels.base.model import Model
class Results(object):
'''just a dummy placeholder for now
most results from RegressionResults can be used here
'''
pass
... | bsd-3-clause | 807804cbc44729be414a4b9a4d4f1a5c | 29.148867 | 96 | 0.598755 | 3.686585 | false | false | false | false |
yarikoptic/pystatsmodels | statsmodels/robust/norms.py | 3 | 19696 | import numpy as np
#TODO: add plots to weighting functions for online docs.
class RobustNorm(object):
"""
The parent class for the norms used for robust regression.
Lays out the methods expected of the robust norms to be used
by statsmodels.RLM.
Parameters
----------
None :
Some ... | bsd-3-clause | 8128919ac92397db89b56018b27892e0 | 22.09027 | 79 | 0.457098 | 3.745911 | false | false | false | false |
yarikoptic/pystatsmodels | statsmodels/sandbox/examples/example_maxent.py | 6 | 1273 | """
This is an example of using scipy.maxentropy to solve Jaynes' dice problem
See Golan, Judge, and Miller Section 2.3
"""
from scipy import maxentropy
import numpy as np
samplespace = [1., 2., 3., 4., 5., 6.]
def sump(x):
return x in samplespace
def meanp(x):
return np.mean(x)
# Set the constraints
# 1) W... | bsd-3-clause | eabe52655ab86ccb21019cfbd9d671e5 | 24.46 | 74 | 0.604085 | 2.873589 | false | false | false | false |
yarikoptic/pystatsmodels | statsmodels/tsa/tests/results/arima111_results.py | 35 | 44167 | import numpy as np
llf = np.array([-241.75576160303])
nobs = np.array([ 202])
k = np.array([ 4])
k_exog = np.array([ 1])
sigma = np.array([ .79987660416529])
chi2 = np.array([ 342.91413339514])
df_model = np.array([ 2])
k_ar = np.array([ 1])
k... | bsd-3-clause | fbfd2756a96ed98fa7a522a30805cbe2 | 33.478532 | 229 | 0.400978 | 3.831945 | false | false | false | false |
yarikoptic/pystatsmodels | examples/example_wls.py | 2 | 2809 | """Weighted Least Squares
"""
import numpy as np
from scipy import stats
import statsmodels.api as sm
import matplotlib.pyplot as plt
from statsmodels.sandbox.regression.predstd import wls_prediction_std
from statsmodels.iolib.table import (SimpleTable, default_txt_fmt)
np.random.seed(1024)
# WLS Estimation
# -------... | bsd-3-clause | a6a01de18b895ef01fcb1ec34d62ef74 | 30.211111 | 79 | 0.632609 | 2.519283 | false | false | false | false |
yarikoptic/pystatsmodels | statsmodels/examples/ex_generic_mle_tdist.py | 3 | 39633 | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 28 08:28:04 2010
Author: josef-pktd
"""
import numpy as np
from scipy import stats, special, optimize
import statsmodels.api as sm
from statsmodels.base.model import GenericLikelihoodModel
#redefine some shortcuts
np_log = np.log
np_pi = np.pi
sps_gamln = special.gamm... | bsd-3-clause | d38cb1c1bbfa390d53cd5e06b9508159 | 35.26075 | 167 | 0.658542 | 2.877169 | false | false | false | false |
yarikoptic/pystatsmodels | statsmodels/tools/parallel.py | 3 | 1838 | '''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)
'''
def parallel_func(func, n_... | bsd-3-clause | e242c7789a3a528df7103b06f08c2f5f | 26.432836 | 78 | 0.615343 | 4.284382 | false | false | false | false |
yarikoptic/pystatsmodels | statsmodels/sandbox/regression/tools.py | 6 | 13069 | '''gradient/Jacobian of normal and t loglikelihood
use chain rule
normal derivative wrt mu, sigma and beta
new version: loc-scale distributions, derivative wrt loc, scale
also includes "standardized" t distribution (for use in GARCH)
TODO:
* use sympy for derivative of loglike wrt shape parameters
it works for d... | bsd-3-clause | ea65577f9c78d9838e6f180f097c2456 | 31.591022 | 95 | 0.587038 | 3.061373 | false | false | false | false |
yarikoptic/pystatsmodels | statsmodels/sandbox/tsa/examples/example_var.py | 36 | 1218 | """
Look at some macro plots, then do some VARs and IRFs.
"""
import numpy as np
import statsmodels.api as sm
import scikits.timeseries as ts
import scikits.timeseries.lib.plotlib as tplt
from matplotlib import pyplot as plt
data = sm.datasets.macrodata.load()
data = data.data
### Create Timeseries Representations ... | bsd-3-clause | f25410803ba2cdbd647124a012046f54 | 21.145455 | 75 | 0.690476 | 2.490798 | false | false | true | false |
yarikoptic/pystatsmodels | statsmodels/tsa/tests/results/arima111_css_results.py | 35 | 44167 | import numpy as np
llf = np.array([-242.06033399744])
nobs = np.array([ 202])
k = np.array([ 4])
k_exog = np.array([ 1])
sigma = np.array([ .80201496146073])
chi2 = np.array([ 348.43324197088])
df_model = np.array([ 2])
k_ar = np.array([ 1])
k... | bsd-3-clause | acee6294eb035e11edce5cac636ecd48 | 33.478532 | 229 | 0.401431 | 3.829287 | false | false | false | false |
yarikoptic/pystatsmodels | statsmodels/tsa/tests/results/arima211nc_results.py | 35 | 36847 | import numpy as np
llf = np.array([-241.25977940638])
nobs = np.array([ 202])
k = np.array([ 4])
k_exog = np.array([ 1])
sigma = np.array([ .79533686587485])
chi2 = np.array([ 48655.961417345])
df_model = np.array([ 3])
k_ar = np.array([ 2])
k... | bsd-3-clause | dd5fda91562c6151b5a22216ec0c8f9e | 33.212628 | 218 | 0.403126 | 3.808869 | false | false | false | false |
yarikoptic/pystatsmodels | statsmodels/datasets/cpunish/data.py | 3 | 2548 | """US Capital Punishment dataset."""
__docformat__ = 'restructuredtext'
COPYRIGHT = """Used with express permission from the original author,
who retains all rights."""
TITLE = __doc__
SOURCE = """
Jeff Gill's `Generalized Linear Models: A Unified Approach`
http://jgill.wustl.edu/research/books.html
"""... | bsd-3-clause | d5f92df7b4e92ce0abdff6f9720424f0 | 31.666667 | 90 | 0.706829 | 3.65043 | false | false | false | false |
yarikoptic/pystatsmodels | statsmodels/sandbox/stats/tests/__init__.py | 218 | 6354 | '''
Econometrics for a Datarich Environment
=======================================
Introduction
------------
In many cases we are performing statistical analysis when many observed variables are
available, when we are in a data rich environment. Machine learning has a wide variety
of tools for dimension reduction an... | bsd-3-clause | a9e0fe95e0e7e82118585fa9e0049469 | 37.509091 | 99 | 0.748033 | 3.766449 | false | false | false | false |
yarikoptic/pystatsmodels | statsmodels/sandbox/distributions/tests/_est_fit.py | 5 | 2608 | # NOTE: contains only one test, _est_cont_fit, that is renamed so that
# nose doesn't run it
# I put this here for the record and for the case when someone wants to
# verify the quality of fit
# with current parameters: relatively small sample size, default starting values
# Ran 84 tests in 401.797s
# ... | bsd-3-clause | 87d733bfb0e8ae73b9a1300acfe29427 | 36.257143 | 85 | 0.634202 | 3.445178 | false | true | false | false |
yarikoptic/pystatsmodels | statsmodels/sandbox/tests/maketests_mlabwrap.py | 36 | 9022 | '''generate py modules with test cases and results from mlabwrap
currently matlab: princomp, garchar, garchma
'''
import numpy as np
from numpy.testing import assert_array_almost_equal
from numpy import array
xo = array([[ -419, -731, -1306, -1294],
[ 6, 529, -200, -437],
[ -27, -833, -6... | bsd-3-clause | 0376429c335875feee6649ab1b5b10a6 | 35.674797 | 86 | 0.495345 | 2.551471 | false | false | false | false |
yarikoptic/pystatsmodels | statsmodels/examples/ex_feasible_gls_het_0.py | 3 | 6390 | # -*- coding: utf-8 -*-
"""Examples for linear model with heteroscedasticity estimated by feasible GLS
These are examples to check the results during developement.
The assumptions:
We have a linear model y = X*beta where the variance of an observation depends
on some explanatory variable Z (`exog_var`).
linear_model... | bsd-3-clause | d64a9fcc5f4274e674cf489e4e53d9cb | 35.936416 | 94 | 0.641158 | 2.966574 | false | false | false | false |
yarikoptic/pystatsmodels | statsmodels/tsa/tests/results/results_ar.py | 35 | 9626 | import numpy as np
import os
class ARLagResults(object):
"""
Results are from R vars::VARselect for sunspot data.
Comands run were
var_select <- VARselect(SUNACTIVITY, lag.max=16, type=c("const"))
"""
def __init__(self, type="const"):
# order of results is AIC, HQ, SC, FPE
if ... | bsd-3-clause | 08fae5bdf524f435559e28955c2a0122 | 43.155963 | 80 | 0.554436 | 3.159173 | false | false | false | false |
yarikoptic/pystatsmodels | statsmodels/regression/tests/results/results_regression.py | 3 | 8038 | """
Hard-coded results for test_regression
"""
### REGRESSION MODEL RESULTS : OLS, GLS, WLS, AR###
import numpy as np
class Longley(object):
'''
The results for the Longley dataset were obtained from NIST
http://www.itl.nist.gov/div898/strd/general/dataarchive.html
Other results were obtained from ... | bsd-3-clause | 7148b2425383849980cc9356a254c87b | 45.732558 | 80 | 0.573277 | 2.711876 | false | false | false | false |
yarikoptic/pystatsmodels | statsmodels/sandbox/examples/thirdparty/ex_ratereturn.py | 4 | 4353 | # -*- coding: utf-8 -*-
"""Playing with correlation of DJ-30 stock returns
this uses pickled data that needs to be created with findow.py
to see graphs, uncomment plt.show()
Created on Sat Jan 30 16:30:18 2010
Author: josef-pktd
"""
import numpy as np
import matplotlib.finance as fin
import matplotlib.pyplot as plt... | bsd-3-clause | 8d6faab6e3e932b3c98ed65d86eed32a | 28.815068 | 100 | 0.668504 | 2.769084 | false | false | false | false |
yarikoptic/pystatsmodels | statsmodels/stats/power.py | 3 | 47401 | # -*- coding: utf-8 -*-
#pylint: disable-msg=W0142
"""Statistical power, solving for nobs, ... - trial version
Created on Sat Jan 12 21:48:06 2013
Author: Josef Perktold
Example
roundtrip - root with respect to all variables
calculated, desired
nobs 33.367204205 33.367204205
effect 0.5 0.5
alpha 0.05 0.05... | bsd-3-clause | ba0eb96387632c056cf7ceb9440d1fb3 | 40.799824 | 89 | 0.577203 | 4.337573 | false | true | false | false |
yarikoptic/pystatsmodels | statsmodels/stats/tests/test_corrpsd.py | 3 | 7727 | # -*- coding: utf-8 -*-
"""Tests for findind a positive semi-definite correlation of covariance matrix
Created on Mon May 27 12:07:02 2013
Author: Josef Perktold
"""
import numpy as np
from numpy.testing import assert_almost_equal, assert_allclose
from statsmodels.stats.correlation_tools import (
co... | bsd-3-clause | fe218c4077d81fc429eaa7c246a8d0c8 | 36.328502 | 95 | 0.603598 | 2.518579 | false | true | false | false |
yarikoptic/pystatsmodels | statsmodels/graphics/tests/test_boxplots.py | 4 | 1261 | import numpy as np
from numpy.testing import dec
from statsmodels.graphics.boxplots import violinplot, beanplot
from statsmodels.datasets import anes96
try:
import matplotlib.pyplot as plt
have_matplotlib = True
except:
have_matplotlib = False
@dec.skipif(not have_matplotlib)
def test_violinplot_beanpl... | bsd-3-clause | 4cfae03f27be64d658afb8cb8d8382eb | 28.325581 | 73 | 0.604282 | 3.552113 | false | true | false | false |
yarikoptic/pystatsmodels | statsmodels/tsa/tests/results/arima112nc_css_results.py | 35 | 44167 | import numpy as np
llf = np.array([-239.75290561974])
nobs = np.array([ 202])
k = np.array([ 4])
k_exog = np.array([ 1])
sigma = np.array([ .79291203639424])
chi2 = np.array([ 35036.682546665])
df_model = np.array([ 3])
k_ar = np.array([ 1])
k... | bsd-3-clause | 38e1b631a2ad894d093af386f39961a5 | 33.478532 | 229 | 0.396767 | 3.829287 | false | false | false | false |
rootpy/rootpy | rootpy/plotting/contrib/quantiles.py | 3 | 3602 | """
Taken from example by Zhiyi Liu, zhiyil@fnal.gov
here: http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=6865
and converted into Python
"""
from __future__ import absolute_import
import ROOT
from math import sqrt
from array import array
from .. import Graph
from ...extern.six.moves import range
__all__ = [
'qq... | bsd-3-clause | 18d1f25931dd5e300dbc305b432cf04b | 25.101449 | 78 | 0.564409 | 2.8542 | false | false | false | false |
rootpy/rootpy | examples/tree/chain_overwrite.py | 7 | 2603 | #!/usr/bin/env python
"""
============================================
Copy a tree chain while overwriting branches
============================================
This is an example showing how to copy a tree chain while overwriting one or
more of its branches with new values.
"""
print(__doc__)
from rootpy.tree import ... | bsd-3-clause | 2a26b1156f389b01d1bf097fe6f96344 | 30.743902 | 79 | 0.663081 | 3.788937 | false | true | false | false |
rootpy/rootpy | examples/plotting/plot_matplotlib_graph.py | 7 | 2423 | #!/usr/bin/env python
"""
=====================================
Plot a ROOT graph with matplotlib
=====================================
This example demonstrates how a ROOT graph can be styled with simple
attributes and displayed via ROOT or matplotlib.
"""
print(__doc__)
import ROOT
import numpy as np
from rootpy.plo... | bsd-3-clause | 435357524153c214c2bf7a3f179d56b8 | 25.922222 | 68 | 0.680149 | 3.082697 | false | false | false | false |
rootpy/rootpy | rootpy/utils/tests/test_cpp.py | 3 | 1191 | from __future__ import print_function
import sys
from ROOT import MethodProxy
import inspect
from rootpy.utils.cpp import CPPGrammar
from rootpy.utils.extras import iter_ROOT_classes
from nose.plugins.attrib import attr
@attr('slow')
def test_cpp():
i = 0
num_methods = 0
for cls in iter_ROOT_classes():
... | bsd-3-clause | 0097066d9aba4a3a9e15c39579844e63 | 28.775 | 67 | 0.570949 | 4.078767 | false | false | false | false |
rootpy/rootpy | rootpy/tree/chain.py | 3 | 10692 | from __future__ import absolute_import
import multiprocessing
import time
from .. import log; log = log[__name__]
from .. import QROOT
from ..io import root_open, DoesNotExist
from ..utils.extras import humanize_bytes
from ..context import preserve_current_directory
from ..plotting.graph import _GraphBase
from ..exte... | bsd-3-clause | 24da8dd1b849509f3d9ffedd9fe9a6c8 | 32.517241 | 79 | 0.528713 | 4.421836 | false | false | false | false |
rootpy/rootpy | rootpy/stats/pdf.py | 3 | 1145 | from __future__ import absolute_import
import ROOT
from . import log; log = log[__name__]
from .. import QROOT, asrootpy
from ..base import NamedObject
from .value import AbsArg
__all__ = [
'Simultaneous',
'AddPdf',
'ProdPdf',
]
class Simultaneous(NamedObject, AbsArg, QROOT.RooSimultaneous):
_ROOT... | bsd-3-clause | 0214bee32504f13e7685316718940531 | 22.367347 | 67 | 0.655895 | 3.480243 | false | false | false | false |
rootpy/rootpy | rootpy/io/tests/test_pickler.py | 3 | 1942 | """
Tests for the file module.
"""
from rootpy.io import root_open, TemporaryFile
from rootpy.io.pickler import load, dump
from rootpy.plotting import Hist
import random
import tempfile
from nose.tools import assert_equal, assert_true, assert_false
def test_pickler():
hlist = list()
for i in range(10):
... | bsd-3-clause | 3b1711f7bc8506bdbc7cd18940b2c10b | 25.972222 | 74 | 0.595778 | 3.425044 | false | false | false | false |
rootpy/rootpy | rootpy/plotting/base.py | 3 | 37647 | """
This module contains base classes defining core funcionality
"""
from __future__ import absolute_import
from functools import wraps
import warnings
import sys
from .. import asrootpy, ROOT
from ..decorators import chainable
from ..memory.keepalive import keepalive
from ..extern.six import string_types
__all__ = ... | bsd-3-clause | f1a2eee04b07016a556fcb350ea80b9c | 30.3725 | 87 | 0.51789 | 3.812354 | false | false | false | false |
rootpy/rootpy | rootpy/extern/byteplay3/wbyteplay.py | 5 | 31871 | # byteplay: CPython assembler/disassembler
# Copyright (C) 2006 Noam Raphael | Version: http://code.google.com/p/byteplay
# Rewritten 2009 Demur Rumed | Version: http://github.com/serprex/byteplay
# Screwed the style over, modified stack logic to be more flexible, updated to Python 3
#
# This... | bsd-3-clause | 7be44803d9895f01d70fd61d897f530a | 43.637255 | 159 | 0.540303 | 3.980889 | false | false | false | false |
rootpy/rootpy | rootpy/logger/formatter.py | 3 | 1941 | """
Provides a ``CustomFormatter`` and ``CustomColoredFormatter`` which are enable
to insert ANSI color codes.
"""
from __future__ import absolute_import
import logging
__all__ = [
'CustomFormatter',
'CustomColoredFormatter',
]
# The background is set with 40 plus the number of the color, and the foreground ... | bsd-3-clause | 9915ed5d2732bba751a6b995e97e4190 | 29.809524 | 88 | 0.634724 | 3.581181 | false | false | false | false |
rootpy/rootpy | examples/plotting/plot_matplotlib_hist.py | 7 | 2749 | #!/usr/bin/env python
"""
=====================================
Plot a ROOT histogram with matplotlib
=====================================
This example demonstrates how a ROOT histogram can be styled with simple
attributes and displayed via ROOT or matplotlib.
"""
print(__doc__)
import ROOT
import numpy as np
from ro... | bsd-3-clause | d67ea756524d27d42e049db00decedb6 | 28.244681 | 73 | 0.708985 | 2.994553 | false | false | false | false |
rootpy/rootpy | rootpy/plotting/utils.py | 3 | 14154 | from __future__ import absolute_import
from math import log
import operator
from .. import ROOT
from .canvas import _PadBase
from .hist import _Hist, Hist, HistStack
from .graph import _Graph1DBase, Graph
from ..context import preserve_current_canvas, do_nothing
from ..extern.six.moves import range
__all__ = [
'... | bsd-3-clause | a7db7f629c313c8fd999fb1b8ed53821 | 30.950339 | 79 | 0.554896 | 3.646059 | false | false | false | false |
pybrain2/pybrain2 | pybrain/structure/modules/gaussianlayer.py | 26 | 1579 | __author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from scipy import random
from pybrain.structure.modules.neuronlayer import NeuronLayer
from pybrain.tools.functions import expln, explnPrime
from pybrain.structure.parametercontainer import ParameterContainer
class GaussianLayer(NeuronLayer, ParameterContainer):
... | bsd-3-clause | 4db5f901acdb186b4c4a909dff056452 | 37.512195 | 104 | 0.647878 | 3.750594 | false | false | false | false |
pybrain2/pybrain2 | pybrain/rl/environments/ode/tasks/acrobot.py | 31 | 1235 | __author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.rl.environments import EpisodicTask
from scipy import pi
class GradualRewardTask(EpisodicTask):
''' task gives more reward, the higher the bar is.'''
def __init__(self, environment):
EpisodicTask.__init__(self, environment)
sel... | bsd-3-clause | 76edc76322217c90919d92729803e27e | 29.875 | 67 | 0.591093 | 3.548851 | false | false | false | false |
pybrain2/pybrain2 | examples/supervised/backprop/parityrnn.py | 26 | 2046 | from __future__ import print_function
#!/usr/bin/env python
""" A simple recurrent neural network that detects parity for arbitrary sequences. """
__author__ = 'Tom Schaul (tom@idsia.ch)'
from datasets import ParityDataSet #@UnresolvedImport
from pybrain.supervised.trainers.backprop import BackpropTrainer
from pybra... | bsd-3-clause | 9bdaa7f3ee8ab20ea71827163ae785a1 | 30 | 96 | 0.627566 | 3.376238 | false | false | false | false |
pybrain2/pybrain2 | pybrain/structure/modules/lstm.py | 26 | 5992 | __author__ = 'Daan Wierstra and Tom Schaul'
from scipy import tanh
from pybrain.structure.modules.neuronlayer import NeuronLayer
from pybrain.structure.modules.module import Module
from pybrain.structure.parametercontainer import ParameterContainer
from pybrain.tools.functions import sigmoid, sigmoidPrime, tanhPrime
... | bsd-3-clause | 0c475615b54b4946f96111227ba02541 | 39.214765 | 149 | 0.633845 | 3.4417 | false | false | false | false |
pybrain2/pybrain2 | pybrain/rl/environments/functions/transformations.py | 26 | 9364 | __author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import rand, dot, power, diag, eye, sqrt, sin, log, exp, ravel, clip, arange
from scipy.linalg import orth, norm, inv
from random import shuffle, random, gauss
from pybrain.rl.environments.functions.function import FunctionEnvironment
from pybrain.structure.paramete... | bsd-3-clause | 9341b8f303e3b07d2c5705c60e104644 | 33.557196 | 117 | 0.504485 | 3.90818 | false | false | false | false |
pybrain2/pybrain2 | pybrain/rl/environments/mazes/polarmaze.py | 25 | 1644 | __author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import zeros
from random import choice, random
from .maze import Maze
class PolarMaze(Maze):
""" Mazes with the emphasis on Perseus: allow him to turn, go forward or backward.
Thus there are 4 states per position.
"""
actions = 5
Stay = 0
... | bsd-3-clause | f99abf1168db084ed16d4ed9465c3ba0 | 28.890909 | 86 | 0.579684 | 3.307847 | false | false | false | false |
pybrain2/pybrain2 | pybrain/rl/environments/shipsteer/northwardtask.py | 25 | 1592 | __author__ = 'Martin Felder, felder@in.tum.de'
from pybrain.rl.environments import EpisodicTask
from .shipsteer import ShipSteeringEnvironment
class GoNorthwardTask(EpisodicTask):
""" The task of balancing some pole(s) on a cart """
def __init__(self, env=None, maxsteps=1000):
"""
:key env: ... | bsd-3-clause | 0453edd4d6296140cb3df1f36f268efd | 29.615385 | 93 | 0.552764 | 3.537778 | false | false | false | false |
pybrain2/pybrain2 | pybrain/structure/modules/gate.py | 25 | 3451 | # -*- coding: utf-8 -*-
__author__ = 'Justin S Bayer, bayer.justin@googlemail.com'
__version__ = '$Id$'
from pybrain.structure.modules.module import Module
from pybrain.structure.modules.neuronlayer import NeuronLayer
from pybrain.tools.functions import sigmoid, sigmoidPrime
class MultiplicationLayer(NeuronLayer)... | bsd-3-clause | 726faa132a61b1336806793bd8b44744 | 34.57732 | 80 | 0.616053 | 3.363548 | false | false | false | false |
pybrain2/pybrain2 | examples/rl/valuebased/td.py | 30 | 1972 | #!/usr/bin/env python
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
""" This example demonstrates how to use the discrete Temporal Difference
Reinforcement Learning algorithms (SARSA, Q, Q(lambda)) in a classical
fully observable MDP maze task. The goal point is the top right free
field. """
from scipy import... | bsd-3-clause | 8da42ab641707cc98db511c9f46127b5 | 29.338462 | 79 | 0.636917 | 3.029186 | false | false | false | false |
pybrain2/pybrain2 | pybrain/rl/environments/ode/instances/johnnie.py | 31 | 1429 | __author__ = 'Frank Sehnke, sehnke@in.tum.de'
from pybrain.rl.environments.ode import ODEEnvironment, sensors, actuators
import imp
from scipy import array
class JohnnieEnvironment(ODEEnvironment):
def __init__(self, renderer=True, realtime=False, ip="127.0.0.1", port="21590", buf='16384'):
ODEEnvironment... | bsd-3-clause | 3445d223dbcfc69191fd7802e18d95a5 | 42.30303 | 119 | 0.627712 | 2.764023 | false | false | false | false |
pybrain2/pybrain2 | pybrain/optimization/distributionbased/snes.py | 25 | 4415 | from __future__ import print_function
__author__ = 'Tom Schaul, tom@idsia.ch'
from pybrain.optimization.distributionbased.distributionbased import DistributionBasedOptimizer
from scipy import dot, exp, log, sqrt, floor, ones, randn
from pybrain.tools.rankingfunctions import HansenRanking
class SNES(DistributionBase... | bsd-3-clause | c9fb8bab04dc4c8a15e77477a08978da | 36.423729 | 123 | 0.579841 | 4.253372 | false | false | false | false |
pybrain2/pybrain2 | examples/rl/environments/ode/johnnie_reinforce.py | 30 | 2899 | #!/usr/bin/env python
#########################################################################
# Reinforcement Learning with PGPE on the Johnnie Environment
#
# The Johnnie robot is a body structure with 11 DoF .
# Complex balancing tasks can be learned with this environment.
#
# Control/Actions:
# The agent can cont... | bsd-3-clause | 7353ec26fb0ef560292f62974573c075 | 41.632353 | 169 | 0.714384 | 3.769831 | false | false | false | false |
pybrain2/pybrain2 | pybrain/rl/environments/flexcube/environment.py | 25 | 5905 | __author__ = 'Frank Sehnke, sehnke@in.tum.de'
from . import sensors
import threading
from pybrain.utilities import threaded
from pybrain.tools.networking.udpconnection import UDPServer
from pybrain.rl.environments.environment import Environment
from scipy import ones, zeros, array, clip, arange, sqrt
from time import ... | bsd-3-clause | 043ce0edd103fb05fef300a679180d85 | 34.359281 | 191 | 0.52989 | 3.387837 | false | false | false | false |
pybrain2/pybrain2 | pybrain/optimization/populationbased/coevolution/coevolution.py | 25 | 10998 | from __future__ import print_function
__author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import argmax, array
from random import sample, choice, shuffle
from pybrain.utilities import fListToString, Named
class Coevolution(Named):
""" Population-based generational evolutionary algorithm
with fitness being b... | bsd-3-clause | e85a1b314884a30b5be883b80f46c875 | 36.535836 | 118 | 0.574104 | 3.670895 | false | false | false | false |
pybrain2/pybrain2 | pybrain/rl/explorers/discrete/boltzmann.py | 31 | 1506 | __author__ = "Thomas Rueckstiess, ruecksti@in.tum.de"
from scipy import array
from pybrain.rl.explorers.discrete.discrete import DiscreteExplorer
from pybrain.utilities import drawGibbs
class BoltzmannExplorer(DiscreteExplorer):
""" A discrete explorer, that executes the actions with probability
that dep... | bsd-3-clause | a2ecfce27672db2d22e2d3a682816f38 | 34.023256 | 73 | 0.652722 | 4.126027 | false | false | false | false |
pybrain2/pybrain2 | pybrain/rl/environments/mazes/tasks/shuttle.py | 25 | 2692 | __author__ = 'Tom Schaul, tom@idsia.ch'
from scipy import array, zeros
from random import random
from .maze import MazeTask
from pybrain.rl.environments.mazes import PolarMaze
class ShuttleDocking(MazeTask):
"""
#######
#. *#
#######
The spaceship needs to dock backwards into the goal station... | bsd-3-clause | 0befd08d824a682b4082ac983ba332cc | 26.752577 | 88 | 0.497771 | 3.464607 | false | false | false | false |
pybrain2/pybrain2 | pybrain/rl/experiments/tournament.py | 25 | 4173 | __author__ = 'Tom Schaul, tom@idsia.ch'
from pybrain.rl.environments.twoplayergames.twoplayergame import TwoPlayerGame
from pybrain.utilities import Named
class Tournament(Named):
""" the tournament class is a specific kind of experiment, that takes a pool of agents
and has them compete against each other in... | bsd-3-clause | a46177cef8fa428e1e238d3eee1e32c0 | 34.666667 | 128 | 0.507788 | 3.790191 | false | false | false | false |
pybrain2/pybrain2 | pybrain/tests/unittests/supervised/trainers/test_backprop.py | 28 | 2025 | """
>>> from pybrain.datasets.supervised import SupervisedDataSet
>>> from pybrain.supervised.trainers import BackpropTrainer
>>> from pybrain import FeedForwardNetwork
>>> from pybrain.structure import LinearLayer, SigmoidLayer, FullConnection
>>> from random import randrange
>>> dataset = Supe... | bsd-3-clause | f098086e1f8b2903964ea7dadb4b70b0 | 37.207547 | 79 | 0.521975 | 3.939689 | false | true | false | false |
pybrain2/pybrain2 | examples/rl/environments/linear_fa/bicycle.py | 26 | 14462 | from __future__ import print_function
"""An attempt to implement Randlov and Alstrom (1998). They successfully
use reinforcement learning to balance a bicycle, and to control it to drive
to a specified goal location. Their work has been used since then by a few
researchers as a benchmark problem.
We only implement th... | bsd-3-clause | 576e50a290f8002c8a6f4c25357ec50d | 32.554524 | 115 | 0.572673 | 3.325362 | false | false | false | false |
pybrain2/pybrain2 | pybrain/tools/rankingfunctions.py | 25 | 4779 | """ Ranking functions that are used in Black-box optimization, or for selection. """
__author__ = 'Daan Wierstra and Tom Schaul'
from pybrain.utilities import Named
from random import randint
from scipy import zeros, argmax, array, power, exp, sqrt, var, zeros_like, arange, mean, log
def rankedFitness(R):
""" p... | bsd-3-clause | 7d60969e0fbdb90aee4feb62bc60abb6 | 28.319018 | 122 | 0.56267 | 3.458032 | false | false | false | false |
pybrain2/pybrain2 | pybrain/auxiliary/pca.py | 31 | 2607 | # -*- coding: utf-8 -*-
"""Module that contains functionality for calculating the principal components
of a dataset."""
__author__ = 'Justin S Bayer, bayerj@in.tum.de'
from scipy import asmatrix, cov
from scipy.linalg import inv, eig
from numpy.random import standard_normal
def reduceDim(data, dim, func='pca'):... | bsd-3-clause | 9954e705f7318676c77a5c6d0c82a80f | 28.625 | 78 | 0.654776 | 3.729614 | false | false | false | false |
pybrain2/pybrain2 | pybrain/supervised/trainers/backprop.py | 2 | 11689 | from __future__ import print_function
from scipy import dot, argmax
from random import shuffle
from math import isnan
from pybrain.supervised.trainers.trainer import Trainer
from pybrain.utilities import fListToString
from pybrain.auxiliary import GradientDescent
from pybrain.tools.functions import abs_error
__author... | bsd-3-clause | bf82f5c85a687d8887518e79718cd24b | 40.746429 | 86 | 0.583882 | 4.544712 | false | false | false | false |
pybrain2/pybrain2 | pybrain/rl/environments/twoplayergames/tasks/capturetask.py | 31 | 3766 | __author__ = 'Tom Schaul, tom@idsia.ch'
from pybrain.rl.environments.episodic import EpisodicTask
from inspect import isclass
from pybrain.utilities import Named
from pybrain.rl.environments.twoplayergames import CaptureGame
from pybrain.rl.environments.twoplayergames.capturegameplayers import RandomCapturePlayer, Mo... | bsd-3-clause | 4d04451032ffdb586dff51afd9bee288 | 35.563107 | 111 | 0.641795 | 4.071351 | false | false | false | false |
cobrateam/splinter | splinter/driver/zopetestbrowser.py | 1 | 13544 | # -*- coding: utf-8 -*-
# Copyright 2012 splinter authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from __future__ import unicode_literals
import mimetypes
import re
import time
import warnings
import lxml.html
from lxml.cssselect im... | bsd-3-clause | bb54aa0fa4806c25d6923f5ebf2f999d | 29.367713 | 87 | 0.588231 | 4.106731 | false | false | false | false |
ahmia/ahmia-site | ahmia/ahmia/management/commands/cleanup_db.py | 1 | 1039 | from datetime import timedelta
from django.conf import settings
from django.core.management import BaseCommand
from django.utils import timezone
from ... import utils
from ...models import TorStats, I2PStats, SearchQuery, SearchResultsClick
class Command(BaseCommand):
def __init__(self):
super(Command, ... | bsd-3-clause | 7d226a562d0786c9ab39efa0be075728 | 36.107143 | 87 | 0.698749 | 3.632867 | false | false | false | false |
django-helpdesk/django-helpdesk | helpdesk/views/public.py | 1 | 9647 | """
django-helpdesk - A Django powered ticket tracker for small enterprise.
(c) Copyright 2008 Jutda. All Rights Reserved. See LICENSE for details.
views/public.py - All public facing views, eg non-staff (no authentication
required) views.
"""
from django.conf import settings
from django.core.exce... | bsd-3-clause | 849b25adf0750d28d1f976f435c4f1c6 | 37.899194 | 106 | 0.639577 | 4.058477 | false | false | false | false |
django-helpdesk/django-helpdesk | demo/demodesk/config/settings.py | 1 | 7279 | """
Django settings for django-helpdesk demodesk project.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
# Build paths inside the project like this... | bsd-3-clause | d65ee46c15fef37afe5e5f72cd924b16 | 28.831967 | 91 | 0.716994 | 3.441608 | false | false | false | false |
lepture/flask-oauthlib | example/douban.py | 16 | 1583 | from flask import Flask, redirect, url_for, session, request, jsonify
from flask_oauthlib.client import OAuth
app = Flask(__name__)
app.debug = True
app.secret_key = 'development'
oauth = OAuth(app)
douban = oauth.remote_app(
'douban',
consumer_key='0cfc3c5d9f873b1826f4b518de95b148',
consumer_secret='3e2... | bsd-3-clause | ee74c82d8c27bee1c6aae0b4cc3f74fc | 25.383333 | 75 | 0.660139 | 3.122288 | false | false | false | false |
lepture/flask-oauthlib | flask_oauthlib/contrib/apps.py | 6 | 7551 | """
flask_oauthlib.contrib.apps
~~~~~~~~~~~~~~~~~~~~~~~~~~~
The bundle of remote app factories for famous third platforms.
Usage::
from flask import Flask
from flask_oauthlib.client import OAuth
from flask_oauthlib.contrib.apps import github
app = Flask(__name__)
... | bsd-3-clause | 87efb75a528885aace6e72467a7008dc | 31.973799 | 76 | 0.639518 | 3.550071 | false | false | false | false |
lepture/flask-oauthlib | flask_oauthlib/client.py | 1 | 24833 | # coding: utf-8
"""
flask_oauthlib.client
~~~~~~~~~~~~~~~~~~~~~
Implemnts OAuth1 and OAuth2 support for Flask.
:copyright: (c) 2013 - 2014 by Hsiaoming Yang.
"""
import logging
import oauthlib.oauth1
import oauthlib.oauth2
from copy import copy
from functools import wraps
from oauthlib.common import ... | bsd-3-clause | 8de9cec9d8f243135c251d91208bd3b6 | 32.694708 | 81 | 0.571337 | 4.33537 | false | false | false | false |
lepture/flask-oauthlib | example/google.py | 5 | 1864 | """
google example
~~~~~~~~~~~~~~
This example is contributed by Bruno Rocha
GitHub: https://github.com/rochacbruno
"""
from flask import Flask, redirect, url_for, session, request, jsonify
from flask_oauthlib.client import OAuth
app = Flask(__name__)
app.config['GOOGLE_ID'] = "cloud.google.com/cons... | bsd-3-clause | b5578256bcf2c7ac691fe8be0bcdc127 | 24.534247 | 75 | 0.642167 | 3.445471 | false | true | false | false |
lepture/flask-oauthlib | example/linkedin.py | 16 | 2007 | from flask import Flask, redirect, url_for, session, request, jsonify
from flask_oauthlib.client import OAuth
app = Flask(__name__)
app.debug = True
app.secret_key = 'development'
oauth = OAuth(app)
linkedin = oauth.remote_app(
'linkedin',
consumer_key='k8fhkgkkqzub',
consumer_secret='ZZtLETQOQYNDjMrz',
... | bsd-3-clause | 440e9e905ecca293298c2ec0b747074e | 24.730769 | 77 | 0.63129 | 3.378788 | false | false | false | false |
ufal/neuralmonkey | neuralmonkey/runners/ctc_debug_runner.py | 1 | 1826 | from typing import Dict, List
import numpy as np
import tensorflow as tf
from typeguard import check_argument_types
from neuralmonkey.runners.base_runner import BaseRunner
from neuralmonkey.decoders.ctc_decoder import CTCDecoder
from neuralmonkey.decorators import tensor
class CTCDebugRunner(BaseRunner[CTCDecoder])... | bsd-3-clause | 2933ee68d837f15c4ee464ed58aee44b | 32.814815 | 79 | 0.608434 | 4.296471 | false | false | false | false |
ufal/neuralmonkey | neuralmonkey/processors/speech.py | 2 | 2025 | from typing import Callable
import numpy as np
from python_speech_features import mfcc, fbank, logfbank, ssc, delta
from neuralmonkey.readers.audio_reader import Audio
# pylint: disable=invalid-name
def SpeechFeaturesPreprocessor(feature_type: str = "mfcc",
delta_order: int = 0,
... | bsd-3-clause | 61a824d082b9fdd1586ed54073eb50f7 | 32.75 | 77 | 0.627654 | 4.05 | false | false | false | false |
ufal/neuralmonkey | neuralmonkey/attention/base_attention.py | 1 | 8051 | """Decoding functions using multiple attentions for RNN decoders.
See http://arxiv.org/abs/1606.07481
The attention mechanisms used in Neural Monkey are inherited from the
``BaseAttention`` class defined in this module.
The attention function can be viewed as a soft lookup over an associative
memory. The *query* vec... | bsd-3-clause | f15e8306ec4adf5e1b15dbd18f787c89 | 38.273171 | 79 | 0.680164 | 4.397051 | false | false | false | false |
ufal/neuralmonkey | neuralmonkey/processors/helpers.py | 1 | 1266 | from typing import Any, Callable, Generator, List
from random import randint
def preprocess_char_based(sentence: List[str]) -> List[str]:
return list(" ".join(sentence))
def preprocess_add_noise(sentence: List[str]) -> List[str]:
sent = sentence[:]
length = len(sentence)
if length > 1:
for _... | bsd-3-clause | 7272700bbac13b5da5c6a041f172d878 | 24.836735 | 74 | 0.605845 | 4.044728 | false | false | false | false |
ufal/neuralmonkey | neuralmonkey/runners/regression_runner.py | 1 | 1912 | from typing import Dict, List, Callable
import numpy as np
import tensorflow as tf
from typeguard import check_argument_types
from neuralmonkey.decoders.sequence_regressor import SequenceRegressor
from neuralmonkey.decorators import tensor
from neuralmonkey.runners.base_runner import BaseRunner
# pylint: disable=inv... | bsd-3-clause | 0d807aff5d86e00f44146fb93df8d5c7 | 33.142857 | 74 | 0.650105 | 4.248889 | false | false | false | false |
ufal/neuralmonkey | neuralmonkey/model/model_part.py | 1 | 4048 | """Basic functionality of all model parts."""
from abc import ABCMeta
from typing import MutableSet, Set, List, Tuple, Iterable
from neuralmonkey.model.parameterized import Parameterized, InitializerSpecs
from neuralmonkey.model.feedable import Feedable
class GenericModelPart(metaclass=ABCMeta):
"""Base class fo... | bsd-3-clause | 6c2f15c766ae24fd8fe8dd6114a0abf3 | 38.300971 | 79 | 0.656374 | 4.482835 | false | false | false | false |
ufal/neuralmonkey | neuralmonkey/attention/transformer_cross_layer.py | 1 | 9898 | """Input combination strategies for multi-source Transformer decoder."""
# TODO add citation when URL becomes available
from typing import Callable, List
import tensorflow as tf
from neuralmonkey.attention.scaled_dot_product import attention
from neuralmonkey.tf_utils import layer_norm
# pylint: disable=too-many-ar... | bsd-3-clause | bdbe0c40fbb7b2e738b3338beaf87f48 | 36.634981 | 79 | 0.646797 | 4.352682 | false | false | false | false |
ufal/neuralmonkey | lib/subword_nmt/bpe_toy.py | 3 | 1687 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Rico Sennrich
"""Use byte pair encoding (BPE) to learn a variable-length encoding of the vocabulary in a text.
Unlike the original BPE, it does not compress the plain text, but can be used to reduce the vocabulary
of a text to a configurable number of symbols, wi... | bsd-3-clause | 18f9ea72a60b33c71b80fb0204f53c6a | 34.145833 | 116 | 0.681091 | 3.153271 | false | false | false | false |
ufal/neuralmonkey | neuralmonkey/decoders/autoregressive.py | 1 | 22666 | # pylint: disable=too-many-lines
"""Abstract class for autoregressive decoding.
Either for the recurrent decoder, or for the transformer decoder.
The autoregressive decoder uses the while loop to get the outputs.
Descendants should only specify the initial state and the while loop body.
"""
from typing import NamedTu... | bsd-3-clause | 5c204f2ea76de930d1c8c54e8e276e30 | 37.811644 | 79 | 0.61215 | 4.269354 | false | false | false | false |
ufal/neuralmonkey | neuralmonkey/evaluators/beer.py | 1 | 2482 | import tempfile
import subprocess
from typing import List
from typeguard import check_argument_types
from neuralmonkey.logging import log
from neuralmonkey.evaluators.evaluator import Evaluator
class BeerWrapper(Evaluator[List[str]]):
"""Wrapper for BEER scorer.
Paper: http://aclweb.org/anthology/D14-1025
... | bsd-3-clause | 5984f38326c6b692c25fa9cd129e2c29 | 30.820513 | 78 | 0.532635 | 4.339161 | false | false | false | false |
ufal/neuralmonkey | neuralmonkey/trainers/self_critical_objective.py | 1 | 8044 | """Training objective for self-critical learning.
Self-critic learning is a modification of the REINFORCE algorithm that uses the
reward of the train-time decoder output as a baseline in the update step.
For more details see: https://arxiv.org/pdf/1612.00563.pdf
"""
from typing import Callable, Iterable, Tuple, Opti... | bsd-3-clause | 4c7221fa0ad05c93d6e1866875894899 | 33.822511 | 79 | 0.620338 | 3.783631 | false | false | false | false |
ufal/neuralmonkey | neuralmonkey/runners/runner.py | 1 | 3169 | from typing import Dict, List, Callable, Union
import numpy as np
import tensorflow as tf
from typeguard import check_argument_types
from neuralmonkey.runners.base_runner import BaseRunner, NextExecute
from neuralmonkey.decoders.autoregressive import AutoregressiveDecoder
from neuralmonkey.decoders.classifier import ... | bsd-3-clause | ffe5a67c40dd1556f7e821448283390c | 34.211111 | 77 | 0.611549 | 4.253691 | false | false | false | false |
ufal/neuralmonkey | lib/subword_nmt/segment-char-ngrams.py | 3 | 2377 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Rico Sennrich
from __future__ import unicode_literals, division
import sys
import codecs
import argparse
# hack for python2/3 compatibility
from io import open
argparse.open = open
# python 2/3 compatibility
if sys.version_info < (3, 0):
sys.stderr = codecs.... | bsd-3-clause | d64c519fbba7bf78a48e718f32b45bab | 32.478873 | 96 | 0.611275 | 3.656923 | false | false | false | false |
ufal/neuralmonkey | neuralmonkey/trainers/delayed_update_trainer.py | 1 | 9072 | # pylint: disable=unused-import
from typing import Dict, List, Tuple, Optional
# pylint: enable=unused-import
import tensorflow as tf
from typeguard import check_argument_types
from neuralmonkey.decorators import tensor
from neuralmonkey.runners.base_runner import GraphExecutor, NextExecute
from neuralmonkey.trainers... | bsd-3-clause | 4df8a04e1c83750dfe09805d23f4167f | 37.769231 | 79 | 0.578924 | 4.182573 | false | false | false | false |
ufal/neuralmonkey | neuralmonkey/writers/plain_text_writer.py | 1 | 1974 | from typing import Iterator, List, Any, Callable
from neuralmonkey.logging import log
from neuralmonkey.readers.plain_text_reader import ALNUM_CHARSET
# pylint: disable=invalid-name
# Writer: function that gets file and the data
Writer = Callable[[str, Any], None]
# pylint: enable=invalid-name
def t2t_detokenize(da... | bsd-3-clause | 79323426254959c8ca5ff25fa1d2af6e | 31.9 | 102 | 0.653495 | 3.433043 | false | false | false | false |
ufal/neuralmonkey | neuralmonkey/encoders/transformer.py | 1 | 12857 | """Implementation of the encoder of the Transformer model.
Described in Vaswani et al. (2017), arxiv.org/abs/1706.03762
"""
from typing import List
import math
import tensorflow as tf
from typeguard import check_argument_types
from neuralmonkey.attention.base_attention import (
Attendable, get_attention_states, ... | bsd-3-clause | 10628950ed3fdbc2e29225c2c6805a6a | 37.960606 | 79 | 0.623085 | 4.123477 | false | false | false | false |
ufal/neuralmonkey | scripts/caffe_image_features.py | 1 | 4420 | import argparse
import sys
import os
os.environ['GLOG_minloglevel'] = '4'
sys.path.append("caffe/python")
import caffe
import numpy as np
import skimage
def crop_image(x, target_height=227, target_width=227):
image = skimage.img_as_float(skimage.io.imread(x)).astype(np.float32)
if len(image.shape) == 2:
... | bsd-3-clause | 53d1a8cec8541cbc6a43296e708b369c | 41.095238 | 129 | 0.647285 | 3.335849 | false | false | false | false |
ufal/neuralmonkey | scripts/postedit_reconstruct_data.py | 2 | 2259 | #!/usr/bin/env python3
"""
This a script that takes the result of automatic postediting encoded as a
sequence of <keep>, <delete> and insert operations and applies them on the
original text being post-edited.
The inverse script to this one is 'postedit_prepare_data.py'.
"""
import argparse
from neuralmonkey.processors... | bsd-3-clause | 7c005d1b00019bc6044ef2ea54cc6ee4 | 29.945205 | 78 | 0.656042 | 4.06295 | false | false | false | false |
ledatelescope/bifrost | python/bifrost/map.py | 1 | 7421 |
# Copyright (c) 2016-2022, The Bifrost Authors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditi... | bsd-3-clause | 0023894c9677eae8af4baa997e0903db | 41.164773 | 111 | 0.612047 | 3.883307 | false | false | false | false |
ledatelescope/bifrost | python/bifrost/addon/leda/make_header.py | 1 | 13543 |
# Copyright (c) 2016-2021, The Bifrost Authors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditi... | bsd-3-clause | 3a070df3706248d3d106a0e8a7edac6c | 43.549342 | 153 | 0.594994 | 3.697243 | false | false | false | false |
ledatelescope/bifrost | python/bifrost/blocks/convert_visibilities.py | 1 | 9672 |
# Copyright (c) 2016-2021, The Bifrost Authors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditi... | bsd-3-clause | ede8708991dbfdc068d82e8fe33153d7 | 44.838863 | 111 | 0.531638 | 3.475386 | false | false | false | false |
ledatelescope/bifrost | python/bifrost/psrdada.py | 1 | 9835 |
# Copyright (c) 2016-2021, The Bifrost Authors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditi... | bsd-3-clause | 68d36c1c8878d30d112c3c53f4827197 | 37.268482 | 91 | 0.629181 | 3.449667 | false | false | false | false |
ledatelescope/bifrost | python/bifrost/blocks/serialize.py | 1 | 11508 |
# Copyright (c) 2016-2020, The Bifrost Authors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditi... | bsd-3-clause | cbd626e3315ab52ba518f65e2196d0af | 40.1 | 87 | 0.614095 | 3.774352 | false | false | false | false |
ledatelescope/bifrost | test/test_ndarray.py | 1 | 7630 |
# Copyright (c) 2016-2022, The Bifrost Authors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditi... | bsd-3-clause | 852389bf49de40e4d6bd17f5e2a56e48 | 48.545455 | 84 | 0.634731 | 3.264869 | false | true | false | false |
ledatelescope/bifrost | testbench/your_first_block.py | 1 | 3507 | #!/usr/bin/env python
# Copyright (c) 2017-2020, The Bifrost Authors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice... | bsd-3-clause | da8cfbf465817a1e4c6ce7e6c371587a | 34.424242 | 83 | 0.692615 | 3.742796 | false | false | false | false |
ledatelescope/bifrost | python/bifrost/views/basic_views.py | 1 | 8870 |
# Copyright (c) 2016-2021, The Bifrost Authors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditi... | bsd-3-clause | dcbd0ba286d51edb6225615217ce2b6b | 40.448598 | 81 | 0.609808 | 4.059497 | false | false | false | false |
ledatelescope/bifrost | docs/source/conf.py | 1 | 5080 | # -*- coding: utf-8 -*-
#
# bifrost documentation build configuration file, created by
# sphinx-quickstart on Thu Apr 27 09:41:02 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
# autogenerated file.
#
# A... | bsd-3-clause | c0a1cf71c182e9bc2246ba5ed68f1afd | 29.787879 | 90 | 0.666339 | 3.816679 | false | true | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.