The compositional similarity matrix was determined for 78 elemental pairs (atomic numbers to bismuth, excluding noble gases elements). Pairwise distances were computed based on previously reported similarity values (gAB) which were themselves computed from data-mining of literature crystal structures. To convert similarities to dissimilarities, we take the reciprocal logarithm of the original values, diss(A,B) = 1 / log10(gAB + 1). While Hautier et al. give similarity measures for multiple oxidation states for some elements, we have adopted the most commonly observed oxidation state for each element to avoid the need to estimate valence. To account for missing AB pairs in the original publication, we assign pairs containing Pm the corresponding Sm values, and otherwise set missing values to an arbitrary large dissimilarity (gAB = 10 -5 ) as a missing pair would suggest that substitution has not been experimentally observed. Given the overlap in data between the Materials Project and ICSD, we do not expect many materials to require these missing gAB pairs. Fig. shows the resulting compositional distance matrix, with elements arranged according to the Pettifor scale which places chemically similar elements near to each other. Blocks of similar distance can clearly be observed for chemically related elements (e.g. rare-earths), as can the large distances between e.g. anions and cations. Note that Fig. visualises log(diss(A,B)) to avoid the effect of extremely large values, whilst our compositional similarity calculations use diss(A,B). Fig. shows the distributions of EMD values for composition and structure, respectively. As only small values are useful in the kNN model, only the smallest EMD values (Fig. ) and the average of 10 smallest EMD values (Fig. ) are shown.