Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch makes the following code cleanup and mathematical corrections to the kernel metrics as well as the max-depth calculation for a concept graph:
Correct the construction of the initial concept graph whereby the dummy root node has a depth value of zero which was creating wildly unreasonable max-depths for individual graphs.
IntrinsicLCHMetric contained a mathematical error where the formula misinterpreted that it should be -1 times the log and instead had an implementation that was 1 minus the log. In addition, the way the concept graph is computed, there is a dummy root node created which inflated the depth of the nodes by (2) - this is now corrected and the output matches exactly to values computed by the Perl UMLS::Similarity LCH computation
LCHMetric contained a mathematical error where the formula misinterpreted that it should be -1 times the log and instead had an implementation that was 1 minus the log. The LCH metric also contained the same depth error as LCH intrinsic and this has been corrected.
JaccardMetric could have had a divide by zero if the ic1 + ic2 was equal to the lcsIC. Added a check to insure this does not happen.
The LinMetric code has been cleaned up to be more readable
Wu-Palmer Metric also suffered from a mis-calculation of node depth due to the dummy node. This code was also cleaned up to be more readable and to more accurately reflect the computations in the Perl UMLS::Similarity wup.pm module.