fields/materials-chemistry/model families
k-nearest neighbours in materials and computational chemistry
How k-nearest neighbours, which predicts by finding the most similar past examples and reading the answer from them, is used in materials and computational chemistry, and why researchers reach for it.
How it is used
Materials and computational chemistry ask how what a substance is made of, and how it is made, decide what it does: which crystal arrangement an alloy adopts, how strong or conductive it is, how a polymer behaves when spun into fibres. A composition is turned into a row of numbers, called descriptors, such as average atomic size, differences in size between the elements, or the processing conditions used. K-nearest neighbours treats each past material as a point in that space of numbers. For a new candidate it finds the handful of recorded materials closest to it and reports their answer: the most common class among them, or the average of their measured values.
The same closest-neighbour idea does quieter work in preparing the data. Datasets in these fields are usually assembled by hand from published papers, so some entries are missing a descriptor or a measurement. One way to fill a gap is to look up the most similar complete entries and borrow their value, which is how nearest neighbours appears alongside simpler filling rules in the examples here. Because the method depends entirely on distances between rows of numbers, the numbers must first be put on a comparable footing: scaled, stripped of columns that never vary, and cleared of extreme or non-numeric entries.
Why researchers use it
Researchers reach for it because it fits the shape of the data. Experiments in these fields are slow and expensive, so a dataset of a few hundred or a few thousand entries gathered from the literature is normal, and that is too little to support a heavy model with many adjustable parts. K-nearest neighbours has almost nothing to fit: the data are the model. It makes no assumption that a property varies smoothly or in a straight line with composition, which suits properties that change sharply at a phase boundary. It is also easy to interrogate, since a prediction can be traced back to the specific known materials that produced it.
In the record
Limits
Its weakness is that similarity in descriptor space need not mean similarity in behaviour. Add more descriptors and everything becomes roughly equidistant, so the nearest neighbours stop being near. Change the scaling or the distance measure and the answer changes. It cannot extrapolate: asked about a composition unlike anything recorded, it still returns the answer of whatever happens to be closest, with no warning. Literature-assembled datasets cluster around well-studied systems, so neighbours may be near-duplicates, which flatters test scores. And filling gaps from neighbours can bake a guess into the data.
Written by AIxSci: the background from general knowledge, the examples from checked records.