keras/src/metrics/accuracy_metrics.py/SparseTopKCategoricalAccuracy/__init__
class SparseTopKCategoricalAccuracy:    def __init__(
        self, k=5, name="sparse_top_k_categorical_accuracy", dtype=None
    ):
        super().__init__(
            fn=sparse_top_k_categorical_accuracy,
            name=name,
            dtype=dtype,
            k=k,
        )
        self.k = k
        # Metric should be maximized during optimization.
        self._direction = "up"