Rewrite classification model, and develop the dataset iteration logic.