1. Introduction
Thyroid disorders are considered one of the most prevalent endocrine diseases in the world, as an estimated 300 million people worldwide and almost 42 million in India alone are affected [
1,
2]. The prevalence of hypothyroidism is between 5 and 10 percent of the general population, and hyperthyroidism is between 1 and 2 percent [
3,
4]. Epidemiological research indicates a disproportionate impact on women with a female-to-male ratio of about 6:1 [
5]. The rates of clinical misdiagnoses are significant, with an estimate of up to 20–25 percent of hypothyroidism cases being misclassified or diagnosed late due to similarities with other metabolic disorders. On the computational side, models of thyroid diagnosis using machine learning with the UCI Thyroid dataset (22,632 records, 28 attributes) have reached an accuracy of 92–98 percent [
6]. Nevertheless, there is still a challenge of overcoming the 97.5% threshold of accuracy and still having interpretability and reliability.
The thyroid gland is important in the regulation of metabolism by the hormones triiodothyronine (T3) and thyroxine (T4). Hypothyroidism, hyperthyroidism, nodular thyroid disease or thyroid cancer are caused by dysfunctions of thyroid hormone regulation. The clinical diagnosis mainly depends on laboratory tests (TSH, T3, TT4, T4U) as well as demographic data (age, sex, and treatment history) [
7,
8]. Although these structured features offer very useful information, they tend to be multidimensional and noisy, and therefore feature selection is a critical process [
9].
Classical machine learning (Decision Trees, Random Forests, SVMs, KNN) or metaheuristic-based feature selection methods have been used as traditional methods in predicting thyroid disease, including Genetic Algorithms, Particle Swarm Optimization, or hybrid bio-inspired methods like the Cuttlefish Algorithm with Simulated Annealing (CFA–SA) [
10,
11,
12]. These techniques have been reported to give competitive results, but are restricted by their wrapper-style optimization, which is computationally intensive, and their lack of the ability to simultaneously learn both feature importance and classification in an end-to-end fashion.
Although there have been significant advances in computational techniques to detect thyroid disease, three issues have not been addressed, and they include:
Non-differentiable feature selection: Metaheuristic optimization is effective but disconnected from the classifier, leading to inefficiency and instability.
Interpretability trade-off: Many high-accuracy models (e.g., ensemble learners, deep networks) act as “black boxes,” providing little insight into which attributes truly matter.
Calibration and robustness issues: Existing models achieve high accuracy but often lack well-calibrated probability estimates, which are crucial for clinical reliability.
To overcome these restrictions, we suggest a new Differentiable Feature Selection + Transformer-based Tabular Learning system. The method presents Concrete (Gumbel-Softmax) gates to execute end-to-end differentiable feature selection, which guarantees that the most discriminative thyroid features are selected by default in training. The chosen features are then run through a Tabular Transformer that uses self-attention to learn higher-order dependence amongst clinical features. Moreover, we combine the class-balanced focal loss to overcome the class imbalance and use post hoc calibration methods (temperature scaling) to increase clinical credibility.
To the best of our knowledge, this study is among the early attempts to integrate differentiable feature selection with an FT-Transformer backbone for thyroid tabular classification. Unlike earlier approaches that rely mainly on heuristic or wrapper-based feature selection, the proposed DFSel-FT framework learns feature relevance and classification representations jointly in an end-to-end manner. This design reduces dependence on externally optimized feature subsets, improves model transparency through learned feature gates, and supports more reliable probability estimation through calibration. However, the framework is positioned as a benchmark-level computational model, and its use in real-world clinical settings requires further external validation, prospective testing, and expert clinical review. The main contributions of this research are as follows:
End-to-End Differentiable Feature Selection—Implementation of Concrete gates to identify the most discriminative thyroid attributes dynamically during training.
Transformer-Based Tabular Modeling—Adoption of a self-attention mechanism to capture complex dependencies among clinical and biochemical features.
Imbalance-Aware Learning—Use of class-balanced focal loss to handle skewed class distributions effectively.
Reliable Probability Estimation—Integration of post hoc temperature scaling to improve probability calibration, which is important for risk-aware medical classification tasks.
Benchmark-Level Performance Evaluation—Demonstration of competitive performance on the UCI Thyroid Dataset against traditional machine learning and hybrid feature-selection baselines, with further validation required on external clinical datasets.
2. Literature Review
The existing literature on thyroid disease prediction is reviewed across different streams, as discussed below.
2.1. Machine Learning and Deep Learning for Thyroid Tabular Classification
Artificial intelligence (AI) has played an important role in enhancing the process of diagnostic evaluation of endocrine diseases like thyroid disease. Classical machine learning algorithms such as Decision Trees, Naïve Bayes, Random Forests, K-Nearest Neighbors, and Support Vector Machines have been widely investigated in classifying thyroid conditions [
13,
14]. The results of these models showed good predictability when used on benchmark data such as the UCI Thyroid Disease dataset. Ensemble and hybrid models were investigated more recently, in which simpler models tended to perform worse than Random Forest and Decision Tree-based classifiers because of the nonlinearities of thyroid data [
15,
16]. Furthermore, TSH, T3, and T4 data mining methods that correlate with hypothyroidism and hyperthyroidism among the different demographics have strengthened the possibility of AI in complementing conventional diagnostic parameters. Nonetheless, issues like imbalance in classes, low interpretability, and medium scalability have remained, and more sophisticated methodologies are required.
2.2. Feature Selection in Medical Tabular Data
Recent studies have resorted to nature-inspired metaheuristics in the optimization of features in medical data. The original paper proposed a two-step hybrid method that involves the Cuttlefish Algorithm (CFA) and Simulated Annealing (SA) to select the best feature subset. The CFA produced sets of candidate features using reflection and visibility processes based on the behavior of cuttlefish skin cells, and SA optimized the subsets with probabilistic acceptance of solutions to avoid local optima [
12]. Shrivastava et al. reported that the CFA–SA + XGBoost model achieved the highest performance among their tested classifiers, with an accuracy of 98.91%, precision of 98.00%, recall of 98.12%, and F1-score of 94.83%. However, this value is treated in the present study as a literature-reported benchmark rather than a directly comparable reproduced result, because the exact preprocessing sequence, fold-wise resampling strategy, split configuration, and metric averaging procedure may differ from the leakage-free validation protocol adopted in this work. Therefore, CFA–SA-based models were additionally reimplemented under the present 10-fold stratified cross-validation setting for direct comparison with DFSel-FT. This performance outperformed single metaheuristics and single classical ML models, showing the effectiveness of combining optimization methods and machine learning. However, the method was problematic: the process of feature selection was computationally complex, interpretability was lacking, and external validation in a wide range of cohorts was not provided. These shortcomings highlight the need to find ways to combine efficiency, interpretability, and strong statistical validation.
2.3. Deep Learning for Tabular Data
Deep learning for tabular data has received increasing attention through architectures such as MLP, TabNet, TabTransformer, SAINT, NODE, and FT-Transformer [
17,
18,
19]. These models attempt to capture nonlinear feature relationships and higher-order interactions that may not be fully captured by traditional machine learning models. FT-Transformer is particularly relevant because it adapts the Transformer architecture to tabular data by representing each feature as a token and applying self-attention across feature embeddings [
20,
21]. However, Transformer-based tabular models may still include redundant features if no feature-selection mechanism is integrated. Therefore, combining differentiable feature selection with FT-Transformer can provide a more compact and interpretable tabular learning framework.
2.4. Explainability and Calibration in Medical AI
Transformers, initially created in the domain of natural language processing, have been infiltrating healthcare tasks because of their capability to capture long-range dependencies through their self-attention mechanisms [
22,
23,
24,
25]. Although several recent studies have used Transformer-based models for thyroid ultrasound image classification and nodule detection, these imaging-based approaches differ methodologically from the present tabular classification problem. Therefore, the present review focuses mainly on thyroid tabular classification, differentiable feature selection, tabular deep learning, explainability, and calibration [
26,
27,
28,
29,
30]. Such methods point to a paradigm shift, with transformers being promising replacements for CNN-based models in the medical imaging domain and promising tabular clinical data modeling tools [
31,
32].
2.5. Research Gap
Existing thyroid disease classification studies have mainly focused on classical machine learning, metaheuristic feature selection, or imaging-based deep learning. Comparatively fewer studies have examined end-to-end differentiable feature selection combined with Transformer-based tabular learning for thyroid classification. Moreover, many prior studies do not jointly report predictive performance, explainability, calibration, and statistical validation under a leakage-free cross-validation protocol. To address these gaps, the present study proposes DFSel-FT, which integrates Concrete gate-based differentiable feature selection with an FT-Transformer backbone for interpretable and calibrated thyroid disease classification using tabular data.
3. Dataset Description
In this paper, we use the UCI Thyroid Disease Dataset, which is a well-known benchmark dataset that can be found at the UCI Machine Learning Repository [
33]. It has 22,632 records of patients and 28 attributes such as demographic details, medical history, and measurements of biochemicals. The dataset provides a suitable basis for computational thyroid disease classification.
The present study does not use CFA–SA for feature selection in the proposed model. CFA–SA is considered only as a reference method from the previous literature and as a comparative baseline where applicable. In the proposed DFSel-FT framework, feature selection is performed through differentiable Concrete/Gumbel-Softmax gates that are trained jointly with the FT-Transformer backbone. Therefore, all attributes are initially treated as candidate input features, and their final relevance is learned during model training.
The main target variable is categorizing the patients as hypothyroid, hyperthyroid, or normal thyroid. The key demographic, biochemical, and categorical attributes of the UCI Thyroid Disease Dataset are summarized in
Table 1. All input attributes were treated as candidate features. Their final relevance was learned through differentiable Concrete/Gumbel-Softmax gates in the proposed DFSel-FT framework.
The UCI Thyroid Disease Dataset was organized into a three-class classification problem. The target labels were mapped as 0 = Normal/Euthyroid, 1 = Hypothyroid, and 2 = Hyperthyroid. Missing predictor values were retained and handled through fold-wise imputation during preprocessing. Ambiguous or non-mappable labels and duplicate records were checked before model training.
4. Proposed Methodology
The suggested methodology presents a new Differentiable Feature Selection + Transformer-based Tabular Learning model to predict thyroid disease. The methodology aims to jointly learn discriminative features and the intricate interactions between them in an end-to-end differentiable way, which is unattainable with the conventional optimization-based wrapper methods.
Figure 1 presents the block diagram with the sequential steps of the proposed framework, which include the data collection and preprocessing followed by differentiable feature selection, FT-Transformer modeling, optimization and training, calibration and, finally, performance evaluation and explainability analysis.
The methodology consists of four stages: (i) data preprocessing, (ii) differentiable feature selection, (iii) tabular Transformer modeling, and (iv) training with imbalance-aware loss and calibration.
4.1. Data Preprocessing
The UCI Thyroid Disease Dataset (
) consists of
= 22,632 records and
= 28 attributes. Each sample is represented as Equation (1).
where
= 0 (Normal), 1 (Hypothyroid) or 2 (Hyperthyroid).
Preprocessing steps:
Missing values: Numerical features imputed with the mean; categorical features with the mode.
Encoding: One-hot encoding for categorical variables (e.g., sex, referral source).
Normalization: Min–Max scaling for numerical features can be seen in Equation (2)
Leakage-Free Cross-Validation Preprocessing Protocol
To avoid data leakage, all preprocessing operations were performed independently within each fold of the 10-fold stratified cross-validation protocol. In each fold, the training partition was first separated from the validation/test partition. Missing-value imputation, one-hot encoding, and Min–Max normalization were fitted only on the training data and then applied to the corresponding validation/test data. SMOTE was applied only to the training partition after imputation, encoding, and scaling. No synthetic samples were generated from, or introduced into, the validation/test fold. Differentiable feature selection, model training, early stopping, and temperature-scaling calibration were also conducted within the training/validation structure of each fold, while the held-out test fold remained unseen until final evaluation.
4.2. Differentiable Feature Selection
To identify the most relevant features, we introduce learned feature gates
for each feature
∈ {1, …, m}. These gates are parameterized using the Concrete (Gumbel-Softmax) distribution, allowing end-to-end differentiability. For feature
, this can be represented as Equation (3).
where
is a learnable parameter,
is the relaxation temperature (annealed during training),
is the sigmoid function.
Each input feature is masked as Equation (4)
The sparsity of selected features is encouraged via an
-like penalty, as can be seen in Equation (5)
where λ controls the degree of sparsity.
4.3. Transformer for Tabular Data
The gated feature vector
is converted into feature tokens, as given in Equation (6).
where
is a learnable embedding of feature
, and
projects feature values into a d-dimensional space.
The tokens are processed using a Transformer encoder with multi-head self-attention [
34,
35]. This can be represented by Equations (7)–(9).
where
is the hidden state at layer
, and
/
denote multi-head self-attention and feed-forward network, respectively.
Equation (10) shows that the [
] token embedding or pooled representation is passed to a classifier head producing class probabilities:
The detailed computational flow of the proposed DFSel-FT framework, along with an illustrative numerical example for feature preprocessing, gating, embedding, attention, and classification, is presented in
Figure 2.
4.4. Training Objective
The training objective of the proposed DFSel-FT framework is to optimize classification performance while addressing class imbalance and probability calibration. This is achieved through the integration of class-balanced focal loss with sparsity regularization and calibration techniques.
To address class imbalance, we use class-balanced focal loss with Equation (11)
where
is the class weight based on effective sample count ;
γ controls the focusing effect;
is the predicted probability for class .
4.5. Total Loss
Equation (12) shows that the final training objective combines classification loss and sparsity penalty:
where Θ is Transformer parameters and ρ is the weight decay coefficient.
4.6. Calibration and Inference
To ensure reliable probability estimates, temperature scaling is applied post-training. Given logits
, calibrated probabilities are computed as Equation (13).
where
> 0 is the learned temperature minimizing negative log-likelihood on a validation set.
4.7. Algorithmic Workflow
This section presents Algorithm 1—the step-by-step computational procedure followed to implement the proposed model and achieve the desired outcomes.
| Algorithm 1: Differentiable Feature Selection + Transformer for Thyroid Disease Prediction |
Input: Dataset D, hyperparameters Output: Selected feature subset , trained Transformer model
Preprocessing: Handle missing values, encode categorical features, normalize numericals. Initialize: Feature gate logits αk, Transformer parameters Θ, Concrete temperature τ ← τ0. For each epoch = 1 to E: Sample logistic noise and compute gates . Mask features: Convert to tokens and pass through Transformer encoder. Compute class probabilities Compute loss: Backpropagate and update (α,Θ) using AdamW. Anneal temperature τ↓.
Prune: Select final feature subset . Retrain (optional): Train Transformer on S without sparsity penalty. Calibrate: Apply temperature scaling on validation set. Return: Selected features S, trained calibrated model.
|
5. Experimental Setup
The experiments were performed using the UCI Thyroid Disease Dataset that consists of 22,632 samples and 28 attributes, and the target classes of the dataset are Normal, Hypothyroid, and Hyperthyroid. Preprocessing of the data involved filling the missing values, categorical coding, numerical normalization, and balancing the classes with SMOTE. The proposed model combines Differentiable Feature Selection through Concrete gates with an FT-Transformer backbone to learn using tabular data. The computational experiments were conducted on a workstation equipped with an Intel Core i7 11th Generation processor, 32 GB RAM, and an NVIDIA RTX 3080 GPU. The processor was manufactured by Intel Corporation, Santa Clara, CA, USA, while the GPU was manufactured by NVIDIA Corporation, Santa Clara, CA, USA. It was evaluated under the 10-fold stratified cross-validation protocol, with the results being compared to robust baselines such as SVM, Random Forest, KNN, and XGBoost. To validate interpretability, performance was measured with Accuracy, Macro-Precision, Macro-Recall, Macro-F1-score and AUC-OVR, Expected Calibration Error (ECE) and Explainable AI (using Concrete gates, SHAP and LIME explanations) measures. To facilitate reproducibility and clarity, the entire experimental setup, such as dataset properties, data preprocessing, model architecture, training setup, baselines and evaluation metrics, is summarized in
Table 2.
To provide a stronger and more technically relevant comparison, the proposed DFSel-FT framework was evaluated against four groups of baseline models: classical machine learning models, gradient-boosting models, modern tabular deep learning models, and ablation/control models. The classical models included Logistic Regression, SVM, Random Forest, KNN, and XGBoost. The gradient-boosting baselines included LightGBM and CatBoost. The tabular deep learning baselines included MLP, TabNet, FT-Transformer without differentiable gates, TabTransformer, and SAINT. In addition, DFSel + MLP was included as a control model to determine whether differentiable feature selection alone could explain the observed performance gains. All baselines were evaluated using the same leakage-free 10-fold stratified cross-validation protocol. For multiclass evaluation, precision, recall, and F1-score were reported using macro-averaging to give equal importance to each class.
Implementation and Reproducibility Details
The experiments were implemented in Python 3.10 using PyTorch 2.0, Scikit-learn 1.3.1, NumPy, pandas, imbalanced-learn, SHAP, LIME, LightGBM, and CatBoost. The neural models were trained using AdamW with a learning rate of 0.001, weight decay of 1 × 10−4, batch size of 128, maximum epochs of 100, early stopping patience of 10, and dropout rate of 0.10. To improve reproducibility, fixed random seeds of 42, 123, and 2026 were used across repeated runs. Hyperparameters were selected using validation-set performance within the training folds only. The held-out test fold was not used for preprocessing, SMOTE generation, model tuning, feature selection, early stopping, or calibration. Code can be made available upon reasonable request.
For each outer fold of the 10-fold stratified cross-validation, 10% of the data was held out as the test fold. The remaining 90% training-development data were further divided into training and validation subsets. The training subset was used for fitting preprocessing parameters, applying SMOTE, learning differentiable gates, and training the DFSel-FT model. The validation subset was used for early stopping, hyperparameter selection, and temperature-scaling calibration. The held-out test fold was used only once for final evaluation in that fold.
6. Results and Discussion
Firstly, an exploratory analysis was conducted to investigate the statistics and outlier nature of the major biochemical and demographic variables in the UCI Hypothyroid dataset.
Figure 3 shows the histograms and boxplots of Age, TSH, T3, TT4, T4U and FTI, indicating the skewness of the attributes related to the hormones (especially TSH and TT4), and the outliers, which were identified during preprocessing. DFSel-FT has been tested on the UCI Thyroid Disease Dataset and compared with the baseline models (SVM, Random Forest, KNN, and XGBoost). A 10-fold stratified cross-validation protocol was used to train all the models and validate them. Several evaluation measures, longer statistical indicators, and formal significance tests were used to evaluate performance.
6.1. Overall Performance
Table 3 presents the performance of the proposed model compared to baselines. DFSel-FT achieved the highest performance with an accuracy of 97.85%, Macro-F1 of 97.65%, and AUC-OVR of 98.10%, while also obtaining the lowest calibration error (ECE = 0.021). All models were evaluated under the same leakage-free 10-fold stratified cross-validation protocol. Imputation, encoding, normalization, SMOTE, feature selection, model tuning, and calibration were performed within the training/validation structure of each fold. The held-out test fold remained unseen until final evaluation.
Figure 4 visually compares the performance of DFSel-FT with baseline models across Accuracy, Macro-F1, and AUC-OVR, highlighting the relative improvement achieved by the proposed framework. Detailed standard deviations and 95% confidence intervals for the proposed DFSel-FT framework are reported in
Table 4.
6.2. Extended Statistical Parameters
We also report specificity, negative predictive value (NPV), Matthews Correlation Coefficient (MCC), Cohen’s kappa, Log-Loss and Brier Score to make sure that they are robust and clinically relevant. These results are summarized in
Table 4, which averages the folds. DFSel-FT performs better than baselines on almost all parameters, including very well on calibration (lowest Log-Loss and Brier score). The 95% confidence intervals for Accuracy, Macro-F1, and AUC-OVR were 97.68–98.02, 97.50–97.80, and 97.97–98.23, respectively.
6.3. Ablation Study
The effects of each methodological component are presented in
Table 5. The Differentiable Feature Selection increased accuracy by +0.6, class-balanced focal loss by +0.4 and temperature scaling additionally decreased calibration error. As shown in
Figure 5, each of the components contributed to improved model performance, with Differentiable Feature Selection (DFSel) contributing to the strength of features, focal loss to counterbalance the issue of class imbalance, and calibration to reduce Expected Calibration Error (ECE), resulting in the final optimized DFSel-FT model.
To examine the individual contribution of each component of the proposed DFSel-FT framework, an expanded ablation study was conducted. The analysis compared the final model with simplified and component-removed variants, including MLP, DFSel + MLP, FT-Transformer without differentiable gates, DFSel-FT without SMOTE, DFSel-FT without focal loss, and DFSel-FT without temperature scaling. These comparisons help determine whether the observed performance improvement is due to differentiable feature selection, Transformer-based representation learning, imbalance handling, or calibration.
6.4. Explainability Analysis
Explainability was assessed using three complementary approaches: learned Concrete gate activations, SHAP-based global feature importance, and LIME-based local explanations. To avoid relying on a single patient-level explanation, SHAP values and LIME contributions were aggregated across the test folds. For LIME, explanations were computed on a representative stratified sample from each fold, including samples from normal, hypothyroid, and hyperthyroid classes. Mean Concrete gate activations were also recorded across folds to examine whether the features selected by the differentiable gates were consistent with post hoc explanation methods.
SHAP explanations were computed using a model-agnostic Kernel SHAP approximation suitable for the trained tabular Transformer model. SHAP explanations were generated using the trained DFSel-FT model before temperature scaling, because temperature scaling modifies only the confidence of the predicted probabilities and does not change the learned feature representations or class decision boundary. Calibration was therefore evaluated separately using ECE, Log-Loss, Brier Score, and the Hosmer–Lemeshow test. The background distribution was constructed from stratified samples of the training fold only to avoid data leakage. SHAP values were then computed on the corresponding held-out fold and aggregated across folds. Explanation stability was assessed by reporting the mean and standard deviation of feature importance scores across folds.
The results show that TSH, TT4, T3, T4U, Age, and FTI were consistently ranked among the most influential predictors. The agreement between gate-based importance and SHAP ranking was further examined using Spearman’s rank correlation. A high positive correlation indicated that the features emphasized by the differentiable gates were also influential in SHAP-based explanations, supporting the stability and interpretability of the proposed DFSel-FT framework. The aggregated explainability results from Concrete gate activations, SHAP, and LIME are presented in
Table 6 to show the consistency of feature importance across model-based and post hoc explanation methods.
Figure 6 presents the SHAP-based explainability results, showing both global feature importance and local feature contributions that support the interpretability of the proposed DFSel-FT framework. Across the 10-fold cross-validation runs, the Concrete gate mechanism selected an average of
8.4 ± 1.2 features per fold, indicating that DFSel-FT retained a compact subset of informative thyroid-related predictors while suppressing less relevant attributes.
The Spearman rank correlation between Concrete gate-based feature ranking and SHAP-based global feature ranking was ρ = 0.86, indicating strong agreement between the embedded feature-selection mechanism and post hoc explainability results. SHAP and LIME values were aggregated across held-out test folds. LIME explanations were computed using representative stratified samples from normal, hypothyroid, and hyperthyroid classes. Rank agreement indicates consistency between gate activation ranking and post hoc explanation ranking.
6.5. Statistical Significance Testing
To ensure that the reported performance improvements were not due to random variation, statistical testing was performed using paired model outputs obtained under the same 10-fold stratified cross-validation protocol. For fold-wise metric comparisons, the paired
t-test and Wilcoxon signed-rank test were applied using the ten paired fold-level scores. The paired
t-test was used when the paired differences were approximately normally distributed, while the Wilcoxon signed-rank test was used as a non-parametric alternative. DeLong’s test was used to compare AUC-OVR values using paired probability estimates from the same held-out test samples. McNemar’s test was applied to paired classification outputs to compare discordant error patterns between DFSel-FT and baseline models. Friedman’s test was used to compare the overall ranking of multiple models across folds, followed by the Nemenyi post hoc test where applicable. Calibration goodness-of-fit was assessed using the Hosmer–Lemeshow test by grouping predicted probabilities into ten bins. Holm correction was applied to control for multiple comparisons. The results, as summarized in
Table 7, confirm that DFSel-FT produces statistically significant increases over baseline models in a variety of metrics, and is calibrated well.
6.6. Comparative Analysis with the Base Paper
In order to emphasize the importance of the proposed DFSel-FT framework, one is to directly compare it with the already established approaches that are being reported in the base paper. Although the base study was able to prove the utility of hybrid metaheuristics in terms of feature selection and obtain competitive results with the help of transfer learning models, some limitations were still present in the form of explainability, calibration, and statistical rigor. The current paper fills these gaps with differentiable feature selection and a Transformer backbone on tabular data and thorough testing using statistical tests and explainable AI methods.
Table 8 provides a detailed comparison of the two methods, presenting their dataset, methods, evaluation metrics, and contributions.
The original paper presented a hybrid metaheuristic algorithm (CFA–SA) to select features with classical machine learning classifiers with a reported accuracy of approximately 96.5–97.1. Although useful in the optimization of feature subsets, the method was computationally expensive, not differentiable and offered little interpretability or calibration. Conversely, the proposed DFSel-FT framework uses differentiable feature selection along with an FT-Transformer that allows end-to-end learning with attention-based modeling over tabular data. The design minimizes the use of heuristic search, improves the relevance of features, and increases the transparency of models with SHAP, LIME, and gate activations.
DFSel-FT performed better than the baseline classifiers and CFA–SA hybrids, with 97.85% accuracy, Macro-F1 of 97.65, and an AUC of 98.10. In addition, the focal loss, calibration, and statistical testing are also included in the performance to guarantee sound and reliable performance. Overall, DFSel-FT extends earlier thyroid tabular classification work by integrating predictive performance, interpretability, calibration, and statistical validation; however, its clinical use requires external validation, prospective testing, and expert review.
7. Limitations and Future Work
Although the proposed DFSel-FT framework achieved strong benchmark-level performance for thyroid disease classification, the study has certain limitations. First, the evaluation was limited to the UCI Thyroid Disease Dataset; therefore, the results may not fully represent real-world hospital populations, laboratory variability, missingness patterns, or clinical uncertainty. Second, although SMOTE helped address class imbalance, synthetic oversampling may introduce artificial patterns in the training data. Third, SHAP, LIME, and Concrete gate activations provide model-based explanations, but they should not be interpreted as causal clinical evidence. Therefore, the findings should be viewed as computational and benchmark-level evidence rather than proof of direct clinical deployability.
Future work should validate the DFSel-FT framework on independent hospital cohorts and prospective clinical datasets. Further studies should also include expert endocrinologist review of model explanations, assessment of explanation stability across diverse populations, and comparison with additional tabular deep learning models. Lightweight deployment strategies such as pruning, quantization, and knowledge distillation may also be explored for practical implementation in resource-constrained healthcare environments.
8. Conclusions
This work presented a new thyroid disease diagnosis framework based on Differentiable Feature Selection and tabular data with an FT-Transformer. The method had better accuracy, calibration, and interpretability than the baseline models, and statistical tests validated the significance of these improvements. The framework provides interpretable evidence through SHAP, LIME, and feature gate activations. However, as the evaluation is limited to a benchmark dataset, the findings should be interpreted as computational evidence rather than proof of direct clinical deployment. External hospital-based validation, prospective testing, and expert clinical review are required before considering real-world clinical use.
Author Contributions
Conceptualization, P.D. and R.K.R.; methodology, G.S.S., A.S. and P.D.; software, G.S.S. and P.K.M.; validation, G.S.S. and A.S.; formal analysis, R.K.R.; investigation, G.S.S. and P.K.M.; resources, R.K.R.; data curation, G.S.S., A.S. and P.K.M.; writing—original draft preparation, G.S.S.; writing—review and editing, P.D. and R.K.R.; visualization, G.S.S. and A.S.; supervision, P.D. and R.K.R.; project administration, R.K.R.; funding acquisition, R.K.R. All authors have read and agreed to the Submitted version of the manuscript. All authors have read and agreed to the published version of the manuscript.
Funding
APC will be paid by Multimedia University.
Data Availability Statement
The authors confirm that all relevant data were included in the article.
Conflicts of Interest
The authors declare no conflicts of interest.
Abbreviations
The following abbreviations are used in this manuscript:
| ECE | Expected Calibration Error |
| OVR | One-vs-Rest |
| MCC | Matthews Correlation Coefficient |
| NPV | Negative Predictive Value |
| MHSA | Multi-Head Self-Attention |
| FFN | Feed-Forward Network |
| CE | Cross-Entropy |
| DFSel-FT | Differentiable Feature Selection FT-Transformer |
References
- Lu, Q.; Wu, Y.; Chang, J.; Zhang, L.; Lv, Q.; Sun, H. Application progress of artificial intelligence in managing thyroid disease. Front. Endocrinol. 2025, 16, 1578455. [Google Scholar] [CrossRef] [PubMed]
- Etehadtavakol, M.; Etehadtavakol, M.; Ng, E.Y.K. Enhanced thyroid nodule segmentation through U-Net and VGG16 fusion with feature engineering: A comprehensive study. Comput. Methods Programs Biomed. 2024, 251, 108209. [Google Scholar] [CrossRef]
- Atighi, F.; Yazdanpanahi, P.; Keshtkar, A.; Karimi, A.; Naseri, A.; Dabbaghmanesh, M.H. Illuminating the Path to thyroid Disorder Management Using Artificial intelligence: A Narrative review. Shiraz E-Med. J. 2024, 26, e151031. [Google Scholar] [CrossRef]
- Guleria, D.; Garg, V.K. Role of Artificial Intelligence in Thyroid Disorder. In Proceedings of the 2023 3rd International Conference on Innovative Sustainable Computational Technologies (CISCT); IEEE: Piscataway, NJ, USA, 2023; Volume 12, pp. 1–4. [Google Scholar] [CrossRef]
- Li, L.-R.; Du, B.; Liu, H.-Q.; Chen, C. Artificial intelligence for Personalized Medicine in thyroid Cancer: Current status and future perspectives. Front. Oncol. 2021, 10, 604051. [Google Scholar] [CrossRef]
- Yazdanpanahi, P.; Atighi, F.; Keshtkar, A.; Hamidi, R.; Rezaeimanesh, M.; Karimi, A.; Naseri, A.; Dabbaghmanesh, M.H. The Current progress of Artificial intelligence in approach to thyroid nodules: A Narrative review. Shiraz E-Med. J. 2024, 25, e148493. [Google Scholar] [CrossRef]
- Fiorentino, V.; Pizzimenti, C.; Franchina, M.; Micali, M.G.; Russotto, F.; Pepe, L.; Militi, G.B.; Tralongo, P.; Pierconti, F.; Ieni, A.; et al. The minefield of indeterminate thyroid nodules: Could artificial intelligence be a suitable diagnostic tool? Diagn. Histopathol. 2023, 29, 396–401. [Google Scholar] [CrossRef]
- Rizzo, P.C.; Marletta, S.; Caldonazzi, N.; Nottegar, A.; Eccher, A.; Pagni, F.; L’Imperio, V.; Pantanowitz, L. The application of artificial intelligence to thyroid nodule assessment. Diagn. Histopathol. 2024, 30, 339–343. [Google Scholar] [CrossRef]
- Deng, X.; Liu, C. Application of artificial intelligence algorithms in ultrasound diagnosis of thyroid diseases. Procedia Comput. Sci. 2025, 261, 1129–1135. [Google Scholar] [CrossRef]
- Cao, C.-L.; Li, Q.-L.; Tong, J.; Shi, L.-N.; Li, W.-X.; Xu, Y.; Cheng, J.; Du, T.-T.; Li, J.; Cui, X.-W. Artificial intelligence in thyroid ultrasound. Front. Oncol. 2023, 13, 1060702. [Google Scholar] [CrossRef]
- Peng, S.; Liu, Y.; Lv, W.; Liu, L.; Zhou, Q.; Yang, H.; Ren, J.; Liu, G.; Wang, X.; Zhang, X.; et al. Deep learning-based artificial intelligence model to assist thyroid nodule diagnosis and management: A multicentre diagnostic study. Lancet Digit. Health 2021, 3, e250–e259. [Google Scholar] [CrossRef]
- Shrivastava, K.; Pandey, S.; Dubey, R.; Namdev, M.; Tiwari, V.; Sharma, A. A novel hybrid approach for thyroid disease detection: Integrating cuttlefish algorithm and simulated annealing for optimal feature selection. MethodsX 2025, 15, 103558. [Google Scholar] [CrossRef]
- Yang, L.; Wang, X.; Zhang, S.; Cao, K.; Yang, J. Research progress on artificial intelligence technology-assisted diagnosis of thyroid diseases. Front. Oncol. 2025, 15, 1536039. [Google Scholar] [CrossRef]
- Lysukhin, D.; Varlamov, A.; Yakimov, B.; Porubayeva, E.; Pachuashvili, N.; Kovaleva, E.; Vanushko, V.; Platonova, N.; Shirshin, E.; Mokrysheva, N.; et al. Multiple-Instance Learning for thyroid gland disease classification: A hands-on experience. Comput. Biol. Med. 2024, 184, 109424. [Google Scholar] [CrossRef]
- Yao, J.; Wang, Y.; Lei, Z.; Wang, K.; Feng, N.; Dong, F.; Zhou, J.; Li, X.; Hao, X.; Shen, J.; et al. Multimodal GPT model for assisting thyroid nodule diagnosis and management. npj Digit. Med. 2025, 8, 245. [Google Scholar] [CrossRef]
- Yin, L.; Li, Y.; Luo, H. Dynamic video prompting network for thyroid nodule detection in ultrasound videos. In Proceedings of the Neural Information Processing; Communications in Computer and Information Science; Springer: Singapore, 2025; pp. 46–61. [Google Scholar] [CrossRef]
- Asal, B.; Yalciner, B. Benchmarking TabNet, NODE, and FT-Transformer for software defect Prediction: An Empirical comparison and Explainability analysis. IEEE Access 2026, 14, 11660–11681. [Google Scholar] [CrossRef]
- Alnasyan, B.A.; Basheri, M.; Alassafi, M.O. A comprehensive comparative analysis of deep learning models for student performance prediction in virtual learning environments: Leveraging the OULA dataset and advanced resampling techniques. IEEE Access 2025, 13, 75953–75972. [Google Scholar] [CrossRef]
- Zhang, Y.; Chen, L.; Tian, Y. A framework for interpreting machine learning models in bond default risk prediction using LIME and SHAP. Risks 2026, 14, 23. [Google Scholar] [CrossRef]
- Rumapea, H.; Manalu, D.R.; Rumapea, Y.Y.P. Interpretable deep learning for enhanced AI trust and clarity. J. Artif. Intell. Technol. 2025, 5, 345–353. [Google Scholar] [CrossRef]
- Algül, E.; Oyucu, S.; Polat, O.; Çelik, H.; Ekşi, S.; Kurker, F.; Aksoz, A. A comparative study of advanced transformer learning frameworks for water potability analysis using physicochemical parameters. Appl. Sci. 2025, 15, 7262. [Google Scholar] [CrossRef]
- Huang, L.; Xu, Y.; Wang, S.; Sang, L.; Ma, H. SRT: Swin-residual transformer for benign and malignant nodules classification in thyroid ultrasound images. Med. Eng. Phys. 2024, 124, 104101. [Google Scholar] [CrossRef]
- Tran, M.H.; Gomez, O.; Fei, B. A video transformer network for thyroid cancer detection on hyperspectral histologic images. In Proceedings of the Medical Imaging 2023: Digital and Computational Pathology, San Diego, CA, USA, 19–23 February 2023; Volume 12471, p. 6. [Google Scholar] [CrossRef]
- Sharma, R.; Mahanti, G.K.; Panda, G.; Rath, A.; Dash, S.; Mallik, S.; Hu, R. A Framework for Detecting Thyroid Cancer from Ultrasound and Histopathological Images Using Deep Learning, Meta-Heuristics, and MCDM Algorithms. J. Imaging 2023, 9, 173. [Google Scholar] [CrossRef]
- Xiang, Y.; Acharya, R.; Le, Q.; Tan, J.H.; Chng, C.-L. Thyroid nodule segmentation in ultrasound images using transformer models with masked autoencoder pre-training. Front. Artif. Intell. 2025, 8, 1618426. [Google Scholar] [CrossRef]
- Xing, H.; Jiang, Y.; Cao, X.; Fang, Y.; Wu, P.; Song, W.; Wu, X. A Unified Segmentation Network for Multi-Organ Lesion Detection in Two-Dimensional Grayscale Ultrasound Images. In Proceedings of the 2023 International Conference on Artificial Intelligence Innovation (ICAII); IEEE: Piscataway, NJ, USA, 2023; pp. 1–5. [Google Scholar] [CrossRef]
- Jiang, T.; Xing, W.; Yu, M.; Ta, D. A hybrid enhanced attention transformer network for medical ultrasound image segmentation. Biomed. Signal Process. Control 2023, 86, 105329. [Google Scholar] [CrossRef]
- Xiao, Y.; Zhuang, Y.; Ling, W.; Jiang, S.; Chen, K.; Liao, G.; Xie, Y.; Hou, Y.; Han, L.; Hua, Z.; et al. LGF-Net: A multi-scale feature fusion network for thyroid nodule ultrasound image classification. J. Appl. Clin. Med. Phys. 2025, 26, e70149. [Google Scholar] [CrossRef] [PubMed]
- Zhou, Y.-T.; Yang, T.-Y.; Han, X.-H.; Piao, J.-C. Thyroid-DETR: Thyroid nodule detection model with transformer in ultrasound images. Biomed. Signal Process. Control 2024, 98, 106762. [Google Scholar] [CrossRef]
- Wang, Z.; Yu, L.; Ding, X.; Liao, X.; Wang, L. Lymph node metastasis prediction from whole slide images with Transformer-Guided multiinstance learning and knowledge transfer. IEEE Trans. Med. Imaging 2022, 41, 2777–2787. [Google Scholar] [CrossRef] [PubMed]
- Le, Z.; Liang, Y.; Hu, X.; Qiu, T.; Xu, P. A risk stratification study of ultrasound images of thyroid nodules based on improved DETR. Int. J. Imaging Syst. Technol. 2024, 34, e23219. [Google Scholar] [CrossRef]
- Tian, Y.; Zhu, J.; Zhang, L.; Mou, L.; Zhu, X.; Shi, Y.; Ma, B.; Zhao, W. A Swin Transformer-Based Model for Thyroid Nodule Detection in Ultrasound Images. J. Vis. Exp. 2023, 194, e64480. [Google Scholar] [CrossRef]
- UCI Machine Learning Repository. Thyroid Disease. Available online: https://archive.ics.uci.edu/dataset/102/thyroid+disease (accessed on 29 November 2025).
- Chi, J.; Li, Z.; Sun, Z.; Yu, X.; Wang, H. Hybrid transformer UNet for thyroid segmentation from ultrasound scans. Comput. Biol. Med. 2022, 153, 106453. [Google Scholar] [CrossRef]
- Li, C.; Du, R.; Luo, Q.; Wang, R.; Ding, X. A novel model of thyroid nodule segmentation for ultrasound images. Ultrasound Med. Biol. 2022, 49, 489–496. [Google Scholar] [CrossRef]
| 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. |