- Activation
- Derivative
- Loss
- LossGradient
- RegressionMetric
- ConfusionMatrix
- ConfusionMatrixMultilabel
- ClassificationMetric
- ClassificationScore
- PrecisionRecall
- ReceiverOperatingCharacteristic
ReceiverOperatingCharacteristic
Compute values to construct the Receiver Operating Characteristic (ROC) curve. Similarly to ClassificationScore, this method is applied to the vector of true values.
bool vector::ReceiverOperatingCharacteristic(
|
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.
fpr
[out] A matrix with calculated values of the false positive rate curve. 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.
tpr
[out] A matrix with calculated values of the true positive rate curve.
threshold
[out] Threshold matrix obtained by sorting the probability matrix
Note
See notes for the ClassificationScore method.
Example
An example of plotting ROC graphs, where tpr values are plotted on the y-axis and fpr values are plotted on the x-axis. Also fpr and tpr graphs are plotted separately, with threshold values plotted on the x-axis
matrixf mat_thres;
|
Resulting curves:
The graph output code is simple and based on the <Graphics/Graphic.mqh> standard library.
The examples use the data of the mnist.onnx model. The code is presented in the PrecisionRecall method description.
ROC AUC is close to ideal.
roc auc score micro = [0.99991] |