Proportion overall accuracy of a confusion matrix
Source:R/FUNCTIONS_TRAIN_TEST.R
proportion_accurate.RdCalculates the overall accuracy and Cohen's kappa statistics of a confusion matrix.
Details
This function evaluates the performance of a confusion matrix by calculating the overall accuracy and Cohen's kappa statistics.
The function performs the following steps: 1. Computes the confusion matrix from the observed and predicted values. 2. Calculates the diagonal proportion (overall accuracy) and the off-diagonal proportion. 3. Computes Cohen's kappa statistics (unweighted,linear,and squared weights).
The output is a data.frame containing the following metrics: -`cm_diagonal`: Proportion of correct classifications (diagonal elements). -`cm_off_diagonal`: Proportion of misclassified observations (off-diagonal elements). -`kappa_unweighted`: Cohen's kappa statistic with no weights. -`kappa_linear`: Cohen's kappa statistic with linear weights. -`kappa_squared`: Cohen's kappa statistic with squared weights.