2  Summary

2.1 Basic Usage

Computing performance metrics with {SLmetrics} is straightforward. At its most basic level, {SLmetrics} accepts vectors of <factor> or <numeric> values as input. Here are two examples demonstrating its basic usage.

2.1.1 Classification metrics

## 1) actual and predicted
## classes
fct_actual <- factor(c("A", "A", "B"))
fct_predicted <- factor(c("B", "A", "B"))

## 2) confusion matrix
confusion_matrix <- SLmetrics::cmatrix(
    actual    = fct_actual, 
    predicted = fct_predicted
)

## 3) summarize confusion
## matrix
summary(confusion_matrix)
Confusion Matrix (2 x 2) 
================================================================================
  A B
A 1 1
B 0 1
================================================================================
Overall Statistics (micro average)
 - Accuracy:          0.67
 - Balanced Accuracy: 0.75
 - Sensitivity:       0.67
 - Specificity:       0.67
 - Precision:         0.67

2.1.2 Regression metrics

## 1) actual and predicted
## values
num_actual    <- c(10.2, 12.5, 14.1)
num_predicted <- c(9.8, 11.5, 14.2)

## 2) RMSE
SLmetrics::rmse(
    actual    = num_actual,
    predicted = num_predicted
)
[1] 0.6244998

2.2 Installation

2.2.1 Stable version

## install stable release
devtools::install_github(
  repo = 'https://github.com/serkor1/SLmetrics@*release',
  ref  = 'main'
)

2.2.2 Development version

## install development version
devtools::install_github(
  repo = 'https://github.com/serkor1/SLmetrics',
  ref  = 'development'
)