'BigQuery ML.DETECT_ANOMALIES with model 'arima_plus' returns only nulls

I build a VERY simple model with only a time series and a data field of always 1 to find anomalies.

CREATE OR REPLACE MODEL `mytest.dummy`
OPTIONS(
    model_type='arima_plus',
    TIME_SERIES_DATA_COL='cnt',
    TIME_SERIES_TIMESTAMP_COL='ts',
    DATA_FREQUENCY='HOURLY',
    DECOMPOSE_TIME_SERIES=TRUE
)
AS
select ts, 1 cnt 
from UNNEST(GENERATE_TIMESTAMP_ARRAY('2022-05-01', '2022-05-02', INTERVAL 1 HOUR)) as ts;

Model works fine unless I use a custom select query to find anomalies. Even if the query is the exact same that was used to create the model.

SELECT * 
FROM ML.DETECT_ANOMALIES(
    MODEL `mytest.dummy`,
    STRUCT (0.9 AS anomaly_prob_threshold),
    (select ts, 1 cnt 
     from UNNEST(GENERATE_TIMESTAMP_ARRAY('2022-05-01', '2022-05-02', INTERVAL 1 HOUR)) as ts)
)

Result

Row ts cnt is_anomaly lower_bound upper_bound anomaly_probability
1 2022-05-01 00:00:00 UTC 1.0 null null null null
2 2022-05-01 01:00:00 UTC 1.0 null null null null
3 ....

Does anyone know what I need to do to get expected results of is_anomaly = false.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source