Class ExternalFeatureIndividualGiniComplement<U extends java.io.Serializable,I extends java.io.Serializable,F>
java.lang.Object
es.uam.eps.ir.relison.diffusion.metrics.AbstractIndividualSimulationMetric<U,I,P>
es.uam.eps.ir.relison.diffusion.metrics.features.AbstractFeatureIndividualSimulationMetric<U,I,P>
es.uam.eps.ir.relison.diffusion.metrics.features.indiv.AbstractExternalFeatureIndividualSimulationMetric<U,I,F>
es.uam.eps.ir.relison.diffusion.metrics.features.indiv.ExternalFeatureIndividualGiniComplement<U,I,F>
- Type Parameters:
- U- type of the user.
- I- type of the information.
- F- type of the features.
- All Implemented Interfaces:
- IndividualSimulationMetric<U,I,F>,- SimulationMetric<U,I,F>
public class ExternalFeatureIndividualGiniComplement<U extends java.io.Serializable,I extends java.io.Serializable,F> extends AbstractExternalFeatureIndividualSimulationMetric<U,I,F>
Computes the complement of the Gini coefficient over the distribution of the features that the user
 does not already know.
 We differ two cases:
 a) User parameters: (Ex.: Communities) In this case, we take the values of the parameter
 for the creators of the received information pieces. 
 
 b) Information parameters: (Ex: hashtags) In this case, we take the values of the parameters
 for the different information pieces which are received and observed by each individual user.
- 
Field SummaryFields Modifier and Type Field Description private java.util.Map<U,java.lang.Integer>countThe number of different values for the feature.private java.util.Map<U,it.unimi.dsi.fastutil.doubles.Double2IntMap>featCounterFor each user, registers the number of features with a certain frequency of appearance.private static java.lang.StringGININame fixed value.private java.util.Map<F,java.util.Map<U,java.lang.Double>>indivFeatCounterFor each user, registers the number of times each feature value has been received.private java.util.Map<U,java.lang.Double>sumFor each user, this map register the total number of times each user it has received a feature value.private booleanuniqueIndicates 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.AbstractIndividualSimulationMetricdata, initialized
- 
Constructor SummaryConstructors Constructor Description ExternalFeatureIndividualGiniComplement(java.lang.String feature, boolean userFeat, boolean unique)Constructor.
- 
Method SummaryModifier and Type Method Description doublecalculate()Calculates the metric for the current state of the simulation.doublecalculate(U user)Calculates the metric value for a single user.voidclear()Resets the metric.protected voidinitialize()Initializes all the variables needed for computing and updating the values of the metric.protected voidupdateInfoFeatures(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.private voidupdateMap(U u, java.util.Map<F,java.lang.Double> aux)Internal function for updating the individual and counter maps.protected voidupdateUserFeatures(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.indiv.AbstractExternalFeatureIndividualSimulationMetricclearOwnFeatures, computeOwnFeatures, computeOwnFeatures, computeOwnInfoFeatures, computeOwnUserFeatures, getOwnFeats, getOwnFeats, setOwnFeaturesMethods inherited from class es.uam.eps.ir.relison.diffusion.metrics.features.AbstractFeatureIndividualSimulationMetricgetParameter, update, usesUserParamMethods inherited from class es.uam.eps.ir.relison.diffusion.metrics.AbstractIndividualSimulationMetriccalculateIndividuals, getName, initialize, isInitializedMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface es.uam.eps.ir.relison.diffusion.metrics.IndividualSimulationMetriccalculate, calculateIndividualsMethods inherited from interface es.uam.eps.ir.relison.diffusion.metrics.SimulationMetriccalculate, initialize
- 
Field Details- 
GINIprivate static final java.lang.String GININame fixed value.- See Also:
- Constant Field Values
 
- 
sumFor each user, this map register the total number of times each user it has received a feature value. Ex: f there are four possible parameter values, A, B, C and D, and, for user u, value A has been received thrice (1 in iteration 1, 2 in iteration 3) , value B has been received once (in iteration 2), value C has not been received, and value D has been received five times (3 in iteration 2 and 2 in iteration 4), the value of this map for user u will be equal to 3+1+0+5=9.
- 
featCounterprivate final java.util.Map<U extends java.io.Serializable,it.unimi.dsi.fastutil.doubles.Double2IntMap> featCounterFor each user, registers the number of features with a certain frequency of appearance. Ex: if value A appears 3.0 times, value B appears 3.0 times, and value C appears twice, the map contains pairs (3.0,2) and (2.0,1).
- 
indivFeatCounterprivate final java.util.Map<F,java.util.Map<U extends java.io.Serializable,java.lang.Double>> indivFeatCounterFor each user, registers the number of times each feature value has been received. Ex: If there are four possible parameter values, A, B, C and D, and, for user u, value A has been received thrice (1 in iteration 1, 2 in iteration 3) , value B has been received once (in iteration 2), value C has not been received, and value D has been received five times (3 in iteration 2 and 2 in iteration 4), the map for user u will contain pairs (A,3),(B,1),(C,0),(D,5).
- 
countThe number of different values for the feature.
- 
uniqueprivate final boolean uniqueIndicates if a piece of information is considered once (or each time it appears if false).
 
- 
- 
Constructor Details- 
ExternalFeatureIndividualGiniComplementpublic ExternalFeatureIndividualGiniComplement(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- 
calculatepublic 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
 
- 
updateUserFeaturesDescription copied from class:AbstractFeatureIndividualSimulationMetricUpdates 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:
- updateUserFeaturesin class- AbstractFeatureIndividualSimulationMetric<U extends java.io.Serializable,I extends java.io.Serializable,F>
- Parameters:
- iteration- the new iteration.
 
- 
updateInfoFeaturesDescription copied from class:AbstractFeatureIndividualSimulationMetricUpdates 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:
- updateInfoFeaturesin class- AbstractFeatureIndividualSimulationMetric<U extends java.io.Serializable,I extends java.io.Serializable,F>
- Parameters:
- iteration- the new iteration.
 
- 
updateMapInternal function for updating the individual and counter maps.- Parameters:
- u- the user.
- aux- an auxiliary map containing the new increments of several parameters for user u.
 
- 
calculateDescription copied from interface:IndividualSimulationMetricCalculates the metric value for a single user.- Parameters:
- user- the single user.
- Returns:
- the value of the metric, NaN if something failed.
 
- 
clearpublic void clear()Description copied from interface:SimulationMetricResets the metric.
- 
initializeprotected void initialize()Description copied from class:AbstractIndividualSimulationMetricInitializes all the variables needed for computing and updating the values of the metric.- Specified by:
- initializein class- AbstractIndividualSimulationMetric<U extends java.io.Serializable,I extends java.io.Serializable,F>
 
 
-