I'm using scikit-learn to fit a multivariate Gaussian Mixture Model to some data (which works brilliantly). But I need to be able to get a new GMM conditional on some of the variables, and the scikit toolkit doesn't seem to be able to do that, which surprised me because it seems like a pretty basic thing to want to do.
Wikipedia has a good explanation of what I'm trying to do (for a single Gaussian, not a GMM), and it's just possible I might be able to implement it myself, but my matrix maths isn't great and I can see it taking a long time.
Has somebody already done this? Is there an easy way of doing it with NumPy/SciPy/Scikit-learn?
Try looking into pypr. From the documentation, here is how you would find a GMM conditioned on one or more of the variables:
# Now we will find the conditional distribution of x given y
(con_cen, con_cov, new_p_k) = gmm.cond_dist(np.array([np.nan, y]), \
cen_lst, cov_lst, p_k)
As far as i remember, there are examples that come with the package.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With