Class FeatureIndividualKLDivergence<U extends java.io.Serializable,​I extends java.io.Serializable,​F>

Type Parameters:
U - type of the users.
I - type of the information pieces.
F - type of the features.
All Implemented Interfaces:
IndividualSimulationMetric<U,​I,​F>, SimulationMetric<U,​I,​F>

public class FeatureIndividualKLDivergence<U extends java.io.Serializable,​I extends java.io.Serializable,​F>
extends AbstractFeatureKLDivergence<U,​I,​F>
This individual metric computes the number of bytes of information we expect to lose if we approximate the real distribution of features of the users (the total frequency of appearance of the features over the information pieces) with the estimated distribution obtained from simulating. It uses KL Divergence for that. We apply a Laplace smoothing to prevent divisions by zero in both distributions.
  • Field Details

  • Constructor Details

    • FeatureIndividualKLDivergence

      public FeatureIndividualKLDivergence​(java.lang.String feature, boolean userFeat, boolean unique)
      Constructor.
      Parameters:
      userFeat - true if we are using a user feature, false if we are using an information piece feature.
      feature - the name of the feature.
      unique - true if a piece of information is considered once, false if it is considered each time it appears.
  • Method Details

    • calculate

      public double calculate​(U user)
      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.