필터 지우기
필터 지우기

find optimal hyperparameters in SVM

조회 수: 5 (최근 30일)
khatere darvish
khatere darvish 2020년 11월 1일
댓글: khatere darvish 2020년 11월 2일
Hello
I'm trying to optimize a SVM model for my training data then predict the labels of new data with it. Also I must find SVM with best hyperparameter by using k-fold crossvalidation. TO do so I wrote the following code:
Mdl = fitcsvm(trainingData,labels,'OptimizeHyperparameters','auto',...
'HyperparameterOptimizationOptions',struct('Optimizer','gridsearch','AcquisitionFunctionName',...
'expected-improvement-per-second','MaxObjectiveEvaluation',10,'ShowPlots',false,'Verbose',0));
label = predict(Mdl,testData);
the problem is every time I ran this code and calculated the classification accuracy for test data I got different classification accuracy.
I should mention that when I train SVM without optimizing hyperparameters results are alaways the same. Is this mean every time I have diffierent hyperparameters? How can I solve this and obtain unique classification accuracy?

채택된 답변

Alan Weiss
Alan Weiss 2020년 11월 2일
Read what the bayesopt documentation has to say about your chosen acquisition function: "Acquisition functions whose names include per-second do not yield reproducible results because the optimization depends on the runtime of the objective function. " In other words, choose the 'expected-improvement-plus' or 'expected-improvement' acquisition function for reproducibility.
Alan Weiss
MATLAB mathematical toolbox documentation
  댓글 수: 3
Alan Weiss
Alan Weiss 2020년 11월 2일
The other possibility is to reset the random number stream before each optimization:
rng default % Or any seed you like
Alan Weiss
MATLAB mathematical toolbox documentation
khatere darvish
khatere darvish 2020년 11월 2일
thank you it's working now

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Support Vector Machine Regression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by