In semi-supervised EM for a Gaussian mixture, the E-step computes each point's responsibility for each component. Labeled points are not allowed to move: their responsibility is one-hot on their known class.
Implement two functions.
responsibilities(X, means, covs, priors) returns an (N, K) array. Row i gives p(component k | x_i) under the mixture. Compute it in log space with log-sum-exp so that far-away points give finite values.semi_supervised_e_step(X, y, means, covs, priors) takes y with -1 for unlabeled points and class indices 0..K-1 for labeled ones. It returns the same (N, K) array, with labeled rows replaced by one-hot vectors.X is 2-D, means is (K, d), covs is (K, d, d), priors is (K,).ValueError. So does a label outside -1..K-1.Compute log p(x | k) + log pi_k for every component, then subtract the row maximum before exponentiating.
No results yet
Run your code to check it against the examples, or submit to run every test.