Repository: sktime/sktime

Issue:
[BUG] `ignores-exogeneous` tag incorrectly set in a few forecasters
Update - estimators where the `ignores-exogeneous` tag needs to be fixed:

- [x] ARIMA family, may have to be set to `False` (see below)
- [x] `TrendForecaster`, should be set to `True

---
**Describe the bug**
Tag `ignores-exogeneous-X` for some models may not be set correctly, e.g. for ARIMA model (seems to support exogenous variables in `sktime`), but tag indicates otherwise.

**To Reproduce**

https://gist.github.com/ngupta23/61c0d18ccf89b8b607acf21b8833f7bb


**Expected behavior**
ARIMA should show the support for X (currently tag `ignores-exogeneous-X` is marked as True)

**Additional context**
Would also like to know which of the models support exogenous variables. Is there a quick way to find this?

**Versions**
<details>

System:
    python: 3.7.12 (default, Sep 10 2021, 00:21:48)  [GCC 7.5.0]
executable: /usr/bin/python3
   machine: Linux-5.4.144+-x86_64-with-Ubuntu-18.04-bionic

Python dependencies:
          pip: 21.1.3
   setuptools: 57.4.0
      sklearn: 1.0.1
       sktime: 0.9.0
  statsmodels: 0.13.1
        numpy: 1.19.3
        scipy: 1.4.1
       Cython: 0.29.24
       pandas: 1.1.5
   matplotlib: 3.2.2
       joblib: 1.1.0
        numba: 0.54.1
     pmdarima: 1.8.4
      tsfresh: None

</details>




Discussion:
> Would also like to know which of the models support exogenous variables. Is there a quick way to find this?

All forecasters allow to pass `X`, but not all will *use* it internally. Those that do, should have the `ignores-exogeneous-X` tag set to `False`. So searching for the ones with `False` (using `registry.all_estimators` should retrieve those you want.

If ARIMA has the tag wrong, that's a bug - would appreciate a PR then. For ARIMA, this may have to be set in `_PmdArimaAdapter` or the children, depending on whether all or only some of the children use `X`.
Thank. I will look into this. There seems to be another issue:

For `TrendForecaster`, the tag is set to `False` but for `PolyTrendForecaster`, it is set to `True`. So for `TrendForecaster`, when I pass X variables during training (univariate **with** exogenous), the predictions after training are no different than case where X is not passed (univariate **without** exogenous). Is this expected or is the tag incorrectly marked as `False`?

https://gist.github.com/ngupta23/d1b83fb4734c7c0eb7ba62af90d49dae

Thanks!

Yes, the `TrendForecaster` is also an erroneous instance of the tag being incorrectly set, thanks for going through this!

One can see this by looking at `fit` and `predict`, where `X` is immediately overwritten by something based entirely on `y`. I assume whoever set the tags saw the code and thought `X` was used since it was passed to an internal `predict`, but that `X` is based on `y` only.
I added some checkboxes at the top to collect the instances.

Resolving patch:
diff --git a/sktime/forecasting/base/adapters/_pmdarima.py b/sktime/forecasting/base/adapters/_pmdarima.py
--- a/sktime/forecasting/base/adapters/_pmdarima.py
+++ b/sktime/forecasting/base/adapters/_pmdarima.py
@@ -17,7 +17,7 @@ class _PmdArimaAdapter(BaseForecaster):
     """Base class for interfacing pmdarima."""
 
     _tags = {
-        "ignores-exogeneous-X": True,
+        "ignores-exogeneous-X": False,
         "capability:pred_int": True,
         "requires-fh-in-fit": False,
         "handles-missing-data": False,
diff --git a/sktime/forecasting/trend.py b/sktime/forecasting/trend.py
--- a/sktime/forecasting/trend.py
+++ b/sktime/forecasting/trend.py
@@ -8,11 +8,11 @@
 
 import numpy as np
 import pandas as pd
+from sklearn.base import clone
 from sklearn.linear_model import LinearRegression
 from sklearn.pipeline import make_pipeline
 from sklearn.preprocessing import PolynomialFeatures
 
-from sklearn.base import clone
 from sktime.forecasting.base import BaseForecaster
 from sktime.forecasting.base._base import DEFAULT_ALPHA
 from sktime.utils.datetime import _get_duration
@@ -41,7 +41,7 @@ class TrendForecaster(BaseForecaster):
     """
 
     _tags = {
-        "ignores-exogeneous-X": False,
+        "ignores-exogeneous-X": True,
         "requires-fh-in-fit": False,
         "handles-missing-data": False,
     }


Test patch: