How to define fitcensemble matlab function?

조회 수: 6 (최근 30일)
Aksh Kumar
Aksh Kumar 2024년 12월 18일
댓글: Walter Roberson 2024년 12월 19일
I am using following matlab code with latest MATLAB R2024b software
initIdx = 1:incrementSize;
Xinit = trainFeatures(initIdx,:);
Yinit = trainLabels(initIdx);
disp(size(Xinit));
disp(size(Yinit));
% Train initial batch model using fitcensemble
t = templateTree('MaxNumSplits',20); % You can adjust as needed
Mdl = fitcensemble(Xinit, Yinit, ...
'Method', 'Bag', ...
'NumLearningCycles', 100, ...
'Learners', t, ...
'OOBPrediction', 'on');
% Convert to incremental model
IncMdl = incrementalLearner(Mdl);
it is displaying [the following] error
3048 2
3048 1
Error using classreg.learning.FitTemplate/fillIfNeeded (line 734)
OOBPrediction is not a valid parameter name.
Error in classreg.learning.FitTemplate.make (line 140)
temp = fillIfNeeded(temp,type);
^^^^^^^^^^^^^^^^^^^^^^^
Error in fitensemble (line 363)
temp = classreg.learning.FitTemplate.make(method,'nlearn',nlearn,'learners',learners,varargin{:});
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in fitcensemble (line 215)
this = fitensemble(X, Y, Method, NumLearningCycles, Learners, ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mdl = fitcensemble(Xinit, Yinit, ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I request you to please suggest me how to resolve this issue.
  댓글 수: 10
Aksh Kumar
Aksh Kumar 2024년 12월 19일
편집: Aksh Kumar 2024년 12월 19일
I would like to request you to please let me know whether this Incremental Classification is different than what you suggested that There is no way to convert a classification ensemble to incremental learning.
Looking forward for your kind suggestion.
Walter Roberson
Walter Roberson 2024년 12월 19일
TreeBagger() as a function returns a TreeBagger object https://www.mathworks.com/help/stats/treebagger.html
There are no functions to convert TreeBagger objects to incremental learning objects.
The documentation at https://www.mathworks.com/help/stats/incremental-learning-overview.html#mw_b9f908d5-71f7-419a-9f6c-386f264864b9 describes the objects that can be converted to incremental learning.
Notice that TreeBagger() and ClassificationBaggedEnsemble and ClassificationEnsemble and ClassificationPartitionedEnsemble are not on this list.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

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