Skip to content

Commit e043201

Browse files
committed
fix array mismatch
1 parent 5f103d8 commit e043201

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

neuralprophet/forecaster.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2916,7 +2916,13 @@ def _train(
29162916

29172917
# Return metrics collected in logger as dataframe
29182918
if self.metrics_logger.history is not None:
2919-
metrics_df = pd.DataFrame(self.metrics_logger.history)
2919+
# avoid array mismatch when continuing training
2920+
history = self.metrics_logger.history
2921+
max_length = max(len(lst) for lst in history.values())
2922+
for key in history:
2923+
while len(history[key]) < max_length:
2924+
history[key].append(None)
2925+
metrics_df = pd.DataFrame(history)
29202926
else:
29212927
metrics_df = pd.DataFrame()
29222928
return metrics_df

0 commit comments

Comments
 (0)