Mercurial > hg > camir-ismir2012
annotate toolboxes/distance_learning/mlr/metricPsi/metricPsiPO.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 S = metricPsiPO(q, y, n, pos, neg) |
Daniel@0 | 2 % |
Daniel@0 | 3 % S = metricPsiPO(q, y, n, d, pos, neg) |
Daniel@0 | 4 % |
Daniel@0 | 5 % q = index of the query point |
Daniel@0 | 6 % y = the ordering to compute |
Daniel@0 | 7 % n = number of points in the data set |
Daniel@0 | 8 % pos = indices of relevant results for q |
Daniel@0 | 9 % neg = indices of irrelevant results for q |
Daniel@0 | 10 % |
Daniel@0 | 11 % S is the vector of weights for q |
Daniel@0 | 12 |
Daniel@0 | 13 yp = ismember(y, pos); |
Daniel@0 | 14 NumPOS = sum(yp); |
Daniel@0 | 15 PosAfter = NumPOS - cumsum(yp); |
Daniel@0 | 16 |
Daniel@0 | 17 yn = ~yp; |
Daniel@0 | 18 NumNEG = sum(yn); |
Daniel@0 | 19 NegBefore = cumsum(yn) - yn; |
Daniel@0 | 20 |
Daniel@0 | 21 S = zeros(n,1); |
Daniel@0 | 22 |
Daniel@0 | 23 S(y) = 2 * (yp .* NegBefore - yn .* PosAfter) / (NumNEG * NumPOS); |
Daniel@0 | 24 |
Daniel@0 | 25 end |