probability
probability copied to clipboard
DynamicLinearRegression fails when specifying `drift_scale_prior`
import tensorflow as tf
from tensorflow_probability.python.sts.internal import util as sts_util
tfd = tfp.distributions
_, observed_stddev, _ = sts_util.empirical_statistics(observed_time_series)
drift_scale_prior = tfd.LogNormal(
loc=tf.math.log(0.05 * observed_stddev),
scale=3.0,
name="drift_scale_prior"
)
component = tfp.sts.DynamicLinearRegression(
design_matrix=design_matrix,
observed_time_series=observed_time_series,
drift_scale_prior=drift_scale_prior,
)
The above rasies UnboundLocalError: local variable 'observed_stddev' referenced before assignment.
This happens when specifying drift_scale_prior for DynamicLinearRegressor, since observed_stddev is only created when drift_scale_prior is None lines 285-290 but is used later on line 305, which is where the above example fails.
tensorflow-probability==0.17.0, tensorflow==2.9.0