Class ExternalFeatureIndividualRate<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.ExternalFeatureIndividualRate<U,I,F>
- Type Parameters:
U- type of the users of the network.I- type of the information.F- type of the features.
- All Implemented Interfaces:
IndividualSimulationMetric<U,I,F>,SimulationMetric<U,I,F>
public class ExternalFeatureIndividualRate<U extends java.io.Serializable,I extends java.io.Serializable,F> extends AbstractExternalFeatureIndividualSimulationMetric<U,I,F>
Computes the proportion of features that reach a user and are unknown to him/her.
In terms of knowledge, we consider that a user does not know about a feature if:
- User feature: The user does not have that feature. For example, if the user belongs to community 1, the rest of communities will be considered as unknown for him
- Information piece feature: there is no piece of information published by the user which contains that feature. For example, if user u has three tweets, containing respectively hashtag sets {sports, football}, {ir} and {ff,followfriday}, hashtag basketball will be unknown to the user, and hashtag football will be known to him
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<U,java.lang.Double>externalFeatsStores the number of external features received.private static java.lang.StringEXTPARAMRATEName fixed value.private java.util.Map<U,java.lang.Double>totalFeatsStores the total number of external features received.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.AbstractIndividualSimulationMetric
data, initialized -
Constructor Summary
Constructors Constructor Description ExternalFeatureIndividualRate(java.lang.String features, boolean userFeats, boolean unique)Constructor. -
Method Summary
Modifier 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 values for computing the metric (when using information pieces features).protected voidupdateUserFeatures(Iteration<U,I,F> iteration)Updates the necessary values for computing the metric (when using user features).Methods inherited from class es.uam.eps.ir.relison.diffusion.metrics.features.indiv.AbstractExternalFeatureIndividualSimulationMetric
clearOwnFeatures, computeOwnFeatures, computeOwnFeatures, computeOwnInfoFeatures, computeOwnUserFeatures, getOwnFeats, getOwnFeats, setOwnFeaturesMethods inherited from class es.uam.eps.ir.relison.diffusion.metrics.features.AbstractFeatureIndividualSimulationMetric
getParameter, update, usesUserParamMethods inherited from class es.uam.eps.ir.relison.diffusion.metrics.AbstractIndividualSimulationMetric
calculateIndividuals, 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.IndividualSimulationMetric
calculate, calculateIndividualsMethods inherited from interface es.uam.eps.ir.relison.diffusion.metrics.SimulationMetric
calculate, initialize
-
Field Details
-
EXTPARAMRATE
private static final java.lang.String EXTPARAMRATEName fixed value.- See Also:
- Constant Field Values
-
externalFeats
Stores the number of external features received. -
totalFeats
Stores the total number of external features received. -
unique
private final boolean uniqueIndicates if a piece of information is considered once (or each time it appears if false).
-
-
Constructor Details
-
ExternalFeatureIndividualRate
public ExternalFeatureIndividualRate(java.lang.String features, boolean userFeats, boolean unique)Constructor.- Parameters:
userFeats- true if we are using a user features, false if we are using an information piece features.features- the name of the features.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:SimulationMetricResets the metric. -
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
-
updateUserFeatures
Updates the necessary values for computing the metric (when using user features).- Specified by:
updateUserFeaturesin classAbstractFeatureIndividualSimulationMetric<U extends java.io.Serializable,I extends java.io.Serializable,F>- Parameters:
iteration- the iteration data.
-
updateInfoFeatures
Updates the necessary values for computing the metric (when using information pieces features).- Specified by:
updateInfoFeaturesin classAbstractFeatureIndividualSimulationMetric<U extends java.io.Serializable,I extends java.io.Serializable,F>- Parameters:
iteration- the iteration data.
-
initialize
protected void initialize()Description copied from class:AbstractIndividualSimulationMetricInitializes all the variables needed for computing and updating the values of the metric.- Specified by:
initializein classAbstractIndividualSimulationMetric<U extends java.io.Serializable,I extends java.io.Serializable,F>
-
calculate
Description 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.
-