This function calculates the redistributed confusion matrix from a caret
ConfusionMatrix object or a simple matrix and optionally prints the
redistributed standard accuracy score. The redistributed confusion matrix
can serve to place significance on observations close to the diagonal by
applying a custom weighting scheme which transfers a proportion of the
non-diagonal observations to the diagonal.
the caret confusion matrix object or simple matrix.
custom.weights
the vector of custom weights to be applied, which
should be equal to "n", but can be larger, with excess values, as well as
the first element, being ignored. The first element is ignored because it
represents weighting applied to the diagonal. As, in the case of
redistribution, a proportion of the non-diagonal observations is shifted
towards the diagonal, the weighting applied to the diagonal depends on the
weights assigned to the non-diagonal elements, and is thus not configurable
by the user.
print.weighted.accuracy
print the standard accuracy metric for the
redistributed matrix, which represents the sum of the correctly classified
observations (or the diagonal elements of the matrix) divided by the
total number of observations (or the sum of all observations).
Author
Alexandru Monahov, <https://www.alexandrumonahov.eu.org/>
Details
The number of categories "n" should be greater or equal to 2.
See Also
[weightmatrix()] for the weight matrix used in computations,
[wconfusionmatrix()] for the computation of weighted confusion matrices,
[balancedaccuracy()] for accuracy metrics designed for imbalanced data.