kristeligt-dagblad / dbt_ml

Package for dbt that allows users to train, audit and use BigQuery ML models.
Apache License 2.0
64 stars 26 forks source link

BQML ARIMA_PLUS model training is failing after changing from v0.4.0 to v0.5.1 #32

Open jfabregascolvin opened 2 years ago

jfabregascolvin commented 2 years ago

While running the model training with model_type = ARIMA_PLUS and AUTO_ARIMA = false is needed to set the NON_SEASONAL_ORDER option. This option type is type STRUCT<p INT64, d INT64, q INT64>, but when I try to define as 'NON_SEASONAL_ORDER' : (1,0,1) i get the error:

Compilation Error in macro model_options (macros\materializations\model.sql) 'int object' has no attribute 'startswith'

When I try changing the value to a string or another type, the error change to:

Option NON_SEASONAL_ORDER value has type STRUCT<STRING, STRING, STRING> which cannot be coerced to expected type STRUCT<p INT64, d INT64, q INT64>; failed to set 'non_seasonal_order' in OPTIONS()

When I try with AUTO_ARIMA = true then 'NON_SEASONAL_ORDER' is not required and the model works correctly

Thank you

rbjerrum commented 2 years ago

Thank you for opening this issue, @jfabregascolvin.

The problem seems to be a regression introduced when we added support for hyperparemeter tuning: https://github.com/kristeligt-dagblad/dbt_ml/pull/25/files.

If you're up for it, feel free to attempt a fix and open a PR - will be happy to review. The problematic part of the code is here: https://github.com/kristeligt-dagblad/dbt_ml/blob/master/macros/materializations/model.sql#L33