Start with the clinical question, not the algorithm
A diabetes prediction study estimates the probability that a person has, or will develop, diabetes from information available at a given moment. The first decision is which of these you mean. A diagnostic model estimates whether someone has undiagnosed diabetes now; a prognostic model estimates the risk of developing it over a stated period, such as five years. The two need different data, different outcome definitions and different validation. Then name the intended user and moment of use: a model to prioritise screening in primary care has different requirements from one used in a hospital.
Machine learning is a set of tools for prediction, not for explaining causes. A variable that improves prediction need not be a cause of diabetes, and a model that predicts well does not show what would happen if a risk factor changed (Mullainathan & Spiess, 2017). Keep this distinction in your research questions and your discussion chapter.

Data: source, size and quality
Prediction data usually come from electronic health records, cohort studies, screening programmes or public benchmark data sets. "Big data" is often described by five Vs: volume (amount), velocity (speed of arrival), variety (types and formats), veracity (quality and trustworthiness) and value (usefulness for a decision). For most doctoral prediction studies, veracity matters most: how the outcome was confirmed, whether measurements were taken the same way at every site, and how much is missing.
Small public data sets are useful for learning but weak for a thesis. They tend to come from one population, carry undocumented coding choices (for example, zeros that stand for missing measurements) and have been analysed so often that results reflect tuning to that data set. If you use one, say so and treat the work as methodological. For a new clinical model, calculate the minimum sample size in advance from the expected outcome rate, the number of candidate predictors and the target precision (Riley et al., 2020). Handle missing data with a principled method such as multiple imputation rather than deleting incomplete records (van Buuren, 2018).
Choosing models
Fit a well-specified logistic regression first. With sensible handling of continuous predictors, it is a strong baseline for tabular clinical data and is easy to interpret (Harrell, 2015). Flexible models may then be compared with it on the same validation data.
| Model | How it works | Strengths | Cautions |
|---|---|---|---|
| Logistic regression | Models log-odds as a function of predictors | Interpretable; well calibrated when specified well | Needs care with non-linear effects and interactions |
| Random forest | Averages many decision trees built on resampled data (Breiman, 2001) | Handles interactions; ranks variable importance | Can still overfit; probabilities often poorly calibrated |
| Gradient boosting | Adds trees sequentially to correct earlier errors | Often high discrimination on tabular data | Many tuning choices; leakage risk in tuning |
| Support vector machine | Finds a separating boundary, using kernels for non-linear cases | Works in high dimensions | Gives scores, not probabilities, without extra calibration |
| k-nearest neighbours | Classifies by the outcomes of similar records | Simple; no training phase | Sensitive to k, scaling and irrelevant variables |
| Naive Bayes | Applies Bayes' rule assuming predictors are independent | Fast; works with small data | Independence assumption rarely holds for clinical variables |
Validation: where most studies go wrong
Performance measured on the data used to build a model is optimistic. Use internal validation by cross-validation or bootstrapping, and keep every step, including scaling, imputation, feature selection, resampling for class imbalance and hyperparameter tuning, inside the validation loop. Doing any of these on the full data set before splitting leaks information from the test data into training, a problem found across many fields of machine-learning research (Kapoor & Narayanan, 2023). Records from the same patient must stay together in one fold. External validation, on data from a different site or period, is the real test of whether a model generalises.

