Class AbstractExternalFeatureGlobalSimulationMetric<U extends java.io.Serializable,I extends java.io.Serializable,P>
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,P>
es.uam.eps.ir.relison.diffusion.metrics.features.global.AbstractExternalFeatureGlobalSimulationMetric<U,I,P>
- Type Parameters:
U
- type of the users.I
- type of the information pieces.P
- type of the user / information pieces features.
- All Implemented Interfaces:
GlobalSimulationMetric<U,I,P>
,SimulationMetric<U,I,P>
- Direct Known Subclasses:
ExternalFeatureGlobalGiniComplement
,ExternalFeatureGlobalRate
public abstract class AbstractExternalFeatureGlobalSimulationMetric<U extends java.io.Serializable,I extends java.io.Serializable,P> extends AbstractFeatureGlobalSimulationMetric<U,I,P>
Abstract class for representing global feature-based metrics which consider those features that the user already knows.
Depending on the nature of the feature, we consider that a user already knows a feature when:
- The user has the feature, in the case of user features.
- The user has created an information piece containing the feature, in the case of information pieces features.
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<U,java.util.Set<P>>
ownFeatures
The set of own features for each user.Fields inherited from class es.uam.eps.ir.relison.diffusion.metrics.AbstractGlobalSimulationMetric
data, initialized
-
Constructor Summary
Constructors Constructor Description AbstractExternalFeatureGlobalSimulationMetric(java.lang.String name, java.lang.String feature, boolean userFeat)
Constructor. -
Method Summary
Modifier and Type Method Description protected void
clearOwnFeatures()
Clears the set of features of all users.protected void
computeOwnFeatures()
Computes and stores the own features for every user in the network.protected java.util.Set<P>
computeOwnFeatures(U u)
Computes the features for a userprotected java.util.Set<P>
computeOwnInfoFeatures(U u)
Computes information piece features for an individual user.protected java.util.Set<P>
computeOwnUserFeatures(U u)
Computes the user features for an individual user.protected java.util.Map<U,java.util.Set<P>>
getOwnFeatures()
Obtains the map identifying the parameters of all users.protected java.util.Set<P>
getOwnFeatures(U u)
Obtains the features that an individual user already knows.protected void
setOwnFeatures(U u, java.util.Set<P> features)
Adds params for an individual user.Methods inherited from class es.uam.eps.ir.relison.diffusion.metrics.features.AbstractFeatureGlobalSimulationMetric
getFeature, update, updateInfoFeature, updateUserFeature, usesUserFeatures
Methods inherited from class es.uam.eps.ir.relison.diffusion.metrics.AbstractGlobalSimulationMetric
getName, initialize, 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, calculate, clear, initialize
-
Field Details
-
ownFeatures
The set of own features for each user.
-
-
Constructor Details
-
AbstractExternalFeatureGlobalSimulationMetric
public AbstractExternalFeatureGlobalSimulationMetric(java.lang.String name, java.lang.String feature, boolean userFeat)Constructor.- Parameters:
name
- the name of the metric.feature
- the name of the feature field to consider.userFeat
- true if the feature is a user feature, false otherwise.
-
-
Method Details
-
getOwnFeatures
Obtains the map identifying the parameters of all users.- Returns:
- the parameters of all users.
-
getOwnFeatures
Obtains the features that an individual user already knows.- Parameters:
u
- the user.- Returns:
- the set of features the user already knows. If the user does not exist, an empty set is returned.
-
computeOwnFeatures
protected void computeOwnFeatures()Computes and stores the own features for every user in the network. -
computeOwnFeatures
Computes the features for a user- Parameters:
u
- the user.- Returns:
- the feature set for the user
-
computeOwnUserFeatures
Computes the user features for an individual user.- Parameters:
u
- the user.- Returns:
- the feature set.
-
computeOwnInfoFeatures
Computes information piece features for an individual user.- Parameters:
u
- the user.- Returns:
- the feature set.
-
clearOwnFeatures
protected void clearOwnFeatures()Clears the set of features of all users. -
setOwnFeatures
Adds params for an individual user.- Parameters:
u
- the user.features
- the features.
-