tech.v3.ml.metrics

Excellent metrics tools from the cortex project.

accuracy

(accuracy y y_hat)

First argument y is the true class, y_hat is the predicted value. Returns the percentage correct.

all-metrics

(all-metrics labels predictions label->class-fn iou-fn iou-threshold)

Returns global and per-class metrics for a given set of labels and predictions. - label->class-fn should take a label or prediction and return the class as a string or keyword. - iou-fn should take a label and prediction and return the intersection over union score - iou-threshold determines what iou value constitutes a matching bounding box. ** NOTE: If labels and predictions are produced from a sequence of images, ensure that the bounding boxes are shifted in each image so that there is not an overlap.

eer-accuracy

(eer-accuracy y y_est)(eer-accuracy y y_est bins)

Returns the accuracy where TPR and FPR are balanced, as well as the threshold value where this balance is obtained. ROC-EER is the standard accuracy measurement in facial recognition.

equal-error-point

(equal-error-point y y_est)(equal-error-point y y_est bins)

Given y and the continuous, normalized output of a predictor’s estimates of binary class predictions corresponding to y_hat, select the threshold which minimizes the difference between true and false positive rates.

error-rate

(error-rate y y_hat)

First argument y is the true class, y_hat is the predicted value. Returns the percentage error rate.

false-negatives

(false-negatives y y_hat)

Returns array with 1. values assigned to false negatives.

false-positives

(false-positives y y_hat)

Returns array with 1. values assigned to false positives.

fnr

(fnr y y_hat)

The false negative rate, using the strict ROC definition.

fpr

(fpr y y_hat)

The false negative rate, using the strict ROC definition.

precision

(precision y y_hat)

Returns precision for a binary classifier, a measure of false positive rate

recall

(recall y y_hat)

Returns recall for a binary classifier, a measure of false negative rate

roc-curve

(roc-curve y y_est)(roc-curve y y_est bins)

Compute an ROC curve with bins level of discretization for threshold values between 0.0 and 1.0 to compute true and false positive rates for.

This is not at all an ideal implementation, just a stand in that is useful for certain problems until a real alternative is provided.

threshold

(threshold y_est thresh)

Return a binary mask of all values above threshold.

tpr

(tpr y y_hat)

The true positive rate, using the strict ROC definition.

true-negatives

(true-negatives y y_hat)

Returns array with 1. values assigned to true negatives.

true-positives

(true-positives y y_hat)

Returns array with 1. values assigned to true positives.

unit-space

(unit-space divs)

Returns an array with divs+1 values that evenly divide a space from 0.0 to 1.0, inclusive.

wrongs

(wrongs y y_hat)

Given y array of ground truth labels and y_hat classifier predictions, returns array with 1.0 values where y does not equal y_hat.