- Activation
- Derivative
- Loss
- LossGradient
- RegressionMetric
- ConfusionMatrix
- ConfusionMatrixMultilabel
- ClassificationMetric
- ClassificationScore
- PrecisionRecall
- ReceiverOperatingCharacteristic
PrecisionRecall
Compute values to construct a precision-recall curve. Similarly to ClassificationScore, this method is applied to the vector of true values.
bool vector::PrecisionRecall(
|
Parameters
pred_scores
[in] A matrix containing a set of horizontal vectors with probabilities for each class. The number of matrix rows must correspond to the size of the vector of true values.
mode
[in] Averaging mode from the ENUM_AVERAGE_MODE enumeration. Only AVERAGE_NONE, AVERAGE_BINARY and AVERAGE_MICRO are used.
precision
[out] A matrix with calculated precision curve values. If no averaging is applied (AVERAGE_NONE), the number of rows in the matrix corresponds to the number of model classes. The number of columns corresponds to the size of the vector of true values (or the number of rows in the probability distribution matrix pred_score). In the case of microaveraging, the number of rows in the matrix corresponds to the total number of threshold values, excluding duplicates.
recall
[out] A matrix with calculated recall curve values.
threshold
[out] Threshold matrix obtained by sorting the probability matrix
Note
See notes for the ClassificationScore method.
Example
An example of collecting statistics from the mnist.onnx model (99% accuracy).
//--- data for classification metrics
//--- input-output
//--- testing
//--- collect data
|
vectorf accuracy=y_pred.ClassificationMetric(y_true,CLASSIFICATION_ACCURACY);
|
An example of plotting precision-recall graphs, where precision values are plotted on the y-axis and recall values are plotted on the x-axis. Also precision and recall graphs are plotted separately, with threshold values plotted on the x-axis
if(y_true.PrecisionRecall(y_scores,AVERAGE_MICRO,mat_precision,mat_recall,mat_thres))
|
Resulting curves: