필터 지우기
필터 지우기

Decision Tree Cross-Validation Accuracy

조회 수: 2 (최근 30일)
dominix
dominix 2013년 4월 18일
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
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
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'.
  댓글 수: 1
dominix
dominix 2013년 4월 19일
thanks a lot.
any(isempty(genes(1:3000,:)))----- not affected on code (i do not know )
but i used this code and it runs
emptySpots = strcmp('EMPTY',genes);
yeastvalues(emptySpots,:) = [];
genes(emptySpots) = [];
numel(genes)

댓글을 달려면 로그인하십시오.

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by