In the EM step of GMM, I call a function gaussianND as:
pdf(:, j) = gaussianND(unseen_data, mu(j, :), sigma{j});
which evaluates gaussian for all data points for each cluster 'j'. I have 150 data points and 10 clusters.
I get an error: "Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN. " in the following line of code of the gaussianND function:
pdf = 1 / sqrt((2*pi)^n * det(Sigma)) * exp(-1/2 * sum((meanDiff * inv(Sigma) .* meanDiff), 2));
which basically calculates the multivariate gaussian. For the single iteration of the EM step, I get cluster probabilities (the probability that each data point belongs to each cluster) which makes sense, however with more than 1 iteration I get all of my cluster probabilities as 'NaN' and the warning above.
Can somebody explain me why and a solution please?