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'});

카테고리

Help CenterFile Exchange에서 Classification Ensembles에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by