A yarn's recommended needle size is related to the diameter of the yarn. Fingering or sock weight yarn will call for about a 2 or 3 needle. Worsted weight will call for about an 8 or 9. The skinnier the yarn, the smaller the recommended needle size. It gives you an idea of the gauge to expect, but..... YMMV.
My advance in understanding metrics in relation to yarn amounts: A 50 gr. ball of yarn makes 1 sock, a 100 gr. ball makes a pair.