Skip to content
Snippets Groups Projects

Resolve "Bug: order in feature_importance_bootstrap_method causes crash"

1 file
+ 3
1
Compare changes
  • Side-by-side
  • Inline
@@ -1014,6 +1014,7 @@ class PostProcessing(RunEnvironment):
report_path = os.path.join(self.data_store.get("experiment_path"), "latex_report")
path_config.check_path_and_create(report_path)
res = []
max_cols = 0
for boot_type, d0 in results.items():
for boot_method, d1 in d0.items():
for station_name, vals in d1.items():
@@ -1022,8 +1023,9 @@ class PostProcessing(RunEnvironment):
res.append([boot_type, boot_method, station_name, boot_var, ahead,
*vals.sel({self.boot_var_dim: boot_var,
self.ahead_dim: ahead}).values.round(5).tolist()])
max_cols = max(max_cols, len(res[-1]))
col_names = [self.model_type_dim, "method", "station", self.boot_var_dim, self.ahead_dim,
*list(range(len(res[0]) - 5))]
*list(range(max_cols - 5))]
df = pd.DataFrame(res, columns=col_names)
file_name = "feature_importance_skill_score_report_raw.csv"
df.to_csv(os.path.join(report_path, file_name), sep=";")
Loading