Did I find the right examples for you? yes no

All Samples(58)  |  Call(42)  |  Derive(0)  |  Import(16)
Get a method or class from any imported module from its name.
Usage: lookup(functionName, globals())

        def lookup(name, namespace):
    """
    Get a method or class from any imported module from its name.
    Usage: lookup(functionName, globals())
    """
    dots = name.count('.')
    if dots > 0:
        moduleName, objName = '.'.join(
            name.split('.')[:-1]), name.split('.')[-1]
        module = __import__(moduleName)
        return getattr(module, objName)
    else:
        modules = [obj for obj in namespace.values() if str(
            type(obj)) == ""]
        options = [getattr(module, name)
                   for module in modules if name in dir(module)]
        options += [obj[1] for obj in namespace.items() if obj[0] == name]
        if len(options) == 1:
            return options[0]
        if len(options) > 1:
            raise Exception('Name conflict for %s')
        raise Exception('%s not found as a method or class' % name)
        


src/b/r/breze-HEAD/breze/arch/model/gaussianprocess.py   breze(Download)
cholesky = Cholesky()
 
from ..util import ParameterSet, Model, lookup
from ..component import misc, kernel as kernel_
 
        # be exploited by code on the top via a givens directory.
 
        kernel_by_dist_func = lookup('%s_by_dist' % kernel, kernel_, None)
        stationary = kernel_by_dist_func is not None
        kernel_func = lookup(kernel, kernel_)

src/b/r/breze-HEAD/breze/arch/model/feature/rica.py   breze(Download)
import theano.tensor as T
 
from ...util import ParameterSet, Model, lookup
from ...component import transfer, loss as loss_
 
    def make_exprs(inpt, in_to_hidden, hidden_transfer, feature_transfer,
                   out_transfer, loss, c_ica):
        f_hidden = lookup(hidden_transfer, transfer)
        f_feature = lookup(feature_transfer, transfer)
        f_output = lookup(out_transfer, transfer)
        f_loss = lookup(loss, loss_)

src/b/r/breze-HEAD/breze/arch/model/neural.py   breze(Download)
import theano.tensor as T
 
from ..util import ParameterSet, Model, lookup
from ..component import transfer, loss as loss_
 
    def make_exprs(inpt, target, in_to_hidden, hidden_to_out,
                   hidden_bias, out_bias,
                   hidden_transfer, output_transfer, loss):
 
        f_hidden = lookup(hidden_transfer, transfer)
        f_output = lookup(output_transfer, transfer)
        f_loss = lookup(loss, loss_)
        exprs = {}
 
        f_hidden = lookup(hidden_transfers[0], transfer)
        hidden_in = exprs['hidden_in_0'] = T.dot(inpt, in_to_hidden) + hidden_biases[0]
        hidden = exprs['hidden_0'] =  f_hidden(hidden_in)

src/b/r/breze-HEAD/breze/arch/model/linear.py   breze(Download)
import theano.tensor as T
 
from ..util import ParameterSet, Model, lookup
from ..component import transfer, loss as loss_
 
    def make_exprs(inpt, in_to_out, bias, out_transfer, loss):
        f_out = lookup(out_transfer, transfer)
        f_loss = lookup(loss, loss_)
 
        target = T.matrix('target')

src/b/r/breze-HEAD/breze/arch/model/sequential/rnn.py   breze(Download)
from theano.tensor.shared_randomstreams import RandomStreams
 
from ...util import ParameterSet, Model, lookup
from ...component import transfer, loss as loss_
 
    exprs = {}
 
    f_hiddens = [lookup(i, transfer) for i in hidden_transfers]
    f_output = lookup(out_transfer, transfer)
 
        exprs = {}
 
        f_hiddens = [lookup(i, transfer) for i in hidden_transfers]
        f_output = lookup(out_transfer, transfer)
 

src/b/r/breze-HEAD/breze/arch/model/varprop/mlp.py   breze(Download)
import theano.tensor as T
 
