[ENH] forecasting test scenarios for categorical variables#5964
[ENH] forecasting test scenarios for categorical variables#5964
Conversation
(cherry picked from commit cc3d056)
(cherry picked from commit 2de7d8c)
Ref. #5886 (review) (cherry picked from commit 2cecd6b)
(cherry picked from commit 1477012)
There was a problem hiding this comment.
I am completely unfamiliar with this module, and do not know how do these get tested. So may be @benHeid / @achieveordie can review this one, I'm not eligible.
But I'll note that probably these changes allow categorical for classification/regression as well. So, may be that's also something you may want to test?
There was a problem hiding this comment.
This module has scripted test scenarios with arguments to call fit and predict with, these are substituted in the scenarios argument of individual tests (methods) of TestAllForecasters.
The separation and tagging is needed, since not all estimators match with all scenarios.
There was a problem hiding this comment.
But I'll note that probably these changes allow categorical for classification/regression as well. So, may be that's also something you may want to test?
Yes, I suppose - but only in the input X. Though, I would be fairly confident that if things work out well for forecastting, it will likely not be a problem in any other module. Of course not fully.
|
hm, that's quite a lot of failures - should we deal with this via tags, @yarnabrina? |
|
Before I say anything, can you please help me understand what do these failures mean? I am guessing that the failures come from the fact that some (majority I guess, if not all) forecasters do not support categorical features directly and will need some encoding (label - can't use, so one-hot?) transformation earlier. Is that it, or is there something else as well? |
I am guessing the same, but I'm also not sure. My understanding of the failures:
So yes, earlier transformation could prevent the failures, the main issue for me is that it doesn't juts fail, but fails with uninformative error. |
|
We can try to create a new boolean tag, say support-categorical-features and set it as False by default. For different subclasses, e.g. reduction ones may override these as True, as XGBoost, CatBoost, etc. can accept categorical columns directly, though they may need specification of special arguments during What I do not like is depending on previous transformations any forecaster may actually be okay, becuase what is being passed at the end will not be numeric. I don't know if that can be detected or not. We can try to set this categorical support tag separately for input/output of a transformer, but don't know how these will work for non-sktime transformers (which are sklearn-compatible and used with |
Can you give an example? |
Meant this case, e.g. something like this from #5867 (comment): pipeline = (ColumnSelect(columns=["Q"]) * OneHotEncoder()) ** (StandardScaler() * ARIMA())(Plus output conversion tag change that you suggested in this case) |
|
yes, but that would work, no? The pipeline has the tag set to "supports", so nothing should break? |
I'm confused, how will pipeline has "caregorical support" tag as True? By default, ARIMA has False. We can only change tgat value for pipeline to True if there is a transformation on all categorical column(s) to make them numerical. How shall we detect these?
|
We'd just set it to So it would be wrong in some instances, e.g., |
This PR adds two test scenarios for use of categorical variables in forecasting:
ForecasterFitPredictCategorical, with a categorical univariateyand no exogeneous dataForecasterFitPredictCategoricalExog, with a mixed categorical/float exogeneousX, and float univariateyDepends on #5886 which relaxes the
pandasbased types to allow categorical and object data.FYI @yarnabrina - this test should systematically run all forecaster test parameter settings with the given input.