CUQI-DTU / CUQIpy

https://cuqi-dtu.github.io/CUQIpy/
Apache License 2.0
48 stars 9 forks source link

Generate an error when passing unexpected parameters to the joint distribution. #42

Open amal-ghamdi opened 2 years ago

amal-ghamdi commented 2 years ago

This scenario does not generate and error:

posterior =  JointDistribution([y, x]) # x and y are distributions that does not depend on z
print(posterior.get_parameter_names())
d = posterior(z = 10)

output:

['y', 'x']

Conditioning on z (third line of the code) does not generate an error message.

amal-ghamdi commented 2 years ago

Hi @nabriis, just wanted to ask you if you think that this issue is redundant or if this behavior is expected, then may be we can close it.

nabriis commented 2 years ago

Hi @amal-ghamdi,

I think it would make sense to catch this behavior. It would simply have to check the parameter names againts the key of the keywords when conditioning. You are welcome to make a PR :)