how to define 'Y' in fitensemble function (Matlab 2011a)
1 view (last 30 days)
Show older comments
how we can write Y (parameter of fitensemble function in Matlab 2011a)...
ens = fitensemble(X,Y,'AdaBoostM1',50,'tree');
I have tried to define it buit prompt the error as:
??? Error using ==> ClassLabel>ClassLabel.ClassLabel at 28 You must pass class labels as a vector.
Error in ==> FullClassificationModel>FullClassificationModel.prepareData at 133 allClassNames = levels(classreg.learning.internal.ClassLabel(Y));
Error in ==> FitTemplate>FitTemplate.fit at 167 [X,Y,dataPrepOut{1:this.NDataPrepOut}] = ...
Error in ==> fitensemble at 274 obj = fit(temp,X,Y);
Error in ==> ada_boost_ex1 at 12 ens1 = fitensemble(data,y,'AdaBoostM1',50,'tree');
0 Comments
Answers (1)
Wayne King
on 22 May 2012
If you are doing classification as you are with 'AdaBoostM', then Y should be a categorical variable, character array, or cell array of strings.
So say you have two classes, sick and healthy. Your Y might look like this for 10 measurements.
Y = {'S','S','H','S','H','H','H','S','H','S'};
or
Y = nominal({'S','S','H','S','H','H','H','S','H','S'});
0 Comments
See Also
Categories
Find more on Classification Ensembles in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!