Class CreatorIndividualEntropy<U extends java.io.Serializable,I extends java.io.Serializable,F>
java.lang.Object
es.uam.eps.ir.relison.diffusion.metrics.AbstractIndividualSimulationMetric<U,I,F>
es.uam.eps.ir.relison.diffusion.metrics.creator.individual.CreatorIndividualEntropy<U,I,F>
- Type Parameters:
U
- type of the users.I
- type of the information pieces.F
- type of the features.
- All Implemented Interfaces:
IndividualSimulationMetric<U,I,F>
,SimulationMetric<U,I,F>
public class CreatorIndividualEntropy<U extends java.io.Serializable,I extends java.io.Serializable,F> extends AbstractIndividualSimulationMetric<U,I,F>
For each user in the network, this metric computes the entropy over
the users in the network who have created an information piece that has been received by the user. If the user
has not received any information piece from a creator, such creator is given the value zero. Otherwise, it takes
the number of times he has received information from that user.
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<U,java.util.Map<U,java.lang.Double>>
counter
Speed value.private static java.lang.String
ENTROPY
Name fixed value.private boolean
unique
Indicates if a piece of information is considered once (or each time it appears if false).Fields inherited from class es.uam.eps.ir.relison.diffusion.metrics.AbstractIndividualSimulationMetric
data, initialized
-
Constructor Summary
Constructors Constructor Description CreatorIndividualEntropy(boolean unique)
Constructor. -
Method Summary
Modifier and Type Method Description double
calculate()
Calculates the metric for the current state of the simulation.double
calculate(U user)
Calculates the metric value for a single user.void
clear()
Resets the metric.protected void
initialize()
Initializes all the variables needed for computing and updating the values of the metric.void
update(Iteration<U,I,F> iteration)
Updates the different values which are necessary for computing a metric, given the information received by users in an iteration of the simulation.Methods inherited from class es.uam.eps.ir.relison.diffusion.metrics.AbstractIndividualSimulationMetric
calculateIndividuals, getName, initialize, isInitialized
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface es.uam.eps.ir.relison.diffusion.metrics.IndividualSimulationMetric
calculate, calculateIndividuals
Methods inherited from interface es.uam.eps.ir.relison.diffusion.metrics.SimulationMetric
calculate, initialize
-
Field Details
-
ENTROPY
private static final java.lang.String ENTROPYName fixed value.- See Also:
- Constant Field Values
-
counter
private final java.util.Map<U extends java.io.Serializable,java.util.Map<U extends java.io.Serializable,java.lang.Double>> counterSpeed value. -
unique
private final boolean uniqueIndicates if a piece of information is considered once (or each time it appears if false).
-
-
Constructor Details
-
CreatorIndividualEntropy
public CreatorIndividualEntropy(boolean unique)Constructor.- Parameters:
unique
- true if a piece of information is considered once, false if it is considered each time it appears.
-
-
Method Details
-
clear
public void clear()Description copied from interface:SimulationMetric
Resets the metric. -
calculate
public double calculate()Description copied from interface:SimulationMetric
Calculates the metric for the current state of the simulation.- Returns:
- the value of the metric for the current state of the simulation
-
update
Description copied from interface:SimulationMetric
Updates the different values which are necessary for computing a metric, given the information received by users in an iteration of the simulation.- Parameters:
iteration
- the new iteration.
-
initialize
protected void initialize()Description copied from class:AbstractIndividualSimulationMetric
Initializes all the variables needed for computing and updating the values of the metric.- Specified by:
initialize
in classAbstractIndividualSimulationMetric<U extends java.io.Serializable,I extends java.io.Serializable,F>
-
calculate
Description copied from interface:IndividualSimulationMetric
Calculates the metric value for a single user.- Parameters:
user
- the single user.- Returns:
- the value of the metric, NaN if something failed.
-