From dd7cf035f002cb87e2323063121007166c29ffb8 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Tue, 22 Oct 2024 17:13:28 +0100 Subject: [PATCH 1/2] auto arima xreg rank deficient test correction --- nbs/src/arima.ipynb | 2 +- python/statsforecast/arima.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nbs/src/arima.ipynb b/nbs/src/arima.ipynb index 5984481ca..878d7c456 100644 --- a/nbs/src/arima.ipynb +++ b/nbs/src/arima.ipynb @@ -2385,7 +2385,7 @@ " else:\n", " if constant_columns.any():\n", " xregg = xregg[:, ~constant_columns]\n", - " X = np.hstack([np.arange(1, xregg.shape[0]+1).reshape(-1, 1), xregg])\n", + " X = np.hstack([np.repeat(1, xregg.shape[0]).reshape(-1, 1), xregg])\n", " X = X[~np.isnan(X).any(1)]\n", " _, sv, _ = np.linalg.svd(X)\n", " if sv.min() / sv.sum() < np.finfo(np.float64).eps:\n", diff --git a/python/statsforecast/arima.py b/python/statsforecast/arima.py index 09d4b678e..f6e4ff3cf 100644 --- a/python/statsforecast/arima.py +++ b/python/statsforecast/arima.py @@ -1446,7 +1446,7 @@ def auto_arima_f( else: if constant_columns.any(): xregg = xregg[:, ~constant_columns] - X = np.hstack([np.arange(1, xregg.shape[0] + 1).reshape(-1, 1), xregg]) + X = np.hstack([np.repeat(1, xregg.shape[0]).reshape(-1, 1), xregg]) X = X[~np.isnan(X).any(1)] _, sv, _ = np.linalg.svd(X) if sv.min() / sv.sum() < np.finfo(np.float64).eps: From bc745f5a468263cca62f9fecfb97cb637d324355 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Tue, 22 Oct 2024 17:13:28 +0100 Subject: [PATCH 2/2] auto arima xreg rank deficient test correction --- nbs/src/arima.ipynb | 2 +- python/statsforecast/arima.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nbs/src/arima.ipynb b/nbs/src/arima.ipynb index 878d7c456..658fc71fa 100644 --- a/nbs/src/arima.ipynb +++ b/nbs/src/arima.ipynb @@ -2385,7 +2385,7 @@ " else:\n", " if constant_columns.any():\n", " xregg = xregg[:, ~constant_columns]\n", - " X = np.hstack([np.repeat(1, xregg.shape[0]).reshape(-1, 1), xregg])\n", + " X = np.hstack([np.ones([xregg.shape[0], 1]), xregg])\n", " X = X[~np.isnan(X).any(1)]\n", " _, sv, _ = np.linalg.svd(X)\n", " if sv.min() / sv.sum() < np.finfo(np.float64).eps:\n", diff --git a/python/statsforecast/arima.py b/python/statsforecast/arima.py index f6e4ff3cf..2e2b67e6a 100644 --- a/python/statsforecast/arima.py +++ b/python/statsforecast/arima.py @@ -1446,7 +1446,7 @@ def auto_arima_f( else: if constant_columns.any(): xregg = xregg[:, ~constant_columns] - X = np.hstack([np.repeat(1, xregg.shape[0]).reshape(-1, 1), xregg]) + X = np.hstack([np.ones([xregg.shape[0], 1]), xregg]) X = X[~np.isnan(X).any(1)] _, sv, _ = np.linalg.svd(X) if sv.min() / sv.sum() < np.finfo(np.float64).eps: