I want to cross validate the train data and use it to construct an ensemble ….
Actually, I want to construct an ensemble (by using ''fitensemble'' function) on train data…… and then I have to test that ensemble on test data in order to evaluate the performance of that ensemble…… this is my basic task…. Thats why I have created separate files for train data and test data…
Now keep in mind only train data…
I want to cross validate the train data (10 folds) and then use it to construct an ensemble…… My code is as follows:
data_set = load('iris_train_data.txt');
data = data_set(:,end-1);
y = data_set(:, end); % labels////
cvpart = cvpartition(y,'kfold',10)
Now how to use that cvpart in fitensemble function given below??…. what should I do with it??
ens_cv = fitensemble(data,y,'AdaBoostM2',50,'tree','type','classification')…???? or how to access these folds to construct an ensemble??
I have tried the following:
ens_cv = fitensemble(data,y,'AdaBoostM2',50,'tree','type','classification', 'kfold',10)
but in this case I am unable to use this ensemble on test data as MATLAB 2011a doesn't allow me to do that… I can do only
Loss = kfoldLoss(ens)
But actually I want to compute the loss on test data (that I have in separate text file) and don't know how to pass that test data as kfoldLoss (in Matlab 2011a) doesn't allow this??
So that's why I am using cvpartition function but don't know how to use the cvpart data after partitioning and then use it to construct an ensemble and after that compute the loss of that ensemble on test data ???
plz suggest me….
thanxxx….
Best Answer