-
Notifications
You must be signed in to change notification settings - Fork 0
Interpolation
Wok edited this page Jul 13, 2019
·
1 revision
var e = se.m_fRecencyValue * (O.NUM_RECENCY_STEPS - 1 - .001),
t = Math.floor(e),
a = t + 1,
r = 1 - (e - t),
n = 1 - r,
o = se.m_fPopularityValue * (O.NUM_POPULARITY_STEPS - 1 - .001),
i = Math.floor(o),
c = i + 1,
l = 1 - (o - i),
s = 1 - l,
u = [];
u.push({ index: i * O.NUM_RECENCY_STEPS + t, weight: l * r }),
u.push({ index: c * O.NUM_RECENCY_STEPS + t, weight: s * r }),
u.push({ index: i * O.NUM_RECENCY_STEPS + a, weight: l * n }),
u.push({ index: c * O.NUM_RECENCY_STEPS + a, weight: s * n });
for (var _ = new Map, p = 0, d = 0, h = u; d < h.length; d++) {
var m = h[d],
E = N[m.index]; if (p = Math.max(p, E.score_scale), E)
for (var v = 0; v < E.app_ids.length; v++) {
var b = E.app_ids[v]; if (D[b] && !D[b].o && !D[b].i) {
var g = (_.get(b) || 0) + E.scores[v] * m.weight * E.score_scale;
_.set(b, g)
}
}
}
_.forEach(function(e, t) { return _.set(t, e / p) }); var f = [];
_.forEach(function(e, t) { return f.push({ appid: t, score: e }) }),
Reference: javascript code archived here.