Shortcuts

torcheval.metrics.functional.frequency_at_k

torcheval.metrics.functional.frequency_at_k(input: Tensor, k: float) Tensor[source]

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])

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources