Can anyone please explain me the difference between fit, transform and fit_transform from the scikit learn and in which scenario we should be using them? I’ve been trying from long to understand this but I guess I am not getting it.
Hello @akanksha004
fit(): Use this method when you only need to calculate the parameters based on the training data. This is common when you will be transforming both training and test data separately using the same parameters.
transform(): Use this method to apply the previously calculated parameters to transform new data, such as a test set or new samples.
fit_transform(): Use this method when you want to fit and transform the training data in a single step. This is convenient for data preprocessing steps during the training phase.
Hope this helps!!!
2 Likes
Got it Thankyou