0
0
ML Pythonml~20 mins

Gaussian Mixture Models in ML Python - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
GMM Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Gaussian Mixture Model Components

What does each component in a Gaussian Mixture Model (GMM) represent?

AA neural network layer used for feature extraction
BA decision boundary separating classes in the dataset
CA single Gaussian distribution representing a cluster in the data
DA single data point used as a centroid
Attempts:
2 left
💡 Hint

Think about how GMM models data distribution using simpler parts.

Predict Output
intermediate
2:00remaining
Output of GMM Prediction Probabilities

What is the output of the following Python code using sklearn's GaussianMixture?

ML Python
from sklearn.mixture import GaussianMixture
import numpy as np

X = np.array([[0], [1], [2], [3]])
gmm = GaussianMixture(n_components=2, random_state=0)
gmm.fit(X)
probs = gmm.predict_proba([[1.5]])
print(probs)
A[[0.5 0.5]]
B[[0.3 0.7]]
C[[0.7 0.3]]
DRaises a ValueError due to input shape
Attempts:
2 left
💡 Hint

Predict_proba returns the probability of the sample belonging to each component.

Model Choice
advanced
1:30remaining
Choosing Number of Components in GMM

You want to cluster data with unknown groups using GMM. Which method helps select the best number of components?

AAlways use 2 components for simplicity
BPick the number of components equal to the number of data points
CUse the mean squared error between data points and cluster centers
DUse the Bayesian Information Criterion (BIC) to compare models with different components
Attempts:
2 left
💡 Hint

Think about a criterion that balances model fit and complexity.

Hyperparameter
advanced
1:30remaining
Effect of Covariance Type in GMM

What is the effect of setting the covariance_type parameter to 'diag' in a GaussianMixture model?

AEach component has its own diagonal covariance matrix, allowing different variances per feature but no covariance
BAll components share the same full covariance matrix
CCovariance matrices are fixed to identity matrices
DCovariance matrices are scalar multiples of the identity matrix
Attempts:
2 left
💡 Hint

Diagonal covariance means no correlation between features within each component.

Metrics
expert
2:00remaining
Evaluating GMM Clustering Quality

Which metric is most appropriate to evaluate the quality of clusters found by a Gaussian Mixture Model when true labels are unknown?

ASilhouette score measuring how similar an object is to its own cluster compared to other clusters
BAccuracy score comparing predicted labels to true labels
CMean squared error between data points and cluster centers
DLog loss computed from predicted probabilities and true labels
Attempts:
2 left
💡 Hint

Think about a metric that works without knowing true labels.