NumericalError#

exception ns_sdn.exceptions.NumericalError[source]#

Bases: NSSDNError, RuntimeError

A computation could not be carried out: non-finite data, a diverged fit.

Raised before training when a series, covariate panel or time grid contains nan or inf (missing data is not imputed), and during training when the loss becomes non-finite at some step, in which case the message names the stage and step and suggests a lower learning rate or scaling the series. The fix is to look at the numbers.

Example

>>> import numpy as np
>>> from ns_sdn.spectral_decomposition import NSSDN
>>> NSSDN(np.arange(10.0), time=np.r_[np.arange(9.0), np.inf])
Traceback (most recent call last):
    ...
ns_sdn.exceptions.NumericalError: time contains non-finite values.