Computes how often integer targets are in the top K predictions

metric_sparse_top_k_categorical_accuracy(
  y_true,
  y_pred,
  k = 5L,
  ...,
  name = "sparse_top_k_categorical_accuracy",
  dtype = NULL
)

Arguments

y_true

Tensor of true targets.

y_pred

Tensor of predicted targets.

k

(Optional) Number of top elements to look at for computing accuracy. Defaults to 5.

...

Passed on to the underlying metric. Used for forwards and backwards compatibility.

name

(Optional) string name of the metric instance.

dtype

(Optional) data type of the metric result.

Value

If y_true and y_pred are missing, a (subclassed) Metric instance is returned. The Metric object can be passed directly to compile(metrics = ) or used as a standalone object. See ?Metric for example usage.

Alternatively, if called with y_true and y_pred arguments, then the computed case-wise values for the mini-batch are returned directly.

See also