Engine.evaluate
Engine.evaluate(split='validation', *, at='model')One row per model: the comparison table the whole multi-model idea is for.
best_epoch is the epoch these very scores came from, which is what a reader of a row of scores takes it for, and it is None when they came from no single epoch - an average, or a run that selected nothing and therefore ended on its last epoch, which epochs_run already names. It was the lowest val_loss whatever the run was watching until pyplatypus#398, so a run monitored on anything else named one epoch and scored another. The epoch that was best by some other quantity is History.best(key), which is now the only way to ask that question.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| split | str | Which data to score on. | 'validation' |
| at | str | Which grid to score on. "model" is each model’s own load_shape and the default, because changing it would silently restate every number anybody has already written down. "source" puts every prediction back on the grid of the file it came from and scores it against the truth as stored, so the rows answer one question. |
'model' |
Returns
| Name | Type | Description |
|---|---|---|
| list[dict[str, Any]] | One row per model: what it is, how long it trained, its loss and its metrics. | |
| list[dict[str, Any]] | The loss column is comparable only between models trained on the same |
|
| list[dict[str, Any]] | objective, which is why loss_function sits beside it - and the metrics are |
|
| list[dict[str, Any]] | comparable only between models scored on the same grid, which is why | |
| list[dict[str, Any]] | load_shape sits beside them. |
load_shape is the second of those and the one nothing used to say. At at="model" each model is scored through its own loader, so a model at input_shape: [512, 512] is measured against a truth reduced to 512 while a model that tiles 2048 is measured against the truth as stored. Both numbers are a real Dice of a real prediction against a real mask; they are not answers to the same question. Measured on retinal vessels (maju116/rplatypus#187), that difference reported a resized model at +0.0187 where the honest figure was +0.0033, with the bias reversed on clDice because upsampling smooths a prediction - better against a skeleton, worse against a boundary. So when the rows do not share a grid this says so, once, rather than leaving a table that looks like a comparison.
at="source" is what that warning now points at. The truth is never resampled - only predictions move - which is why the grid is the files’ own rather than one the caller names: a named grid interpolates the very thing every model is being judged against. The column then reads source, because what it has always meant is the grid this row’s numbers were computed on.
Two things that are the price of it, neither recoverable: interpolating probabilities softens a boundary, and where the forward crop cut anatomy away the inverse pads it with background, which means not examined rather than nothing there. For a comparison the second is correct rather than unfair - a model whose field of view did not contain the organ did not segment it - but a 0.000 arriving that way is a result and not a bug.
The loss is not reported at at="source". A loss is defined by the objective a model was trained with, on the grid it was trained on; re-deriving one from a resampled prediction would be a number with no training meaning and a column somebody would compare.
The pooling is the same in both: the mean over cases. That has been the claim here since at was added and became true in 0.8.0a40 - until then this branch passed no case names and reported the mean over batches, so the sentence described a pooling the code did not do and the comment in the at="source" branch rested on it. maju116/rplatypus#196.
A case’s own score is a ratio of sums - its tiles’ counts added, the formula applied once - and the split’s is the mean of those. evaluate_cases pools a group the same way, by adding the counts of the images in it, which is a different number again and the better statistic for a patient: summarise_cases is where to read it. So at changes the grid and nothing else, and the gap between its two values is the rig it exists to measure rather than that gap plus a change of definition.
Raises
| Name | Type | Description |
|---|---|---|
| EngineError | If the split carries no masks - and the message says predict works on it, because that is the question asked next. |