Hi, I've got some good results with stataforecast ...
# general
m
Hi, I've got some good results with stataforecast AutoARIMA together with exogenous features. I'm trying to reduce the number of dummy predictors as I have (approx 50) and I've created a custom sklearn transformer for that. It works as intended when I run on MLForecast sklearn's LinearRegression but when I try to replace it with statsforecast AutoARIMA or ARIMA I get "AttributeError: 'DataFrame' object has no attribute 'dtype'". It looks to be running on numpy, and when I edit my transformer to return numpy I get "ValueError: auto_arima can only handle univariate time series". Is there a way to use custom transformers in statsforecast side too or is there a way to use AutoARIMA in the MLForecast pipeline context?
linear_regression = LinearRegression() arima = AutoARIMA() pipeline = Pipeline( [ ("PromoAverageTransformer", promotion_avg_transformer), # ("LinearRegression", linear_regression), ("ARIMAX", arima), ] ) ml = MLForecast( models={"promo_lr": pipeline}, freq="1d", ) cv_results = ml.cross_validation( df=features, h=21, step_size=21, n_windows=18, time_col="Date", id_col="Market", target_col="Visitors", static_features=[], )
o
What happens when you use statsforecast's cross-validation?
m
Good idea, didnt even think about it, but what I get is "ValueError: could not convert string to float: 'Season Sale...'". I think this means that the sklearn transformer is not working in the StatsForecast context. I only changed the MLForecast to StatsForecast, changed model from LR to AutoARIMA In the pipeline and then commented out the static_features param which is required in the MLForecast cv.. other than that it should be the same.
If just trying to pass AutoARIMA in the sklearn pipeline without any transformers it also doesnt work and gets AttibuteError: 'str' object has no attribute 'prediction_intervals'.
o
Does it work without the pipeline, i.e. just perform cross-validation with AutoArima using statsforecast?
m
Yeh works as normal without the pipeline
o
Ok - if the issue is purely in the pipeline you could consider adding the features first, and then running the cv. Is that a possibility?
m
In my case the transformer is adapting based on the new data, so cant really create features prior using the cross validation, but I'll try if I can reach similar results with LinearRegression + LightGBM combo.
👍 1