TreeBagger Error function won't run with tables
Show older comments
I want to use TreeBagger to generate several ensembles. One of the things I need to do to use them effectively is to be able to calculate the MSE. I have 17 variables, 2 of which are categorical, thus I generated the ensembles from data in a table. Here comes my problem. As soon as I run Error(tree, table, ynew), I get the following error message:
Error using CompactTreeBagger/predictAccum (line 1340)
Input matrix of predictor values must be numeric.
To double check that it wasn't something in my data I made another table from the fisheriris data, made a tree, and ran that. Still no dice. Using a table for the y data works fine, but anything not a regular table and I can't get error to work. Can anyone tell me what I'm doing wrong? Or offer an alternative way to measure the MSE for TreeBagger ensembles?
Example of commands that give me this error:
load fisheriris
foo = [array2table(meas),array2table(species)];
t = TreeBagger(5,foo(:,1:4),foo.species)
error(t,foo(:,1:4),foo.species);
Answers (0)
Categories
Find more on Classification Ensembles in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!