Leveraging Machine Learning to Predict Surgical Outcomes in Ophthalmology


Introduction

In the field of ophthalmology, keratoconus is a progressive corneal disease that significantly impairs vision due to corneal thinning and irregular astigmatism. Intrastromal corneal ring segment (ICRS) implantation is a surgical intervention designed to reshape the cornea and improve visual acuity. However, postoperative outcomes vary widely, posing challenges for preoperative predictions. As part of my work in machine learning (ML) applied to healthcare, I contributed to a study developing predictive models to forecast postoperative visual improvements. This project showcases my expertise in data preprocessing, feature engineering, model selection, and evaluation—skills highly transferable to ML roles in industries such as healthcare, finance, or technology.

This article provides a detailed walkthrough of the project, from problem definition to results, emphasizing the ML techniques employed.

For a comprehensive understanding, you can view the published paper (open access) here or download it right there. (Cornea, 2025).

Problem Statement

Keratoconus affects approximately 1 in 2,000 individuals, causing vision distortion due to progressive corneal thinning and irregularities. This condition leads to high-order aberrations—optical imperfections beyond simple nearsightedness or farsightedness—that scatter light and impair visual clarity, making it difficult for patients to achieve adequate vision even with corrective glasses. Intracorneal ring segment (ICRS) surgery aims to flatten the cornea and improve visual outcomes, yet 25% of surgeries result in no vision improvement, and 5% are critical failures, where patients experience worsened vision post-procedure. These outcomes underscore the need for precise patient selection and outcome prediction to optimize surgical success.

Our objectives were to leverage machine learning (ML) to address these challenges and drive innovation in ophthalmic care:

  • Classify whether a patient would gain more than 1 line of visual acuity postoperatively (binary classification), enabling clinicians to identify suitable candidates for ICRS surgery with higher confidence.
  • Predict quantitative outcomes, such as postoperative LogMAR visual acuity, keratometry (corneal curvature), and corneal asphericity (regression), to provide detailed prognostic insights.

By developing robust ML models, we aim to enhance surgical decision-making, improve patient selection, and enable personalized treatment planning. These advancements not only improve patient outcomes but also position our solution as a scalable tool for ophthalmic practices, offering data-driven precision to reduce surgical failures and optimize resource allocation. This approach aligns with the growing demand for AI-driven healthcare solutions, creating opportunities for collaboration with medical institutions, technology partners, and investors seeking to revolutionize personalized medicine.

Descriptive alt text

Data Collection and Preprocessing

The dataset included 120 eyes from 102 keratoconus patients who underwent ICRS implantation between 2021 and 2024. Data sources comprised:

  • Refractive Data: Uncorrected and corrected visual acuity (converted to LogMAR), spherical equivalent, and cylinder.
  • Corneal Topography/Tomography: Obtained from the MS-39 device, including keratometry (K1, K2, Kmax), minimum corneal thickness, asphericity (Q-value), and aberrations like coma.

Preprocessing Steps

The preprocessing pipeline demonstrated key ML skills, including data integration, feature engineering, and handling missing data:

  • Extracted 196 statistical features (e.g., min, max, mean, variance, percentiles, skewness, kurtosis) from CSV files.
  • Reconstructed 11 topography maps, normalized, and resized to 256x256 for convolutional neural network (CNN) input.
  • Applied z-score normalization to continuous variables and one-hot encoding to categorical variables.
  • Imputed missing data using median values.
  • Split the dataset: 70% training, 15% validation, 15% test, with 3-fold cross-validation.

Machine Learning Models

We utilized a combination of gradient boosting and deep learning models, highlighting proficiency in both traditional ML and neural networks.

Classification: Predicting Visual Gain

  • Model: XGBoost (Gradient Boosting Classifier).
  • Task: Binary classification (visual gain >1 line vs. ≤1 line).
  • Hyperparameter Tuning: Grid search with cross-validation.
  • Performance: Achieved a perfect R²=1.0 and Youden Index=1.0 (all test samples correctly classified, though small sample size raises potential overfitting concerns).
  • Feature Importance: Key predictors included preoperative LogMAR DCVA, keratometry values, and corneal elevations (see Table 2 in the paper).

This task underscores skills in classification, handling imbalanced data, and interpreting model decisions.

Regression: Predicting Quantitative Outcomes

  • Model: CatBoost (natively handles categorical features and models nonlinear relationships).
  • Tasks and Performance:
    • LogMAR DCVA: R²=0.59, MAE=0.07 (approximately 0.7 lines).
    • Mean Keratometry: R²=0.76, MAE=1.08 D.
    • Corneal Asphericity (Q-value): R²=0.54, MAE=0.29.
  • Feature Importance: Preoperative visual acuity and corneal elevations were critical drivers (see Figure 1).

Deep Learning: CNN for Topography Maps

  • Architecture: Modified VGG16 implemented in PyTorch, featuring convolutional layers, max-pooling, fully connected layers, and dropout.
  • Input: Reconstructed 256x256 topography maps.
  • Optimizer: AdamW with a learning rate of 1e-2.
  • Performance: Lower than boosting models (e.g., R²=0.10 for LogMAR), highlighting challenges in leveraging spatial data for this dataset.

Table 3: Model Comparison
CatBoost outperformed the CNN, emphasizing the strength of ensemble methods for tabular data in this context.

Results and Insights

Descriptive Statistics

  • Average Visual Gain: 2 lines of visual acuity.
  • Cylinder Reduction: 1.84 D.
  • Keratometry Decrease: 2.86 D.

Key Findings

  • Models accurately predicted outcomes using preoperative data, with corneal metrics (e.g., keratometry, asphericity) being more influential than segment characteristics.
  • Implications: Enhanced patient selection and surgical planning, potentially reducing unnecessary procedures.

Feature Importance

Analysis revealed that preoperative keratometry and asphericity were primary drivers of predictions, aligning with clinical expectations.

Lessons Learned and Transferable Skills

This project refined my expertise in:

  • End-to-End ML Pipelines: From data collection to deployment-ready models.
  • Tools: Python (Pandas, Scikit-learn, XGBoost, CatBoost, PyTorch), statistical analysis (Spearman correlations, Mann-Whitney tests).
  • Healthcare ML: Managing sensitive medical data and adhering to ethical standards (Helsinki Declaration compliance).
  • Challenges Overcome: Handling high-dimensional data, small sample sizes, and integrating imaging with tabular features.

These skills are directly applicable to predictive modeling in domains like fraud detection, customer churn prediction, or recommendation systems.

Conclusion

By applying advanced machine learning to ophthalmology, this project demonstrates the potential to personalize ICRS surgery for keratoconus patients. The work not only advances treatment strategies but also exemplifies robust ML practices. I’m eager to apply these skills to industry challenges—connect with me on LinkedIn or explore my other projects!