benchmark/mlr-bmr/run-best-model-runtime.R

files = list.files(path = "~/repos/compboost/benchmark/mlr-bmr/res-results", full.names = TRUE)

extractStringBetween = function(str, left, right) {
  tmp = sapply(strsplit(str, left), function(x) x[2])
  sapply(strsplit(tmp, right), function(x) x[1])
}

if (! dir.exists("~/repos/compboost/benchmark/mlr-bmr/best-runs"))
  dir.create("~/repos/compboost/benchmark/mlr-bmr/best-runs")

k = 1L
for (fn in files) {
  is_done = any(grepl(fn, list.files("best-runs")))
  if (is_done) {
    cat(k, "/", length(files), ": Already done\n", sep = "")
  } else {
    config_runtime = list(
      ts = extractStringBetween(fn, "-task", "-classif_"),
      ln = paste0("classif_", extractStringBetween(fn, "classif_", ".Rda")),
      file = fn)

    cat(k, "/", length(files), ": ", fn, "\n", sep = "")

    save(config_runtime, file = "~/repos/compboost/benchmark/mlr-bmr/config-best-model.Rda")
    system("Rscript best-model-runtime.R")
  }
  k = k + 1L
}

if (FALSE) {
  files = list.files("best-runs", full.names = TRUE)

  ll = list()
  for (fn in files) {
    load(fn)
    ll = c(ll, list(df_best))
  }
  df_run = do.call(rbind, ll)
}
schalkdaniel/compboost documentation built on April 15, 2023, 9:03 p.m.