Training the model and making predictions