www.gusucode.com > stats 源码程序 matlab案例代码 > stats/OptimizeAnSVMClassifierExample.m

    %% Optimize SVM Classifier
% This example shows how to optimize hyperparameters automatically using
% |fitcsvm|. The example uses the |ionosphere| data.
%
% Load the data.
load ionosphere

%%
% Find hyperparameters that minimize five-fold cross-validation loss by
% using automatic hyperparameter optimization.
%
% For reproducibility, set the random seed and use the
% |'expected-improvement-plus'| acquisition function.
rng default
Mdl = fitcsvm(X,Y,'OptimizeHyperparameters','auto',...
    'HyperparameterOptimizationOptions',struct('AcquisitionFunctionName',...
    'expected-improvement-plus'))