Attachment 'U06_test_margs.m'

Download

   1 function U06_test_margs
   2 %U06_TEST_MARGS            Test simple_marg and bp.
   3 %
   4 %usage
   5 %  U06_test_margs
   6 %
   7 %author
   8 %  buenau@cs.tu-berlin.de
   9 
  10 % Data (kindly donated by Pascal Lehwark).
  11 A=[0 1 0 0 0 0;1 0 1 1 0 0;0 1 0 0 0 0;0 1 0 0 1 1;0 0 0 1 0 0;0 0 0 1 0 0];
  12 E=[0.1 0.1 0.1 0.9 0.1 0.9;0.9 0.9 0.9 0.1 0.9 0.1];
  13 L=[0.2 0.7;0.7 0.2]; 
  14 
  15 % Correct marginals.
  16 correct_margs = [   0.224137931034483   0.224137931034483   0.224137931034483   0.913368700265252   0.052360416241583   0.741591185472353; ...
  17                    0.775862068965517   0.775862068965517   0.775862068965517   0.086631299734748   0.947639583758417   0.258408814527647 ];
  18 
  19 % Run tests.
  20 
  21 if exist('bp.m', 'file') 
  22   % Test Belief Propagation.
  23   fprintf('Testing bp.m ... ');
  24   margs = bp(A,E,L);
  25 
  26   if max(max(abs(margs - correct_margs))) > 1e-10
  27     fprintf('failed (discrepancy > 1e-10).\n');
  28   else
  29     fprintf('OK.\n'); 
  30   end
  31 end
  32 
  33 if exist('simple_marg.m', 'file') 
  34   % Naive summing.
  35   fprintf('Testing simple_marg.m ... ');
  36   margs = simple_marg(A,E,L);
  37 
  38   if max(max(abs(margs - correct_margs))) > 1e-10
  39     fprintf('failed (discrepancy > 1e-10).\n');
  40   else
  41     fprintf('OK.\n'); 
  42   end
  43 end

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2009-03-12 14:03:18, 74.6 KB) [[attachment:ML_Praktikum_U01.pdf]]
  • [get | view] (2009-03-12 14:03:18, 72.1 KB) [[attachment:ML_Praktikum_U02.pdf]]
  • [get | view] (2009-03-12 14:03:18, 66.7 KB) [[attachment:ML_Praktikum_U03.pdf]]
  • [get | view] (2009-03-12 14:03:18, 94.0 KB) [[attachment:ML_Praktikum_U04.pdf]]
  • [get | view] (2009-03-12 14:03:18, 65.2 KB) [[attachment:ML_Praktikum_U05.pdf]]
  • [get | view] (2009-03-12 14:03:18, 79.3 KB) [[attachment:ML_Praktikum_U06.pdf]]
  • [get | view] (2009-03-12 14:03:18, 66.6 KB) [[attachment:Praktikum_ML_Info.pdf]]
  • [get | view] (2009-03-12 14:03:18, 4053.5 KB) [[attachment:U01_usps.mat]]
  • [get | view] (2009-03-12 14:03:18, 6.3 KB) [[attachment:U03_2gaussians.dat]]
  • [get | view] (2009-03-12 14:03:18, 15.6 KB) [[attachment:U03_5gaussians.dat]]
  • [get | view] (2009-03-12 14:03:18, 1018.4 KB) [[attachment:U04_datasets.tar.gz]]
  • [get | view] (2009-03-12 14:03:18, 6.4 KB) [[attachment:U05_datasets.zip]]
  • [get | view] (2009-03-12 14:03:18, 108.7 KB) [[attachment:U06_datasets.tar.gz]]
  • [get | view] (2009-03-12 14:03:18, 1.1 KB) [[attachment:U06_test_margs.m]]
  • [get | view] (2009-03-12 14:03:18, 60.1 KB) [[attachment:fishbowl.mat]]
  • [get | view] (2009-03-12 14:03:18, 22.7 KB) [[attachment:flatroll.mat]]
  • [get | view] (2009-03-12 14:03:18, 0.1 KB) [[attachment:func1.m]]
  • [get | view] (2009-03-12 14:03:18, 371.2 KB) [[attachment:guide.pdf]]
  • [get | view] (2009-03-12 14:03:18, 496.0 KB) [[attachment:lle_talk.pdf]]
  • [get | view] (2009-03-12 14:03:18, 275.7 KB) [[attachment:logfile.txt]]
  • [get | view] (2009-03-12 14:03:18, 0.2 KB) [[attachment:myprod.m]]
  • [get | view] (2009-03-12 14:03:18, 27.3 KB) [[attachment:ratbert-debate.gif]]
  • [get | view] (2009-03-12 14:03:18, 7.6 KB) [[attachment:ratbert-debate.mat]]
  • [get | view] (2009-03-12 14:03:18, 45.3 KB) [[attachment:swissroll.mat]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.