Preprint
Article

This version is not peer-reviewed.

Predictive Analytics for Thyroid Cancer Recurrence: A Machine Learning Approach

A peer-reviewed version of this preprint was published in:
Knowledge 2024, 4(4), 557-570. https://doi.org/10.3390/knowledge4040029

Submitted:

07 September 2024

Posted:

09 September 2024

You are already at the latest version

Abstract
Differentiated thyroid cancer (DTC), comprising of papillary and follicular thyroid cancers, is the most prevalent type of thyroid malignancy. Accurate prediction of DTC is crucial for improving patient outcomes. Machine learning (ML) offers a promising approach to analyze risk factors and predict cancer recurrence. In this study, we aimed to develop predictive models to identify patients at an elevated risk of DTC recurrence based on 16 risk factors. We developed six ML models and applied them to a DTC dataset. We evaluated the ML models using Synthetic Minority Over-Sampling Technique (SMOTE) and with hyperparameter tuning. We measured the models’ performance using precision, recall, F1 score, and accuracy. Results showed that Random Forest consistently outperformed the other investigated models (KNN, SVM, Decision Tree, AdaBoost, and XGBoost) across all scenarios, demonstrating high accuracy and balanced precision and recall. The application of SMOTE improved model performance and hyperparameter tuning enhanced overall model effectiveness.
Keywords: 
;  ;  ;  ;  

1. Introduction

Differentiated thyroid carcinoma (DTC), which encompasses both papillary and follicular thyroid cancers, represents the most prevalent type of thyroid malignancies [1]. The recurrence risk is influenced by many factors, necessitating accurate predictive models to enhance patient outcomes. Over the past two decades, incidence of thyroid cancers has increased internationally, however rate of mortality has stayed consistent [2]. This lack of increased relative mortality is thought to be associated with contemporary advancements in diagnosis and treatment approaches that emphasize the importance of accurate risk assessment in predicting recurrence and tailoring early interventions.
Traditional non-technical approaches to monitor for and detect recurrence rely heavily on evaluation of risk assessment data, including biological markers, genetic factors, imaging, and comorbidities, however assessment of all these factors in combination is a challenge in a busy medical environment. In recent years, research into and use of machine learning (ML) has become increasingly attractive for this purpose to assess complex data sets consisting of patient risk factors and use this analysis to predict risk for cancer occurrence and recurrence. Although these methods are promising, they are not yet widely used.
More research on this topic with larger and more diverse datasets are needed to thoroughly demonstrate the importance of ML in the healthcare setting regarding recurrent cancer. The aim of this study is to enrich existing literature by developing predictive models to identify patients at an elevated risk for recurrence of DTC based on 16 commonly accepted risk factors, including patient data, treatment types, and personal histories. More specifically, we aim to develop six machine learning algorithms and determine which one among them can provide the most accurate predictions of thyroid cancer recurrence.
We aim to utilize a dataset comprising 383 instances and 16 features, sourced from the Differentiated Thyroid Cancer Recurrence dataset in the UC Irvine Repository database [3]. This dataset includes various factors such as age, gender, smoking status, history of radiotherapy, thyroid functioning, adenopathy status, pathology category, risk category, focality, primary tumor (T), regional lymph nodes (N), distant metastasis (M), cancer stage, and response to treatment. Supervised learning and ensemble learning algorithms will be employed to analyze the data and predict the risk of recurrence. The performance of each model will be evaluated using precision, recall, F1 score, and accuracy. This study aims to contribute to this critical area by developing robust predictive models to enhance the management and prognosis of patients with DTC.

3. Design and Methodology

