Transform and fit_transform

I observe we are applying encoder.transform on training and validation set in the lesson notebook.

I believe this is not correct. On training set we should apply only endocer.fit_transfrom and on the validation and test sets we should apply only transform

Now the next question can be what is the difference btw fit_transform and transform. I recently came across an article explaining this very clearly. This small change can go a long way is resolving the overfitting on the test sets.

link - https://towardsdatascience.com/what-and-why-behind-fit-transform-vs-transform-in-scikit-learn-78f915cf96fe

Please do share your thought if u think otherwise.

1 Like