Class UserFeatureCount<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.UserFeatureCount<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 UserFeatureCount<U extends java.io.Serializable,I extends java.io.Serializable,F> extends AbstractFeatureGlobalSimulationMetric<U,I,F>
Metric that computes the number of different (user, feature) pairs which have appeared during the simulation.
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
RECALL
Name fixed value.private java.util.Map<U,java.util.Set<F>>
receivedFeatures
Stores (if it is necessary), a relation between users and features.private double
total
The total number of external parameters that have reached the different users.Fields inherited from class es.uam.eps.ir.relison.diffusion.metrics.AbstractGlobalSimulationMetric
data, initialized
-
Constructor Summary
Constructors Constructor Description UserFeatureCount(java.lang.String feature, boolean userFeats)
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 values for computing the metric (when using information pieces features).protected void
updateUserFeature(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.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
-
RECALL
private static final java.lang.String RECALLName fixed value.- See Also:
- Constant Field Values
-
receivedFeatures
Stores (if it is necessary), a relation between users and features. -
total
private double totalThe total number of external parameters that have reached the different users.
-
-
Constructor Details
-
UserFeatureCount
public UserFeatureCount(java.lang.String feature, boolean userFeats)Constructor.- Parameters:
userFeats
- true if we are using a user feature, false if we are using an information piece feature.feature
- the name of the feature.
-
-
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
-
updateUserFeature
Updates the necessary values for computing the metric (when using user features).- Specified by:
updateUserFeature
in classAbstractFeatureGlobalSimulationMetric<U extends java.io.Serializable,I extends java.io.Serializable,F>
- Parameters:
iteration
- the iteration data.
-
updateInfoFeature
Updates the necessary values for computing the metric (when using information pieces features).- Specified by:
updateInfoFeature
in classAbstractFeatureGlobalSimulationMetric<U extends java.io.Serializable,I extends java.io.Serializable,F>
- Parameters:
iteration
- the iteration data.
-
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>
-