validate_cie_model: Validate CIE sky models

View source: R/validate_cie_model.R

validate_cie_modelR Documentation

Validate CIE sky models

Description

Validate CIE sky models fitted with fit_cie_model() (or ootb_sky_cie()) using k-fold cross-validation on relative radiance.

Usage

validate_cie_model(model, k = 10)

Arguments

model

list. Output of fit_cie_model().

k

numeric vector of length one. Number of folds.

Details

Validation uses k-fold cross-validation with k = 10 by default \insertCiteKohavi1995rcaiman. For each fold, predictions are compared against observed relative radiance and a simple linear regression of predicted vs. observed is fitted, following \insertCitePineiro2008;textualrcaiman. Outliers are detected with a median–MAD rule (see rem_outliers()) using a threshold of 3 and removed before fitting the regression.

Value

A list with:

lm

An object of class lm (see stats::lm()) for predicted vs. observed.

pred

Numeric vector of predicted relative radiance used in lm.

obs

Numeric vector of observed relative radiance used in lm.

r_squared

Coefficient of determination (R^2).

rmse

Root mean squared error (RMSE).

mae

Median absolute error (MAE).

is_outlier

Logical vector marking outliers (MAD > 3) in the original sky-point set.

metric

Numeric value. Mean squared deviation as in \insertCiteGauch2003;textualrcaiman.

References

\insertAllCited

Examples

## Not run: 
caim <- read_caim()
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)
path <- system.file("external/sky_points.csv", package = "rcaiman")
sky_points <- read.csv(path)[c("Y", "X")]
names(sky_points) <- c("row", "col")
rr <- extract_rr(caim$Blue, z, a, sky_points)

set.seed(7)
model <- fit_cie_model(rr, sun_angles = c(z = 49.5, a = 27.4),
                       general_sky_type = "Clear", method = "CG")
val <- validate_cie_model(model, k = 10)
val$r_squared
val$rmse

## End(Not run)

rcaiman documentation built on Sept. 9, 2025, 5:42 p.m.