Cannot copy PointMass random variables

Good catch. This relates to Github issue #610 and Confused by error message from inference.run() for LDA with KLqp. Looking into a fix now.

Is there a reason why random_variables.py doesn’t use the copy() method which could then be easily implemented in PointMass and other classes that derive from RandomVariable?

The copy() method in random variables only works for overwriting keyword arguments. However we’d like to overwrite both positional arguments and keyword arguments. This is because in order for inference to work properly, we require deep copies across all arguments to a random variable in ed.copy(). Maybe the copy() method in random variables could be improved to enable this.

1 Like