Class FeatureGlobalEntropy<U extends java.io.Serializable,I extends java.io.Serializable,F>
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,F>
es.uam.eps.ir.relison.diffusion.metrics.features.global.FeatureGlobalEntropy<U,I,F>
- Type Parameters:
U
- type of the users.I
- type of the information pieces.F
- type of the user / information pieces features.
- All Implemented Interfaces:
GlobalSimulationMetric<U,I,F>
,SimulationMetric<U,I,F>
public class FeatureGlobalEntropy<U extends java.io.Serializable,I extends java.io.Serializable,F> extends AbstractFeatureGlobalSimulationMetric<U,I,F>
Metric that computes the entropy over the number of times each feature has been received.
If we use information pieces features (i.e. hashtags) the (user, feature) value counts the number of times
that the user has received information pieces using that feature. In case we use user features, it is just
how many times the user has received information from users with that feature.
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
ENTROPY
Name fixed valueprivate double
sum
The total number of features that have reached the different users.private boolean
unique
Indicates if a piece of information is considered once (or each time it appears if false).private java.util.Map<F,java.lang.Double>
values
Times each parameter has been received.Fields inherited from class es.uam.eps.ir.relison.diffusion.metrics.AbstractGlobalSimulationMetric
data, initialized
-
Constructor Summary
Constructors Constructor Description FeatureGlobalEntropy(java.lang.String feature, boolean userFeat, boolean unique)
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,F> 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,F> 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
-
ENTROPY
private static final java.lang.String ENTROPYName fixed value- See Also:
- Constant Field Values
-
values
Times each parameter has been received. -
sum
private double sumThe total number of features that have reached the different users. -
unique
private final boolean uniqueIndicates if a piece of information is considered once (or each time it appears if false).
-
-
Constructor Details
-
FeatureGlobalEntropy
public FeatureGlobalEntropy(java.lang.String feature, boolean userFeat, boolean unique)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.unique
- true if a piece of information is considered once, false if it is considered each time it appears.
-
-
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,F>
- 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,F>
- 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,F>
-