Report three kinds of performance. Discrimination, usually the area under the ROC curve, shows how well the model ranks people by risk. Calibration shows whether predicted risks match observed risks; a model can rank well and still predict 30% risk for people whose true risk is 10%, which misleads clinicians (Van Calster et al., 2019). Clinical usefulness, assessed for example by decision curve analysis, shows whether using the model would lead to better decisions than treating everyone or no one (Vickers & Elkin, 2006). Accuracy alone is misleading when diabetes is uncommon in the sample.
Reporting and appraisal: TRIPOD+AI and PROBAST+AI
Reviews have found that machine-learning prediction studies often omit basic information such as how the sample was selected, how missing data were handled and how the model was validated (Andaur Navarro et al., 2022), and that claims of performance equal to clinicians frequently rest on weak designs (Nagendran et al., 2020). The TRIPOD+AI statement, published in 2024, sets the reporting standard for prediction models built with regression or machine learning (Collins et al., 2024), and PROBAST+AI, published in 2025, is the tool reviewers use to judge risk of bias and applicability (Moons et al., 2025). Use the first as a checklist while writing and the second to criticise your own design before an examiner does.
| Report | Example for a diabetes model |
|---|---|
| Source of data and dates | Primary-care records, two regions, 2015 to 2020 |
| Participants and eligibility | Adults without diagnosed diabetes at baseline |
| Outcome and how it was confirmed | Type 2 diabetes within five years by HbA1c or diagnosis code |
| Predictors and timing | Measured at or before baseline only |
| Sample size and events | Number of participants and outcome events; how size was justified |
| Missing data | Amount per variable and method used |
| Model building and tuning | Algorithms, hyperparameters, all steps inside cross-validation |
| Performance | Discrimination, calibration and clinical usefulness, with uncertainty |
| Fairness | Performance in subgroups such as sex and ethnicity |
| Code and data availability | Where code is shared; how data can be requested |
From a validated model to health care practice
That promise depends on steps that a thesis should at least discuss. A model must be usable at the moment of decision, which means its predictors must be routinely recorded and available then; a model that needs a laboratory test nobody orders will not be used. Its performance can drift as populations, testing practices and diagnostic thresholds change, so it needs monitoring and periodic recalibration. And its errors may fall unevenly: if one group is under-represented in the training data, the model may be less accurate for that group, which is why subgroup performance belongs in the results chapter.
Class imbalance deserves a word of its own, because it attracts many quick fixes. When diabetes is uncommon in a sample, oversampling or synthetic records can raise apparent sensitivity, but they also distort predicted probabilities and so damage calibration (Van Calster et al., 2019). Often the better course is to keep the original data, model the probability well and choose a decision threshold that reflects the clinical costs of false positives and false negatives. Whatever you do, do it inside the validation loop and report it.
Worked example (illustrative)
A doctoral researcher wants to predict five-year risk of type 2 diabetes in adults attending primary care. She defines the outcome, lists twelve candidate predictors available at a routine visit, and uses the outcome rate in a pilot extract to calculate the minimum sample size. She imputes missing values within each cross-validation fold, fits logistic regression with flexible terms for age and body mass index, and compares it with gradient boosting. Boosting ranks patients slightly better but is poorly calibrated until recalibrated. She validates both models on records from a third region, reports calibration plots and a decision curve, and examines performance by sex and ethnic group. The design and its outcomes are hypothetical; the sequence of decisions is the point.
Common mistakes
- Choosing the algorithm before defining the clinical question and outcome.
- Relying on a small public data set and presenting the result as a clinical tool.
- Selecting features, imputing or oversampling before splitting the data.
- Reporting accuracy or AUC only, with no calibration.
- No external validation, or "external" data drawn from the same source.
- Interpreting variable importance as evidence of causation.
See also choosing and reporting evaluation metrics in a machine learning dissertation, how to choose a machine learning algorithm and machine learning for early sepsis prediction.
Key takeaways
- Define the clinical question, outcome and time horizon before choosing an algorithm.
- Justify the sample size and handle missing data properly (Riley et al., 2020; van Buuren, 2018).
- Keep every preprocessing and tuning step inside validation to avoid leakage (Kapoor & Narayanan, 2023).
- Report calibration and clinical usefulness as well as discrimination (Van Calster et al., 2019; Vickers & Elkin, 2006).
- Write to TRIPOD+AI and appraise your design with PROBAST+AI (Collins et al., 2024; Moons et al., 2025).
