neon.transforms.cost.PrecisionRecall

class neon.transforms.cost.PrecisionRecall(num_classes, binarize=False, epsilon=1e-06)[source]

Bases: neon.transforms.cost.Metric

Precision and Recall metrics.

Typically used in a conjunction with a multi-classification model.

__init__(num_classes, binarize=False, epsilon=1e-06)[source]
Parameters:
  • num_classes (int) – Number of different output classes.
  • binarize (bool, optional) – If True will attempt to convert the model outputs to a one-hot encoding (in place). Defaults to False.
  • epsilon (float, optional) – Smoothing to apply to avoid division by zero. Defaults to 1e-6.

Methods

__init__(num_classes[, binarize, epsilon])
param num_classes:
 Number of different output classes.
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