-
-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Closed
Labels
EasyWell-defined and straightforward way to resolveWell-defined and straightforward way to resolveEnhancement
Description
The formula for the Matthews correlation coefficient metric involves a division. In certain cases, the denominator of this division can be 0. In this situation, one of numpy's functions called by metrics.matthews_corrcoef throws a warning:
RuntimeWarning: invalid value encountered in divide
However, as Wikipedia states on the page for the metric, "If any of the four sums in the denominator is zero, the denominator can be arbitrarily set to one; this results in a Matthews correlation coefficient of zero, which can be shown to be the correct limiting value."
I think metrics.matthews_corrcoef should detect if the denominator will be 0 (this is a trivial property to check), and if so, set it to 1, instead of triggering a runtime warning and returning the right value (0) anyway.
Metadata
Metadata
Assignees
Labels
EasyWell-defined and straightforward way to resolveWell-defined and straightforward way to resolveEnhancement