theanets.losses.Loss

class theanets.losses.Loss(target, weight=1.0, weighted=False, output_name='out')

A loss function base class.

Parameters:

target : int or Theano variable

If this is an integer, it specifies the number of dimensions required to store the target values for computing the loss. If it is a Theano variable, this variable will be used directly to access target values.

weight : float, optional

The importance of this loss for the model being trained. Defaults to 1.

weighted : bool, optional

If True, a floating-point array of weights with the same dimensions as target will be required to compute the “weighted” loss. Defaults to False.

output_name : str, optional

Name of the network output to tap for computing the loss. Defaults to ‘out:out’, the name of the default output of the last layer in a linear network.

Attributes

weight (float) The importance of this loss for the model being trained.
output_name (str) Name of the network output to tap for computing the loss.
__init__(target, weight=1.0, weighted=False, output_name='out')

Methods

__init__(target[, weight, weighted, output_name])
log() Log some diagnostic info about this loss.

Attributes

variables A list of Theano variables used in this loss.
log()

Log some diagnostic info about this loss.

variables

A list of Theano variables used in this loss.