Training data preparation and model testing