0
0
ML Pythonml~10 mins

Gaussian Mixture Models in ML Python - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the GaussianMixture class from sklearn.

ML Python
from sklearn.mixture import [1]
Drag options to blanks, or click blank then click option'
AGaussianMixture
BKMeans
CLinearRegression
DDecisionTreeClassifier
Attempts:
3 left
💡 Hint
Common Mistakes
Importing KMeans instead of GaussianMixture.
Using a classifier class instead of a mixture model.
2fill in blank
medium

Complete the code to create a Gaussian Mixture Model with 3 components.

ML Python
model = GaussianMixture(n_components=[1])
Drag options to blanks, or click blank then click option'
A5
B3
C1
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Setting n_components to 1 when multiple clusters are expected.
Using too many components without reason.
3fill in blank
hard

Fix the error in the code to fit the model to data stored in X.

ML Python
model.[1](X)
Drag options to blanks, or click blank then click option'
Afit
Bpredict
Ctransform
Dscore
Attempts:
3 left
💡 Hint
Common Mistakes
Using predict before fitting the model.
Using transform instead of fit.
4fill in blank
hard

Fill both blanks to predict the cluster labels for data X.

ML Python
labels = model.[1](X)
print(labels.[2])
Drag options to blanks, or click blank then click option'
Apredict
Bshape
Csize
Dfit
Attempts:
3 left
💡 Hint
Common Mistakes
Using fit instead of predict to get labels.
Using size instead of shape to check label array dimensions.
5fill in blank
hard

Fill all three blanks to compute the probability of each sample belonging to each cluster.

ML Python
probabilities = model.[1](X)
max_probs = probabilities.max(axis=[2])
print(max_probs.[3]())
Drag options to blanks, or click blank then click option'
Apredict_proba
B1
Cmean
Dpredict
Attempts:
3 left
💡 Hint
Common Mistakes
Using predict instead of predict_proba for probabilities.
Using axis=0 instead of axis=1 in max.
Using size instead of mean to summarize probabilities.