Skip to content

Instantly share code, notes, and snippets.

@agarie
Created December 10, 2013 18:20
Show Gist options
  • Save agarie/7895354 to your computer and use it in GitHub Desktop.
Save agarie/7895354 to your computer and use it in GitHub Desktop.
Matthews correlation coefficient. I'll never have to reimplement this!
def matthews(tp, tn, fp, fn)
den = tp * tn - fp * fn
num = (tp + fp) * (tp + fn) * (tn + fp) * (tn + fn)
den / Math.sqrt(num)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment