java.lang.Object
es.uam.eps.ir.relison.links.linkprediction.metrics.AbstractClassificationMetric<U>
es.uam.eps.ir.relison.links.linkprediction.metrics.Accuracy<U>
Type Parameters:
U - type of the users.
All Implemented Interfaces:
LinkPredictionMetric<U>

public class Accuracy<U>
extends AbstractClassificationMetric<U>
Implementation of the accuracy metric for link prediction.
  • Constructor Summary

    Constructors 
    Constructor Description
    Accuracy​(double threshold)
    Constructor.
    Accuracy​(int cutoff)
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    protected double compute​(long size, long truePos, long trueNeg, long falsePos, long falseNeg)
    Computes the actual classification metric.

    Methods inherited from class es.uam.eps.ir.relison.links.linkprediction.metrics.AbstractClassificationMetric

    evaluate, evaluate, evaluate

    Methods inherited from class java.lang.Object

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

    • Accuracy

      public Accuracy​(int cutoff)
      Constructor.
      Parameters:
      cutoff - the number of items in the ranking to consider. If cutoff is smaller or equal than 0, we consider that the links in the ranking are all the seen objects.
    • Accuracy

      public Accuracy​(double threshold)
      Constructor.
      Parameters:
      threshold - the minimum threshold. Pairs given a value greater or equal than the threshold will be considered as if they were positively classified. The rest, as negative.
  • Method Details

    • compute

      protected double compute​(long size, long truePos, long trueNeg, long falsePos, long falseNeg)
      Description copied from class: AbstractClassificationMetric
      Computes the actual classification metric.
      Specified by:
      compute in class AbstractClassificationMetric<U>
      Parameters:
      size - the total number of links to consider.
      truePos - the number of correctly classified positive links.
      trueNeg - the number of correctly classified negative links.
      falsePos - the number of wrongly classified positive links.
      falseNeg - the number of wrongly classified negative links.
      Returns:
      the value of the metric.