I have run this code on mat lab.....
function [store,temp] = LR( X,y )
store=zeros(10,10);
indices = crossvalind('Kfold',y,10);
for i = 1:10
test = (indices == i); train = ~test;
[b,dev,stats] = glmfit(X(train,:),y(train),'binomial','logit');
temp= glmval(b,X(test,:),'logit');
store(:,i)=temp;
end
end
but I'm getting an error Subscripted assignment dimension mismatch. Error in LR (line 8) store(:,i)=temp;
please help
Check the dimension of store(:,i)
and temp
. Maybe you need to transpose the temp
with temp'
or modify store(:,i)
to store(i,:)
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.