Class RecommenderSelectionMechanism<U extends java.io.Serializable,I extends java.io.Serializable,P>
java.lang.Object
es.uam.eps.ir.relison.diffusion.selections.RecommenderSelectionMechanism<U,I,P>
- Type Parameters:
U
- type of the users.I
- type of the information.P
- type of the parameters.
- All Implemented Interfaces:
SelectionMechanism<U,I,P>
public class RecommenderSelectionMechanism<U extends java.io.Serializable,I extends java.io.Serializable,P> extends java.lang.Object implements SelectionMechanism<U,I,P>
Selects the propagated pieces depending on the recommendations. When the user has to propagate
others information, chooses with some probability the information that has arrived from some users
that have been recommended to him, and with the rest of probability the information that has arrived from
users of the original graph.
-
Field Summary
Fields Modifier and Type Field Description private int
numOwn
Number of own information pieces to propagate for each user and iteration.private int
numPropagate
Number of received information to propagate for each user and iteration.private int
numRepropagate
Number of already propagated information to repropagate for each user and iteration.private EdgeOrientation
orientation
It indicates the neighborhood that sends the information pieces.private double
prob
Probability of choosing information to propagate that comes from recommended users. -
Constructor Summary
Constructors Constructor Description RecommenderSelectionMechanism(int numOwn, int numPropagate, double prob, EdgeOrientation orientation)
Constructor.RecommenderSelectionMechanism(int numOwn, int numPropagate, int numRepr, double prob, EdgeOrientation orientation)
Constructor. -
Method Summary
Modifier and Type Method Description java.util.stream.Stream<U>
getSelectableUsers(Data<U,I,P> data, SimulationState<U,I,P> state, int numIter, java.lang.Long timestamp)
Selects the users which can propagate information during the iteration.Selection
select(UserState<U> user, Data<U,I,P> data, SimulationState<U,I,P> state, int numIter, java.lang.Long timestamp)
Given a user, selects the information pieces that he/she propagates during this iteration.
-
Field Details
-
numOwn
private final int numOwnNumber of own information pieces to propagate for each user and iteration. -
numPropagate
private final int numPropagateNumber of received information to propagate for each user and iteration. -
numRepropagate
private final int numRepropagateNumber of already propagated information to repropagate for each user and iteration. -
prob
private final double probProbability of choosing information to propagate that comes from recommended users. If there are enough pieces, each time a piece of information is selected, with probability prob that piece will come from recommended users, and with probability (1-p) the piece will come from an edge in the training graph. -
orientation
It indicates the neighborhood that sends the information pieces.
-
-
Constructor Details
-
RecommenderSelectionMechanism
public RecommenderSelectionMechanism(int numOwn, int numPropagate, double prob, EdgeOrientation orientation)Constructor.- Parameters:
numOwn
- number of own information pieces to propagate for each user and iteration.numPropagate
- number of received information to propagate for each user and iteration.prob
- probability of chosing information to propagate that comes from recommended users.orientation
- it indicates the neighborhood that sends the information pieces.
-
RecommenderSelectionMechanism
public RecommenderSelectionMechanism(int numOwn, int numPropagate, int numRepr, double prob, EdgeOrientation orientation)Constructor.- Parameters:
numOwn
- number of own information pieces to propagate for each user and iteration.numPropagate
- number of received information to propagate for each user and iteration.numRepr
- number of already propagated pieces to propagate for each user and iteration.prob
- probability of chosing information to propagate that comes from recommended users.orientation
- it indicates the neighborhood that sends the information pieces.
-
-
Method Details
-
select
public Selection select(UserState<U> user, Data<U,I,P> data, SimulationState<U,I,P> state, int numIter, java.lang.Long timestamp)Description copied from interface:SelectionMechanism
Given a user, selects the information pieces that he/she propagates during this iteration.- Specified by:
select
in interfaceSelectionMechanism<U extends java.io.Serializable,I extends java.io.Serializable,P>
- Parameters:
user
- the user to analyze.data
- the complete data.state
- the current state of the simulation.numIter
- the iteration number.timestamp
- the current timestamp.- Returns:
- a selection of information pieces to be propagated.
-
getSelectableUsers
public java.util.stream.Stream<U> getSelectableUsers(Data<U,I,P> data, SimulationState<U,I,P> state, int numIter, java.lang.Long timestamp)Description copied from interface:SelectionMechanism
Selects the users which can propagate information during the iteration.- Specified by:
getSelectableUsers
in interfaceSelectionMechanism<U extends java.io.Serializable,I extends java.io.Serializable,P>
- Parameters:
data
- the complete data.state
- the current state of the simulation.numIter
- iteration number.timestamp
- the current timestamp.- Returns:
- a stream containing the users who can propagate information.
-