From 35265cb006af114a6dcaaa4c20c364df68da3122 Mon Sep 17 00:00:00 2001 From: Peter Shaffery Date: Fri, 20 Dec 2024 08:28:28 -0800 Subject: [PATCH] models module upgrades Summary: PSS2 upgrades that can be shipped pre-upgrade for the models module and tests Reviewed By: islijepcevic Differential Revision: D67507978 fbshipit-source-id: 712a143f8613abb189b9d227849878c0a3085405 --- kats/models/bayesian_var.py | 2 +- kats/models/globalmodel/backtester.py | 3 ++- kats/models/metalearner/metalearner_hpt.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/kats/models/bayesian_var.py b/kats/models/bayesian_var.py index 0279824a..84f15c79 100644 --- a/kats/models/bayesian_var.py +++ b/kats/models/bayesian_var.py @@ -442,7 +442,7 @@ def predict( [Y_curr, look_ahead_pred[:, np.newaxis]], axis=1 ) - times += ahead_times + times += list(ahead_times) forecast_length = len(times) diff --git a/kats/models/globalmodel/backtester.py b/kats/models/globalmodel/backtester.py index 2975eca3..f7ee6341 100644 --- a/kats/models/globalmodel/backtester.py +++ b/kats/models/globalmodel/backtester.py @@ -438,7 +438,8 @@ def _evaluate( ] ans.extend(tmp_ans) ensemble_fcst = np.median( - np.column_stack(fcst_all[i][k][j] for i in range(n)), axis=1 + np.column_stack(fcst_all[i][k][j] for i in range(n)), + axis=1, ) evl = eval_func(ensemble_fcst, tmp_actuals) evl["step"] = j diff --git a/kats/models/metalearner/metalearner_hpt.py b/kats/models/metalearner/metalearner_hpt.py index 8c03ed79..56d027df 100644 --- a/kats/models/metalearner/metalearner_hpt.py +++ b/kats/models/metalearner/metalearner_hpt.py @@ -260,7 +260,7 @@ def __init__( ) # pyre-fixme[4]: Attribute must be annotated. self._dim_output_num = ( - self._target_num.shape[1] if self.numerical_idx else 0 + self._target_num.shape[1] if self._target_num is not None else 0 ) self._get_target_cat() self._validate_data()