I wrote this program to classify the dataset(colon) and compute the accuracy of the classifier, I wanted to repeat the classification 10 times and save the results in an array(Arforest)and then compute the average of these results(averf) but when I test size(Arforest) the size of the result is 1 so any array isn't shaped.
clc;clear;close all;ticload colon.mat data=colon; [n,m]=size(data);rows=(1:n);test_count=floor((0.2)*n);sum_ens=0;sum_result=0;it=10;for k=1:ittest_rows=randsample(rows,test_count);train_rows=setdiff(rows,test_rows);test=data(test_rows,:);train=data(train_rows,:);xtest=test(:,1:m-1);ytest=test(:,m);xtrain=train(:,1:m-1);ytrain=train(:,m);[rforest, DT , sk ] = classificationa(xtest,xtrain,ytrain);[Arforest, ADT , Ask] = allaccuracydata(rforest, DT , sk , ytest);endaverf=mean(Arforest);avedt=mean(ADT);avesk=mean(Ask);
Arforest is the result of Random Forest classifier,
when I use the counter (k) an error shows:
it=10;for k=1:it[rforest, DT , sk ] = classificationa(xtest,xtrain,ytrain);[Arforest(k), ADT(k) , Ask(k)] = allaccuracydata(rforest(k), DT(k) , sk(k) , ytest);endaverf=mean(Arforest);avedt=mean(ADT);avesk=mean(Ask);
the error is:
Error: File: myFSmethod20.m Line: 157 Column: 19An array for multiple LHS assignment cannot contain expressions.
I'll be gratefull to have your opinions to obtain true result.Thanks
Best Answer