I wrote these codes,I loaded the dataset(colon attached) and I randomly selected a part of the data for test and a part for train the classifiers and computed the accuracies.
I want to define a for loop to run these lines 4 times and save the results of the runs in an array and then compute the sum of the array and calculate the average of the 4 runs.I don't know how to add the elements of an array and save it to divide by 4 for average.I'm trying to calculate the average of accuracies.
I want to compute the average for Arforest, ADT , Ask seprately.
the classificationa function is defined for apply the 3 classifiers,and allaccuracydata function is defined for computing the accuracy of each classifier.
I added a for loop and then used sum for add the elements of each array(Arforest,ADT,Ask) and divided the sum by 4 to obtain average. Are these codes right for computing the true average of 4 runs of the program?
I'll be very gratefull to have your opinions. Thanks
[rforest, DT , sk ] = classificationa(xtest,xtrain,ytrain);
[Arforest, ADT , Ask] = allaccuracydata(rforest, DT , sk , ytest);