Commit 58fa40a9 authored by kosnil's avatar kosnil
Browse files
parents ec436e88 46b13e00
"","forecast_date","target","horizon","q0.025","q0.25","q0.5","q0.75","q0.975"
"1",2021-12-08,"DAX","1 day",-2.68549816495171,-0.623292823715796,0.0828223771170524,0.822114054392173,2.49748268897254
"2",2021-12-08,"DAX","2 day",-3.72838338265869,-0.93738003528129,0.189061346089738,1.17979660088957,3.33583275705282
"3",2021-12-08,"temperature","36 hour",-1.93859516686411,-0.578317038332597,0.0904507264954277,0.831024016403286,2.22401284949835
"4",2021-12-08,"wind","36 hour",4.75222358301155,8.55527075920534,10.3940953033711,12.2991267180225,16.1968425625162
"5",2021-12-08,"temperature","48 hour",-2.47790212874689,-1.04468615078754,-0.368958347014214,0.374447650356432,1.8294760551777
"6",2021-12-08,"wind","48 hour",3.05028813476215,6.62592847234124,8.48873472417009,10.5624892201995,14.6998129474038
"7",2021-12-08,"DAX","5 day",-4.25016491971215,-0.703467638597591,0.516968100657969,1.78886094197418,4.4015726867205
"8",2021-12-08,"DAX","6 day",-4.70566061860707,-0.87810379108592,0.467013546887524,1.85664730779956,4.91127909618552
"9",2021-12-08,"temperature","60 hour",-1.08331117152067,0.622226691378432,1.46253985879218,2.27524973428095,4.00886914164163
"10",2021-12-08,"wind","60 hour",3.71129244567904,7.56810438576657,9.52761713368088,11.8127151435613,16.0412607883093
"11",2021-12-08,"DAX","7 day",-5.35425368980607,-1.04405993647513,0.574890501411493,1.95294505513645,5.45228050941537
"12",2021-12-08,"temperature","72 hour",-3.15066262737483,-1.28636636955103,-0.454303474496607,0.493716573632005,2.15034914177003
"13",2021-12-08,"wind","72 hour",2.28180471676165,5.82609828071659,7.8674557420896,10.0841065650883,14.4433961936864
"14",2021-12-08,"temperature","84 hour",-1.97096065327534,-0.00226479223997329,0.989681626926872,2.12314078306458,4.3125326738233
"15",2021-12-08,"wind","84 hour",3.0337980187069,6.9553627446315,9.14577998999541,11.5736920086873,16.5188831780117
"","forecast_date","target","horizon","q0.025","q0.25","q0.5","q0.75","q0.975"
"1",2021-12-08,"DAX","1 day",-2.768865,-0.603312312944606,0.0754703763075959,0.807759199764219,2.57699054200194
"2",2021-12-08,"DAX","2 day",-3.93656249759128,-0.84819557625469,0.15394269408694,1.0837719699674,3.36686463031345
"3",2021-12-08,"temperature","36 hour",-2.08156151450643,-0.66177897964146,0.0254181275219436,0.799277588012707,2.13239776955032
"4",2021-12-08,"wind","36 hour",4.04927887414187,7.83015377758759,9.80434606950001,12.0721803056686,16.3767461425425
"5",2021-12-08,"temperature","48 hour",-2.28678745322705,-0.836173697322976,-0.20696671903318,0.575121428265187,2.0380942350687
"6",2021-12-08,"wind","48 hour",2.18715522869986,5.8019602857362,7.74331656078175,10.1165451587023,14.7191620289369
"7",2021-12-08,"DAX","5 day",-4.75944674725471,-0.834726688584375,0.30253451779415,1.75411092200915,4.30744297622689
"8",2021-12-08,"DAX","6 day",-5.24615804417818,-1.1148874590796,0.293949359258868,1.76426738280055,4.69440506438463
"9",2021-12-08,"temperature","60 hour",-0.944770372272089,0.674393710245137,1.53834717330018,2.33078216717043,4.00860363132344
"10",2021-12-08,"wind","60 hour",3.31632070838716,7.24507377182637,9.34357897062739,11.6889973181319,16.2214362775311
"11",2021-12-08,"DAX","7 day",-5.75308316717284,-1.10980931887409,0.392182685950626,1.89560391032554,5.28773680321487
"12",2021-12-08,"temperature","72 hour",-2.91009812568095,-1.23938446998247,-0.384682849660641,0.485129126560036,2.07594127705778
"13",2021-12-08,"wind","72 hour",1.47702590522749,5.28613455082809,7.3151526768402,9.8925434965705,14.8730900612386
"14",2021-12-08,"temperature","84 hour",-1.80701104985426,-0.0636376857502883,0.966929847340567,2.09991160232648,4.28523968144451
"15",2021-12-08,"wind","84 hour",2.01812510233878,6.10386399899966,8.80803136942312,11.6896296540153,17.1774643841398
"forecast_date","target","horizon","q0.025","q0.25","q0.5","q0.75","q0.975"
"2021-12-15","DAX","1 day",-2.71099410396365,-0.485396555504147,0.0733950537846084,0.65948147757644,2.43822167008952
"2021-12-15","DAX","2 day",-3.93656249759128,-0.748017337438078,0.162164603826653,0.910938083469892,3.1329715130069
"2021-12-15","DAX","5 day",-4.75944674725471,-0.846163184392834,0.165364453806394,1.22275451519016,3.89032640718187
"2021-12-15","DAX","6 day",-5.24615804417818,-0.968345906220103,0.242304787813641,1.41010627993872,4.57407374600166
"2021-12-15","DAX","7 day",-5.75308316717284,-1.09294845009975,0.385871361460932,1.4963419076008,5.19223708311003
"forecast_date","target","horizon","q0.025","q0.25","q0.5","q0.75","q0.975"
2021-12-15,"temperature","36 hour",6.45927192863802,7.98622261331378,8.78741532364009,9.5886080339664,11.1155587186422
2021-12-15,"temperature","48 hour",2.93126184111122,4.9082899528704,5.94563878616819,6.98298761946597,8.96001573122516
2021-12-15,"temperature","60 hour",3.775904424256,5.83974698759074,6.92264745949175,8.00554793139277,10.0693904947275
2021-12-15,"temperature","72 hour",-1.83683988900023,1.64998927995056,3.4795323950969,5.30907551024324,8.79590467919403
2021-12-15,"temperature","84 hour",-0.333336890872512,3.39691785053066,5.35418663233615,7.31145541414164,11.0417101555448
"forecast_date","target","horizon","q0.025","q0.25","q0.5","q0.75","q0.975"
2021-12-15,"temperature","36 hour",6.74725,7.7625,8.235,8.785,9.4625
2021-12-15,"temperature","48 hour",2.65975,4.4325,5.39,6.2475,7.60775
2021-12-15,"temperature","60 hour",4.337,5.335,6.275,7.4225,8.7015
2021-12-15,"temperature","72 hour",-0.1505,0.43,1.26,5.63,8.325
2021-12-15,"temperature","84 hour",0.6155,2.2025,5.085,7.7625,8.928
"forecast_date","target","horizon","q0.025","q0.25","q0.5","q0.75","q0.975"
2021-12-15,"wind","36 hour",8.90950537152506,12.9847323718975,15.1230271633983,17.2613238217304,21.3365915360542
2021-12-15,"wind","48 hour",6.41573484011715,11.5833824564172,14.2998182082176,17.0167519002577,22.1952242762163
2021-12-15,"wind","60 hour",7.83866107572064,12.1174327090262,14.362679419647,16.6079431688224,20.8870863539034
2021-12-15,"wind","72 hour",1.56865148874991,6.22883125279099,9.04874267931344,11.9185566053424,17.4307233057337
2021-12-15,"wind","84 hour",3.12196606683951,9.7267543719942,13.4440650953068,17.1903636291751,24.3546030601243
"forecast_date","target","horizon","q0.025","q0.25","q0.5","q0.75","q0.975"
2021-12-15,"wind","36 hour",10.14375,11.055,12.57,13.545,14.2215
2021-12-15,"wind","48 hour",8.42775,10.0675,11.495,13.2525,15.436
2021-12-15,"wind","60 hour",8.77575,10.45,11.77,12.5175,14.8485
2021-12-15,"wind","72 hour",3.272,5.915,7.69,9.135,12.57675
2021-12-15,"wind","84 hour",4.14175,6.59,10.465,13.81,18.28775
......@@ -6,7 +6,7 @@ library(quantmod)
# source functions:
source("functions.R")
forecast_dates0 <- Sys.Date() - 10:2 # as.Date("2021-11-17")
forecast_dates0 <- Sys.Date() - 10:1 # as.Date("2021-11-17")
forecast_dates <- forecast_dates0[weekdays(forecast_dates0) %in% c("Mittwoch", "Wednesday")]
# forecast_dates <- as.Date("2021-11-17")
......@@ -23,13 +23,13 @@ for(i in seq_along(forecast_dates)){
# read in:
all_forecasts <- NULL
for(i in seq_along(files)){
dat_temp <- read.csv(paste0("../", week_tag, "/", files[i]),
for(j in seq_along(files)){
dat_temp <- read.csv(paste0("../", week_tag, "/", files[j]),
colClasses = c(forecast_date = "Date"))
dat_temp$X <- NULL
dat_temp$model <- extract_name_from_file(files[i])
dat_temp$model <- extract_name_from_file(files[j])
if(!is.null(all_forecasts)){
all_forecasts <- rbind(all_forecasts, dat_temp)
......@@ -49,10 +49,6 @@ for(i in seq_along(forecast_dates)){
dat_dax$value <- 100*(log(dat_dax$value) - log(reference_value))
truths_dax <- subset(dat_dax, date %in% (forecast_date + c(1, 2, 5, 6, 7)))
truths_dax <- truths_dax[order(truths_dax$date), ]
truths_dax$target <- "DAX"
truths_dax$horizon <- c("1 day", "2 day", "5 day", "6 day", "7 day")[1:nrow(truths_dax)]
truths_dax$date <- NULL
# subset forecasts to DAX:
dax_forecasts <- subset(all_forecasts, target == "DAX")
......@@ -61,9 +57,20 @@ for(i in seq_along(forecast_dates)){
dax_forecasts <- subset(dax_forecasts,
horizon %in% c("1 day", "2 day", "5 day", "6 day", "7 day"))
# add truth data:
dax_forecasts <- merge(dax_forecasts, truths_dax, by = c("target", "horizon"), all.x = TRUE)
# add truths:
if(nrow(truths_dax) > 0){
truths_dax <- truths_dax[order(truths_dax$date), ]
truths_dax$target <- "DAX"
truths_dax$horizon <- c("1 day", "2 day", "5 day", "6 day", "7 day")[1:nrow(truths_dax)]
truths_dax$date <- NULL
# add truth data:
dax_forecasts <- merge(dax_forecasts, truths_dax, by = c("target", "horizon"), all.x = TRUE)
}else{
# if no truth data available: add NA values:
dax_forecasts$value <- NA
}
# add truths to wind forecasts:
truth_wind <- read.csv("../ptsfc_viz/plot_data/wind.csv")
......
......@@ -15,66 +15,72 @@ for(lab in labels_weeks){
# identify files
fls <- list.files(paste0("../", lab))
# run through files and read in:
result <- NULL
for(i in seq_along(fls)){
dat_temp <- read.csv(paste0("../", lab, "/", fls[i]),
colClasses = c(forecast_date = "Date"))
# remove row numbers if necessary:
dat_temp$X <- NULL
# add model name:
dat_temp$model <- extract_name_from_file(fls[i])
# add column for target end date / time:
dat_temp$target_end_date <- NA
# re-format forecast time:
dat_temp$forecast_date <- as.POSIXlt(dat_temp$forecast_date, "GMT") + 24*60*60 - 60
# handle DAX forecasts:
subs_DAX <- subset(dat_temp, target == "DAX")
# generate target end date / time:
days_numeric <- as.numeric(gsub(" day", "", subs_DAX$horizon))
subs_DAX$target_end_date <- subs_DAX$forecast_date + 60 + days_numeric*24*60*60 - 6.5*60*60
if(any(grepl("ensemble", fls))){
# run through files and read in:
result <- NULL
for(i in seq_along(fls)){
dat_temp <- read.csv(paste0("../", lab, "/", fls[i]),
colClasses = c(forecast_date = "Date"))
# remove row numbers if necessary:
dat_temp$X <- NULL
# add model name:
dat_temp$model <- extract_name_from_file(fls[i])
# add column for target end date / time:
dat_temp$target_end_date <- NA
# re-format forecast time:
dat_temp$forecast_date <- as.POSIXlt(dat_temp$forecast_date, "GMT") + 24*60*60 - 60
# handle DAX forecasts:
subs_DAX <- subset(dat_temp, target == "DAX")
# generate target end date / time:
days_numeric <- as.numeric(gsub(" day", "", subs_DAX$horizon))
subs_DAX$target_end_date <- subs_DAX$forecast_date + 60 + days_numeric*24*60*60 - 6.5*60*60
# handle weather forecasts:
subs_weather <- subset(dat_temp, target %in% c("wind", "temperature"))
# generate target end date / time:
hours_numeric <- as.numeric(gsub(" hour", "", subs_weather$horizon))
subs_weather$target_end_date <- subs_weather$forecast_date + 60 + hours_numeric*60*60 - 24*60*60
# put back together:
dat_temp <- rbind(subs_DAX, subs_weather)
# add to data.frame:
if(!is.null(result)){
result <- rbind(result, dat_temp)
}else{
result <- dat_temp
}
}
# handle weather forecasts:
subs_weather <- subset(dat_temp, target %in% c("wind", "temperature"))
# generate target end date / time:
hours_numeric <- as.numeric(gsub(" hour", "", subs_weather$horizon))
subs_weather$target_end_date <- subs_weather$forecast_date + 60 + hours_numeric*60*60 - 24*60*60
# get evaluation data:
dat_eval <- NULL
try({
dat_eval <- read.csv(paste0("../evaluation/evaluation_", lab, ".csv"))
}, silent = TRUE)
# put back together:
dat_temp <- rbind(subs_DAX, subs_weather)
# add to data.frame:
# write out if non-empty
if(!is.null(result)){
result <- rbind(result, dat_temp)
}else{
result <- dat_temp
# add evaluation data:
if(!is.null(dat_eval)){
dat_eval <- dat_eval[, c("target", "model", "horizon", "mean_qscore", "ae")]
result <- merge(result, dat_eval, by = c("model", "target", "horizon"), all.x = TRUE)
}else{
result$mean_qscore <- result$ae <- NA
}
# result <- subset(result, target == "DAX" & horizon %in% paste(c(1, 2, 5, 6, 7), "day"))
forecast_date <- as.Date(result$forecast_date[1])
write.csv(result, file = paste0("../ptsfc_viz/plot_data/plot_data_", forecast_date, ".csv"), row.names = FALSE)
}
}else{
warning(paste("Not processing visualization data for ", lab, "as ensemble not created yet."))
}
# get evaluation data:
dat_eval <- NULL
try({
dat_eval <- read.csv(paste0("../evaluation/evaluation_", lab, ".csv"))
}, silent = TRUE)
# write out if non-empty
if(!is.null(result)){
# add evaluation data:
if(!is.null(dat_eval)){
dat_eval <- dat_eval[, c("target", "model", "horizon", "mean_qscore", "ae")]
result <- merge(result, dat_eval, by = c("model", "target", "horizon"), all.x = TRUE)
}else{
result$mean_qscore <- result$ae <- NA
}
# result <- subset(result, target == "DAX" & horizon %in% paste(c(1, 2, 5, 6, 7), "day"))
forecast_date <- as.Date(result$forecast_date[1])
write.csv(result, file = paste0("../ptsfc_viz/plot_data/plot_data_", forecast_date, ".csv"), row.names = FALSE)
}
}
setwd("/home/johannes/Documents/Teaching/Ensemble_Seminar/ptsfc_results/code")
#johannes
#setwd("/home/johannes/Documents/Teaching/Ensemble_Seminar/ptsfc_results/code")
#nils
setwd("/home/nils/projects/ptsfc_results/code")
# update the wind data (stored in ptsfc_viz, but also used for evaluation etc):
source("retrieve_weather_data_ts.R")
......@@ -24,5 +28,9 @@ source("process_viz_data.R")
# evaluation/evaluation_<date>.csv
# re-deploy app:
#johannes
setwd("/home/johannes/Documents/Teaching/Ensemble_Seminar/ptsfc_results/ptsfc_viz")
#nils
setwd("/home/nils/projects/ptsfc_results/ptsfc_viz")
rsconnect::deployApp()
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
"model","n_eval_cases","mean_rk_wind","mean_rk_temp","mean_rk_dax","mean_rk_overall"
"AryaStark",79,6.6,9.4,12.8,9.6
"Bronn",79,14.8,12.2,14.6,13.8666666666667
"CaptainRaymondHolt",79,7.2,7.2,7.8,7.4
"ChandlerBing",79,8,17.8,9.4,11.7333333333333
"DexterJettster",79,15.2,6.6,11.4,11.0666666666667
"DougJudy",79,12,5.4,6.4,7.93333333333333
"GeneralGrievous",79,20,19.2,19,19.4
"GinaLinetti",79,20.8,16.6,14.6,17.3333333333333
"HanSolo",79,5.2,15.2,10.6,10.3333333333333
"HotPie",79,8,7.8,4.2,6.66666666666667
"JabbaTheHutt",79,16.6,19.4,19.2,18.4
"Joey",79,7.6,7.2,4.8,6.53333333333333
"Joffrey_Baratheon",79,17.2,5.6,10.4,11.0666666666667
"KyloRen",79,6,7.2,9.4,7.53333333333333
"ObiWanKenobi",79,9.4,8.8,14.4,10.8666666666667
"PhoebeBuffay",79,5,7.2,5.8,6
"RossGeller",79,18.6,21,20.6,20.0666666666667
"SamwellTarly",79,15.6,16.4,13,15
"Shaggydog",79,4.6,9,10.2,7.93333333333333
"UglyNakedGuy",79,6.8,6,6.8,6.53333333333333
"Yoda",79,5.8,5.8,5.6,5.73333333333333
"AryaStark",94,6.6,8.6,11.4,8.86666666666667
"Bronn",94,14.6,11.6,13.6,13.2666666666667
"CaptainRaymondHolt",94,7.2,5.6,5.8,6.2
"ChandlerBing",94,8,17.8,9.8,11.8666666666667
"DexterJettster",94,14.6,8.6,11,11.4
"DougJudy",94,14,4,8.4,8.8
"GeneralGrievous",94,20,19.2,18.8,19.3333333333333
"GinaLinetti",94,20.8,16.6,15,17.4666666666667
"HanSolo",94,7.2,15.2,8.4,10.2666666666667
"HotPie",94,8,6.6,5.6,6.73333333333333
"JabbaTheHutt",94,17.6,19.4,19.4,18.8
"Joey",94,8.2,9.8,4.2,7.4
"Joffrey_Baratheon",94,17.6,11.4,13.6,14.2
"KyloRen",94,5.6,7.2,7.2,6.66666666666667
"ObiWanKenobi",94,8.8,6.4,13.2,9.46666666666667
"PhoebeBuffay",94,3.8,6.8,5.6,5.4
"RossGeller",94,18.8,21,20.6,20.1333333333333
"SamwellTarly",94,15,16.4,18.2,16.5333333333333
"Shaggydog",94,3.6,7.2,9.4,6.73333333333333
"UglyNakedGuy",94,6,7,7.8,6.93333333333333
"Yoda",94,5,4.6,4,4.53333333333333
This diff is collapsed.
Markdown is supported
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