Skip to content

SparseCategoricalCrossentropyIgnore

SparseCategoricalCrossentropyIgnore class

dlf.metrics.sparse_categorial_crossentropy_ignore.SparseCategoricalCrossentropyIgnore(
    num_classes, from_logits=False, name="sparse_categorical_crossentropy_ignore", **kwargs
)

Implementation for sparse crossentropy metric with ignore label functionality.

The same implmentation like tf.keras.metrics.SparseCategoricalCrossentropy but with the addtion that this implementation ignores all label ids <= num_classes.

Arguments

  • num_classes: int. Number of classes, everthing above will be ignored
  • name: str, optonal, Name of the loss function. Defaults to 'sparse_categorical_crossentropy_ignore'.
  • from_logits: bool. If true, y_pred is expected to be a logits tensor. Defaults to False.

Returns

A tf.keras.metrics.Metric

YAML Configuration

metrics:
    SparseCategoricalCrossentropyIgnore:
        from_logits: False
        num_classes: 7