Decision Tree Cross-Validation Accuracy
조회 수: 3 (최근 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'.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!