Last answered:

17 Apr 2022

Posted on:

16 Apr 2022

0

Transforming data for train and test

x_train_transf = enc_i.fit_transform(x_train)
x_test_transf = enc_i.transform(x_test)

Why is one just transform and the other fit_transform?

1 answers ( 0 marked as helpful)
Posted on:

17 Apr 2022

0

We fit our encoder on only the train set and not the entire set to avoid data leaks in our model. After fitting with the train set and transforming it, we then transform the test set.

Submit an answer