annotate toolboxes/distance_learning/mlr/loss/lossHingeDODMKL.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 function Xi = lossHingeDODMKL(W, Psi, M, gradient)
Daniel@0 2 %
Daniel@0 3 % Xi = lossHingeDODMKL(W, Psi, M, gradient)
Daniel@0 4 %
Daniel@0 5 % W: m*m*d matrix of diagonal metrics
Daniel@0 6 % Psi: m*m*d feature matrix
Daniel@0 7 % M: the desired margin
Daniel@0 8 % gradient: if 0, returns the loss value
Daniel@0 9 % if 1, returns the gradient of the loss WRT W
Daniel@0 10
Daniel@0 11 m = size(W,1);
Daniel@0 12
Daniel@0 13 Xi = max(0, M - sum(sum(sum(W .* Psi))));
Daniel@0 14
Daniel@0 15 if gradient & Xi > 0
Daniel@0 16 Xi = -Psi;
Daniel@0 17 end
Daniel@0 18 end