Classification problem parsed as regression problem when Split Criterion is supplied to fitcensemble
Hi
I ran a hyperparameter optimization to find the best parameters for a two-class classification problem using _fitcensemble_. But when I try to use these I get a strange warning:
*Warning: You must pass ‘SplitCriterion’ as a character vector ‘mse’ for regression.*
What is wrong with my code? The warning comes when I use a boosting ensemble as ‘method’. When I remove the ‘SplitCriterion’ everything works fine, but I cannot understand why Matlab somewhere on the line thinks this is a regression problem when I use fit"c"ensemble.
Here is a toy example with arbitrarily chosen settings that you can run to reproduce the Warning/Error.
load carsmall
X = table(Acceleration,Cylinders,Displacement,Horsepower,Mfg,Model_Year,Weight,MPG);
X.Cylinders(X.Cylinders < 8) = 0; % Create two classes in the Cylinders variable
t = templateTree( ‘MaxNumSplits’, 30,…
‘MinLeafSize’, 10,…
‘SplitCriterion’, ‘gdi’);
classificationEnsemble = fitcensemble(X,’Cylinders’,…
‘Method’, ‘LogitBoost’, …
‘NumLearningCycles’,12,…
‘Learners’,t,…
‘KFold’,7,…
‘LearnRate’,0.1);Hi
I ran a hyperparameter optimization to find the best parameters for a two-class classification problem using _fitcensemble_. But when I try to use these I get a strange warning:
*Warning: You must pass ‘SplitCriterion’ as a character vector ‘mse’ for regression.*
What is wrong with my code? The warning comes when I use a boosting ensemble as ‘method’. When I remove the ‘SplitCriterion’ everything works fine, but I cannot understand why Matlab somewhere on the line thinks this is a regression problem when I use fit"c"ensemble.
Here is a toy example with arbitrarily chosen settings that you can run to reproduce the Warning/Error.
load carsmall
X = table(Acceleration,Cylinders,Displacement,Horsepower,Mfg,Model_Year,Weight,MPG);
X.Cylinders(X.Cylinders < 8) = 0; % Create two classes in the Cylinders variable
t = templateTree( ‘MaxNumSplits’, 30,…
‘MinLeafSize’, 10,…
‘SplitCriterion’, ‘gdi’);
classificationEnsemble = fitcensemble(X,’Cylinders’,…
‘Method’, ‘LogitBoost’, …
‘NumLearningCycles’,12,…
‘Learners’,t,…
‘KFold’,7,…
‘LearnRate’,0.1); Hi
I ran a hyperparameter optimization to find the best parameters for a two-class classification problem using _fitcensemble_. But when I try to use these I get a strange warning:
*Warning: You must pass ‘SplitCriterion’ as a character vector ‘mse’ for regression.*
What is wrong with my code? The warning comes when I use a boosting ensemble as ‘method’. When I remove the ‘SplitCriterion’ everything works fine, but I cannot understand why Matlab somewhere on the line thinks this is a regression problem when I use fit"c"ensemble.
Here is a toy example with arbitrarily chosen settings that you can run to reproduce the Warning/Error.
load carsmall
X = table(Acceleration,Cylinders,Displacement,Horsepower,Mfg,Model_Year,Weight,MPG);
X.Cylinders(X.Cylinders < 8) = 0; % Create two classes in the Cylinders variable
t = templateTree( ‘MaxNumSplits’, 30,…
‘MinLeafSize’, 10,…
‘SplitCriterion’, ‘gdi’);
classificationEnsemble = fitcensemble(X,’Cylinders’,…
‘Method’, ‘LogitBoost’, …
‘NumLearningCycles’,12,…
‘Learners’,t,…
‘KFold’,7,…
‘LearnRate’,0.1); fitcensemble, split criterion, classification, regression, hyperparameter, optimization, boost, templatetree MATLAB Answers — New Questions