Gaussian Mixture Model (GMM) E-step

Clustering DS practice problem on Onlearn.

Difficulty: medium.

Topics: Gaussian Mixture Model (GMM) E-step, Responsibility Matrix, Mahalanobis Distance, Expectation-Maximization, Covariance Regularization, Log-Likelihood Convergence, Probability Theory, Linear Algebra, Optimization Theory, Statistical Inference, Unsupervised Learning, Multivariate Distributions, Matrix Decompositions, Iterative Algorithms, Maximum Likelihood Estimation, Latent Variable Modeling.

Implement the Expectation (E) step of the Gaussian Mixture Model (GMM) algorithm for 1 dimensional data. In the E step, you compute the responsibilities the posterior probability that each Gaussian component generated each data point. Input Parameters X: A 1D numpy array of data points with shape (n samples,) means: A 1D numpy array of component means with shape (n components,) variances: A 1D numpy array of component variances with shape (n components,) mixing coeffs: A 1D numpy array of mixing coefficients (prior probabilities) with shape (n components,). These sum to 1. Output Return a 2D numpy array of responsibilities with shape (n samples, n components), where each row sums to 1. Notes Use the standard univariate Gaussian probability density function Each row of the output represents the soft assignment of a data point to all components The mixing coefficients represent the prior probability of each component