- Activation
- Derivative
- Loss
- LossGradient
- RegressionMetric
- ConfusionMatrix
- ConfusionMatrixMultilabel
- ClassificationMetric
- ClassificationScore
- PrecisionRecall
- ReceiverOperatingCharacteristic
ClassificationMetric
Compute the classification metric to evaluate the quality of the predicted data compared to the true data. The method is applied to the vector of predicted values.
vector vector::ClassificationMetric(
|
Parameters
vect_true
[in] Vector of true values.
metric
[in] Metric type from the ENUM_CLASSIFICATION_METRIC enumeration. Values other than CLASSIFICATION_TOP_K_ACCURACY, CLASSIFICATION_AVERAGE_PRECISION and CLASSIFICATION_ROC_AUC (used in the ClassificationScore method) are applied.
mode
[in] Averaging mode from the ENUM_AVERAGE_MODE enumeration. Used for the CLASSIFICATION_F1, CLASSIFICATION_JACCARD, CLASSIFICATION_PRECISION and CLASSIFICATION_RECALL metrics.
Return Value
A vector containing the calculated metric. In the case of the AVERAGE_NONE averaging mode, the vector contains metric values for each class without averaging. (For example, in case of the binary classification, this would be two metrics for 'false' and 'true' respectively).
Note about averaging modes
AVERAGE_BINARY is only meaningful for binary classification.
AVERAGE_MICRO — calculate metrics globally by counting the total true positives, false negatives and false positives.
AVERAGE_MACRO — calculate metrics for each label and find their unweighted mean. This does not take label imbalance into account.
AVERAGE_WEIGHTED — calculate metrics for each label and find their average weighted by support (the number of true instances for each label). This alters ‘macro’ to account for label imbalance; it can result in an F-score that is not between precision and recall.
Note
In case of binary classification, we can input not only an n x 2 matrix, where the first column contains probabilities for a negative label, and the second column contains probabilities for a positive label, but also a matrix consisting of one column with positive probabilities. This is because binary classification models can return either two probabilities or one probability for a positive label.
Example:
vector y_true={7,2,1,0,4,1,4,9,5,9,0,6,9,0,1,5,9,7,3,4,8,4,2,7,6,8,4,2,3,6};
|