Fixed bug in building training matrix
Fixed bug in building training matrix