Get best hyperparameters for ionosphere data using fitcecoc & bayesopt. but i am getting error optimizableVariable.

조회 수: 1 (최근 30일)
load ionosphere
box = optimizableVariable('box',[1e-4,1e3],'Type','real','Transform','log');
kern = optimizableVariable('kern',[1e-4,1e3],'Type','real','Transform','log');
vars = [box,kern];
t = templateSVM('Standardize',true,'KernelFunction','gaussian','kernelscale',vars.kern ,'boxconstraint', vars.box);
fun = @(vars)kfoldLoss(fitcecoc(X,Y,'Learners',t,'FitPosterior',true,...
'ClassNames',{'g','b'},...
'Verbose',2,'Kfold',5));
results = bayesopt(fun,vars,'UseParallel',true);
The error coming is shown below:
No appropriate method, property, or field 'kern' for class 'optimizableVariable'.

채택된 답변

Alan Weiss
Alan Weiss 2022년 3월 20일
I do not understand why you are attempting to use fitcecoc with a 2-class model. Try this instead:
load ionosphere
mdl = fitcsvm(X,Y,"OptimizeHyperparameters","auto") % The auto parameters are box and kernel scale
Alan Weiss
MATLAB mathematical toolbox documentation

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Stress and Strain에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by