Thanks, on its way to CRAN

R-bloggers 2025-03-24

[This article was first published on R-posts.com, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
The generic seal of approval from the CRAN team – countless hours spent tabbing between R CMD check and R CMD build logs, ‘Writing R Extensions’ and Stackoverflow approved, with a single line. The equivalent of “Noted, thanks” after a painstakingly well-written e-mail to your professor – except, this has an amazing feeling and a clear meaning: {SLmetrics} (finally) found its way to CRAN!

What is {SLmetrics}? Why should we even care?

{SLmetrics} is a collection of AI/ML performance metrics written in ‘C++’ with three things in mind: scalability, speed and simplicity – all well-known buzzwords on LinkedIn. Below is the results of the benchmark on computing a 2×2 confusion matrix:Median execution time for constructing 2x2 confusion matrices across R packages.Median execution time across R packages. For each N, 1000 measures have been taken with {microbenchmark}{SLmetrics} is much faster, and more memory efficient, than the R-packages in question when computing the confusion matrix – this is an essential difference, as many if not most classification metrics are based off of the confusion matrix.

What’s new?

Since the blog-post on scalability and efficiency in January, many new features have been added. Below is an example on the Relative Root Mean Squared Error:
## 1) actual and predicted##    valuesactual    <- c(0.43, 0.85, 0.22, 0.48, 0.12, 0.88)predicted <- c(0.46, 0.77, 0.12, 0.63, 0.18, 0.78)## 2) calculate##    metric and print##    valuescat(  "Mean Relative Root Mean Squared Error", SLmetrics::rrmse(    actual        = actual,    predicted     = predicted,    normalization = 0  ),  "Range Relative Root Mean Squared Error (weighted)", SLmetrics::rrmse(    actual        = actual,    predicted     = predicted,    normalization = 1  ),  sep = "\n")#> Mean Relative Root Mean Squared Error#> 0.3284712#> Range Relative Root Mean Squared Error (weighted)#> 0.3284712

Created on 2025-03-24 with reprex v2.1.1

Visit the online docs for a quick overview of all the available metrics and features.

Installing {SLmetrics}

{SLmetrics} can be installed via CRAN, or built from source using, for example, {pak}. See below:

Via CRAN

install.packages("SLmetrics")

Build from source

pak::pak(    pkg = "serkor1/SLmetrics",    ask = FALSE)

Thanks, on its way to CRAN was first posted on March 24, 2025 at 1:00 pm.
To leave a comment for the author, please follow the link and comment on their blog: R-posts.com.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Continue reading: Thanks, on its way to CRAN