Predictive class on svi

Hi,
I have a model based on hmm examples: and i would like during training to predict (either on test or validation set).

The code I use is:

predictive = Predictive(model, num_samples= args.num_samp)
samples = predictive.get_samples(inputs)

However, I always have the same result.(which is the inputs)
Do you have any idea why that happens?

If your code does something like this

def model(..., y):
    pyro.sample("y", ..., obs=y)

then you need to set y = None to say that y is an unobserved variable (i.e. make prediction).

1 Like

Thank you very much for your fast response.
It works like charm now:)

1 Like