Haven't digested all the code, so I'm not sure if it's still necessary, but the reason the relabeling exists is in the event that the training set is down-sampled to exclude some subjects, we want to make sure that the class labels are still in [0,downsampledNumSubjects)