I am solving a classification problem using Random Forests. For that I have decided to use Python library scikit-learn. But I am new to both Random Forest algorithm and this tool. My data contains many factor variables. I googled for that and found out that it's not right to give numerical values to factor variables like we do in linear regression, as it will treat it as continuous variable and give wrong result. But I could not find anything about how to deal with factor variables in scikit-learn. Please tell me the options to use or point me to some document where I can get it.
It seems that you're comparing
scikit-learn's Random Forest with
randomForest package in
R, where this package deals with categorical variables automatically.
However in scikit-learn you have to preprocess your data yourself. To do this, you could use DictVectorizer class, which would create new binary features for every new value of your original feature.