Behaviour of multiple calls to pymc.set_data



with pm.Model():
    pm.set_data({"a": a_values, "b": b_values, "c": c_values})
    pm.set_data({"a": a_new_values, "b": b_new_values})    

does the model still have c? Or does the second call to set_data clobber all existing data?

Is there a way that I can inspect what data the model currently ‘sees’? (Which would allow me to answer this myself)

Many thanks

Assuming your model is named mod, you can do mod['c'].eval() to check the current value of c.

You can also use pm.model_to_graphviz and inspect the shapes.

Thanks. Hadn’t realised you could access the data like that.

For future reference, a second call to set_data doesn’t alter existing values (c in the above example) if they aren’t referenced in the second call.

1 Like

You can actually access any model variable that way