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.StringRECALLName fixed value.private java.util.Map<U,java.util.Set<F>>receivedFeaturesStores (if it is necessary), a relation between users and features.private doubletotalThe 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 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 values for computing the metric (when using information pieces features).protected voidupdateUserFeature(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, 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
-
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: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
-
updateUserFeature
Updates the necessary values for computing the metric (when using user features).- Specified by:
updateUserFeaturein 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:
updateInfoFeaturein 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: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>
-