1
$\begingroup$

I have developed a RandomForest classification model and I am pretty satisfied with the results on the test set.

Now, my next step is to deploy the model. Before deployment, I want to remove the test set, so the model learns on the whole dataset. It is then going to be used to classify new unseen data.

How can I do this? I have used test_train_split to split the data into train and test, I have defined the random forest model and I have used it to fit(X_train, y_train).

$\endgroup$
1
  • $\begingroup$ Sure, you will retrain the model on the train + test... but how will you then test it again? $\endgroup$ Nov 17, 2022 at 7:34

2 Answers 2

1
$\begingroup$

It is common practice to retrain a final model before deploying. That final model will use the hyperparameters found through cross-validation and be trained on all the data (both train and test). Using all the data will result in the best estimate of the parameters.

There is no additional testing or evaluation of the final model.

$\endgroup$
2
$\begingroup$

You can just do it easily by removing test_train_split step. However, I don't think you should do that. The appearance of the test set is to make sure that your model is generalized enough to predict accurately the unseen data.

If you retrain the model on the whole dataset without splitting, it's basically a different model, not the one that you said you are satisfied with.

How can you ensure that the new model is not overfitting? You have no data to validate it. The only option for you is to deploy it and wait for the unseen data coming in and compare the result later on. It takes time and is not recommended.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.