TreeBagger removes elements from the dataset during training process
3 views (last 30 days)
Show older comments
I am using the TreeBagger for classificate my data. I would like to extract some stats about it, like confusion matrix, but I can't due to a mismatch between the training sets.
%That's how I set the TreeBagger:
b = TreeBagger(50, X, y, 'method', 'classification', 'NVarToSample', 10, 'oobpred', 'on', 'MinLeaf', 10);
%output:
b =
Ensemble with 50 bagged decision trees:
Training X: [1801x32]
Training Y: [1801x1]
Method: classification
Nvars: 32
NVarToSample: 10
MinLeaf: 10
FBoot: 1
SampleWithReplacement: 1
ComputeOOBPrediction: 1
ComputeOOBVarImp: 0
Proximity: []
Prune: 0
MergeLeaves: 0
TreeArgs:
ClassNames: '-1' '1'
%Note: y was originally composed by 1834 elements
[y1, scores] = oobPredict(b);
[conf, order] = confusionmat(y, y1)
%ERROR: y1 is just 1801 elements long!
Why does it happens?
0 Comments
Answers (0)
See Also
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!