Writing the Methods Section for an AI Study
What must be documented: data sources, inclusion/exclusion criteria, preprocessing, model architecture, training procedure, evaluation protocol, and statistical analysis. Common omissions that undermine reproducibility.
The methods section of an AI paper has a harder job than most. It has to describe a clinical study (who the patients were, what the reference standard was) and a piece of software engineering (what was built, how, and with what settings), for readers who usually know one of those worlds well and the other hardly at all.
The test for whether it works is simple to state. Could a competent group at another hospital, reading only your paper and its supplement, repeat the study and expect a similar result? Most published AI papers fail this, usually through omission of things the authors knew perfectly well and didn't think to write down.
This article goes through the section in the order we'd suggest writing it. The matching reporting guideline (see 9.1 Reporting Standards) tells you what is required. This is about how to say it.
Study design and intended use
Start with two or three sentences that orient the reader. Was the study retrospective or prospective? Single site or several? Is this model development, validation of an existing model, or both?
Then say what the model is for. Who would use it, on which patients, at what point in care, and to make what decision? A model meant to triage emergency head CTs and a model meant to give a second read on outpatient scans can be the same network, and they need different test populations and different thresholds. Everything later in the section is judged against the intended use, so the reader needs it first.
Include the ethics approval and consent or waiver here, plus the trial or study registration if there is one.
Data sources and participants
This is the part clinicians write well, when they remember that an AI study needs it as much as any cohort study does.
For each dataset used, we'd want to know:
- Where it came from: institutions, care setting (screening, emergency, inpatient), and dates.
- How cases were identified. A database query, a consecutive series, a convenience sample? If positives and negatives were found by different routes, say so (see 2.4 Class Imbalance).
- Inclusion and exclusion criteria, with the number excluded for each reason. Exclusions for "poor image quality" deserve a number and a definition, since those cases will turn up in real use.
- A flow diagram from the cases first identified down to the cases analysed.
- Counts of patients, studies and images separately. "12,000 images" from 400 patients is a 400-patient study.
- Demographics and case mix for each partition: age, sex, disease prevalence and severity, and race or ethnicity where it is recorded and relevant.
- Scanner manufacturers, models and the main acquisition parameters.
If you used a public dataset, name the version and say which subset you used. Public datasets get revised, and "we used the public chest X-ray dataset" isn't enough to find the same cases.
The reference standard
The reference standard is what your model was scored against, and it is the most consequential paragraph in the section. Readers want to know:
- What it was. Pathology, follow-up, expert reading, or labels extracted from reports?
- Who produced it. How many readers, with what training and years of experience?
- What they could see. Were they blind to the model's output? Did they have clinical history, prior imaging, the original report?
- How disagreements were resolved, and how much disagreement there was to begin with. Give the agreement statistic.
- Whether it differed between the training set and the test set. It often does, and reasonably so, but the reader has to be told.
If an annotation protocol existed, put it in the supplement. 2.3 Data Annotation and Labeling for Clinical AI and 5.7 Reference Standards and Ground Truth in Medical AI cover what a good one contains.
How the data was split
Say how cases were divided into training, validation (tuning) and test sets, and at what level. "Randomly split 70/15/15" isn't sufficient, because it doesn't say whether the split was by image, by study or by patient, and that single detail decides whether the results can be believed (see 3.2 Training, Validation, and Test Sets).
State plainly that no patient appears in more than one partition, if that is true. Say whether the test set came from the same sites and period as the training data or from somewhere else, and call it internal or external accordingly. If you used cross-validation, say which kind and how the folds were grouped (see 4.6 Cross-Validation Strategies for Medical Data).
One word of caution on vocabulary. Engineers use "validation set" for the data used to tune the model during development. Clinicians use "validation" for the final independent test. Papers that mix the two meanings are very hard to follow. Define your terms once, early, and stick to them. Many journals now prefer "tuning set" for the first meaning to avoid the muddle.
Preprocessing
List each step that was applied to the data between the archive and the model, in order: de-identification, format conversion, intensity windowing or normalization, resampling, resizing (to what resolution), cropping, and any exclusion of images by an automated quality check.
This is where "standard preprocessing was applied" tends to appear, and it tells the reader nothing. A reader who can't reproduce the preprocessing can't reproduce the model. The detail can go in a supplementary table if space is tight (see 2.5 Data Preprocessing and Augmentation).
The model and its training
You will probably need your engineers to draft this part. Your job is to check that it is complete and that a clinical reader can follow the outline. It should cover:
- The architecture, by name and with a citation, plus any changes made to it.
- The starting point. Was the model trained from scratch or from pretrained weights? Which weights, trained on what?
- Inputs and outputs. What exactly goes in (one image, a volume, images plus clinical variables) and what comes out (a probability, a mask, a class).
- The training procedure: loss function, optimizer, learning rate and schedule, batch size, number of epochs, and how the final model was chosen (for example, the epoch with the best performance on the tuning set).
- Augmentation: which transformations and over what ranges.
- How class imbalance was handled, if it was.
- How hyperparameters were chosen, and how many configurations were tried. If you trained forty variants and report the best, the reader needs to know there were forty (see 3.4 Hyperparameter Tuning and Model Selection).
- Software and hardware: framework and version, key libraries, GPU type. Random seeds, if you fixed them.
A table of hyperparameters in the supplement does most of this more clearly than prose. Better still is the code itself (see 9.4 Sharing Code, Data, and Models), though code is a supplement to the description and not a substitute. A reader shouldn't have to read your Python to learn what loss function you used.
The evaluation protocol
Describe how the finished model was tested, in enough detail to show that the test was fair.
Which metrics, and which one was primary? Name it in advance of the results, with the reason it suits the clinical question.
How was the operating threshold chosen, and on which data? A threshold chosen on the test set makes the reported sensitivity and specificity optimistic. It should be fixed on the tuning set and then applied to the test set unchanged.
What was the unit of analysis: lesion, image, study or patient? A model can find 90% of lesions and still miss the only lesion in a fair number of patients.
Which subgroups were analysed, and were they chosen beforehand? Sex, age band, site and scanner vendor are the usual minimum (see 7.2 Demographic Fairness).
And how many times was the test set used? Ideally once. If the model was revised after test results were seen, the honest thing is to say so, since the test set has then done some of the work of a tuning set.
If you compared the model with clinicians, describe the readers and the reading conditions with the same care you gave the reference standard: how many, how experienced, what information they had, whether there was a time limit, and whether those conditions resemble their normal work (see 5.5 Reader Studies).
Statistical analysis
AI papers are often weakest here, perhaps because the engineering culture they come from reports single numbers on benchmark datasets. A clinical journal expects what it would expect of any diagnostic study:
- A sample size justification for the test set.
- Confidence intervals for every performance estimate, with the method (bootstrap, exact binomial, DeLong for AUC). When there are several images per patient, the intervals need to account for the clustering, for instance by resampling patients.
- The tests used for any comparison between models, or between model and readers, chosen for paired data where the same cases were read by both (see 4.7 Comparing Models).
- How multiple comparisons were handled.
- How missing data and uninterpretable outputs were handled. If the model declined to produce a result for 4% of cases, were those counted as errors or dropped?
4.5 Statistical Significance, Confidence Intervals, and Sample Size for AI Studies covers the methods.
The things most often left out
If you have time to check only a few things before submission, we'd check these, because they are the omissions reviewers find most often:
- Whether the split was by patient.
- How the threshold was chosen, and on which data.
- The number of patients, as opposed to images.
- How many models or configurations were tried before the reported one.
- What happened to excluded, failed or ungradable cases.
- The readers' experience and blinding, for the reference standard and for any comparison.
- Inter-reader agreement.
- Scanner and site details for each partition.
- Version numbers for the software and for any public dataset or pretrained model.
None of these takes more than a sentence or two to report. They are usually missing because the person writing didn't know the answer and the person who knew wasn't asked.
Advice on the writing
Write the methods as the study goes, not at the end. Six months after training, nobody remembers which learning rate schedule produced the final model. A shared document that the engineers update when something changes is the easiest way to get this right, and experiment tracking tools record most of the technical settings automatically (see 3.7 Tools and Infrastructure).
Use the main text for what a clinical reader needs to judge the study, and the supplement for what an engineer needs to rebuild it. Word limits are not a good reason to omit a split procedure or a threshold.
Have the section read by one person from each side. A clinician colleague should be able to say who the patients were and what the reference standard was. An engineer who wasn't on the project should be able to say how they would retrain the model. Whatever either of them has to ask about is what's missing.
Key takeaways
- The methods section has to describe both a clinical study and a software build, well enough that another group could repeat it.
- Open with the study design and the model's intended use. The rest of the section is judged against it.
- Report data sources, selection, exclusions and case mix as you would for any cohort, with patients counted separately from images.
- Describe the reference standard in full: who, how many, what they could see, how disagreements were settled and how often they occurred.
- State the level of the data split and confirm that no patient crosses partitions. Define "validation" once and use it consistently.
- Give preprocessing, architecture, training settings and the number of configurations tried, in a supplement if necessary.
- Say how the threshold was chosen and how often the test set was used, and give confidence intervals with their method.
- Write it during the study, and have a clinician and an outside engineer each read it.
What to read next
- 9.1 Reporting Standards: CONSORT-AI, SPIRIT-AI, TRIPOD+AI, and STARD: the checklist that applies to your design
- 9.3 Common Methodological Pitfalls in Medical AI Papers: what reviewers look for in the section you just wrote
- 9.4 Sharing Code, Data, and Models: making the methods checkable
- 7.5 Transparency and Reproducibility: why this level of detail is asked for
- D. Checklist: Is Your AI Study Ready for Publication?: a pre-submission list
This article is part of the AI in Clinical Research Knowledge Base.