metrics_ransac {RANSAC}R Documentation

Performance Metrics for RANSAC Models

Description

Calculates the root mean square error (RMSE), mean absolute error (MAE), and coefficient of determination (R²) for a model fitted using the RANSAC algorithm.

Usage

metrics_ransac(model, data)

Arguments

model

A model fitted via RANSAC ('ransac_model' or 'ransac_nls').

data

Data frame containing the model variables.

Value

A data frame with RMSE, MAE, and R² calculated on the inliers.

Examples

set.seed(123)
D <- seq(10, 50, by = 5)
H <- seq(15, 30, length.out = length(D))
V <- 0.01 * D^2 * H + rnorm(length(D), sd = 5)
V[c(3, 7)] <- V[c(3, 7)] + 50  # add outliers
data <- data.frame(D = D, H = H, V = V)

model <- ransac_nls(V ~ a * D^b * H^c, data = data,
                    start = list(a = 0.01, b = 2, c = 1),
                    n_min = 4, n_iter = 100, tol = 10)

metrics_ransac(model, data)


[Package RANSAC version 0.1.0 Index]