Class TRECAveragePrecision<U,​I>

java.lang.Object
es.uam.eps.ir.ranksys.metrics.AbstractRecommendationMetric<U,​I>
es.uam.eps.ir.relison.links.recommendation.metrics.accuracy.TRECAveragePrecision<U,​I>
Type Parameters:
U - type of the users
I - type of the items
All Implemented Interfaces:
es.uam.eps.ir.ranksys.metrics.RecommendationMetric<U,​I>

public class TRECAveragePrecision<U,​I>
extends es.uam.eps.ir.ranksys.metrics.AbstractRecommendationMetric<U,​I>
Average Precision: average of the precision at each recall level.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private int cutoff
    The cutoff of the metric.
    private es.uam.eps.ir.ranksys.metrics.rel.IdealRelevanceModel<U,​I> relModel
    An ideal relevance model.
  • Constructor Summary

    Constructors 
    Constructor Description
    TRECAveragePrecision​(int cutoff, es.uam.eps.ir.ranksys.metrics.rel.IdealRelevanceModel<U,​I> relevanceModel)
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    double evaluate​(es.uam.eps.ir.ranksys.core.Recommendation<U,​I> recommendation)
    Returns a score for the recommendation list.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • relModel

      private final es.uam.eps.ir.ranksys.metrics.rel.IdealRelevanceModel<U,​I> relModel
      An ideal relevance model.
    • cutoff

      private final int cutoff
      The cutoff of the metric.
  • Constructor Details

    • TRECAveragePrecision

      public TRECAveragePrecision​(int cutoff, es.uam.eps.ir.ranksys.metrics.rel.IdealRelevanceModel<U,​I> relevanceModel)
      Constructor.
      Parameters:
      cutoff - cutoff of the metric
      relevanceModel - relevance model
  • Method Details

    • evaluate

      public double evaluate​(es.uam.eps.ir.ranksys.core.Recommendation<U,​I> recommendation)
      Returns a score for the recommendation list.
      Parameters:
      recommendation - recommendation list
      Returns:
      score of the metric to the recommendation