Decision tree non-numerical data statistics toolbox
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
It says in the statistics toolbox documentation:Classification trees give responses that are nominal, such as 'true' or 'false'. Regression trees give numeric responses. I am trying to build a decision tree. I am working with numeric (output) and non-numeric data(inputs).I think the classification tree would be more appropriate than the regression tree, or (as the regression tree seems to work just with numeric data). Is it possible to use non-numeric data in order to predict numeric data?And if so, how could I do this with the help of the statistics toolbox?Would Classificationtree.fit be the right choice?
Thank you :)
0 commentaires
Réponse acceptée
Ilya
le 16 Juin 2014
The type of tree you need is defined by the type of output. If your output is numeric ("numeric" here means that you can do greater and less comparisons and compute a meaningful distance between values), regression tree is the right choice.
For either type of tree, you need to convert your inputs to a numeric matrix. Then you can indicate what variables are non-numeric (categorical) using the 'CategoricalPredictors' parameter; if all your variables are categorical, set it to 'all'.
You can convert your non-numeric data to numeric in many ways. One way would be to use the categorical class in MATLAB on each variable in your data, for example:
>> colors = categorical({'g' 'r' 'b'; 'b' 'r' 'g'});
>> numeric_colors = double(colors);
Then use the new numeric variables as columns in the matrix you pass to the fit function.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Classification Trees dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!