{# REVIEW: the wording of this section was written by the builder, not by the author. #}

Stain lab

{% if p2.stain_lab_live %}

Pick a patch from hospital {{ p2.live_held_out }}, the hospital the live models never saw, then change its stain. Both models answer on the changed patch, and the strip shows its nearest neighbors among {{ p2.map_n|count }} stored patches.

{% else %}

The live version of this section needs the Phase two server endpoint, which is not part of this build. It will change the stain of a patch from hospital {{ p2.live_held_out }}. Meanwhile, here is how the hospitals differ in stain.

{% endif %} {% for s in p2.stain_rows %} {% endfor %}
Mean optical density over tissue pixels, by hospital (hematoxylin, eosin, residual)
HospitalHematoxylinEosinResidualTissue pixels measured
{{ s.hospital }}{{ s.h|num(4) }}{{ s.e|num(4) }}{{ s.d|num(4) }}{{ s.n_pixels|count }}

Hospital {{ p2.stain_outlier }} differs most in eosin.{% if p2.stain_outlier == p2.worst_hospital %} It is also the hospital where the plain model did worst.{% endif %} This does not show that one explains the other: with {{ p2.hier.n_hospitals|count }} hospitals, a link between a stain statistic and a score is easy to see by chance.

Tissue is told apart from glass by a threshold on the summed optical density. It was calibrated on a different data set. On these patches the data-driven value is {{ p2.thr.otsu_on_camelyon|num(3) }}, against {{ p2.thr.default_threshold|num(3) }} in the code. At the value in the code the median patch is {{ p2.thr.median_tissue_fraction_at_default|pct(0) }} tissue. It was left unchanged, because the models were trained with it.