Added some comments.  Realized that instead of dividing up the data set by subtypes, I can use the entire training set and subtype.weights, will finish coding this up tonight.