The Differentiated Thyroid Cancer Recurrence dataset from the University of California at Irvine Machine Learning Repository was used in this study [3]. This dataset consists of the retrospective clinical data for 383 patients diagnosed with DTC, each followed for a minimum of ten years. The collected clinical data included 16 features: age at diagnosis, gender, current smoking status, prior smoking history, history of head and neck radiation therapy, thyroid function, presence of goiter, presence of adenopathy on physical examination, pathological subtype of cancer, focality, ATA risk assessment, TNM staging, initial treatment response, and recurrence status. The dataset contains 312 females (81%) and 71 males (19%). The average age at diagnosis was 41. The pathological subtype breakdown was 287 Papillary (75%), 48 Micropapillary (13%), 28 Folicular (7%), and 20 Hurthel Cell (5%). According to the ATA risk classification, patients were classified as follows: 249 low risk (65%), 102 intermediate risk (27%), and 32 high risk (8%). Most cases (333) were classified as Stage 1 (87%). 208 patients had an excellent initial treatment response (54%). The remaining cases had the following initial treatment responses: 91 structural incomplete (24%), 61 indeterminate (16%), and 23 biochemical incomplete (6%). In terms of recurrence, 108 patients (28%) experienced recurrence. Notably, this dataset contained no missing values.
ML models were applied in this study to analyze and predict DTC recurrence. The ML models used were KNN, SVM, Decision Tree, Random Forest, AdaBoost, and XGBoost. KNN is a simple, instance-based learning algorithm that classifies data points based on the majority class among their k-nearest neighbors in the feature space, using a chosen distance metric. SVM works by using a kernel trick to map the inputs into high-dimensional feature spaces and draw margins between the classes [21]. It is robust against outliers and works well with high dimensional small datasets [22]. Decision Tree represents choices and their results in a tree-shaped graph. The results are easy to interpret but can be prone to overfitting and tend to be sensitive to data changes [21,22]. Random Forest uses a parallel ensemble method to create multiple decision trees. It is generally more accurate than a single decision tree and can handle high dimensional data [23]. AdaBoost is an ensemble method that improves poor classifiers by learning from prior errors. It generally performs well and has better accuracy than other methodologies. This algorithm can be sensitive to noisy data and outliers [21,23]. XGBoost is an ensemble model that uses a sequential method to build multiple decision trees, and each future tree corrects the errors made by the previous one. It has high accuracy, efficiency, and can handle missing values well. It generally does require careful tuning of hyperparameters to perform optimally [23].
Python was used to run the different models. Python has a rich variety of libraries and tools which make python an excellent choice for implementing machine learning classification techniques. From data preparation and model training to evaluation and deployment, Python provides comprehensive support for every step of the machine learning workflow. The dataset was partitioned into a training set (80%) and a test set (20%). Data was run once with no modifications. Given the gender imbalance in this dataset, a second experiment was performed using SMOTE to address class imbalance. SMOTE generates synthetic samples for the minority class based on feature similarity with existing minority instances. This technique helps to alleviate the bias towards the majority class by increasing the representation of the minority class, thereby improving the performance of classifiers trained on imbalanced datasets. In hopes of improving ML model performance, a final run was conducted using hyperparameter tuning. This process involves selecting the best values for these parameters to achieve optimal model performance. Grid search was the method used for hyperparameter tuning which allows you to systematically find the best hyperparameter combination to optimize model performance. Hyper-parameter optimization techniques in machine learning encompass manual methods like trial-and-error tuning and exhaustive grid search. Random search efficiently explores broader spaces by random sampling [24].
The performance of the models was assessed using accuracy, precision, recall, and F1 score. These metrics provide a comprehensive view of each model’s effectiveness. Accuracy shows how often the model was able to correctly predict if DTC recurred or not. It can be misleading at times if classes are imbalanced. Precision indicates how many patients predicted to have DTC recurrence actually had recurrence. High precision means that when the model predicts recurrence, it is likely to be correct. This is critical for minimizing false alarms which may cause unnecessary treatment. Recall shows how effectively the model predicts patients who will experience recurrence. High recall shows that the model will be able to predict most recurrences. This ensures that all at risk patients are identified. This minimizes false negatives and helps ensure that all patients receive the proper treatment needed to minimize their chances of recurrence. Finally, a high F1 score shows that the model has a good balance of precision and recall. This score can be especially helpful in cases of class imbalance [21].

4. Results

