Survival Prediction for Liver Cirrhosis

A Robust Machine Learning Model for Patient Outcome Forecasting

Full Analysis on GitHub

The Problem & Data Context

Liver cirrhosis is a progressive disease with high mortality rates. Predicting patient survival—whether a patient will die (D), be censored due to a liver transplant (C), or be censored without a transplant (O)—is crucial for timely clinical interventions and resource allocation. This project applies advanced classification techniques to complex clinical data to provide early, accurate prognostic assessments.

Dataset Snapshot: 418 Total Samples, 19 Features (after encoding), 3 Target Classes (D, C, O), and a significant Class Imbalance Ratio of 9.25.

Core Model Performance Summary

Best Classifier

LogReg

(Logistic Regression, Balanced)

Best CV Score

0.7436

Cross-Validation Performance

Test Accuracy

69.05%

Final Classification Performance

Test F1-Score

0.693

Harmonic mean of Precision/Recall

Model Selection & Benchmarking

Six classifier variants were benchmarked using cross-validation to ensure model robustness and to mitigate the effects of class imbalance. The models were ranked based on their cross-validation F1-weighted score.

Rank Model Variant Best CV Score (F1-Weighted)
1 Logistic Regression (Balanced) 0.7436
2 Logistic Regression (Original) 0.7377
3 SVM (Original) 0.7275
4 SVM (Balanced) 0.7185
5 Ridge Classifier (Original) 0.7180
6 Ridge Classifier (Balanced) 0.7180

Justification for Selection:

The Logistic Regression (Balanced) model was chosen due to achieving the **highest F1-weighted cross-validation score (0.7436)**. The F1-weighted metric ensures performance is accurately assessed across all three imbalanced classes, providing the most reliable estimate of the model's true predictive capability.

Technical Approach & Preprocessing

  • Preprocessing Pipeline: Data was cleaned using imputation for missing values, skewness correction, and `StandardScaler` for feature normalization. Categorical features were one-hot encoded.
  • Model Selection: Benchmarking included Logistic Regression, Ridge Classifier, and SVC. **Logistic Regression** with `class_weight='balanced'` was selected for its superior cross-validation score and interpretability.
  • Validation: Performance was optimized using 5-fold Cross-Validation via `GridSearchCV` for robust parameter tuning, followed by final evaluation on a separate 84-sample Test set.

Dual Feature Importance Methodology

Commonly Important Features (Both Methods):

N_Days (Rank 1, 1) Bilirubin (Rank 3, 3) Copper (Rank 6, 6) Stage (Rank 12, 12)

Method-Specific Insights:

  • ANOVA F-test: Identified Bilirubin as the single most important feature based on its strong *univariate* statistical relationship with the target.
  • Permutation Importance: Identified SGOT as the most influential feature on model performance, capturing *interaction effects* within the LogReg model.

Conclusion: Moderate agreement between statistical (ANOVA) and model-driven (Permutation) importance suggests complex feature interactions. 17/19 features were found to be statistically significant (p<0.05).

Technologies Used

Python Logistic Regression Machine Learning Classification Scikit-learn Pandas/NumPy