Classification Task

Evaluate synthetic data utility for classification problems.

Usage Examples

Click the below button to run this example in Colab:

Open In Colab

Splitter:
  external_split:
    method: custom_data
    filepath:
      ori: benchmark://adult-income_ori
      control: benchmark://adult-income_control
    schema:
      ori: benchmark://adult-income_schema
      control: benchmark://adult-income_schema
Synthesizer:
  external_data:
    method: custom_data
    filepath: benchmark://adult-income_syn
    schema: benchmark://adult-income_schema
Evaluator:
  classification_utility:
    method: mlutility
    task_type: classification
    target: income                       # Target column (required)
    experiment_design: domain_transfer   # Experiment design (default: domain_transfer)
    resampling: None                     # Imbalance handling (default none, omit if not needed)
    metrics:                             # Evaluation metrics
      - mcc
      - f1_score
      - roc_auc
      - accuracy
    random_state: 42                     # Random seed (default: 42)
    xgb_params:                          # XGBoost parameters (omit if not needed)
      scale_pos_weight: 3                # Positive class weight ratio (default: 1)
      max_depth: 5                       # Maximum tree depth (default: 6)
      min_child_weight: 3                # Minimum sum of instance weight in a child (default: 1)
      subsample: 0.8                     # Sample ratio per tree (default: 1.0)
      colsample_bytree: 0.8              # Feature ratio per tree (default: 1.0)

Task-Specific Parameters

ParameterTypeDefaultDescription
targetstringRequiredTarget variable column name for classification
resamplingstringNoneImbalanced data handling: omit for none, or use smote-enn, smote-tomek
metricsarraySee belowEvaluation metrics to calculate
xgb_paramsdictNoneXGBoost hyperparameters (omit for defaults)

Default Metrics

  • f1_score, roc_auc, accuracy
  • precision, recall, specificity
  • mcc, pr_auc
  • tp, tn, fp, fn

XGBoost Parameters

ParameterDefaultDescription
n_estimators100Number of boosting rounds (trees)
max_depth6Maximum tree depth
learning_rate0.3Learning rate (eta)
subsample1.0Sample ratio per tree
colsample_bytree1.0Feature ratio per tree
scale_pos_weight1Weight ratio for positive class (for imbalanced data)
min_child_weight1Minimum sum of instance weight in a child
ℹ️
If you don’t need to adjust XGBoost parameters, you can omit the entire xgb_params block and the system will use default values.

For detailed parameter descriptions and tuning guidance, please refer to the XGBoost documentation.

Supported Metrics

MetricDescriptionRangeDefault
f1_scoreHarmonic mean of precision and recall0-1
roc_aucArea under ROC curve0-1
accuracyOverall correct predictions0-1
precisionTrue positives / (True positives + False positives)0-1
recallTrue positives / (True positives + False negatives)0-1
specificityTrue negatives / (True negatives + False positives)0-1
mccMatthews Correlation Coefficient-1 to 1
pr_aucArea under Precision-Recall curve0-1
tpTrue positives (count)≥0
tnTrue negatives (count)≥0
fpFalse positives (count)≥0
fnFalse negatives (count)≥0
sensitivitySame as recall0-1

Key Metrics Recommendations

Standard Classification

MetricDescriptionRecommended Standard
F1 ScoreBalance between precision and recall≥ 0.7
ROC AUCComprehensive performance across all thresholds≥ 0.8

Imbalanced Classification

MetricDescriptionRecommended Standard
PR AUCPerformance on minority class (not diluted by negatives)≥ 0.3*
MCCBalanced measure considering all confusion matrix elements≥ 0.5

*PR AUC standard varies with imbalance ratio:

  • Mild imbalance (10-20% minority): ≥ 0.5
  • Moderate imbalance (5-10% minority): ≥ 0.3
  • Severe imbalance (<5% minority): ≥ 0.2

Handling Imbalanced Data

When to Use Resampling

  • Class imbalance > 10:1: Consider resampling
  • Minority class < 10%: Strongly recommended
  • Minority class < 1%: Essential

Resampling Methods

SMOTE-ENN: Synthesizes minority class samples and aggressively removes noise, suitable for noisy data with unclear boundaries.

SMOTE-Tomek: Synthesizes minority class samples and conservatively removes boundary conflicts, suitable for cleaner data with overlapping classes.

ℹ️
Resampling is only applied to training data (ori and syn), never to test data (control).