The machine learning models were trained on the preprocessed user data using various techniques, such as cross-validation and hyperparameter tuning, to optimize their performance. Evaluation metrics, such as precision, recall, and F1-score, were employed to assess the models' accuracy and ensure high-quality recommendations.