Liliya Spencer.

Dementia diagnosis: ensemble model

Seven models stacked into two ensembles, trained on health and lifestyle data from 1,000 people. Both scored a perfect 1.0 – which is exactly where the interesting work starts.

Sector
Machine learning, healthcare
Role
Researcher and developer – built end to end
Scope
Feature analysis, ensemble architecture, tuning, evaluation
Tools
Python, scikit-learn, XGBoost
Dataset
1,000 rows, 24 columns
Year
2024–2025
Correlation and feature analysis for the dementia dataset

The seven models

I built two stacked ensembles, each combining the same seven base models:

  • Random Forest
  • Gradient Boosting
  • AdaBoost
  • Bagging Classifier
  • ExtraTreesClassifier
  • XGBClassifier
  • HistGradientBoosting
The seven base models used in the stacking ensembles

Dataset

The dataset contains 1,000 rows and 24 columns, covering various parameters related to the health and lifestyle factors of people, with a focus on their dementia status.

The dataset's 24 columns

Stacking

I chose stacking because it lets models with different strengths vote, with a final model learning how much to trust each one.

First results

The first ensemble scored 1.0 on accuracy, ROC AUC, precision, recall and F1.

Why a perfect score is a warning

Real clinical data is not that clean. When a model scores 1.0 on 1,000 rows, the task is usually easier than it looks – most often because one of the columns already carries the answer, for example something recorded only after a diagnosis was made – or because information has leaked between the training and test data. The next step is to remove any column recorded after diagnosis, retrain, and see what the models were really learning.

Metrics for the first stacking ensemble

Optimisation of models

I tuned each model’s hyperparameters with GridSearchCV.

GridSearchCV hyperparameter tuning

Model configuration

A second ensemble, built on the tuned settings, was trained and timed, then checked with cross-validation against the first.

Training time comparison
Metrics for the second stacking ensemble

Results

The tuned ensemble matched the first on every metric and trained and predicted faster.

What the project taught me is less about dementia than about evaluation: a result that looks perfect deserves more scrutiny, not less. It is the same instinct I bring to reviewing any AI feature before it reaches the people using it.

Get in touch

Tell me what you’re building.

I’m open to a role where design owns something: the research behind it, the system underneath it, and the people doing the work. Singapore-based and a permanent resident here.