diff yeti/silvet.yeti @ 14:a91de434feb8

More (sometimes baffled) annotations and a bit of work on the EM
author Chris Cannam
date Mon, 24 Mar 2014 16:31:20 +0000
parents e15bc63cb146
children f1f8c84339d0
line wrap: on
line diff
--- a/yeti/silvet.yeti	Fri Mar 21 18:12:38 2014 +0000
+++ b/yeti/silvet.yeti	Mon Mar 24 16:31:20 2014 +0000
@@ -3,10 +3,12 @@
 
 { prepareTimeFrequency } = load timefreq;
 { loadTemplates, extractRanges } = load templates;
-{ initialiseEM } = load em;
+
+em = load em;
 
 mat = load may.matrix;
 vec = load may.vector;
+plot = load may.plot;
 
 templates = loadTemplates ();
 
@@ -14,7 +16,7 @@
 
 eprintln "\nWe have \(length (keys templates)) instruments:";
 for (sort (keys templates)) do k:
-    eprintln " * \(k) \(mat.size templates[k]) range \(ranges[k].lowestNote) -> \(ranges[k].highestNote)";
+    eprintln " * \(k) \(mat.size templates[k]) range \(ranges[k].lowest) -> \(ranges[k].highest)";
 done;
 eprintln "";
 
@@ -24,9 +26,9 @@
 
 chunkSize = { rows = height, columns = 100 };
 
-emdata = initialiseEM ranges 88 chunkSize;
+emdata = em.initialise ranges templates 88 chunkSize;
 
-eprintln "initialised EM data";
+eprintln "initialised EM data: overall pitch range \(emdata.lowest) -> \(emdata.highest)";
 
 chunkify cols = 
     if empty? cols then []
@@ -40,4 +42,23 @@
 
 eprintln "we have \(length chunks) chunks of size \(mat.size (head chunks))";
 
+eprintln "attempting one expectation phase...";
 
+error = em.performExpectation emdata (head chunks);
+
+eprintln "done, result has dimension \(mat.size error)";
+
+eprintln "attempting one maximisation phase...";
+
+newP = em.performMaximisation emdata (head chunks) error;
+
+eprintln "done";
+
+\() (plot.plot [ Grid (head chunks) ]);
+\() (plot.plot [ Grid error ]);
+
+\() (plot.plot [ Grid newP ]);
+
+();
+
+