neuraltrain.metrics.metrics.TopkAcc

class neuraltrain.metrics.metrics.TopkAcc(topk: int = 5)[source][source]

Top-k accuracy.

Parameters:

topk – K in top-k, i.e. minimal rank to classify a prediction as a success.

compute() Tensor[source][source]

Override this method to compute the final metric value.

This method will automatically synchronize state variables when running in distributed backend.