Mercurial > hg > camir-aes2014
comparison toolboxes/distance_learning/mlr/loss/lossHingeDODMKL.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
1 function Xi = lossHingeDODMKL(W, Psi, M, gradient) | |
2 % | |
3 % Xi = lossHingeDODMKL(W, Psi, M, gradient) | |
4 % | |
5 % W: m*m*d matrix of diagonal metrics | |
6 % Psi: m*m*d feature matrix | |
7 % M: the desired margin | |
8 % gradient: if 0, returns the loss value | |
9 % if 1, returns the gradient of the loss WRT W | |
10 | |
11 m = size(W,1); | |
12 | |
13 Xi = max(0, M - sum(sum(sum(W .* Psi)))); | |
14 | |
15 if gradient & Xi > 0 | |
16 Xi = -Psi; | |
17 end | |
18 end |