View source: R/validate_cie_sky_model.R
validate_cie_sky_model | R Documentation |
Validate CIE sky models fitted with fit_cie_sky_model()
and
ootb_fit_cie_sky_model()
.
validate_cie_sky_model(model, rr, k = 10)
model |
An object of the class list. The output of
|
rr |
An object of class list. The output of |
k |
Numeric vector of length ones. Number of folds. |
The validation of the CIE sky model is done with a k-fold approach with k equal to 10, following \insertCiteKohavi1995;textualrcaiman, and for the values of relative radiance. The regression of the predicted vs. observed values was done following \insertCitePineiro2008;textualrcaiman. The is_outlier were determined following \insertCiteLeys2013;textualrcaiman and with threshold equal to 3.
A list with the following components:
An object of class lm
(see stats::lm()
).
predicted values.
observed vales.
the coefficient of determination (r^2
).
The root mean squared error (RMSE).
The median absolute error (MAE).
A logical vector indicating is_outlier within the sky points set attached to the 'model' argument.
## Not run:
caim <- read_caim() %>% normalize_minmax()
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)
# See fit_cie_sky_model() for details on below file
path <- system.file("external/sky_points.csv",
package = "rcaiman")
sky_points <- read.csv(path)
sky_points <- sky_points[c("Y", "X")]
colnames(sky_points) <- c("row", "col")
head(sky_points)
plot(caim$Blue)
points(sky_points$col, nrow(caim) - sky_points$row, col = 2, pch = 10)
xy <- c(210, 451) #taken with click() after x11(), then hardcoded here
sun_coord <- zenith_azimuth_from_row_col(z, a, c(nrow(z) - xy[2],xy[1]))
points(sun_coord$row_col[2], nrow(caim) - sun_coord$row_col[1],
col = 3, pch = 1)
rr <- extract_rel_radiance(caim$Blue, z, a, sky_points)
set.seed(7)
model <- fit_cie_sky_model(rr, sun_coord,
general_sky_type = "Clear",
twilight = FALSE,
method = "CG")
model_validation <- validate_cie_sky_model(model, rr)
model_validation$r_squared
model_validation$rmse
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.