TorchLean API

NN.Runtime.Autograd.Model.Metrics

Metrics #

TorchLean metrics helpers.

These are non-differentiable evaluation helpers for classification and accuracy reports.

Correct and total classifications measured by an accuracy metric.

  • correct :

    Number of correctly classified entries.

  • total :

    Number of entries considered by the metric.

Instances For
    Instances For
      def TorchLean.Metrics.argmax? {α : Type} [Storage α] [LT α] [DecidableRel fun (x1 x2 : α) => x1 > x2] {s : Spec.Shape} (values : Tensor α s) :

      Index of the first maximum in row-major storage order.

      This operation accepts a tensor of any rank. It returns none exactly when the tensor has no entries; ties are resolved in favor of the first index.

      Instances For
        def TorchLean.Metrics.argmaxAxis? {α : Type} [Storage α] [LT α] [DecidableRel fun (x1 x2 : α) => x1 > x2] {s : Spec.Shape} (axis : ) [Spec.Shape.AxisInBounds axis s] (values : Tensor α s) :

        Indices of the maxima along axis, in row-major order over all remaining dimensions.

        The selected axis is moved to the innermost position before the tensor is flattened, so each contiguous chunk is one class slice. An empty class axis contributes none for every slice of the remaining shape. Ties are resolved in favor of the first index.

        Instances For
          def TorchLean.Metrics.correctOneHotAxis? {α : Type} [Storage α] [LT α] [DecidableRel fun (x1 x2 : α) => x1 > x2] {s : Spec.Shape} (axis : ) [Spec.Shape.AxisInBounds axis s] (logits targetOneHot : Tensor α s) :

          Compare logits with one-hot targets along axis, once for every slice orthogonal to that axis.

          An entry is none exactly when the selected class axis is empty. Otherwise it records whether the two first-maximum indices agree.

          Instances For
            def TorchLean.Metrics.accuracyOneHotAxis {α : Type} [Storage α] [LT α] [DecidableRel fun (x1 x2 : α) => x1 > x2] {s : Spec.Shape} (axis : ) [Spec.Shape.AxisInBounds axis s] (logits targetOneHot : Tensor α s) :

            Count correct and total one-hot classifications along axis.

            Instances For