Binary classification evaluation

更新时间:
复制 MD 格式

The Binary Classification Evaluation component measures the performance of binary classification models. It calculates AUC (area under the ROC curve), KS (Kolmogorov-Smirnov), and F1 score, and generates a set of charts for visual analysis. Use this component after training a binary classifier in PAI Designer to understand how well the model separates positive and negative classes.

Outputs

Metrics

MetricWhat it measures
AUC (area under the ROC curve)Overall separability between positive and negative classes across all decision thresholds. A higher AUC means the model ranks positive samples above negative ones more reliably. Values range from 0 to 1; 0.5 indicates no discrimination.
KS (Kolmogorov-Smirnov)Maximum separation between the cumulative distributions of positive and negative samples. A higher KS value indicates stronger class separation. Commonly used in credit scoring and risk modeling.
F1 scoreHarmonic mean of precision and recall. Use F1 when you need to balance the trade-off between false positives and false negatives, particularly on imbalanced datasets.

Charts

ChartWhat it shows
KS curveThe cumulative distribution gap between positive and negative samples at each decision threshold.
Precision-recall (PR) curveThe trade-off between precision and recall across thresholds. Useful when positive samples are rare.
Receiver operating characteristic (ROC) curveThe true positive rate versus the false positive rate across thresholds. The area under this curve equals AUC.
Lift chartHow much better the model performs compared to random selection, given a specific fraction of the population. For example, a lift of 3 at the top 10% means the model finds three times as many positives as random sampling in that group.
Gain chartThe cumulative percentage of positive samples captured as you increase the fraction of the population targeted. Useful for ranking-based selection tasks such as marketing campaigns.

Configure the component

Method 1: Use the GUI

On the Designer workflow page, add the Binary Classification Evaluation component and configure its parameters in the right pane.

ParameterDescription
Label column nameThe name of the target column.
Score column nameThe prediction score column. This is usually the prediction_score column.
Positive sample label valueThe label value that identifies positive samples.
Number of bins for equal frequency binningThe number of buckets for equal-frequency partitioning.
Group column nameThe group ID column. Evaluation metrics are calculated separately for each group. Use this for evaluation-by-group scenarios.
Advanced optionsSelect this check box to show the Prediction detail column, Are prediction and evaluation targets consistent, and Save performance metrics parameters.
Prediction detail columnThe name of the column that contains prediction details.
Are prediction and evaluation targets consistentWhether the model predicts the same class that the evaluation metric targets. See Prediction and evaluation target consistency.
Save performance metricsWhether to save the performance metrics to an output table.

Prediction and evaluation target consistency

This setting controls how rank-based metrics such as Lift are calculated when the class the model predicts differs from the class the metric evaluates.

ScenarioModel predictsMetric evaluatesConsistent?
Finance (risk scoring)Probability that a customer is "bad" — a higher score means more likely badBad-customer detection rateYes
Credit scoringProbability that a customer is "good" — a higher score means more likely goodBad-customer detection rateNo

Method 2: Use PAI commands

Call the component via the SQL Script component using the following PAI command syntax. For more information about calling PAI commands, see SQL Script.

PAI -name=evaluate -project=algo_public
    -DoutputMetricTableName=output_metric_table
    -DoutputDetailTableName=output_detail_table
    -DinputTableName=input_data_table
    -DlabelColName=label
    -DscoreColName=score
ParameterRequiredDefaultDescription
inputTableNameYesThe name of the input table.
inputTablePartitionsNoFull tableThe partitions in the input table.
labelColNameYesThe name of the target column.
scoreColNameYesThe name of the score column.
groupColNameNoThe name of the group column. Use this for evaluation-by-group scenarios.
binCountNo1000The number of equal-frequency bins for calculating metrics such as KS and PR.
outputMetricTableNameYesThe output table for metrics, which includes AUC, KS, and F1 score.
outputDetailTableNameNoThe detailed data table used to plot charts.
positiveLabelNo1The label value for positive samples.
lifecycleNoThe lifecycle of the output table.
coreNumNoAutomatically calculatedThe number of cores.
memSizePerCoreNoAutomatically calculatedThe memory size per core.