The function _to_positive, which is used to force a positive mean for Gamma and Neg Binomial likelihoods can return zeros due to float precision. This then breaks the model, leading to "NaNs" in the loss. A solution would be to add a clip to avoid this error.
Code for reproducing the bug
from prophetverse.sktime import Prophetverse
import pandas as pd
import numpy as np
min_val = 3
_y =np.clip(np.linspace(0, 10, 1000), min_val, None) - min_val + 1e-6
y = pd.Series(
_y,
index=pd.date_range("2022-01-01", periods=len(_y), freq="D"),
)
Prophetverse(likelihood="gamma").fit(y)
The function
_to_positive
, which is used to force a positive mean for Gamma and Neg Binomial likelihoods can return zeros due to float precision. This then breaks the model, leading to "NaNs" in the loss. A solution would be to add a clip to avoid this error.Code for reproducing the bug