In the initial run with no modifications (Table 1), KNN demonstrated strong overall performance with high accuracy (0.90) and precision (0.91). It did have a lower recall (0.81) which could mean that the model would miss some positive cases of recurrence.
The SVM model had a lower accuracy (0.83), but still had good precision (0.91). The recall was low (0.66), which meant the model struggled to identify recurrence. The Decision Tree model had overall strong performance with high accuracy (0.92), precision (0.89), recall (0.91), and F1 score (0.98). A training score of 1.0 indicates there may have been overfitting to the training data. The test score of 0.92 indicates that the model still performs well with new data.
The Random Forest model had the best overall performance with near-perfect accuracy (0.99), precision (0.99), and F1 score (0.98). The recall (0.97) was only slightly lower, which indicates that this model was reliable for predicting DTC recurrence. The high training and test scores also indicate good model generalization and minimal overfitting.
AdaBoost also had high performance with high accuracy (0.97), precision (0.98), recall (0.95), and F1 score (0.96). The close training and test scores indicate that it is a robust choice. Finally, XGBoost also had consistently high metrics for accuracy (0.97), precision (0.97), recall (0.97), and F1 score (0.97). A training score of 1.0 does show the possibility of overfitting with this model.
The data was run again with the application of SMOTE (Table 2) to address class imbalances. Overall, the models showed good improvement with the application of SMOTE. KNN showed significant improvement, achieving high accuracy (0.97), precision (0.97), recall (0.97), and F1 score (0.97).
SVM greatly benefited from SMOTE, indicating that the model was likely influenced by the class imbalance. SVM had balanced performance with good accuracy (0.94), precision (0.94), recall (0.94), and F1 score (0.94). The Decision Tree model also showed improvements with consistent performance for accuracy (0.94), precision (0.94), recall (0.94), and F1 score (0.94). Once again, the perfect training score indicated that there could be a potential of overfitting with this model.
Random Forest did see a slight decrease in performance when SMOTE was applied. This could indicate that there had been some overfitting to the initial model. Since Random Forest is an ensemble method it can typically handle some degree of class imbalance. Introducing the synthetic samples to the data can add noise to the data which can also explain the decreased performance.
AdaBoost did see a slight decrease to both accuracy (0.95) and precision (0.95). Recall (0.96) did see some slight improvement, but the model is less apt to favor one class disproportionally. XGBoost saw similar results to the initial run and once again showed the potential for some overfitting with this model.
The final test was conducted using hyperparameter tuning (Table 3). The purpose of running hyperparameter tuning was to improve each algorithm’s performance by finding the parameters which would ultimately maximize the performance of each algorithm. KNN had a consistent performance with no significant changes.
Despite the hyperparameter tuning, recall remained lower (0.81), suggesting that the model could miss some cases of potential recurrence. SVM showed good improvement from the initial results, indicating hyperparameter tuning enhanced the model’s ability to predict DTC recurrence. Decision Tree showed marked improvement with accuracy (0.97), precision (0.98), recall (0.95), and F1 score (0.96). This shows that hyperparameter tuning helped the Decision Tree model reduce overfitting and improve generalization.
Random Forest once again had a very high performance across the board for accuracy (0.99), precision (0.99), recall (0.97), and F1 score (0.98). Hyperparameter tuning helped to solidify its performance and make this model very reliable for predicting DTC recurrence. AdaBoost saw an improvement with precision (0.98) but did see a slight drop with recall (0.92).
Finally, XGBoost showed consistent performance with accuracy (0.97), precision (0.97), recall (0.97), and F1 score (0.97). This demonstrates that hyperparameter tuning helps enhance this model allowing it to maintain high performance across all metrics.

5. Discussion

The goal of this study was to determine what the best method was to predict likelihood of recurrence of DTC. To accomplish this, six different ML models were utilized, along with three different sets of parameters. SMOTE was used to handle any class imbalance in the training set. In order to clarify its use, we chose to run the ML algorithms both without using SMOTE and then once again with it. The purpose of running it without it was to create a baseline performance marker for each of the individual algorithms. After that, hyperparameter tuning was used as a third method to help analyze this dataset. Hyperparameter tuning selects the best possible values for each machine learning model to achieve the optimal performance. Through these three different parameters and six different machine learning models it was determined that the best machine learning model was Random Forest, which consistently outperformed or matched the other models across all three scenarios.
Overall, the application of SMOTE did improve the performance of most models, particularly those that struggled with imbalanced data, such as KNN and SVM. Hyperparameter tuning further enhanced performance, especially for models like SVM and Decision Tree. Random Forest, AdaBoost, and XGBoost demonstrated strong performance in all scenarios, making them reliable choices for handling imbalanced datasets. Hyperparameter tuning further enhanced the performance of most models, particularly SVM, Decision Tree, and AdaBoost. In all three scenarios Random Forest seems to be the best and most reliable algorithm. Random Forest consistently scored higher than the other algorithms in each scenario and would lead to the most reliable results when determining likelihood of recurrence of thyroid cancer. These findings underscore the importance of addressing data imbalance and optimizing model parameters to achieve the best predictive performance in medical diagnosis tasks. Future studies should explore these models in larger and more diverse datasets to validate and generalize these findings.
Results of this study imply interesting clinical applications, particularly advancements in personalized treatment development. This tool in combination with oversight from clinical experts could be utilized to better predict chances of recurrent DTC in patients following primary treatment methodologies. Understanding risk levels for recurrence allows clinicians to create more effective screening and monitoring programs at regular intervals to better detect recurrence in earlier stages and to monitor more closely for distant metastasis that often increases risk of mortality in recurrent DTC. Overall, this study demonstrates some promising implications for clinical use, with the caveat that classic ML algorithms such as this one requires ongoing oversight from experts in the field to ascertain ongoing accuracy, particularly with application to larger and larger datasets.

