Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
sani ars
sani ars el 22 de Mayo de 2012
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');

Respuestas (1)

Wayne King
Wayne King el 22 de Mayo de 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'});

Community Treasure Hunt

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

Start Hunting!

Translated by