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

public class AUC<U>
extends java.lang.Object
implements LinkPredictionMetric<U>
Implementation of the area under the receiver-operating characteristic curve for link prediction.
  • Constructor Summary

    Constructors 
    Constructor Description
    AUC()  
  • Method Summary

    Modifier and Type Method Description
    private double computeAUC​(java.util.List<Pair<java.lang.Double>> roc)
    Given a ROC curve, computes its area.
    double evaluate​(Graph<U> graph, Prediction<U> pred)
    Evaluates a link prediction algorithm.
    double evaluate​(Graph<U> graph, Prediction<U> pred, java.util.function.Predicate<Pair<U>> filter)
    Evaluates a link prediction algorithm.
    double evaluate​(Graph<U> graph, Prediction<U> pred, java.util.stream.Stream<Pair<U>> users)
    Evaluates a link prediction algorithm.

    Methods inherited from class java.lang.Object

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

    • AUC

      public AUC()
  • Method Details

    • evaluate

      public double evaluate​(Graph<U> graph, Prediction<U> pred)
      Description copied from interface: LinkPredictionMetric
      Evaluates a link prediction algorithm. It considers that the prediction is applied over all pairs of users in the network.
      Specified by:
      evaluate in interface LinkPredictionMetric<U>
      Parameters:
      graph - a graph containing the set of links to predict.
      pred - the prediction.
      Returns:
      the value of the metric.
    • evaluate

      public double evaluate​(Graph<U> graph, Prediction<U> pred, java.util.function.Predicate<Pair<U>> filter)
      Description copied from interface: LinkPredictionMetric
      Evaluates a link prediction algorithm. It considers that the prediction is only applied for a subset of pairs of users in the network: those who pass a given filter.
      Specified by:
      evaluate in interface LinkPredictionMetric<U>
      Parameters:
      graph - a graph containing the set of links to predict.
      pred - the prediction.
      filter - the filter for the different pairs of users.
      Returns:
      the value of the metric.
    • evaluate

      public double evaluate​(Graph<U> graph, Prediction<U> pred, java.util.stream.Stream<Pair<U>> users)
      Description copied from interface: LinkPredictionMetric
      Evaluates a link prediction algorithm. It considers that we only apply this over a given set of links.
      Specified by:
      evaluate in interface LinkPredictionMetric<U>
      Parameters:
      graph - a graph containing the set of links to predict.
      pred - the prediction.
      users - the set of users to apply the recommendation to.
      Returns:
      the value of the metric.
    • computeAUC

      private double computeAUC​(java.util.List<Pair<java.lang.Double>> roc)
      Given a ROC curve, computes its area.
      Parameters:
      roc - the ROC curve.
      Returns:
      the area under the ROC curve.