How to marginalize latent discrete variables in CDMs (cognitive diagnosis models)?

I think I misunderstand marginalization.I will try pm.Mixture().