Measure
public class HitRate extends java.lang.Object implements Measure
Measure
provides a HitRate@k evaluation, which measures whether the occurred interactions lie among the top k recommendations
provided by SocialGraphMiner.recommendInteractions(Context)
. Ties are resolved towards not favoring the
recommendation, so that for example all-zero recommendations are evaluated as failed ones. Since this Measure
is used to assess only one prediction instance at a time, its assessment is either 0 or 1 and needs be aggregated
across multiple interactions using another measure, such as Accumulate
. Since it makes no sense to assess recommendations
between too few nodes (e.g. less than k), the evaluateSend(SocialGraphMiner, Context, Node)
method returns a NaN value
if there are fewer than a preselected
number of predictions.Constructor | Description |
---|---|
HitRate() |
Default constructor for calculating HitRate@3.
|
HitRate(int k) |
Constructor that creates for calculating HitRate@k when there are at least 2k or more recommendations.
|
HitRate(int k,
int requiredCandidates) |
Constructor that creates a HitRate@k evaluation.
|
Modifier and Type | Method | Description |
---|---|---|
double |
evaluateSend(SocialGraphMiner socialGraphMiner,
eu.h2020.helios_social.core.contextualegonetwork.Context context,
eu.h2020.helios_social.core.contextualegonetwork.Node dst) |
Supervised evaluation of interactions sent by each node.
|
lastEvaluation
public HitRate()
HitRate(int)
public HitRate(int k)
k
- The number of top recommendations in which to check that occurring interactions reside.HitRate(int, int)
public HitRate(int k, int requiredCandidates)
k
- The number of top recommendations in which to check that occurring interactions reside.requiredCandidates
- The number of recommendations that need be available for the evaluation to be valid.public double evaluateSend(SocialGraphMiner socialGraphMiner, eu.h2020.helios_social.core.contextualegonetwork.Context context, eu.h2020.helios_social.core.contextualegonetwork.Node dst)
Measure
evaluateSend
in interface Measure
socialGraphMiner
- The social graph miner used to perform the prediction.context
- The context in which new interactions are predicted.dst
- The destination node.