- split the data into train and test
- fit your imputer based on the train data set (use just fit)
- use the fitted imputer and fill missing value in the training dataset (use transform)
- Train you decision tree based on the training dataset
Now you are done with the training step. start testing a follows
- Use imputer trained in step 2 and transform function to replace missing values in the test dataset
- Use the trained decision tree for test prediction and evaluating the performance of your model on the unseen test dataset