expectation maximization

hi
I've been trying to implement an EM algorithm, but there seems to be something wrong...
I know it's lengthy (and probably pretty bad style, sorry, I'm rather new to this).
It would be soo great if you can help me and find the mistake!

1
2
edit: Nov 29, 2011
removed the code since noone could help me anyway :)
Last edited on
but there seems to be something wrong...


Don't be so vague. Tell us what's wrong.

It's hard for us to solve a problem when you don't tell us what the problem is.
it compiles, but the numbers are wrong.

in the gammas vector every entry is 0.5

and theoretically the algorithm should run until convergence. in my version it runs a set number of iterations cause I didn't know which variables should converge (I tried mu1 vs mu2 and sigma1 vs sigma2, as well as oldmu1 vs mu1 etc, but it always stopped after one iteration).

the numbers (the mu's, sigma's and pi's) don't change anymore after the first iteration, which indicates another mistake.

so I guess the expectation function and maximization are wrong (line 99 to end).
even though I thought I implemented them according to the formulas.
Last edited on
Topic archived. No new replies allowed.