Generate Autoregressive Random Variables for given initial states

Skip to first unread message

Konstantin Vasilev

May 17, 2022, 6:32:22 PMMay 17
to TensorFlow Probability

I've been trying to generate a set of AR(1) processes for a given set of initial states and AR params using tfp.distributions.Autoregressive. What I'm currently getting are processes with random initial states and I don't see how to set them as fixed:

import tensorflow_probability as tfp
import tensorflow as tf

model = tfp.sts.Autoregressive(order=1).make_state_space_model(
        'coefficients': [tf.constant(0.2)],
        'level_scale': tf.constant(0.5),


Brian Patton 🚀

May 18, 2022, 6:30:38 AMMay 18
to Konstantin Vasilev, TensorFlow Probability
Something along the lines of .build_state_space_model(..).copy(initial_state_prior=[tfd.Deterministic(..), ..])
might do it.

You can look at ssm.parameters to understand the right structure for that argument. says it needs to be an MVN, so there's some risk this won't work, but you could at least make it very tightly concentrated, and the API doc might be over restrictive for sampling (maybe that constraint only applies for log prob and marginal).

You received this message because you are subscribed to the Google Groups "TensorFlow Probability" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages