Class RecommendationLinkPredictor<U>
java.lang.Object
es.uam.eps.ir.relison.links.linkprediction.AbstractLinkPredictor<U>
es.uam.eps.ir.relison.links.linkprediction.RecommendationLinkPredictor<U>
- Type Parameters:
U
- type of the users.
- All Implemented Interfaces:
LinkPredictor<U>
public class RecommendationLinkPredictor<U> extends AbstractLinkPredictor<U>
Link prediction algorithm based on a contact recommendation algorithm.
-
Field Summary
Fields Modifier and Type Field Description private es.uam.eps.ir.ranksys.rec.Recommender<U,U>
recommender
The original contact recommendation algorithm. -
Constructor Summary
Constructors Constructor Description RecommendationLinkPredictor(Graph<U> graph, es.uam.eps.ir.ranksys.rec.Recommender<U,U> recommender)
Constructor.RecommendationLinkPredictor(Graph<U> graph, java.util.Comparator<org.ranksys.core.util.tuples.Tuple2od<Pair<U>>> comparator, es.uam.eps.ir.ranksys.rec.Recommender<U,U> recommender)
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
-
Field Details
-
recommender
The original contact recommendation algorithm.
-
-
Constructor Details
-
RecommendationLinkPredictor
public RecommendationLinkPredictor(Graph<U> graph, java.util.Comparator<org.ranksys.core.util.tuples.Tuple2od<Pair<U>>> comparator, es.uam.eps.ir.ranksys.rec.Recommender<U,U> recommender)Constructor.- Parameters:
graph
- the social network graph.comparator
- the comparator for sorting the pairs.recommender
- the original contact recommendation algorithm.
-
RecommendationLinkPredictor
public RecommendationLinkPredictor(Graph<U> graph, es.uam.eps.ir.ranksys.rec.Recommender<U,U> recommender)Constructor.- Parameters:
graph
- the social network graph.recommender
- the original contact recommendation algorithm.
-
-
Method Details
-
getPrediction
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 interfaceLinkPredictor<U>
- Specified by:
getPrediction
in classAbstractLinkPredictor<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).
-