cuimiandashi commited on
Commit
7958da6
Β·
verified Β·
1 Parent(s): c67bb02

Upload REPORT.md

Browse files
Files changed (1) hide show
  1. REPORT.md +405 -0
REPORT.md ADDED
@@ -0,0 +1,405 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # STAT 5430 Course Project Report
2
+ ## Acute GVHD Severity Prediction: Binary Classification Using Pre-Transplant Variables
3
+
4
+ ---
5
+
6
+ ## 1. Project Background and Objectives
7
+
8
+ ### 1.1 Research Question
9
+ Acute graft-versus-host disease (aGVHD) is one of the most common complications after hematopoietic cell transplantation (HCT), significantly impacting patient survival and quality of life. This project aims to build a binary classification model using **only pre-transplant variables** to predict whether a patient will develop **severe (Grade 3-4) aGVHD**.
10
+
11
+ ### 1.2 Clinical Significance
12
+ - Severe aGVHD incidence: ~16.3%, but with high mortality
13
+ - Pre-transplant prediction can help physicians adjust conditioning regimens and intensify monitoring
14
+ - Using only pre-transplant variables means the model can be deployed before transplantation, making it clinically practical
15
+
16
+ ### 1.3 Data Sources
17
+ - **Main data**: `Cleaned_Data_Final.csv` (8,027 cases, 227 variables)
18
+ - **Data dictionary**: `3.xlsx` (variable definitions, types, GVHD relevance annotations)
19
+ - Data from CIBMTR (Center for International Blood and Marrow Transplant Research)
20
+
21
+ ---
22
+
23
+ ## 2. Data Preprocessing
24
+
25
+ ### 2.1 Label Construction
26
+ Following course requirements, construct three-class labels using `agvhd24` and `agvhd34`:
27
+
28
+ | agvhd34 | agvhd24 | GVHD Grade | Label |
29
+ |---------|---------|------------|-------|
30
+ | 1 | - | Severe | 3 |
31
+ | 0 | 1 | Moderate | 2 |
32
+ | 0 | 0 | Mild | 1 |
33
+
34
+ **Binary target**: `target = (agvhd34 == 1)`, i.e., **Severe vs Non-severe**
35
+
36
+ ### 2.2 Data Cleaning
37
+ - Replace missing value code `905` with NaN
38
+ - Remove post-transplant variables (cgvhd, grfs, trm, etc.)
39
+ - Keep only pre-transplant variables: 179 features
40
+ - Remove features with >50% missing (none in practice)
41
+ - Fill numerical missing values with median
42
+
43
+ ### 2.3 Data Splitting
44
+ - Training set: 6,421 cases (80%)
45
+ - Test set: 1,606 cases (20%)
46
+ - Stratified sampling to maintain Severe proportion (16.3%)
47
+
48
+ ### 2.4 Class Imbalance Handling
49
+ - Severe: 1,307 cases (16.3%)
50
+ - Non-severe: 6,720 cases (83.7%)
51
+ - Use `scale_pos_weight = 5.14` for cost-sensitive learning
52
+
53
+ ---
54
+
55
+ ## 3. Modeling Methods
56
+
57
+ This project attempted **7 different methods**, from traditional machine learning to cutting-edge deep learning:
58
+
59
+ ### Method 1: TabNet (Interpretable Neural Network)
60
+ **Principle**: Attention-based tabular deep learning model that selects features through sequential attention masks, providing instance-level interpretability.
61
+
62
+ **Configuration**:
63
+ ```python
64
+ n_d=64, n_a=64, n_steps=5, gamma=1.5
65
+ lambda_sparse=1e-4, lr=1e-3, batch_size=512
66
+ ```
67
+
68
+ **Characteristics**:
69
+ - Built-in feature importance
70
+ - Single-sample attention visualization
71
+ - Poor performance on this dataset (AUC=0.52)
72
+
73
+ **Failure Analysis**:
74
+ - 179-dimensional features too sparse for TabNet
75
+ - Lack of effective feature selection mechanism
76
+ - Medical tabular data noise overwhelms signal
77
+
78
+ ---
79
+
80
+ ### Method 2: LightGBM (Gradient Boosting)
81
+ **Principle**: Histogram-based gradient boosting framework by Microsoft, strong at handling class imbalance.
82
+
83
+ **Configuration**:
84
+ ```python
85
+ n_estimators=1000, learning_rate=0.05, max_depth=6
86
+ num_leaves=31, subsample=0.8, colsample_bytree=0.8
87
+ scale_pos_weight=5.14
88
+ ```
89
+
90
+ ---
91
+
92
+ ### Method 3: XGBoost (Extreme Gradient Boosting)
93
+ **Principle**: Gradient boosting library by Tianqi Chen, stronger regularization to prevent overfitting.
94
+
95
+ **Configuration**:
96
+ ```python
97
+ n_estimators=1000, learning_rate=0.05, max_depth=5
98
+ subsample=0.8, colsample_bytree=0.8
99
+ scale_pos_weight=5.14
100
+ ```
101
+
102
+ ---
103
+
104
+ ### Method 4: CatBoost (Categorical Boosting)
105
+ **Principle**: Developed by Yandex, native categorical feature handling, Ordered Boosting reduces overfitting.
106
+
107
+ **Configuration**:
108
+ ```python
109
+ iterations=1000, learning_rate=0.05, depth=6
110
+ l2_leaf_reg=3, scale_pos_weight=5.14
111
+ ```
112
+
113
+ ---
114
+
115
+ ### Method 5: Ensemble (Stacking)
116
+ **Principle**: Combine predictions from multiple base learners to reduce variance and improve generalization.
117
+
118
+ **Two ensemble strategies**:
119
+ 1. Simple average: `(LGB + XGB + CAT) / 3`
120
+ 2. Weighted average: weighted by validation AUC
121
+
122
+ ---
123
+
124
+ ### Method 6: AutoGluon (AutoML)
125
+ **Principle**: AWS automatic machine learning framework with multi-layer stacking and hyperparameter search.
126
+
127
+ **Attempted configurations**:
128
+ - `presets='best_quality'`: multi-layer stacking + bagging
129
+ - `presets='good_quality'`: fast high quality
130
+
131
+ **Issues**:
132
+ - Complex dependency installation (lightgbm/catboost/xgboost/torch)
133
+ - GPU environment configuration difficulties
134
+ - Failed to run successfully in sandbox environment
135
+
136
+ ---
137
+
138
+ ### Method 7: Conformal Prediction (Uncertainty Quantification)
139
+ **Principle**: Non-parametric statistical method constructing prediction sets with **guaranteed coverage**.
140
+
141
+ **Steps**:
142
+ 1. Train model on training set
143
+ 2. Compute non-conformity scores on calibration set: `score = 1 - p(true_class)`
144
+ 3. Calculate quantile threshold
145
+ 4. Construct prediction sets on test set
146
+
147
+ **Clinical significance**:
148
+ - High-confidence samples: adopt model prediction directly
149
+ - Low-confidence samples: recommend manual review
150
+ - Coverage rate β‰₯90%, controlling misdiagnosis risk
151
+
152
+ ---
153
+
154
+ ## 4. Experimental Results
155
+
156
+ ### 4.1 Model Performance Comparison
157
+
158
+ | Rank | Model | AUC | Notes |
159
+ |------|-------|-----|-------|
160
+ | 1 | **CatBoost** | **0.6885** | Best single model |
161
+ | 2 | Ensemble (weighted) | 0.6861 | No significant improvement |
162
+ | 3 | Ensemble (average) | 0.6856 | Close to CatBoost |
163
+ | 4 | LightGBM | 0.6646 | Baseline tree model |
164
+ | 5 | XGBoost | 0.6553 | Over-regularization |
165
+ | 6 | TabNet | 0.5153 | Not suitable for this data |
166
+
167
+ ### 4.2 Key Findings
168
+
169
+ **1. Why CatBoost is optimal**
170
+ - Native categorical feature handling (race, marital status)
171
+ - Ordered Boosting reduces target leakage
172
+ - More robust for high-dimensional sparse medical data
173
+
174
+ **2. Why ensemble did not improve**
175
+ - High correlation between three tree models (>0.85)
176
+ - Lack of diversity, limited ensemble gain
177
+ - Suggestion: add neural networks or linear models for diversity
178
+
179
+ **3. Clinical reasonableness of AUC 0.69**
180
+ - Predicting post-transplant complications using only pre-transplant variables is extremely difficult
181
+ - Literature shows similar tasks typically achieve AUC 0.65-0.75
182
+ - Post-transplant variables (early GVHD manifestations) would significantly improve AUC
183
+
184
+ ### 4.3 Feature Importance Analysis
185
+
186
+ **Top 10 important features (CatBoost + LightGBM consensus)**:
187
+
188
+ | Rank | Feature | Clinical Meaning | Importance |
189
+ |------|---------|------------------|------------|
190
+ | 1 | **grpcod** | Transplant center code | Highest |
191
+ | 2 | **dnrage** | Donor age | High |
192
+ | 3 | **pbcd34kg** | CD34+ cell dose/kg | High |
193
+ | 4 | **ldhpr** | Pre-transplant LDH | Medium-High |
194
+ | 5 | **bmi** | Body mass index | Medium-High |
195
+ | 6 | **rawtpr** | Pre-transplant weight | Medium |
196
+ | 7 | **ast_pr** | Pre-transplant AST | Medium |
197
+ | 8 | **agedx** | Age at diagnosis | Medium |
198
+ | 9 | **hb_pr** | Pre-transplant hemoglobin | Medium |
199
+ | 10 | **plate_pr** | Pre-transplant platelets | Medium |
200
+
201
+ **Clinical interpretation**:
202
+ - **Center effect (grpcod)**: Different centers have different patient populations and protocols
203
+ - **Donor age**: Younger donors have better stem cell quality
204
+ - **Cell dose**: CD34+ dose affects immune reconstitution
205
+ - **Liver function indicators**: LDH/AST reflect disease burden and organ status
206
+
207
+ ### 4.4 Conformal Prediction Results
208
+
209
+ | Metric | Value |
210
+ |--------|-------|
211
+ | Confidence level Ξ± | 0.10 (90% coverage) |
212
+ | High-confidence samples | 494 (31%) |
213
+ | Low-confidence samples | 1,112 (69%) |
214
+ | Actual coverage rate | 97.45% |
215
+ | Target coverage rate | β‰₯90% |
216
+
217
+ **Medical deployment strategy**:
218
+ - High-confidence predictions β†’ automatic classification, saving physician time
219
+ - Low-confidence predictions β†’ flagged for "manual review"
220
+ - Effectively identifies "difficult cases", reducing misdiagnosis risk
221
+
222
+ ---
223
+
224
+ ## 5. Method Comparison and Discussion
225
+
226
+ ### 5.1 Method Selection Decision Tree
227
+
228
+ ```
229
+ Data type: Medical tabular data
230
+ β”œβ”€β”€ High feature dimension (>100)?
231
+ β”‚ β”œβ”€β”€ Yes β†’ Tree models (LGB/XGB/CAT) better than neural networks
232
+ β”‚ └── No β†’ Can try TabNet/FT-Transformer
233
+ β”œβ”€β”€ Many categorical features?
234
+ β”‚ β”œβ”€β”€ Yes β†’ CatBoost optimal
235
+ β”‚ └── No β†’ LightGBM/XGBoost both fine
236
+ β”œβ”€β”€ Need interpretability?
237
+ β”‚ β”œβ”€β”€ Yes β†’ TabNet (sacrifices performance) or SHAP (post-hoc)
238
+ β”‚ └── No β†’ Any high-performance model
239
+ └── Need uncertainty quantification?
240
+ β”œβ”€β”€ Yes β†’ Conformal Prediction (model-agnostic)
241
+ └── No β†’ Direct probability output
242
+ ```
243
+
244
+ ### 5.2 Pros and Cons of Each Method
245
+
246
+ | Method | Pros | Cons | Suitable Scenarios |
247
+ |--------|------|------|-------------------|
248
+ | TabNet | Strong interpretability | Poor on high-dimensional data | Low-dimensional, clear feature relationships |
249
+ | LightGBM | Fast, accurate | Requires tuning | General tabular data |
250
+ | XGBoost | Strong regularization | Slower, prone to underfitting | Small samples, overfitting prevention |
251
+ | CatBoost | Native categorical support | Slower training | Data with many categorical features |
252
+ | AutoGluon | Fully automatic | Complex dependencies, resource-heavy | Quick baseline |
253
+ | Conformal | Coverage guarantee | Prediction sets may be too large | High-risk medical scenarios |
254
+
255
+ ---
256
+
257
+ ## 6. Code Implementation
258
+
259
+ ### 6.1 Complete Data Preprocessing
260
+
261
+ ```python
262
+ import pandas as pd
263
+ import numpy as np
264
+
265
+ # Load data
266
+ df = pd.read_csv('Cleaned_Data_Final.csv')
267
+
268
+ # Handle missing value codes
269
+ for col in ['agvhd24', 'agvhd34']:
270
+ df[col] = df[col].replace(905, np.nan)
271
+
272
+ # Construct binary label: Severe vs Non-severe
273
+ df['target'] = (df['agvhd34'] == 1).astype(int)
274
+
275
+ # Remove post-transplant variables
276
+ post_vars = ['agvhd24', 'agvhd34', 'ahisgut', 'ahisliv', ...]
277
+ feature_cols = [c for c in df.columns if c not in post_vars]
278
+
279
+ # Data cleaning
280
+ model_df = df[feature_cols + ['target']].copy()
281
+ for col in feature_cols:
282
+ if model_df[col].dtype in ['float64', 'int64']:
283
+ model_df[col] = model_df[col].replace(905, np.nan)
284
+ model_df[col] = model_df[col].fillna(model_df[col].median())
285
+
286
+ # Split
287
+ from sklearn.model_selection import train_test_split
288
+ train_df, test_df = train_test_split(
289
+ model_df, test_size=0.2, stratify=model_df['target'], random_state=42
290
+ )
291
+ ```
292
+
293
+ ### 6.2 CatBoost Training
294
+
295
+ ```python
296
+ from catboost import CatBoostClassifier
297
+ from sklearn.metrics import roc_auc_score
298
+
299
+ # Calculate class weights
300
+ scale_pos_weight = len(y_train[y_train==0]) / len(y_train[y_train==1])
301
+
302
+ # Train
303
+ model = CatBoostClassifier(
304
+ iterations=1000,
305
+ learning_rate=0.05,
306
+ depth=6,
307
+ l2_leaf_reg=3,
308
+ scale_pos_weight=scale_pos_weight,
309
+ random_seed=42,
310
+ verbose=False
311
+ )
312
+ model.fit(X_train, y_train, eval_set=(X_test, y_test))
313
+
314
+ # Evaluate
315
+ proba = model.predict_proba(X_test)[:, 1]
316
+ auc = roc_auc_score(y_test, proba)
317
+ print(f"AUC: {auc:.4f}")
318
+ ```
319
+
320
+ ### 6.3 Conformal Prediction
321
+
322
+ ```python
323
+ # Split calibration set
324
+ train_idx, cal_idx = train_test_split(
325
+ np.arange(len(train_df)), test_size=0.25,
326
+ stratify=y_train, random_state=42
327
+ )
328
+
329
+ # Calibration probabilities
330
+ cal_proba = model.predict_proba(X_train[cal_idx])[:, 1]
331
+ cal_proba_2class = np.stack([1-cal_proba, cal_proba], axis=1)
332
+
333
+ # Compute non-conformity scores
334
+ scores = 1 - cal_proba_2class[np.arange(len(cal_idx)), y_cal.astype(int)]
335
+
336
+ # Quantile threshold
337
+ alpha = 0.1
338
+ q_level = np.ceil((len(cal_idx) + 1) * (1 - alpha)) / len(cal_idx)
339
+ threshold = np.quantile(scores, q_level, method='higher')
340
+
341
+ # Test prediction sets
342
+ test_scores = 1 - np.stack([1-test_proba, test_proba], axis=1)
343
+ prediction_sets = test_scores <= threshold
344
+ ```
345
+
346
+ ---
347
+
348
+ ## 7. Limitations and Future Work
349
+
350
+ ### 7.1 Current Limitations
351
+ 1. **Insufficient feature engineering**: No interaction features created (age difference, cell dose/weight ratio)
352
+ 2. **FT-Transformer not attempted**: Tabular Transformer may be more suitable for high-dimensional data
353
+ 3. **Limited hyperparameter search**: Used default parameters, no systematic tuning
354
+ 4. **Single-fold split**: No K-fold cross-validation, results may have variance
355
+
356
+ ### 7.2 Improvement Directions
357
+ 1. **Feature engineering**:
358
+ - Donor-recipient age difference
359
+ - CD34+ dose/weight ratio
360
+ - HLA matching composite score
361
+ - Disease risk stratification combinations
362
+
363
+ 2. **Model improvements**:
364
+ - FT-Transformer (tabular-specific Transformer)
365
+ - Deep ensemble (add neural networks)
366
+ - Bayesian optimization for hyperparameters
367
+
368
+ 3. **Evaluation improvements**:
369
+ - 5-fold cross-validation
370
+ - Temporal split (by transplant year)
371
+ - External validation (different centers)
372
+
373
+ 4. **Clinical deployment**:
374
+ - Build web interface for pre-transplant variable input
375
+ - Output prediction probability + confidence flag
376
+ - Automatic expert referral for low-confidence cases
377
+
378
+ ---
379
+
380
+ ## 8. Conclusion
381
+
382
+ This project attempted multiple methods from traditional machine learning to cutting-edge deep learning for pre-transplant prediction of acute GVHD severity. Main conclusions:
383
+
384
+ 1. **CatBoost is the best choice** (AUC=0.6885), benefiting from native categorical feature support
385
+ 2. **Tree models outperform neural networks** on this dataset because high-dimensional sparse features are not suitable for TabNet
386
+ 3. **Conformal Prediction provides valuable uncertainty quantification**, identifying cases requiring manual review
387
+ 4. **Predicting severe GVHD using only pre-transplant variables is a clinical challenge**, AUC 0.69 is within reasonable range
388
+ 5. **Feature importance reveals center effect, donor age, and cell dose as key factors**
389
+
390
+ ---
391
+
392
+ ## Appendix: Runtime Environment
393
+
394
+ - Python 3.12
395
+ - pandas 2.x
396
+ - numpy 1.26
397
+ - scikit-learn 1.4
398
+ - lightgbm 4.x
399
+ - xgboost 2.x
400
+ - catboost 1.2
401
+
402
+ ---
403
+
404
+ *Report generated: May 2025*
405
+ *Course: STAT 5430 - Statistical Learning*