From d19995385d25ec88cff3580382786de0614818e5 Mon Sep 17 00:00:00 2001 From: junos Date: Sat, 21 Aug 2021 18:49:57 +0200 Subject: [PATCH] Account for the case when there is no data for days with labels. --- machine_learning/pipeline.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/machine_learning/pipeline.py b/machine_learning/pipeline.py index efc4cb1..bada6df 100644 --- a/machine_learning/pipeline.py +++ b/machine_learning/pipeline.py @@ -171,9 +171,10 @@ class ModelValidation: self.model = None self.cv = None - self.y = y["NA"] + idx_common = X.index.intersection(y.index) + self.y = y.loc[idx_common, "NA"] # TODO Handle the case of multiple labels. - self.X = X.loc[self.y.index] + self.X = X.loc[idx_common] self.groups = self.y.index.get_level_values(group_variable) self.cv_name = cv_name