matchpairs function input parameter costUnmatched
이전 댓글 표시
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?
댓글 수: 10
I don't fully understand the first paragraph and have never used this function, but looking at the help and what the function does it seems perfectly natural that M is empty.
You told it to match pairs, but told it the cost of not matching a row or column is 0, so the best cost it can achieve is 0 by not matching anything, hence M, the list of matched pairs is empty and uR and uC, the lists of unmatched rows and columns contains every row and every column. Unless there were a row and column containing identical values any matching would have a cost > 0.
When you gave an actual cost for not matching then in some cases actually finding a match was lower cost than that fixed value.
As for finding a value for costUnmatched, it depends entirely what you want. As with anything that uses thresholds it is often trial and error or based on knowledge of the actual inputs you have, which presumably are not just matrices of random numbers in your actual usage?
But if they were random numbers then you can use probabilities to determine a costUnmatched that would, on average match a certain percentage of pairs, it all depends what you want as a final result.
Michal
2020년 2월 14일
EmielH
2020년 2월 14일
you could just use a 100 times the max value of cost or something like that.
costUnmatched = 100*max(max(Cost));
That way it's always more benificial to connect a row and column. Where 100 is just arbritatry as long as it's bigger then 1.
Steven Lord
2020년 2월 14일
x = 1e20;
y = x + 10;
y == x % true
I suspect what's happening is that the penalty for leaving something unmatched is so large relatively speaking that it doesn't really matter what gets matched as long as you match something.
It's like in an action movie where the hero is on the edge of a cliff, looking down at a river far below. If a lava flow is coming towards them, prepared to engulf the little spit of land they're on, they're going to jump. The fall and landing in the river almost has to be a better option than being burned alive by lava.
Experiment with unmatched costs where the cost of the matches that switch are around eps of the unmatched cost.
Adam
2020년 2월 14일
Please don't delete large parts of the question when rephrasing, just improve the phrasing of it if that is what you are doing. It makes comments mostly irrelevant if you then delete most of what they are referring to.
Michal
2020년 2월 14일
Michal
2020년 2월 14일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!