matchpairs function input parameter costUnmatched

2 views (last 30 days)
Michal Kvasnicka on 14 Feb 2020
Commented: Michal Kvasnicka on 14 Feb 2020
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?
Michal Kvasnicka on 14 Feb 2020
Once again ... sorry!!!

Michal Kvasnicka on 14 Feb 2020
Edited: Michal Kvasnicka on 14 Feb 2020
I propose the following costUnmatched input parameter estimation for given Cost matrix:
costUnmatched = max(size(Cost)) * max(Cost,[],'all')
then
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');
end
Michal Kvasnicka 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.

R2019b

Community Treasure Hunt

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

Start Hunting!