6. Conclusions and Limitations

Random Forest is the superior algorithm when determining the recurrence of thyroid cancer. Whether the data is imbalanced, balanced, or ran with optimal settings, Random Forest continuously outperforms the other five investigated ML algorithms (KNN, SVM, Decision Tree, AdaBoost, and XGBoost). This study aimed to correct the imbalance that was seen in the previous study using this dataset. While it was corrected and proved to have a better algorithm to use in predicting recurrence of thyroid cancer, there still were limitations. Ideally having more data to work with would give a better or more accurate prediction. The recurrence of DTC is typically seen more in women than in men, so while the data may still be imbalanced if there was more of it, a stronger conclusion could be made utilizing a larger, more diverse dataset.

References

  1. Shokoohi et al., “Treatment for Recurrent Differentiated Thyroid Cancer: A Canadian Population Based Experience,” Cureus, vol. 12, no. 2, p. e7122, 2020, doi: 10.7759/cureus.7122.
  2. Coca-Pelaz et al., “Recurrent Differentiated Thyroid Cancer: The Current Treatment Options,” Cancers, vol. 15, no. 10, Art. no. 10, Jan. 2023, doi: 10.3390/cancers15102692.
  3. T. Shiva Borzooei, “Differentiated Thyroid Cancer Recurrence.” UCI Machine Learning Repository, 2023. [CrossRef]
  4. 4. M. Sasson et al., “The T4/T3 quotient as a risk factor for differentiated thyroid cancer: A case control study,” Journal of Otolaryngology - Head & Neck Surgery, vol. 46, no. 1, p. 28, Jan. 2017, doi: 10.1186/s40463-017-0208-0.
  5. S. Bhattacharya, R. K. Mahato, S. Singh, G. K. Bhatti, S. S. Mastana, and J. S. Bhatti, “Advances and challenges in thyroid cancer: The interplay of genetic modulators, targeted therapies, and AI-driven approaches,” Life Sciences, vol. 332, p. 122110, Nov. 2023, doi: 10.1016/j.lfs.2023.122110.
  6. Y. Habchi et al., “AI in Thyroid Cancer Diagnosis: Techniques, Trends, and Future Directions,” Systems, vol. 11, no. 10, Art. no. 10, Oct. 2023, doi: 10.3390/systems11100519.
  7. -Brown Peter Watson and D. Anderson, “Differentiated thyroid cancer: A guide to survivorship care,” Australian Journal of General Practice, vol. 52, no. 1/2, pp. 47–51, Jan. 2023, doi: 10.3316/informit.896817871599081.
  8. N. Tang, C. Yang, J. Fan, and L. Cao, “VerifAI: Verified Generative AI,” arXiv preprint arXiv:2307.02796, 2023.
  9. J. Gu et al., “A machine learning-based approach to predicting the malignant and metastasis of thyroid cancer,” Front. Oncol., vol. 12, Dec. 2022, doi: 10.3389/fonc.2022.938292.
  10. L. Nagendra, J. M. Pappachan, and C. J. Fernandez, “Artificial intelligence in the diagnosis of thyroid cancer: Recent advances and future directions,” Artificial Intelligence in Cancer, vol. 4, no. 1, pp. 1–10, 2023.
  11. H. Ahmad and A. Van Der Lugt, “The Radiology Assistant : TI-RADS - Thyroid Imaging Reporting and Data System.” Accessed: Aug. 12, 2024. [Online]. Available: https://radiologyassistant.nl/head-neck/tirads/ti-rads.
  12. G. Luong, A. J. Idarraga, V. Hsiao, and D. F. Schneider, “Risk Stratifying Indeterminate Thyroid Nodules With Machine Learning,” Journal of Surgical Research, vol. 270, pp. 214–220, Feb. 2022, doi: 10.1016/j.jss.2021.09.015.
  13. J. Ballester, Finn, Caitlin, S. Ginzberg, R. Kelz, and H. Wachtel, “Thyroid cancer pathologic upstaging: Frequency and related factors,” The American Journal of Surgery, vol. 226, no. 2, pp. 171–175, Aug. 2023, doi: 10.1016/j.amjsurg.2023.03.023.
  14. Y. Mao et al., “Machine learning algorithms are comparable to conventional regression models in predicting distant metastasis of follicular thyroid carcinoma,” Clinical Endocrinology, vol. 98, no. 1, pp. 98–109, 2023, doi: 10.1111/cen.14693.
  15. F. Medas, G. L. Canu, F. Boi, M. L. Lai, E. Erdas, and P. G. Calò, “Predictive Factors of Recurrence in Patients with Differentiated Thyroid Carcinoma: A Retrospective Analysis on 579 Patients,” Cancers, vol. 11, no. 9, Art. no. 9, Sep. 2019, doi: 10.3390/cancers11091230.
  16. S. Jin et al., “A Predictive Model for the 10-year Overall Survival Status of Patients With Distant Metastases From Differentiated Thyroid Cancer Using XGBoost Algorithm-A Population-Based Analysis,” Front. Genet., vol. 13, Jul. 2022, doi: 10.3389/fgene.2022.896805.
  17. J. Tang et al., “Development and validation of a nomogram to predict cancer-specific survival in middle-aged patients with papillary thyroid cancer: A SEER database study,” Heliyon, vol. 9, no. 2, Feb. 2023, doi: 10.1016/j.heliyon.2023.e13665.
  18. Y. M. Park and B.-J. Lee, “Machine learning-based prediction model using clinico-pathologic factors for papillary thyroid carcinoma recurrence,” Sci Rep, vol. 11, no. 1, p. 4948, Mar. 2021, doi: 10.1038/s41598-021-84504-2.
  19. H. Wang et al., “Development and validation of prediction models for papillary thyroid cancer structural recurrence using machine learning approaches,” BMC Cancer, vol. 24, no. 1, p. 427, Apr. 2024, doi: 10.1186/s12885-024-12146-4.
  20. S. Borzooei, G. Briganti, M. Golparian, J. R. Lechien, and A. Tarokhian, “Machine learning for risk stratification of thyroid cancer patients: a 15-year cohort study,” Eur Arch Otorhinolaryngol, vol. 281, no. 4, pp. 2095–2104, Apr. 2024, doi: 10.1007/s00405-023-08299-w.
  21. 21. Mahesh, “Machine learning algorithms-a review,” International Journal of Science and Research (IJSR).[Internet], vol. 9, no. 1, pp. 381–386, 2020.
  22. H. Lickert, A. Wewer, S. Dittmann, P. Bilge, and F. Dietrich, “Selection of Suitable Machine Learning Algorithms for Classification Tasks in Reverse Logistics,” Procedia CIRP, vol. 96, pp. 272–277, Jan. 2021, doi: 10.1016/j.procir.2021.01.086.
  23. I. H. Sarker, “Machine Learning: Algorithms, Real-World Applications and Research Directions,” SN COMPUT. SCI., vol. 2, no. 3, p. 160, Mar. 2021, doi: 10.1007/s42979-021-00592-x.
  24. Yang and A. Shami, “On hyperparameter optimization of machine learning algorithms: Theory and practice,” Neurocomputing, vol. 415, pp. 295–316, Nov. 2020, doi: 10.1016/j.neucom.2020.07.061.
