Transforming data for train and test
in
Machine Learning with Support Vector Machines
/
Splitting the data into train and test and rescaling
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)
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.