DOI: 10.5281/zenodo.17612015
title: CTG Classification & Regression Benchmark (Classical ML & Transformer Models)

description: 1. Overview

This repository contains the full experimental pipeline used to evaluate three-class clinical classification and 0–100 continuous clinical score regression on real-world cardiotocography (CTG) time-series data.

The project compares:





Five classical machine learning models, and




Five transformer-based deep learning models, plus




A transformer-based regression framework predicting the continuous clinical score (0–100).



All analyses are performed on segmented CTG tracings consisting of FHR (Fetal Heart Rate), UA (Uterine Activity), and AFM (Automatic Fetal Movement) channels.

2. Repository Structure







 



├── ClassicModels.ipynb


├── Transformer_iTransformer.ipynb


├── Transformer_PatchCTG.ipynb


├── Transformer_PatchTST.ipynb


├── Transformer_TimesNetLite.ipynb


├── Transformer_ETCNN.ipynb


├── Transformer_Regression.ipynb


├── _scored_output.xlsx


└── README.md



3. Description of Files

A) Classical Machine Learning — Three-Class Classification

ClassicModels.ipynb

Trains and evaluates five widely used classical ML algorithms:





Logistic Regression




LightGBM




Random Forest




SVM (RBF kernel)




XGBoost



Includes:





Preprocessing and feature handling




SMOTE-balanced training data, original distribution test data




Accuracy, Precision, Recall, Macro-F1




Class-wise ROC curves and macro-ROC metrics




Confusion matrices



B) Transformer-Based Models — Three-Class Classification

Each transformer model is implemented in a separate notebook for modularity and reproducibility:

Transformer_iTransformer.ipynb

Implements the iTransformer architecture for multivariate long-range time-series modeling.

Transformer_PatchCTG.ipynb

Patch-based transformer optimized specifically for CTG segmentation and feature aggregation.

Transformer_PatchTST.ipynb

Implementation of the PatchTST architecture for multivariate physiological time-series.

Transformer_TimesNetLite.ipynb

Lightweight version of TimesNet using multi-scale temporal decomposition.

Transformer_ETCNN.ipynb

Hybrid encoder combining CNN feature extraction and transformer-based temporal modeling.

All transformer notebooks include:





Train/validation loop




Optimizers (AdamW / Lion)




LR scheduling




Early stopping




ROC curves (per class + macro)




Complete classification metrics



C) Transformer-Based Regression — 0–100 Continuous Score

Transformer_Regression.ipynb

Predicts the continuous 0–100 clinical evaluation score (regression task), using:





PatchTST


PatchCTG



iTransformer




TimesNetLite




ETCNN



Outputs:





MAE, RMSE, R²




Pearson & Spearman correlations




Bland–Altman analysis




Calibration curves




Scatter plots for predicted vs. true scores



This notebook corresponds to the Regression Axis described in the associated thesis/manuscript.

D) Additional Output

_scored_output.xlsx

Contains:





True class labels




True continuous clinical scores




Predicted probabilities (3-class models)




Predicted regression outputs




Threshold-based validation metrics




Data used to generate all figures (ROC, PR, Bland–Altman, calibration, etc.)



4. Tasks & Experimental Axes

This repository covers three analytical axes:

Axis 1 — Three-Class Classification (Classical ML)

Evaluates baseline machine learning algorithms on CTG-derived segments.

Axis 2 — Three-Class Classification (Transformers)

Assesses the discriminative performance of modern transformer architectures.

Axis 3 — Regression (0–100 Continuous Clinical Score)

Predicts clinician-derived continuous assessment values and compares regression accuracy across transformer-based models.

5. Requirements

This project requires:







 



Python >= 3.10


PyTorch >= 2.0


scikit-learn


xgboost


lightgbm


imbalanced-learn


numpy, pandas


einops


matplotlib, seaborn



GPU acceleration (Colab / A100 / CUDA-enabled environment) is strongly recommended for transformer models.

6. How to Use





Provide dataset paths in the notebooks.




Run preprocessing and segmentation (if needed).




Execute classical models via ClassicModels.ipynb.




Execute transformer-based classification models individually.




Run Transformer_Regression.ipynb for continuous score prediction.




Use _scored_output.xlsx for analysis, visualization, and statistical comparisons.



7. Citation

Once published on Zenodo, please cite:

APA



Karataş, F. (2025). CTG Classification & Regression Benchmark: Classical Machine Learning and Transformer Models [Code and Analysis]. Zenodo. https://doi.org/10.5281/zenodo.17612016


BibTeX







 



@dataset{karatas2025ctgbenchmark,
  author       = {Karataş, Ferhat},
  title        = {CTG Classification and Regression Benchmark:
                  Classical Machine Learning and Transformer Models},
  year         = {2025},
  publisher    = {Zenodo},
  doi          = {https://doi.org/10.5281/zenodo.17612016},
}



8. License

This work is shared under the Creative Commons Attribution 4.0 (CC-BY 4.0) license.You are free to reuse, modify, and distribute with proper attribution.

9. Contact

Dr. Ferhat KarataşDepartment of Computer EngineeringFirat University, TürkiyeORCID: 0000-0002-9462-6092