Which function should I use to classify an input data into one of ten classes in Statistics Toolbox 7.1 (R2010a)?
1 view (last 30 days)
Show older comments
I have an input data that has two categorical values: hobbies, favorite food. Hobbies can take 50 different values and favorite food can take 12 values. The issue is that I am using CLASSREGTREE and the number of values hobbies can take exceeds the upper bound on the maximum number of values categorical values can take, which is 32. Is CLASSREGTREE a right approach or are there other functions in the Statistics Toolbox suitable for this task?
0 Comments
Answers (1)
Maurice Boueri
on 19 Jan 2011
There are two ways to solve this problem:
1) CLASSREGTREE can be used to solve this classification problem because response values are ordinal. Convert the numerical YFIT output from CLASSREGTREE/EVAL to integer by calling ceil(YFIT)). Note that when many levels in the predictor variables, even when the number of levels, L, is less than 32, calling CLASSREGTREE with 'classification' method would be very slow, because it has to go through all 2^(L-1) possibilities.
2) NaiveBayes can be used as follows:
NB=NaiveBayes.fit([hobbies favFoods],ageGroups, 'dist','mvmn');
C= NB.predict(newData);
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!