kfoldLoss not found for 2022a
Show older comments
I have tried for both 2020a and 2022a, but getting the same error:
Unrecognized function or variable 'kfoldLoss'.
%hyperparameter tuning for NN - https://uk.mathworks.com/matlabcentral/answers/428298-neural-network-hyperparameter-tuning
YTrain=classEns(resampleInd,:);
XTrain=train_prod_0(resampleInd,:);
% Define a train/validation split to use inside the objective function
cv = cvpartition(numel(YTrain), 'Holdout', 1/3);
% Define hyperparameters to optimize
vars = [optimizableVariable('hiddenLayerSize', [1,20], 'Type', 'integer');
optimizableVariable('lr', [1e-3 1], 'Transform', 'log')];
% Optimize
minfn = @(T)kfoldLoss(XTrain', YTrain', cv, T.hiddenLayerSize, T.lr);
results = bayesopt(minfn, vars,'IsObjectiveDeterministic', false,...
'AcquisitionFunctionName', 'expected-improvement-plus');
errors are shown below:
results = bayesopt(minfn, vars,'IsObjectiveDeterministic', false,...
'AcquisitionFunctionName', 'expected-improvement-plus');
Unrecognized function or variable 'kfoldLoss'.
Error in @(T)kfoldLoss(XTrain',YTrain',cv,T.hiddenLayerSize,T.lr)
Error in BayesianOptimization/callObjNormally (line 2552)
Objective = this.ObjectiveFcn(conditionalizeX(this, X));
Error in BayesianOptimization/callObjFcn (line 487)
= callObjNormally(this, X);
Error in BayesianOptimization/runSerial (line 1914)
ObjectiveFcnObjectiveEvaluationTime, ObjectiveNargout] = callObjFcn(this, this.XNext);
Error in BayesianOptimization/run (line 1856)
this = runSerial(this);
Error in BayesianOptimization (line 459)
this = run(this);
Error in bayesopt (line 323)
Results = BayesianOptimization(Options);
I need to use kfoldLoss but it is not found, please help!
Answers (0)
Categories
Find more on Gaussian Process Regression 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!