segment-modeling

Discover segmentation strategies and train per-segment XGBoost models with AUC/KS evaluation.

580|66|Updated Apr 21, 2025
One-click install
npx skills add https://github.com/aliyun/qwen-dianjin --skill segment-modeling
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: segment-modeling
Source: https://github.com/aliyun/qwen-dianjin/tree/main/DianJin-SKILLS/financial-engineering-expert/segment-modeling
Command: npx skills add https://github.com/aliyun/qwen-dianjin --skill segment-modeling

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill helps you improve binary classification performance by finding an effective segmentation strategy and training separate sub-models for each segment instead of using one single model for all users.

Core Features & Use Cases

  • Segmentation strategy exploration (rule / clustering / decision-tree): Supports rule-based segmentation (human priors), unsupervised clustering (e.g., K-Means), and supervised decision-tree segmentation to discover meaningful groups.
  • Try → Measure → Keep/Discard → Repeat workflow: Runs multiple rounds to explore candidate segmentation hypotheses, evaluates them with AUC or KS, and keeps only better strategies while discarding non-improving or unstable ones.
  • Sub-model training and aggregation: Trains an independent XGBoost model per segment and combines predictions using either routing (route) or stacking (stacking) style aggregation.
  • Stability and coverage checks: Enforces minimum segment coverage and penalizes segment distribution drift via PSI to avoid fragile segmentation schemes.

Quick Start

Use the segment-modeling skill to run autonomous customer segmentation modeling on your dataset by selecting target y_label, using max_rounds 5, and outputting the results to ./outputs/seg.

Frequently Asked Questions about segment-modeling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I train separate sub-models for different customer segments in binary classification?

To train separate sub-models for customer segments, you apply a segmentation strategy to split users and train an independent XGBoost model for each segment. This approach optimizes binary classification by tailoring models to specific groups rather than using a single global model.

What is the best way to discover meaningful customer segments for group-based modeling?

The best way to discover meaningful customer segments is exploring rule-based, clustering-based, and decision-tree-based hypotheses. By running multiple rounds of segment generation and measuring performance with AUC or KS, you keep effective segments and discard unstable ones.

How do I aggregate predictions from multiple segment-specific XGBoost models?

You aggregate predictions from segment-specific XGBoost models using either routing or stacking style aggregation. Routing directs inputs through their matched segment model, while stacking combines outputs from all segment models to produce the final binary classification prediction.

How can I check the stability of customer segmentation schemes to avoid distribution drift?

You check the stability of customer segmentation schemes by enforcing minimum segment coverage and penalizing distribution drift via PSI. Applying these stability constraints ensures your segmentation strategy remains robust and prevents fragile sub-models.

Does this segmentation approach work with my existing train, validation, and OOT data splits?

Yes, this segmentation approach works with your existing data splits. It requires loading your dataset and producing train, validation, and OOT splits to evaluate segment-specific XGBoost models, ensuring out-of-time testing validates the selected segmentation strategy.

Why should I use multiple sub-models instead of one single model for all users?

You should use multiple sub-models instead of one single model to improve binary classification performance for distinct groups. Training segment-specific models captures behavioral differences across customer segments, achieving better AUC and KS than a generalized single model.