Unable to predict using set_value with an errors-in-variables model

Hi Alex, thanks for your reply!

I have tried both suggestions without success.

First I tried adding B_len = shared(len(x)) and changing shape=x.shape[0] to shape=int(B_len.get_value()) because shape requires a real number.

I also tried…

with pm.Model() as model:    
    x_in = pm.Data('x_in', x)
    y_in = pm.Data('y_in', y)
    B_len = pm.Data('B_len', len(x))
    ...

and

x_new = np.linspace(0,20,200)
with model:
    pm.set_data({'x_in': x_new})
    pm.set_data({'B_len': 200})
    ppc = pm.sample_posterior_predictive(trace, samples=1000)

It looks like the values do change in model['x_in'].get_value() and B_len but still sample_posterior_predictive gives predictions on the original data. Is this what you were suggesting?

1 Like