Machine learning pipeline for predicting cardiac abnormalities in children, built on a real-world clinical dataset (UCMF) from a Portuguese pediatric cardiology unit.
Built as a final project for the Fundamentals of Data Science course at Universidade de Aveiro (2024/2025).
The goal of this project is to predict whether a child presents a normal or abnormal cardiac condition based on clinical measurements. The full pipeline covers everything from raw data exploration to predictive modelling, producing 50+ outputs including statistical reports, visualisations, and model evaluations.
The UCMF dataset contains anonymised pediatric cardiology records with the following features:
| Feature | Description |
|---|---|
| IDADE | Patient age (0-19 years) |
| SEXO | Sex |
| IMC | Body Mass Index |
| PA SISTOLICA | Systolic blood pressure |
| PA DIASTOLICA | Diastolic blood pressure |
| FC | Heart rate |
| PULSOS | Pulse assessment |
| SOPRO | Heart murmur |
| B2 | Second heart sound |
| NORMAL X ANORMAL | Target variable (Normal / Abnormal) |
Exploratory analysis of the raw dataset before any preprocessing.
Key outputs: variable classification, missing value analysis, physiologically impossible values, descriptive statistics, histograms, boxplots, KDE density curves, categorical distributions.
Cleaning and preparation for downstream analysis.
Transformations applied:
- Duplicate removal (ID column)
- Age validation (0-19 years)
- Weight, height and BMI cleaning
- Systolic/diastolic blood pressure and heart rate validation
- Categorical standardisation (SEXO, TARGET, PULSOS, SOPRO, B2)
- Irrelevant column removal
Output: UCMF_CLEAN.xlsx
Detailed descriptive analysis of the cleaned dataset: statistics summary, histograms, boxplots, dispersion measures, normality tests (Shapiro-Wilk, Kolmogorov-Smirnov).
Analysis of pairwise variable relationships: Pearson, Spearman and Kendall correlations, simple linear regressions, t-tests comparing Normal vs Abnormal groups, ANOVA for categorical variables, partial correlations controlling for age.
Complex multi-variable relationships: logistic regression with Odds Ratios, Mutual Information scores, PCA (scree plot, biplot, loadings), K-Means clustering with Silhouette and Davies-Bouldin evaluation.
Identification of the most relevant predictive variables using: F-test, Mutual Information, Random Forest importance, Gradient Boosting importance, Recursive Feature Elimination (RFE), cross-validation performance curve.
Training and evaluation of 5 classification models:
| Model | Description |
|---|---|
| Decision Tree | Interpretable tree-based classifier |
| SVM | Support Vector Machine with RBF kernel |
| Naive Bayes | Gaussian probabilistic classifier |
| Random Forest | Ensemble of decision trees |
| Neural Network | Multi-layer Perceptron (MLP) |
Evaluation metrics: Accuracy, Precision, Recall, F1-score, ROC-AUC, confusion matrices, 5-fold cross-validation.
pip install pandas numpy matplotlib seaborn scikit-learn openpyxl xlrdpython src/raw_data_analysis.py
python src/pre_process.py
python src/eda_basic.py
python src/bivariate_analysis.py
python src/multivariate_analysis.py
python src/feature_selection.py
python src/predictive_models.pyEach script reads from the previous step's output. Start with raw_data_analysis.py and run sequentially.