Learn R Programming

rcaiman (version 2.0.1)

validate_cie_model: 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)

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 Gauch2003;textualrcaiman.

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 Kohavi1995rcaiman. For each fold, predictions are compared against observed relative radiance and a simple linear regression of predicted vs. observed is fitted, following Pineiro2008;textualrcaiman. Outliers are detected with a median–MAD rule (see rem_outliers()) using a threshold of 3 and removed before fitting the regression.

References

Examples

Run this code
if (FALSE) {
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
}

Run the code above in your browser using DataLab