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>
externalFeats
Stores the number of external features received.private static java.lang.String
EXTPARAMRATE
Name fixed value.private java.util.Map<U,java.lang.Double>
totalFeats
Stores the total number of external features received.private boolean
unique
Indicates 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 double
calculate()
Calculates the metric for the current state of the simulation.double
calculate(U user)
Calculates the metric value for a single user.void
clear()
Resets the metric.protected void
initialize()
Initializes all the variables needed for computing and updating the values of the metric.protected void
updateInfoFeatures(Iteration<U,I,F> iteration)
Updates the necessary values for computing the metric (when using information pieces features).protected void
updateUserFeatures(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, setOwnFeatures
Methods inherited from class es.uam.eps.ir.relison.diffusion.metrics.features.AbstractFeatureIndividualSimulationMetric
getParameter, update, usesUserParam
Methods inherited from class es.uam.eps.ir.relison.diffusion.metrics.AbstractIndividualSimulationMetric
calculateIndividuals, 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.IndividualSimulationMetric
calculate, calculateIndividuals
Methods 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:SimulationMetric
Resets the metric. -
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
-
updateUserFeatures
Updates the necessary values for computing the metric (when using user features).- Specified by:
updateUserFeatures
in 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:
updateInfoFeatures
in 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:AbstractIndividualSimulationMetric
Initializes all the variables needed for computing and updating the values of the metric.- Specified by:
initialize
in classAbstractIndividualSimulationMetric<U extends java.io.Serializable,I extends java.io.Serializable,F>
-
calculate
Description copied from interface:IndividualSimulationMetric
Calculates the metric value for a single user.- Parameters:
user
- the single user.- Returns:
- the value of the metric, NaN if something failed.
-