function [models] = optimizeSVM(cdata,y)

models=struct;
models.Mdls=[];
models.CriterionValue=[];
VariableDescriptions = hyperparameters('fitcecoc',cdata,y,'SVM');
VariableDescriptions(2).Range=[10^-4, 10^4];
VariableDescriptions(3).Range=[10^-4, 10^4];
VariableDescriptions(5).Range=[2,5];
VariableDescriptions(1).Optimize = true;
VariableDescriptions(2).Optimize = true;
VariableDescriptions(3).Optimize = true;
VariableDescriptions(4).Optimize = true;
VariableDescriptions(5).Optimize = true;
VariableDescriptions(6).Optimize = true;


for i=1:50
    cvp = cvpartition(12,'HoldOut',0.3); 
    
    opts = struct('CVPartition', cvp,'AcquisitionFunctionName','expected-improvement-plus','Optimizer', 'bayesopt', 'ShowPlots', false, 'MaxObjectiveEvaluations', 500);
    
    models(i).Mdls = fitcecoc(cdata,y, 'Learners', 'svm',...
        'OptimizeHyperparameters',VariableDescriptions,'HyperparameterOptimizationOptions',opts);
    [~,models(i).CriterionValue,~] = bestPoint(models(i).Mdls.HyperparameterOptimizationResults);
end
end