Class InstancePostfixExLinkPredictor<U>

java.lang.Object
es.uam.eps.ir.relison.links.linkprediction.AbstractLinkPredictor<U>
es.uam.eps.ir.relison.links.linkprediction.InstancePostfixExLinkPredictor<U>
Type Parameters:
U - type of users
All Implemented Interfaces:
LinkPredictor<U>

public class InstancePostfixExLinkPredictor<U>
extends AbstractLinkPredictor<U>
Given as set of instances, this algorithm predicts the presence or absence of a link, according to a function of the different features. The score for a possible pair of indexes is defined by a postfix expression with the following format: Format of the postfix expression: - If two numbers are next to each other, they must be separated using a dot ("."). - Operations allowed: +,-,*,/
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private java.util.List<org.ranksys.core.util.tuples.Tuple2od<Pair<U>>> results
    List which contains the results of the algorithm link prediction.
  • Constructor Summary

    Constructors 
    Constructor Description
    InstancePostfixExLinkPredictor​(Graph<U> graph, java.util.Comparator<org.ranksys.core.util.tuples.Tuple2od<Pair<U>>> comparator, InstanceSet<U> patterns, java.lang.String postfix)
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    Prediction<U> getPrediction​(int maxLength, java.util.function.Predicate<Pair<U>> filter)
    Given a social network, ranks the possible user-user pairs, according to the scores given by the algorithm.

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

    getComparator, getGraph, getPrediction, getPrediction, getPrediction, getPrediction, getPredictionScore

    Methods inherited from class java.lang.Object

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

    • results

      private final java.util.List<org.ranksys.core.util.tuples.Tuple2od<Pair<U>>> results
      List which contains the results of the algorithm link prediction.
  • Constructor Details

    • InstancePostfixExLinkPredictor

      public InstancePostfixExLinkPredictor​(Graph<U> graph, java.util.Comparator<org.ranksys.core.util.tuples.Tuple2od<Pair<U>>> comparator, InstanceSet<U> patterns, java.lang.String postfix)
      Constructor.
      Parameters:
      graph - The graph.
      patterns - The set of patterns.
      postfix - The postfix notation expression.
      comparator - Comparator for ordering the nodes.
      Throws:
      java.lang.UnsupportedOperationException - if the postfix expression is badly created.
  • Method Details

    • getPrediction

      public Prediction<U> getPrediction​(int maxLength, java.util.function.Predicate<Pair<U>> filter)
      Description copied from interface: LinkPredictor
      Given a social network, ranks the possible user-user pairs, according to the scores given by the algorithm. It only ranks those user pairs which pass a given filter. It returns a limited number of such pairs.
      Specified by:
      getPrediction in interface LinkPredictor<U>
      Specified by:
      getPrediction in class AbstractLinkPredictor<U>
      Parameters:
      maxLength - the maximum size of the link prediction list.
      filter - a filter to indicate which user pairs shall be ranked.
      Returns:
      a sorted list containing the user-user pairs and the link prediction score (in descending score order).