fields/astronomy/model families
k-nearest neighbours in astronomy and astrophysics
How astronomers use k-nearest neighbours, a method that answers a question by finding the most similar past cases and reading the answer off them, rather than fitting any equation.
How it is used
Astronomy and astrophysics study objects that cannot be brought into a laboratory: stars, collapsing stellar cores, faint cool bodies drifting between the stars. Almost everything is known indirectly, through light collected in a few wavelength bands or through a brief wobble in a detector. The work is therefore full of sorting tasks. Is this object the cool kind of dwarf star we are hunting, or one of the far more common warmer ones? Does this signal match a collapse that was spinning, or one that was not? K-nearest neighbours answers such questions by storing a library of examples whose answers are known, measuring how close a new case sits to each stored one, and letting the closest few vote.
The library is often built rather than observed. In one study of brown dwarfs, simulated spectra were passed through the response curves of a real telescope's three near-infrared filters to make the positive examples, while catalogue objects and simulated warmer dwarfs supplied the negatives, with colours (differences between bands) used as the coordinates. In another, waveforms from a stellar-collapse simulation code were generated for several equations of state and many rotation rates, sampled around the moment of core bounce and scaled by amplitude, giving a set of labelled shapes a new signal can be compared against.
Why researchers use it
Astronomers reach for k-nearest neighbours when they have a reliable set of labelled examples but no simple formula linking measurements to the answer. The relation between three filter colours and a dwarf's spectral type, or between a waveform's shape and the physics inside a collapsing core, is set by complicated physics with no tidy closed form. The method sidesteps that: it never writes down a rule, it just remembers. That makes it cheap to set up, easy to inspect (one can look at which stored examples drove a decision) and a useful baseline against which more elaborate classifiers must prove themselves. It also suits simulated libraries well, since the examples can be produced in whatever quantity and coverage the physics code allows.
In the record
Limits
The method is only as good as its library. If the stored examples come from simulations, anything the simulation gets wrong is inherited silently, and real observations that fall outside the covered range still get assigned to the nearest stored case rather than flagged as unfamiliar. Distance also depends on the chosen measurements and their scaling: a few colours or a short time window discard most of what was observed. Rare objects, which is often what astronomers want, have few neighbours by definition, so the nearest ones may belong to the common class instead.
Written by AIxSci: the background from general knowledge, the examples from checked records.