Whenever you gain a mastery level on a term you get one mastery star. They are separate for each vector. Maxing out every vector for a term should give you 9*n stars (n - total number of vectors, 9 - number of mastery levels). Pretty sure that's it.
PS: Math might be a bit off depending on how level 0 works, but that's not important.