torcheval.metrics.functional.frequency_at_k¶
- torcheval.metrics.functional.frequency_at_k(input: Tensor, k: float) Tensor ¶
Calculate the frequency given a list of frequencies and threshold k. Generate a binary list to indicate if frequencies is less than k.
- Parameters:
input (Tensor) – Predicted unnormalized scores (often referred to as logits).
k (float) – Threshold of the frequency. k should not negative value.
Example
>>> import torch >>> from torcheval.metrics.functional import frequency >>> input = torch.tensor([0.3, 0.1, 0.6]) >>> frequency(input, k=0.5) tensor([1.0000, 1.0000, 0.0000])