When to use fit, transform and fit_transform ?

`fit()`

is used to `"train model"`

- it means to calculate parameters for transformation.

Only after training model you can `transform()`

data.

If you want then you can do both things in one step using `fit_transform()`

So all depends on you if you need `fit()`

+ `other calculations`

+ `transform()`

or at once` fit_transform()`

Stackoverflow: what is the difference between ‘transform’ and ‘fit_transform’ in sklearn

Data Science: What’s the difference between fit and fit_transform in scikit-learn models?

1 Like