Filter löschen
Filter löschen

Decision Tree Cross-Validation Accuracy

2 Ansichten (letzte 30 Tage)
dominix
dominix am 18 Apr. 2013
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 Kommentar
Tanguy
Tanguy am 22 Apr. 2013
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, ...).

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Tanguy
Tanguy am 18 Apr. 2013
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 Kommentar
dominix
dominix am 19 Apr. 2013
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)

Melden Sie sich an, um zu kommentieren.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by