Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

about the categorical feature #49

Open
GoogleCodeExporter opened this issue Mar 7, 2016 · 6 comments
Open

about the categorical feature #49

GoogleCodeExporter opened this issue Mar 7, 2016 · 6 comments

Comments

@GoogleCodeExporter
Copy link

hi,abhirana .
Thanks for your nice code.
I am not sure how you treat categorical features.I mean if there exist some 
categorical features in my dataset, how could I transfer them into numerical 
ones that can use your package.
Kindly guide me, please.

Original issue reported on code.google.com by zhangleu...@gmail.com on 16 Nov 2012 at 6:27

@GoogleCodeExporter
Copy link
Author

just convert all categories to unique classes so say you have {'yes', 
'no','maybe'} those will have numeric values 0,1,2 respectively. You can then 
specify that particular feature to be a categorical feature or a numeric 
feature. 

look at the categorical test code example
http://code.google.com/p/randomforest-matlab/source/browse/trunk/RF_Class_C/tuto
rial_ClassRF.m#256

you will have to use the svn source to get the categorical data working maybe.

Original comment by abhirana on 16 Nov 2012 at 7:17

@GoogleCodeExporter
Copy link
Author

Thank you for your reply.
Could I understand it as following:
There weill be a vector(extra_options.categorical_feature ) indicate that which 
feature is categorial one,if I convert the categorial featur(which is the third 
feature in the original feature space)into numerical feature, then the third 
entry of 'extra_options.categorical_feature ' will be 1 and the rest be zero?

Original comment by zhangleu...@gmail.com on 16 Nov 2012 at 7:21

@GoogleCodeExporter
Copy link
Author

yup, exactly, the extra_options.categorical_feature is of size 1xD and if the 
corresponding vector value is 0 then its numerical and if its 1 then its 
categorical

Original comment by abhirana on 16 Nov 2012 at 7:39

@GoogleCodeExporter
Copy link
Author

yeah, I still want to know how random Forest handle this categorial 
attributes.What is the difference between the categorial feature and 
non-categorial features?
Could you provide some details here? 
Thanks.

Original comment by zhangleu...@gmail.com on 16 Nov 2012 at 8:07

@GoogleCodeExporter
Copy link
Author

as RFs are based on the CART algorithm, you can look into how CART 
distinguishes between categorical and non-categorical features.

Original comment by abhirana on 16 Nov 2012 at 8:33

@GoogleCodeExporter
Copy link
Author

Ok.Thanks.

Original comment by zhangleu...@gmail.com on 16 Nov 2012 at 10:06

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant