Skip to content

24-7 Today

Menu
  • Home
  • Ads Guide
  • Blogging
  • Sec Tips
  • SEO Strategies
Menu

Thanks, on its way to CRAN

Posted on March 24, 2025 by 24-7

[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
##    values
actual    <- 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
##    values
cat(
  "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.

{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.

Related

Related

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

©2025 24-7 Today | Design: WordPress | Design: Facts