Brace indexing error using fitcensemble

1 次查看(过去 30 天)
I am getting strange errors trying to use fitcensemble, so I refered to the manual, and ran the simple following example, which I found on the fitcensemble help page:
load census1994
Mdl1 = fitcensemble(adultdata,'salary')
these two simple lines of code should result in a classification ensemble but instead I get the following error:
Error using classreg.learning.internal.callBuiltinFitEnsemble
Error: File: callBuiltinFitEnsemble.m Line: 191 Column: 41
Brace indexing into the result of a function call is not supported. Assign the result of 'curvature' to a variable first, then brace index into it.
Error in classreg.learning.ensemble.Ensemble/fitBuiltinEnsemble (line 457)
classreg.learning.internal.callBuiltinFitEnsemble(this.Method,...
Error in classreg.learning.classif.ClassificationEnsemble (line 85)
this = fitBuiltinEnsemble(this,nlearn,dataSummary,classSummary);
Error in classreg.learning.FitTemplate/fit (line 292)
[varargout{1:nargout}] = this.MakeFitObject(X,Y,W,this.ModelParams,fitArgs{:});
Error in fitensemble (line 364)
obj = fit(temp,X,Y);
Error in fitcensemble (line 212)
obj = fitensemble(X, Y, Method, NumLearningCycles, Learners, ...
So I feel like the problem is not my code, but instead I wonder if the problem is with some of the recent updates?
I am using version: '24.1.0.2628055 (R2024a) Update 4'
on a 64-bit Windows® platform

采纳的回答

Vinayak
Vinayak 2024-7-17
Hi Yoav,
The error you're encountering with fitcensemble seems to be related to the way MATLAB is handling the internal variable curvature in the callBuiltinFitEnsemble function. This issue might have arisen due to some recent updates or changes in your MATLAB environment.
To resolve this, you can try restoring the default MATLAB path and refreshing the toolbox cache. Running the following commands should help:
>> restoredefaultpath
>> rehash toolboxcache
This should fix the issue. If the problem persists, you might need to contact MathWorks Technical Support.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Classification Ensembles 的更多信息

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by