Mercurial > hg > silvet
diff yeti/silvet.yeti @ 25:80f02ff5d37a
I think that previous normalisation was wrong!
author | Chris Cannam |
---|---|
date | Mon, 31 Mar 2014 15:41:15 +0100 |
parents | 0e8ee830b5ee |
children | fbc4011c7693 |
line wrap: on
line diff
--- a/yeti/silvet.yeti Mon Mar 31 12:46:24 2014 +0100 +++ b/yeti/silvet.yeti Mon Mar 31 15:41:15 2014 +0100 @@ -70,13 +70,21 @@ \() (plot.plot [ Caption "Source distribution beforehand", Grid em1data.sources]); +normalise v = + (s = vec.sum v; + if s > 0 then vec.divideBy s v + else v + fi); + oneIteration em1data col n = - (q = em1.performExpectation em1data col; + ({ estimate, q } = em1.performExpectation em1data col; // \() (plot.plot [ Caption "Frequency distribution and output of E-step for iteration \(n)", Vector col, Vector q ]); newdata = em1.performMaximisation em1data col q; if (n % 6 == 0) then \() (plot.plot [ Caption "Pitch distribution before and after M-step update for iteration \(n)", Vector (em1data.pitches), Vector (newdata.pitches) ]); \() (plot.plot [ Caption "Source distribution after M-step update for iteration \(n)", Grid newdata.sources ]); + \() (plot.plot [ Caption "Q function for E-step iteration \(n)", Vector q ]); + \() (plot.plot [ Caption "Estimate from E-step iteration \(n) against original source distribution, and difference between them", Vector estimate, Vector (normalise col), Vector (vec.subtract estimate (normalise col)) ]); fi; newdata); @@ -123,12 +131,6 @@ println "Instruments: \(map do i: (d.instruments[i]) done instruments)"; -normalise v = - (s = vec.sum v; - if s > 0 then vec.divideBy s v - else v - fi); - if not (empty? sounding) then p = head sounding; i = head instruments;