Skip to content

entropy

allennlp.training.metrics.entropy

[SOURCE]


Entropy

@Metric.register("entropy")
class Entropy(Metric):
 | def __init__(self) -> None

__call__

class Entropy(Metric):
 | ...
 | def __call__(
 |     self,
 |     logits: torch.Tensor,
 |     mask: Optional[torch.BoolTensor] = None
 | )

Parameters

  • logits : torch.Tensor
    A tensor of unnormalized log probabilities of shape (batch_size, ..., num_classes).
  • mask : torch.BoolTensor, optional (default = None)
    A masking tensor of shape (batch_size, ...).

get_metric

class Entropy(Metric):
 | ...
 | def get_metric(self, reset: bool = False)

Returns

  • The scalar average entropy.

reset

class Entropy(Metric):
 | ...
 | def reset(self)