theanet.layer package

Submodules

theanet.layer.auxillary module

theanet.layer.convpool module

class theanet.layer.convpool.ConvLayer(inpt, wts, rand_gen, batch_sz, num_prev_maps, in_sz, num_maps, filter_sz, stride, mode='valid', actvn='relu50', reg=())[source]

Bases: theanet.layer.layer.Layer

TestVersion(inpt)[source]
class theanet.layer.convpool.MeanLayer(inpt, num_maps, in_sz)[source]

Bases: theanet.layer.layer.Layer

TestVersion(inpt)[source]
class theanet.layer.convpool.PoolLayer(inpt, num_maps, in_sz, pool_sz, ignore_border=False)[source]

Bases: theanet.layer.layer.Layer

TestVersion(inpt)[source]

theanet.layer.hidden module

class theanet.layer.hidden.HiddenLayer(inpt, wts, rand_gen=None, n_in=None, n_out=None, pdrop=0, actvn='relu01', reg=())[source]

Bases: theanet.layer.layer.Layer

TestVersion(inpt)[source]

theanet.layer.inlayers module

class theanet.layer.inlayers.ElasticLayer(inpt, img_sz, num_maps=1, translation=0, zoom=1, magnitude=0, sigma=1, pflip=0, angle=0, rand_gen=None, invert_image=False, nearest=False)[source]

Bases: theanet.layer.layer.Layer

TestVersion(te_inpt)[source]
class theanet.layer.inlayers.InputLayer(inpt, img_sz, num_maps=1, rand_gen=None)[source]

Bases: theanet.layer.layer.Layer

TestVersion(inpt)[source]

theanet.layer.layer module

class theanet.layer.layer.Activation(fn, name)[source]

Bases: object

Defines a bunch of activations as callable classes. Useful for printing and specifying activations as strings.

class theanet.layer.layer.Layer[source]

Bases: object

Base class for Layer

get_updates(cost, rate)[source]
get_wtcost()[source]
get_wts()[source]
theanet.layer.layer.activation_by_name(name)[source]

Get an activation function or callabe-class from its name :param name: string :return: Callable Activation

theanet.layer.outlayers module

class theanet.layer.outlayers.CenteredOutLayer(inpt, wts, centers, rand_gen=None, n_in=None, n_features=None, n_classes=None, kind='LOGIT', learn_centers=False, junk_dist=<Mock id='140068954974640'>, reg=())[source]

Bases: theanet.layer.hidden.HiddenLayer, theanet.layer.outlayers.OutputLayer

TestVersion(inpt)[source]
class theanet.layer.outlayers.HingeLayer(inpt, wts, rand_gen=None, n_in=None, n_out=None, reg=(), loss='hinge')[source]

Bases: theanet.layer.hidden.HiddenLayer, theanet.layer.outlayers.OutputLayer

TestVersion(inpt)[source]
class theanet.layer.outlayers.OutputLayer[source]

Bases: object

cost(y)[source]
features_and_predictions()[source]
hinge(y)[source]
neg_log_likli(y)[source]
neg_log_likli_sq(y)[source]
neg_log_likli_trunc(y, threshold)[source]
sym_and_oth_err_rate(y)[source]
class theanet.layer.outlayers.SoftmaxLayer(inpt, wts, rand_gen=None, n_in=None, n_out=None, reg=(), loss='nll')[source]

Bases: theanet.layer.hidden.HiddenLayer, theanet.layer.outlayers.OutputLayer

TestVersion(inpt)[source]

theanet.layer.weights module

theanet.layer.weights.borrow(sharedvar, boro=True)[source]

Gets the numpy ndarray underlying a sharedVariable

theanet.layer.weights.init_wb(wb, rand_gen, size_w, size_b, fan_in, fan_out, actvn, name)[source]

Initialize the weights. If wb is given, the weights are initialized as a copy of the same. If wb is None, they are randomly initialized based on the rest of the arguments.

Parameters:wb (None or ndarray or SharedVariable) – w and b (to be copied or None)

The following a are needed only when wb is None.

Parameters:
  • rand_gen (RandomStream) – A random stream.
  • size_w (tuple) – Size of w
  • size_b (tuple or int) – Size of b
  • fan_in (int) – Number of units coming in.
  • fan_out (int) – Number of units going out.
  • actvn (str) – The activation that will be applied. See `Activation`s
Returns:

The initialized weights

Return type:

SharedVariable

theanet.layer.weights.is_shared_var(x)[source]

Checks if x is SharedVar. Could be a CUDA SharedVar or just a normal Theano SharedVar

Module contents