Methods & interpretation

How KITH measures familiarity

What each number on this site means, how it is worked out, and its limits.

KITH stands for K-nearest Index of Typicality in Hidden layers.

The path from an input image to its nearest training images.

The site reads your JPEG or PNG and resizes it to the size the model expects.

The model (EfficientNetB0, a widely used image-recognition network) outputs one number between 0 and 1. Above 0.5 it answers malignant; otherwise benign. The site shows the output probability: the probability the network gives its top answer. A model output of 0.9 is shown as “90% malignant” and 0.2 as “80% benign”. This number has not been checked against real clinical outcomes.

Along the way, the model produces an internal summary of the image (a long list of numbers) at four stages partway through and at a late stage. For each of these five summaries, the site finds which of the 5,772 training images have the most similar summaries, measuring straight-line distance.

Five familiarity scores.

Four of the scores (W, B, G and E) measure how crowded the area around your image is with one group of training images. Each looks at the 16th-closest image in that group: the closer it is, the bigger the score. The groups are based on the label the model gave each training image. The correct labels are used only to find the model’s past mistakes.

W
Within the predicted class. How crowded the area is with training images the model gave the same label as yours.
B
Between classes. How crowded the area is with training images the model gave the other label.
G
General neighbourhood. How crowded the area is with all training images, whatever their label.
E
Error neighbourhood. How crowded the area is with past mistakes: training images the model wrongly gave the same label as yours. If there are fewer than 16 such images, the score is zero; that means too few examples, not proof of no risk.
C
Composite familiarity. A ratio of W to W + B + E. G is shown separately and is not part of this ratio.

density = 1 / (d₁₆ + 0.001)
C = W / (W + B + E + 10⁻⁸)

C describes your image’s neighbours. It is not the chance the answer is right. Because it is a ratio, it can be high even when your image is far from all the training images, so check W, B and E as well.

Measuring Neural Network certainty by distance to known examples

The model processes an image in a series of stages. The site measures familiarity at four stages partway through (“perceptual”, for short) and at the final stage, just before the model gives its answer (“decisional”). These are only names for where the stage sits; they do not mean the model perceives or decides the way a person does.

The site measures four early stages and one late stage (96, 144, 240, 480 and 1,280 numbers). Try labels them “Early stage 1” to “Early stage 4” and “Late stage”. These are rough roles, not sharply separate jobs, and they are not every layer in the network.

Each stage measures distance on its own scale, so raw scores cannot be compared across stages. For the four early stages, the site shows the middle value of C and its range; the late stage is shown separately. The chart keeps every stage, so you can see where they disagree.

What the familiarity bands mean.

A raw familiarity score such as 0.354 is hard to read on its own. So Try places each result in one of five bands, from least familiar to most familiar, and says how often the model was right on held-out images in the same band. It does the same for the output probability.

The bands were built in two steps, from two separate sets of images that the model never trained on. First, we scored one held-out set of 2,000 images (the validation set) and split them into five groups of equal size. The boundaries between those groups are the band edges. Second, we scored a different held-out set of 2,000 images (the test set), placed each one in a band using those edges, and counted how often the model was right in each band. So the band edges come from one held-out set, and the rates come from another. Keeping the two sets apart means the rates were not tuned on the same images they describe.

At the late stage, the model was right on 61% of the images in the second set that fell in the least familiar band and on 100% of those in the most familiar band. Over all 2,000 images in that set, it was right 86% of the time. Early-stage familiarity rises in a similar way (60% to 100%), and so does the output probability (60% to 100%).

A single number, called AUROC, summarises how well a score separates right answers from wrong ones. Pick one right answer and one wrong answer at random: AUROC is the chance that the right one has the higher score. 0.5 is no better than a coin toss, and 1 is perfect separation. On the second held-out set, late-stage familiarity scored 0.85, early-stage familiarity 0.84 and the output probability 0.84.

For ordinary photos like these, familiarity tracks the output probability fairly closely: images the model is sure about also tend to look familiar, so the two usually land in similar bands. Familiarity has not been shown to add much to the output probability on these images. It is most informative when the two disagree, for example when the model is very sure about an image that looks unfamiliar. Try says so when that happens. It also says when the early and late stages disagree.

These are rates for groups of held-out images, not the chance that any single answer is right, and they have not been checked against clinical outcomes.

How to interpret the map.

Try lists the raw familiarity score (C, from 0 to 1) for each stage under Raw scores and stage details. Raw scores are hard to compare on their own, which is why Try leads with the bands described above.

The map flattens each stage’s long list of numbers into two dimensions so it can be drawn (a method called PCA). The flattening is fitted to the training images only, and your image is placed on the same map. The percentage shown is how much of the original spread the map keeps. Flattening distorts distances, so points that look close on the map may not be close for the model.

Each dot is a training image, coloured by the answer the model gave it: indigo dots are Benign answers and rose dots are Malignant answers. Red diamond outlines mark Past mistakes, the training images the model got wrong. Gold rings mark the Nearest training images, the 16 closest to yours, measured before flattening. Your image is the hot-pink dot inside a dark ring, with a “Your image” label, so it stands out even without colour. Use Zoom in to the nearest training images, Zoom in, Zoom out and Reset view to move around. Lines join your image to the 16th-closest image for each score, but their length on screen is not the distance the model used; the list below the map gives the real distances. If a group has fewer than 16 images, it has no 16th-closest image and its score is zero. You can step through the nearest images and see their labels. No patient information is shown.

Comparing models.

“Run every model and compare them” runs each available model in turn and keeps every result and any errors. The summary averages the probabilities given to each label, reports votes and the range across models, and leaves out any model that failed, saying so. When only one model is available, it is labelled as one model, not as a combination.

Each model’s familiarity score depends on its own answer and its own training images. The summary therefore lists early-stage (perceptual) and late-stage (decisional) familiarity by predicted label, keeping every model separate rather than blending support for answers that disagree. Neither the averaged probabilities nor the familiarity scores have been checked against real clinical outcomes.

This is not a medical tool.

This proof of concept explores machine metacognition using a classifier trained on ISIC dermoscopic images. It is not a medical device and does not provide medical advice or diagnosis. A result must not be used to decide whether a lesion needs care.

Images from other cameras, ordinary skin photographs, drawings and synthetic inputs can differ substantially from the training domain. Neither a confident prediction nor a high familiarity score establishes that the model is appropriate for an image.

This site does not claim that: (1) familiarity is better than the model’s output probability; (2) any score is medically reliable; (3) it catches every unusual image. We checked that the site gives the same numbers as the research code. That shows the site works as built; it says nothing about medical usefulness.

Your image is processed in your browser. Nothing is uploaded, there is no account, and no images are saved. The page downloads the model and its training-image data; a results file is downloaded only when you ask for it.

Version.

The live model is a recovered copy of the original research model (EfficientNetB0). It is provisional: its files and arithmetic have been checked, but whether it matches the original training-image data exactly is still being confirmed.

Every result records which model produced it, so future models can be added without changing what an earlier result means.

This site currently shows one network, EfficientNetB0. The same method is being run on additional networks, and their results will be added here.

Processing speed and memory use depend on your browser and device.

You can upload images up to 20 MB and 40 million pixels.

Further reading.

The implementation follows the static research-site approach used by GRIN.