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

public class F1Score<U>
extends AbstractClassificationMetric<U>
Implementation of the F1 score metric for link prediction.
  • Constructor Summary

    Constructors 
    Constructor Description
    F1Score​(double threshold)
    Constructor.
    F1Score​(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

    • F1Score

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

      public F1Score​(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.