Brace indexing error using fitcensemble
2 views (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
Vinayak
on 17 Jul 2024
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.
More Answers (0)
See Also
Categories
Find more on Classification Ensembles in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!