how to cross validate the data and use it for ensemble?
Ältere Kommentare anzeigen
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....
1 Kommentar
Greg Heath
am 14 Jul. 2012
Terminology:
Replace: I want to cross validate the train data (10 folds) and then use it to construct an ensemble......
With: I want to partition (or divide)the train data (10 folds) and then use it to construct an ensemble......
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Classification Ensembles finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!