Complete the code to import the GaussianMixture class from sklearn.
from sklearn.mixture import [1]
The GaussianMixture class is used to create Gaussian Mixture Models in scikit-learn.
Complete the code to create a Gaussian Mixture Model with 3 components.
model = GaussianMixture(n_components=[1])The n_components parameter sets how many Gaussian distributions the model will use. Here, 3 is correct.
Fix the error in the code to fit the model to data stored in X.
model.[1](X)The fit method trains the Gaussian Mixture Model on the data X.
Fill both blanks to predict the cluster labels for data X.
labels = model.[1](X) print(labels.[2])
Use predict to get cluster labels, then shape to see the number of labels.
Fill all three blanks to compute the probability of each sample belonging to each cluster.
probabilities = model.[1](X) max_probs = probabilities.max(axis=[2]) print(max_probs.[3]())
predict_proba returns probabilities per cluster, max with axis=1 finds max per sample, mean computes average max probability.