Class ExternalFeatureGlobalGiniComplement<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,P>
es.uam.eps.ir.relison.diffusion.metrics.features.global.AbstractExternalFeatureGlobalSimulationMetric<U,I,F>
es.uam.eps.ir.relison.diffusion.metrics.features.global.ExternalFeatureGlobalGiniComplement<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 ExternalFeatureGlobalGiniComplement<U extends java.io.Serializable,I extends java.io.Serializable,F> extends AbstractExternalFeatureGlobalSimulationMetric<U,I,F>
Metric that computes the complement of the Gini coefficient over the different features unknown to the different
users.
It provides a measure of the balance of the distribution 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 intcountThe number of different features.private static java.lang.StringGLOBALGININame fixed value.private doublesumThe total number of external features that have reached the different users.private booleanuniqueIndicates if a piece of information is considered once (or each time it appears if false).private java.util.Map<F,java.lang.Double>valuesTimes each feature has been received.Fields inherited from class es.uam.eps.ir.relison.diffusion.metrics.AbstractGlobalSimulationMetric
data, initialized -
Constructor Summary
Constructors Constructor Description ExternalFeatureGlobalGiniComplement(java.lang.String feature, boolean userFeat, boolean unique)Constructor. -
Method Summary
Modifier and Type Method Description doublecalculate()Calculates the metric for the current state of the simulation.voidclear()Resets the metric.protected voidinitialize()Initializes all the variables needed for computing and updating the values of the metric.protected voidupdateInfoFeature(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 voidupdateUserFeature(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.global.AbstractExternalFeatureGlobalSimulationMetric
clearOwnFeatures, computeOwnFeatures, computeOwnFeatures, computeOwnInfoFeatures, computeOwnUserFeatures, getOwnFeatures, getOwnFeatures, setOwnFeaturesMethods inherited from class es.uam.eps.ir.relison.diffusion.metrics.features.AbstractFeatureGlobalSimulationMetric
getFeature, update, usesUserFeaturesMethods inherited from class es.uam.eps.ir.relison.diffusion.metrics.AbstractGlobalSimulationMetric
getName, initialize, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
-
values
Times each feature has been received. -
sum
private double sumThe total number of external features that have reached the different users. -
count
private int countThe number of different features. -
unique
private final boolean uniqueIndicates if a piece of information is considered once (or each time it appears if false).
-
-
Constructor Details
-
ExternalFeatureGlobalGiniComplement
public ExternalFeatureGlobalGiniComplement(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:SimulationMetricCalculates 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:AbstractFeatureGlobalSimulationMetricUpdates 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:
updateUserFeaturein classAbstractFeatureGlobalSimulationMetric<U extends java.io.Serializable,I extends java.io.Serializable,F>- Parameters:
iteration- the new iteration.
-
updateInfoFeature
Description copied from class:AbstractFeatureGlobalSimulationMetricUpdates 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:
updateInfoFeaturein 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:SimulationMetricResets the metric. -
initialize
protected void initialize()Description copied from class:AbstractGlobalSimulationMetricInitializes all the variables needed for computing and updating the values of the metric.- Specified by:
initializein classAbstractGlobalSimulationMetric<U extends java.io.Serializable,I extends java.io.Serializable,F>
-