Last active
December 29, 2016 19:17
-
-
Save defndaines/bd7ac86a20db80bdc42f15ef37fa10ad to your computer and use it in GitHub Desktop.
Area Under Curve [AUC] reduce function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defn iter | |
| "Area Under Curve [AUC] reduce function. | |
| The element is a vector of three elements: the ID of the model, | |
| whether the classifier example is positive (pos), | |
| and the probabilistic value (f). | |
| The accumulator tracks six values, aggregated area, the last f value (f'), | |
| negative examples (fp and fp'), and positive examples (tp and tp')." | |
| [[area f' fp fp' tp tp'] [_ pos f]] | |
| (if (= f' f) | |
| [area | |
| f' | |
| (if pos fp (inc fp)) | |
| fp' | |
| (if pos (inc tp) tp) | |
| tp'] | |
| ;; else | |
| [(+ area (trap-area fp fp' tp tp')) | |
| f | |
| (if pos fp (inc fp)) | |
| fp | |
| (if pos (inc tp) tp) | |
| tp])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment