Combining two classifications for ensemble learning in R

ensemble_methods

#1

Hello,

I went through this post on ensemble learning in R and tried to implement something similar in R using

new_predict <- (knn_predict+randomForestPredict)/2 but it is giving an error saying:

I understand that this is because I cannot combine models predicting factors in this way.
How do I then achieve combining the results from KNN and Random Forests in R?
Can someone please help me with this!!


#2

Alternatively, one way for ensembling in classification is to sum up the probability of predictions instead of summing up the classes which are factors. Hope this helps!


#3

If you have multiple outputs already, generated by your KNN and RandomForest, you can average them with something very easy like which is the majority (for each individual / row) or something more advanced like weight each factor with the accuracy of each model.