using row and col to construct training data