Commit 4e628e2d authored by fabian.krueger's avatar fabian.krueger
Browse files

edit evaluation code

parent 8fc5e3e7
......@@ -3,6 +3,8 @@
# needs to be run from repository root folder
# setwd("/home/johannes/Documents/Teaching/Ensemble_Seminar/ptsfc_results/")
library(dplyr)
eval_files <- list.files("evaluation")
eval_files <- eval_files[grep("evaluation_2", eval_files)]
......@@ -23,15 +25,25 @@ all_evals$interval_coverage_0.5 <- as.numeric(all_evals$interval_coverage_0.5)
all_evals$interval_coverage_0.95 <- as.numeric(all_evals$interval_coverage_0.95)
all_evals$scores_imputed <- as.numeric(all_evals$scores_imputed)
summary_all_evals <- aggregate(cbind(ae, mean_qscore, interval_coverage_0.5, interval_coverage_0.95) ~ model + target + horizon,
data = all_evals, FUN = mean, na.rm = TRUE)
#summary_all_evals <- aggregate(cbind(ae, mean_qscore, interval_coverage_0.5, interval_coverage_0.95) ~ model + target + horizon,
# data = all_evals, FUN = mean, na.rm = TRUE)
# add number of forecasts counted:
all_evals$n <- 1
n_forecasts <- aggregate(cbind(n, scores_imputed) ~ model + target + horizon,
data = all_evals, FUN = sum, na.rm = TRUE)
summary_all_evals <- merge(summary_all_evals, n_forecasts, by = c("model", "target", "horizon"))
#all_evals$n <- 1
#n_forecasts <- aggregate(cbind(n, scores_imputed) ~ model + target + horizon,
# data = all_evals, FUN = sum, na.rm = TRUE)
#summary_all_evals <- merge(summary_all_evals, n_forecasts, by = c("model", "target", "horizon"))
summary_all_evals <- all_evals %>%
# remove weather forecasts from Oct 27 (location changed from KA to B)
filter(! (forecast_date == "2021-10-27" & target != "DAX") ) %>%
# remove cases with missing ae (due to missing truth data)
filter(!is.na(ae)) %>%
# compute mean scores, count # of forecasts and # of imputed scores
group_by(model, target, horizon) %>%
summarise(ae = mean(ae),
mean_qscore = mean(mean_qscore),
interval_coverage_0.5 = mean(interval_coverage_0.5),
interval_coverage_0.95 = mean(interval_coverage_0.95),
n = n(), scores_imputed = sum(scores_imputed))
write.csv(summary_all_evals, file = "ptsfc_viz/plot_data/summary_eval.csv", row.names = FALSE)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment