フィルターのクリア

how to define 'Y' in fitensemble function (Matlab 2011a)

1 回表示 (過去 30 日間)
sani ars
sani ars 2012 年 5 月 22 日
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');

回答 (1 件)

Wayne King
Wayne King 2012 年 5 月 22 日
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'});

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by