RuixueLiu / pmtk3

Automatically exported from code.google.com/p/pmtk3
MIT License
0 stars 0 forks source link

Possible issue with mrfToMrf2 logic #43

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. See attached file mrfToMrf2Issue.m

What is the expected output? What do you see instead?

The function testMisconceptionMRFtoMRF2() should generate the same output as 
the testMisconceptionMRF(). Instead, the edge potentials in the mrf2 model 
appear to be getting set up incorrectly. 

What version / revision of the product are you using? On what operating
system?

pmtk3-3jan11.zip  - uploaded january 2012.
Matlab r2011a, Win 32 bit.
Windows 7 64bit.

Please provide any additional information below.

The attached updated file factorGraphToMrf2.m contains a proposed fix for the 
issue, which appears to be at line 34:

edgesWithPots = cell2mat(cellfuncell(@(f)f.domain, epots));

whereby a row vector is returned, which is inconsistent with edgeEnds - i.e. a 
column vector - when compared at line 35. 

The proposed fix is after line 32:
epots    = fg.factors(edgeFacNdx);

to add the following:

if isrowvec(epots)
    epots = epots';
end

Original issue reported on code.google.com by ctjoreilly@gmail.com on 3 Sep 2012 at 9:22

Attachments:

GoogleCodeExporter commented 8 years ago
Moved to GitHub: https://github.com/probml/pmtk3/issues/43

Original comment by irosen on 4 Jan 2014 at 2:37