Bayesian Optimization? Can't find anything wrong.
Afficher commentaires plus anciens
% I followed example in the first line and don't know how to change it right. Thanks a lot!
clear;clc;
load ionosphere
dataX = X;
dataY = Y;
c = cvpartition(351,'KFold',5);
kernel = optimizableVariable('kernel',{'gaussian','polynomial'},'Type','categorical');
kernelScale = optimizableVariable('kernelScale',[1, 30]);
polyOrder = optimizableVariable('polyOrder',[2, 3],'Type','integer');
vars = [kernel,kernelScale,polyOrder];
fun = @(x)kfoldLoss(fitcsvm(dataX,dataY,'CVPartition',c,'KernelFunction',string(x.kernel),'KernelScale',x.kernelScale,'PolynomialOrder',x.polyOrder));
results = bayesopt(fun,vars,'Verbose',1,'AcquisitionFunctionName','expected-improvement-plus');
%% The output
|====================================================================================================================|
| Iter | Eval | Objective | Objective | BestSoFar | BestSoFar | kernel | kernelScale | polyOrder |
| | result | | runtime | (observed) | (estim.) | | | |
|====================================================================================================================|
| 1 | Best | 0.11966 | 0.067042 | 0.11966 | 0.11966 | polynomial | 7.1654 | 3 |
错误使用 classreg.learning.partition.PartitionedModel/checkFoldArgs (line 327)
Indices of folds must be a vector with numbers between 1 and 0.
出错 classreg.learning.partition.ClassificationPartitionedModel/kfoldLoss (line 310)
[mode,folds,extraArgs] = checkFoldArgs(this,varargin{:});
出错
BO_SVM>@(x)kfoldLoss(fitcsvm(dataX,dataY,'CVPartition',c,'KernelFunction',string(x.kernel),'KernelScale',x.kernelScale,'PolynomialOrder',x.polyOrder))
出错 BayesianOptimization/callObjNormally (line 2553)
Objective = this.ObjectiveFcn(conditionalizeX(this, X));
出错 BayesianOptimization/callObjFcn (line 467)
= callObjNormally(this, X);
出错 BayesianOptimization/runSerial (line 1989)
ObjectiveFcnObjectiveEvaluationTime, ObjectiveNargout] = callObjFcn(this, this.XNext);
出错 BayesianOptimization/run (line 1941)
this = runSerial(this);
出错 BayesianOptimization (line 457)
this = run(this);
出错 bayesopt (line 323)
Results = BayesianOptimization(Options);
出错 BO_SVM (line 13)
results = bayesopt(fun,vars,'Verbose',1,'AcquisitionFunctionName','expected-improvement-plus');
Réponses (0)
Catégories
En savoir plus sur Design of Experiments (DOE) dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!