I have a very related issue currently. I am porting a causal model from pymc3 to pymc4 and I’ve previously used the following code to check if a variable is a categorical:
def is_categorical(variable):
return hasattr(variable, "distribution") and isinstance(
variable.distribution, pm.Categorical
)
Unfortunately, this does not seem to work any longer in pymc4. Can anyone help me to find an alternative that will work?