Table 1. Summary of results without modification.
Table 1. Summary of results without modification.
Model Accuracy Precision Recall F1
KNN 0.90 0.91 0.81 0.84
SVM 0.83 0.91 0.66 0.69
Decision Tree 0.92 0.89 0.91 0.90
Random Forest 0.99 0.99 0.97 0.98
AdaBoost 0.97 0.98 0.95 0.96
XGBoost 0.97 0.97 0.97 0.97
Table 2. Summary of results using SMOTE.
Table 2. Summary of results using SMOTE.
Model Accuracy Precision Recall F1
KNN 0.97 0.97 0.97 0.97
SVM 0.94 0.94 0.94 0.94
Decision Tree 0.94 0.94 0.94 0.94
Random Forest 0.95 0.95 0.96 0.95
AdaBoost 0.95 0.95 0.96 0.95
XGBoost 0.96 0.96 0.96 0.96
Table 3. Summary of results using Hyperparameter Tuning.
Table 3. Summary of results using Hyperparameter Tuning.
Model Accuracy Precision Recall F1 Support
KNN 0.90 0.91 0.81 0.84 77
SVM 0.94 0.94 0.89 0.91 77
Decision Tree 0.97 0.98 0.95 0.96 77
Random Forest 0.99 0.99 0.97 0.98 77
AdaBoost 0.96 0.98 0.92 0.94 77
XGBoost 0.97 0.97 0.97 0.97 77
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.