I tried the random forest model in my research topic, but I met a problem during the validation phase.
When, I used the final model of random forest to predict on an independent dataset, I received this message:
Type of predictors in new data do not match that of the training data
So, to detect the different categories in my factors/variables, I used:
levels(Train$Aquifer.media) levels(Test$Aquifer.media)
For this factor "Aquifer.media", I have:
Train dataset: "Carbonates rocks" "Crystalline rocks" "Siliciclastic sedimentary rocks" "Unconsolisated sediments rocks" "Volcanic rocks"
Test Dataset: "Crystalline rocks" "Siliciclastic sedimentary rocks" "Unconsolisated sediments rocks" "Volcanic rocks"
I detected that predictors were of different categories, I would like to know, how I can solve this problem?
Is it possible to delete some categories in the factors?