Research method /
What changes when a model meets a new dataset?
Why the same accuracy can hide a different practical result, with a runnable example of prevalence shift and a clearer external-validation plan.
Updated

Your classifier reaches 90% accuracy on one dataset. Then it reaches 90% on another. Same result, right?
Not necessarily. The proportion of useful positive predictions could have changed substantially, even while that headline stayed identical. A dataset is a population, a measurement process and a labeling process. Moving the model changes the context in which its outputs are interpreted.
Let’s start with a small example where nothing is hidden inside a neural network. The arithmetic alone is enough to make the problem visible.
Same accuracy, different positive predictions
Imagine two synthetic cohorts of 1,000 examples each. In cohort A, 50% are positive. In cohort B, 10% are positive.
Assume a fixed classifier operating point with 90% sensitivity and 90% specificity in both populations. Sensitivity is the fraction of actual positives detected. Specificity is the fraction of actual negatives correctly rejected.
Under those assumptions, the counts are:
| Count or metric | Cohort A | Cohort B |
|---|---|---|
| Actual positives | 500 | 100 |
| True positives | 450 | 90 |
| False positives | 50 | 90 |
| True negatives | 450 | 810 |
| False negatives | 50 | 10 |
| Accuracy | 90% | 90% |
| Precision | 90% | 50% |
Precision asks: among predictions marked positive, how many are actually positive? The standard classification metric definitions make that distinction explicit.
In cohort B, there are 90 correct positive predictions and 90 false alarms. Half of the positive predictions are correct, despite the same accuracy, sensitivity and specificity as cohort A.
This is an assumed-count example. It is not an observed clinical result, and it does not suggest that sensitivity and specificity will remain stable under every real dataset change.
Run the numbers yourself
Download the cohort example and run it with Node:
node cohort-toy.mjs
I ran it with Node 24.21.0 and no packages. It produced the counts in the table and passed assertions for the population totals, both accuracies and both precision values. It calculates expected counts from the stated assumptions; it does not train or evaluate a classifier.
You can also see the relationship directly. If p is the positive-class prevalence:
precision =
sensitivity × p
/ (sensitivity × p + (1 − specificity) × (1 − p))
For cohort B, that is 0.09 / (0.09 + 0.09) = 0.5. Lower prevalence leaves more negatives that can become false positives.
The practical lesson is to connect the metric to the decision. If someone must review each positive prediction, the number of false alarms matters. A single aggregate accuracy cannot describe that workload.
Ask what changed before explaining why
Real external datasets rarely differ in just one neat way. Before blaming the architecture, write a short comparison of the data-generating processes.
Who was included? Were labels assigned using the same rules? Did scanners, language, collection dates or missing-value patterns change? Are the input units and feature definitions genuinely compatible? A column with the same name is a useful clue, not proof of the same measurement.
Think of the model as a ruler calibrated in one workshop. Moving it to another workshop raises two questions: are you measuring the same thing, and is the measuring process still comparable? That analogy helps separate population changes from plain implementation mismatches.
These checks are an investigation plan, not a diagnosis of the cause of a score difference. If the new cohort also has older participants, a different scanner and different labels, one comparison cannot isolate which factor caused the change.
Write down competing explanations and test those that your data can actually distinguish.
Make the evaluation direction explicit
Training on A and testing on B is a specific experiment. Training on B and testing on A is another one. They need not produce the same result: training size, population coverage and measurement quality can differ.
For each direction, define its training procedure and keep the target cohort outside fitting and model selection. Fit preprocessing on the training side. If external results inspire changes, record that reuse and qualify the next assessment accordingly.
My cross-cohort work studies this directional question between ADNI and OASIS. The methodological point is useful beyond those cohorts: “we used two datasets” is less informative than stating which one trained the model, which selected the settings and which assessed the final procedure.
If that boundary is unclear, start with the leakage-safe checklist before interpreting a distribution-shift result. Clean separation and external validation address related, but different, questions.
Report the failure pattern, not just the drop
Start with counts and the measures that match the intended use. For binary classification, report the confusion matrix and relevant threshold-dependent metrics. If probabilities matter, examine calibration too: does a predicted probability correspond to the observed frequency in the target data?
Keep the threshold selection procedure explicit. Moving a threshold after inspecting target labels is adaptation using those labels. It can be a legitimate experiment, but it changes what the result demonstrates.
Inspect meaningful subgroups where sample size supports it, and include uncertainty. A few errors in a small subgroup can move a percentage considerably. Treat those observations as leads for further analysis rather than established explanations.
A useful final statement is specific: this version of the model was tested under these split rules, on this target population, with this operating point. That gives another researcher enough context to judge the evidence.
For your next experiment, add a one-page “what changed?” table beside the score table. You may discover that the hardest part of external validation is making the new question precise.
Prepared with AI assistance. Sources and a worked example are provided so you can check the reasoning.
