neon.transforms.cost.Metric

class neon.transforms.cost.Metric(name=None)[source]

Bases: neon.transforms.cost.Cost

Base class for Metrics. Metrics are quantities not used during training for the back-propogration but are useful to compute and display to check on progress.

For example, when training on image classification network, we may want to use the Cross-entropy cost to train the weights, but display the misclassification rate metric.

__init__(name=None)

Class constructor.

Parameters:name (str, optional) – Name to assign instance of this class.

Methods

__init__([name]) Class constructor.
bprop(y, t) Computes the derivative of the cost function
gen_class(pdict)
get_description([skip]) Returns a dict that contains all necessary information needed to serialize this object.
recursive_gen(pdict, key) helper method to check whether the definition
be = None
bprop(y, t)

Computes the derivative of the cost function

Parameters:
  • y (Tensor or OpTree) – Output of previous layer or model
  • t (Tensor or OpTree) – True targets corresponding to y
Returns:

Returns the derivative of the cost function

Return type:

OpTree

classnm

Returns the class name.

gen_class(pdict)
get_description(skip=[], **kwargs)

Returns a dict that contains all necessary information needed to serialize this object.

Parameters:skip (list) – Objects to omit from the dictionary.
Returns:Dictionary format for object information.
Return type:(dict)
modulenm

Returns the full module path.

recursive_gen(pdict, key)

helper method to check whether the definition dictionary is defining a NervanaObject child, if so it will instantiate that object and replace the dictionary element with an instance of that object