If a mathematician is presented with a huge series of numbers and asked to organize them, they usually look for patterns. Then mathematicians determine a formula that will give them the numbers they want. For example, a mathematician is given a list of numbers, they then chart all of them out and see that they make a curve. They can then determine a formula for a curve. That classifies the set of numbers from other random numbers in the list.
Temperature determines much of the activity of a star.
You can even figure out how old it is when you know the temperature. Astronomers at Harvard College Observatory came up with the system and applied letters to each class. That list can tell an astronomer how hot the star is. The O s are the hottest with temperatures over 25,000 Kelvin. The cooler stars are at the other end of the list with M stars at less that 3,500 Kelvin.