matchpairs function input parameter costUnmatched

7 views (last 30 days)
How to choose proper value of parameter costUnmatched (matchpairs function) to get requested number of matches.
Especially in a case, when I need maximum number of possible matches min(M,N), where [M,N] = size(Cost), Cost is (M x N) matrix.
Is there at least some clue for a suitable choice of costUnmatched for given cost matrix?

Sign in to comment.

Accepted Answer

Michal on 14 Feb 2020
Edited: Michal on 14 Feb 2020
I propose the following costUnmatched input parameter estimation for given Cost matrix:
costUnmatched = max(size(Cost)) * max(Cost,[],'all')
M = matchpairs(Cost,costUnmatched)
and the following accuracy check:
CostAssigned = sum(Cost(sub2ind(size(Cost), M(:,1), M(:,2))));
CostUnassigned = costUnmatched*(sum(size(Cost))-2*size(M,1));
TotalCost = CostAssigned + CostUnassigned;
if TotalCost - CostUnassigned == 0
error('matchpairs: Input parameter costUnmatched is very high ... possible loss of accuracy');
Michal on 14 Feb 2020
Edited: Michal on 14 Feb 2020
@Steven Lord My motivattion how and why I propose to modify the matchpairs function is based only on the fact, that in a case of
TotalCost - CostUnassigned == 0
the resulting matches M are incorrect. So, from my point view, should be good idea to warn user that (in this specific case, only!!!) is something wrong. That is all.

Sign in to comment.

More Answers (0)




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by