Factor Variables in Random Forest, XGBoost



Can we use factor variables (Using R to create factor variables from categorical variables) as inputs to algorithms like Random Forest and XGBoost ? Or do we need to convert all levels to dummy variables ?


@asha_vish - Ya we can use factor variable for both Random Forest and Xgboost.

Random Forest - For this R assign automatically as a numeric value to each factor of the variable.

But for Xgboost, we have to convert all the variable to numeric variable because Xgboost only takes the numeric value as inputs to the model.

Hope this helps!