Decision Tree Cross-Validation Accuracy
2 次查看(过去 30 天)
显示 更早的评论
Hi, this error appear when i run this code "*??? Error using ==> classregtree.test at 145 At least one Y value ('EMPTY') is incompatible with the tree.
Error in ==> DesTr at 17 cost = test(t,'crossvalidate',yeastvalues,genes);*"
i need to compute Decision Tree Cross-Validation Accuracy my code -------------------------------------
load yeastdata.mat
t = classregtree(yeastvalues(1:3000,:),genes(1:3000,:),'names',{'one' 'two' 'three' 'four' 'five' 'six' 'seven'});
view(t)
sfit = eval(t,yeastvalues);
strcmp(sfit,genes);
pct = mean(strcmp(sfit,genes));
[cost,secost,ntnodes,bestlevel]=treetest(t,'crossvalidate',yeastvalues,genes);
1 个评论
Tanguy
2013-4-22
Excuse me, I answered without looking your data...
the answer is very easy. You created your decision tree with the first 3000 data (in yeastvalues and genes).
(t = classregtree(yeastvalues(1:3000,:),genes(1:3000,:),'names',{'one' 'two' 'three' 'four' 'five' 'six' 'seven'});)
But when you use your tree :
[cost,secost,ntnodes,bestlevel]=treetest(t,'crossvalidate',yeastvalues,genes);
you use all the data you have.
If you look at the array "genes", you have :
genes(3001)
ans =
'YOR267C'
This value ('YOR267C') doesn't appear in the first 3000 occurence. So your tree doesn't know this output (and it can't work with it).
When you create your tree, be carreful to do it with all kind of output.
(for information : genes(3002)='YOR269W' isn't in the first 3000, genes(3003)='YOR271C' either, ...).
回答(1 个)
Tanguy
2013-4-18
you have a problem with your variable genes .
classregtree is used like this :
t=classregtree(X,Y,'name',value)
X is your predictor values (you don't seems to have a problem with them size(x) = n*m
In most of cases, Y is a n-long vector of response values.
Y determine the class of n-predictors values.
In your case, a least one value of Y is empty, and doesn't correspond to any class! That's why classregtree can't run.
Check the genes values :
any(isempty(genes(1:3000,:)))
and put a value instead 'empty'.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Genomics and Next Generation Sequencing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!