Skip to content

Commit

Permalink
fix array mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
weberpals committed Jul 9, 2024
1 parent 5f103d8 commit e043201
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion neuralprophet/forecaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -2916,7 +2916,13 @@ def _train(

# Return metrics collected in logger as dataframe
if self.metrics_logger.history is not None:
metrics_df = pd.DataFrame(self.metrics_logger.history)
# avoid array mismatch when continuing training
history = self.metrics_logger.history
max_length = max(len(lst) for lst in history.values())
for key in history:
while len(history[key]) < max_length:
history[key].append(None)
metrics_df = pd.DataFrame(history)
else:
metrics_df = pd.DataFrame()
return metrics_df
Expand Down

0 comments on commit e043201

Please sign in to comment.