Class FeatureGlobalUserEntropy<U extends java.io.Serializable,I extends java.io.Serializable,P>
java.lang.Object
es.uam.eps.ir.relison.diffusion.metrics.AbstractGlobalSimulationMetric<U,I,F>
es.uam.eps.ir.relison.diffusion.metrics.features.AbstractFeatureGlobalSimulationMetric<U,I,P>
es.uam.eps.ir.relison.diffusion.metrics.features.global.FeatureGlobalUserEntropy<U,I,P>
- Type Parameters:
U
- type of the user.I
- type of the information.P
- type of the parameters.
- All Implemented Interfaces:
GlobalSimulationMetric<U,I,P>
,SimulationMetric<U,I,P>
public class FeatureGlobalUserEntropy<U extends java.io.Serializable,I extends java.io.Serializable,P> extends AbstractFeatureGlobalSimulationMetric<U,I,P>
Computes the entropy over the different features. For each feature value, it counts the
number of (different) users who have received the feature.
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
GLOBALGINI
Name fixed value.private Relation<java.lang.Integer>
relation
Times each parameter has been received.private double
sum
The number of different (user, feature) pairs.Fields inherited from class es.uam.eps.ir.relison.diffusion.metrics.AbstractGlobalSimulationMetric
data, initialized
-
Constructor Summary
Constructors Constructor Description FeatureGlobalUserEntropy(java.lang.String feature, boolean userFeat)
Constructor. -
Method Summary
Modifier and Type Method Description double
calculate()
Calculates the metric for the current state of the simulation.void
clear()
Resets the metric.protected void
initialize()
Initializes all the variables needed for computing and updating the values of the metric.protected void
updateInfoFeature(Iteration<U,I,P> iteration)
Updates the necessary variables to compute a metric, in case the feature values we are using belong to the information pieces received by the users in the network.protected void
updateUserFeature(Iteration<U,I,P> iteration)
Updates the necessary variables to compute a metric, in case the feature values we are using belongs to the creators of the information pieces received by the users in the network.Methods inherited from class es.uam.eps.ir.relison.diffusion.metrics.features.AbstractFeatureGlobalSimulationMetric
getFeature, update, usesUserFeatures
Methods inherited from class es.uam.eps.ir.relison.diffusion.metrics.AbstractGlobalSimulationMetric
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.SimulationMetric
calculate, initialize
-
Field Details
-
GLOBALGINI
private static final java.lang.String GLOBALGININame fixed value.- See Also:
- Constant Field Values
-
relation
Times each parameter has been received. -
sum
private double sumThe number of different (user, feature) pairs.
-
-
Constructor Details
-
FeatureGlobalUserEntropy
public FeatureGlobalUserEntropy(java.lang.String feature, boolean userFeat)Constructor.- Parameters:
userFeat
- true if we are using a user feature, false if we are using an information piece feature.feature
- the name of the feature.
-
-
Method Details
-
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
-
updateUserFeature
Description copied from class:AbstractFeatureGlobalSimulationMetric
Updates the necessary variables to compute a metric, in case the feature values we are using belongs to the creators of the information pieces received by the users in the network.- Specified by:
updateUserFeature
in classAbstractFeatureGlobalSimulationMetric<U extends java.io.Serializable,I extends java.io.Serializable,P>
- Parameters:
iteration
- the new iteration.
-
updateInfoFeature
Description copied from class:AbstractFeatureGlobalSimulationMetric
Updates the necessary variables to compute a metric, in case the feature values we are using belong to the information pieces received by the users in the network.- Specified by:
updateInfoFeature
in classAbstractFeatureGlobalSimulationMetric<U extends java.io.Serializable,I extends java.io.Serializable,P>
- Parameters:
iteration
- the new iteration.
-
clear
public void clear()Description copied from interface:SimulationMetric
Resets the metric. -
initialize
protected void initialize()Description copied from class:AbstractGlobalSimulationMetric
Initializes all the variables needed for computing and updating the values of the metric.- Specified by:
initialize
in classAbstractGlobalSimulationMetric<U extends java.io.Serializable,I extends java.io.Serializable,P>
-