from ...util import lookup
from ...component.varprop import transfer, loss as loss_
from ...model.neural import MultiLayerPerceptron
        exprs = {}
 
        f_hidden = lookup(hidden_transfers[0], transfer)
        hidden = mean_var_forward(inpt_mean, inpt_var, in_to_hidden,
                                  hidden_biases[0], hidden_var_biases[0],
        for i, (w, b, bv, t) in enumerate(zipped):
            hidden_mean_m1, hidden_var_m1 = hidden_mean, hidden_var
            f = lookup(t, transfer)
            hidden = mean_var_forward(hidden_mean_m1, hidden_var_m1, w, b, bv,
                                      f, p_dropout_hidden)
            exprs['hidden_var_%i' % (i + 1)] = hidden_var
 
        f_output = lookup(output_transfer, transfer)
        output = mean_var_forward(hidden_mean, hidden_var, hidden_to_out,
                                  out_bias, out_var_bias,
                                  f_output, p_dropout_hidden)
        (output_in_mean, output_in_var, output_mean, output_var) = output
        output = T.concatenate([output_mean, output_var], axis=1)
 
        f_loss = lookup(loss, loss_)

src/b/r/breze-HEAD/breze/arch/model/feature/sparsefiltering.py   breze(Download)
import theano.tensor as T
 
from ...util import ParameterSet, Model, lookup
from ...component import transfer, distance, norm
 
    def make_exprs(feature_transfer, inpt, inpt_to_feature):
        feature_in = T.dot(inpt, inpt_to_feature)
        f_feature = lookup(feature_transfer, transfer)
        feature = f_feature(feature_in)
 

src/b/r/breze-HEAD/breze/arch/model/awn/mlp.py   breze(Download)
import theano.tensor as T
 
from ...util import lookup
from ...component.varprop import transfer, loss as loss_
from ...model.neural import MultiLayerPerceptron
        exprs = {}
 
        f_hidden = lookup(hidden_transfers[0], transfer)
        hidden = mean_var_forward(
            inpt_mean, inpt_var,
        for i, (wm, wv, bm, bv, t) in enumerate(zipped):
            hidden_mean_m1, hidden_var_m1 = hidden_mean, hidden_var
            f = lookup(t, transfer)
            hidden = mean_var_forward(
                hidden_mean_m1, hidden_var_m1, wm, wv, bm, bv, f)
            exprs['hidden_var_%i' % (i + 1)] = hidden_var
 
        f_output = lookup(out_transfer, transfer)
        output = mean_var_forward(
            hidden_mean, hidden_var, hidden_to_out_mean, hidden_to_out_var,
        output = T.concatenate([output_mean, output_var], axis=1)
 
        f_loss = lookup(loss, loss_)
 
        loss_rowwise = f_loss(target, output).sum(axis=1)

src/b/r/breze-HEAD/breze/arch/model/varprop/rnn.py   breze(Download)
from theano.tensor.extra_ops import repeat
 
from ...util import lookup
from ...component.varprop import transfer, loss as loss_
from ...model.sequential.rnn import BaseRecurrentNetwork, SimpleRnnComponent
    exprs = {}
 
    f_hiddens = [lookup(i, transfer) for i in hidden_transfers]
    f_output = lookup(out_transfer, transfer)
 
                    out_bias, hidden_transfers, out_transfer, p_dropouts,
                    hotk_inpt)
        f_loss = lookup(loss, loss_)
        sum_axis = 2
        loss_row_wise = f_loss(target, exprs['output']).sum(axis=sum_axis)

src/b/r/breze-HEAD/breze/arch/model/feature/autoencoder.py   breze(Download)
from theano.tensor.shared_randomstreams import RandomStreams
 
from ...util import ParameterSet, lookup
from ...component import loss as loss_, corrupt
from ..neural import TwoLayerPerceptron
 
        hidden = exprs['hidden']
        f_sparsity_loss = lookup(sparsity_loss, loss_)
 
        sparsity_loss = f_sparsity_loss(sparsity_target, hidden.mean(axis=0)).sum()

  1 | 2  Next