GaussianMixtures.jl - Equivalent of sklearn GaussianMixture.predict

I’m trying to recreate the equivalent of SKLearn’s documentation example with GaussianMixtures.jl.

The SKLearn example is below:

import numpy as np
from sklearn.mixture import GaussianMixture
X = np.array([[1, 2], [1, 4], [1, 0], [10, 2], [10, 4], [10, 0]])
gm = GaussianMixture(n_components=2, random_state=0).fit(X)
gm.predict([[0, 0], [12, 3]]) # prints "array([1, 0])"

In Julia, when I do:

using GaussianMixtures
X = [1.0 2; 1 4; 1 0; 10 2; 10 4; 10 0]
gm = GMM(2, X)

I see a bunch of warnings - “Warning: 8 pathological elements normalized”

I’m also not sure how to get the prediction for new points (i.e. I’m looking for the equivalent of gm.predict from the sklearn code above).

Thanks!

1 Like