-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheasymkl_predict.m
31 lines (30 loc) · 1.2 KB
/
easymkl_predict.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function [pred, score] = easymkl_predict(model, Ks)
%EASYMKL_PREDICT predict labels for unseen test instances [1]
% Input :
% model : EasyMKL model Struct
% .gamma : [Nx1] [double] instance coefficients
% N : number of training examples
% .bias : 1x1 double bias
% .weights : [1xL] [double] kernel weights
% .labels : [NxN] [double] training labes in diagonal format
% Ks : [NxMxL] [double] Set of Kernels
% N : number of testing examples
% M : number of trainins examples
% L : Number of Kernels
% Output :
% pred : [Nx1] [double] predicted labels 1|-1
% score : [Nx1] [double] evaluation function value
% References:
% [1] Fabio Aiolli and Michele Donini
% EasyMKL: a scalable multiple kernel learning algorithm
% Paper @ http://www.math.unipd.it/~mdonini/publications.html
% created 11-04-2018
% last modfied -- -- --
% Okba Bekhelifi, <okba.bekhelif@univ-usto.dz>
% created 11-06-2018
% last modfied -- -- --
% Okba Bekhelifi, <okba.bekhelif@univ-usto.dz>
K = sum_kernels(Ks, model.weights);
score = K * model.labels * model.gamma;
pred = sign(score);
end