I want to optimize Nonlinear Least Square SVM 's hyper parameters (c,eta,gamma) using Artificial Bee Colony (ABC) Algorithm (downloaded from mathworks website). Please guide me how to pass 3 parameters in cost function to optimize hyper parameters.

3 visualizzazioni (ultimi 30 giorni)
I download ABC algorithm from https://www.mathworks.com/matlabcentral/fileexchange/52966-artificial-bee-colony--abc--in-matlab. Cost function is:
% if true
1 function z = Sphere(x)
2 z = sum(x.^2);
3 end
% end
I write following function but I am not sure it will work.
% if true
1 % diff: Difference between Actual labels/classes of test data
2 % and labels predicted by the Kernel SVM classifier
3 % c: cost penalty
4 % eta: insensitive loss parameter
5 % gamma: value of gamma in kernel fuction of Kernel SVM
6 function w = RegularizedRiskFunction(test,SVM_Mdl, eta, c, gamma)
7 % % % KSVM_3(gamma);
8 SVM_Mdl = loadCompactModel('SVM_Mdl');
9 % Calculating class labels of test data classified
10 load testF17;
11 test = test17;
12 load tp17;
13 tp = tp17;
14 % Predicting test data price
15 P = predict (SVM_Mdl, test);
16 save predictedLabel P;
17 % Calculating KSVM Model and percentage accuracy of classification
18 diff = [];
19 score = 0;
20 for i = 1: size(tf17)
21 diff(i,:) = abs(tp17(i) - P(i));
22 if diff(i,:) < Eta
23 diff(i,:) = 0;
24 score = score + 1;
25 end
26 end
27 save CError diff;
28 diff = yi-y;
29 Eta = e;
30 for i = 1 : size(diff16)
31 if diff16 < Eta
32 diff16 = 0;
33 end
34 s = sum(diff);
35 m = 0.5;
36 D = 3;
37 w = (s + m*(c^2))/D;
38 end
% end
Please guide me, how to pass hyper parameters(optimized by ABC algorithm) to cost function and train svm model after every iteration of ABC algorithm and how to calculate error to pass back to ABC algorithm.

Risposte (0)

Categorie

Scopri di più su Food Sciences in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by