# AbstractMetricMultiDimensionalPotentiallyPrecomputed (ARX Developer Documentation)

org.deidentifier.arx.metric.v2

## Class AbstractMetricMultiDimensionalPotentiallyPrecomputed

- java.lang.Object
- - org.deidentifier.arx.metric.Metric<AbstractILMultiDimensional>
  - - org.deidentifier.arx.metric.v2.AbstractMetricMultiDimensional
    - - org.deidentifier.arx.metric.v2.AbstractMetricMultiDimensionalPotentiallyPrecomputed

- All Implemented Interfaces:
    java.io.Serializable
  Direct Known Subclasses:
    MetricMDNMLossPotentiallyPrecomputed, MetricMDNUEntropyPotentiallyPrecomputed, MetricMDNUNMEntropyPotentiallyPrecomputed, MetricMDNUNMNormalizedEntropyPotentiallyPrecomputed

      public abstract class AbstractMetricMultiDimensionalPotentiallyPrecomputed
      extends AbstractMetricMultiDimensional

  This class provides an abstract skeleton for the implementation of metrics that can either be precomputed or not. The decision is made at runtime depending on data properties.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.deidentifier.arx.metric.Metric

      `Metric.AggregateFunction`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `InformationLoss<?>` | `createMaxInformationLoss()` Returns an instance of the maximal value.
    `InformationLoss<?>` | `createMinInformationLoss()` Returns an instance of the minimal value.
    `Metric.AggregateFunction` | `getAggregateFunction()` Returns the aggregate function of a multi-dimensional metric, null otherwise.
    `protected AbstractMetricMultiDimensional` | `getDefaultMetric()` Returns the default variant.
    `double` | `getGeneralizationFactor()` Returns the factor used weight generalized values.
    `double` | `getGeneralizationSuppressionFactor()` Returns the factor weighting generalization and suppression.
    `protected InformationLossWithBound<AbstractILMultiDimensional>` | `getInformationLossInternal(Transformation node, HashGroupify groupify)` Evaluates the metric for the given node.
    `protected InformationLossWithBound<AbstractILMultiDimensional>` | `getInformationLossInternal(Transformation node, HashGroupifyEntry entry)` Returns the information loss that would be induced by suppressing the given entry.
    `protected AbstractILMultiDimensional` | `getLowerBoundInternal(Transformation node)` Returns a lower bound for the information loss for the given node.
    `protected AbstractILMultiDimensional` | `getLowerBoundInternal(Transformation node, HashGroupify groupify)` Returns a lower bound for the information loss for the given node.
    `protected AbstractMetricMultiDimensional` | `getPrecomputedMetric()` Returns the precomputed variant.
    `double` | `getSuppressionFactor()` Returns the factor used to weight suppressed values.
    `protected double` | `getThreshold()` Returns the threshold.
    `protected void` | `initializeInternal(DataManager manager, DataDefinition definition, Data input, GeneralizationHierarchy[] ahierarchies, ARXConfiguration config)` Implement this to initialize the metric.
    `boolean` | `isIndependent()` Returns whether this metric requires the transformed data or groups to determine information loss.
    `boolean` | `isPrecomputed()` Returns whether the metric is precomputed

    - ### Methods inherited from class org.deidentifier.arx.metric.v2.AbstractMetricMultiDimensional

      `createInformationLoss, createInformationLossWithBound, createInformationLossWithoutBound, getAggregateFunctions, getDimensions, getDimensionsAggregated, getDimensionsGeneralized, getError, getMicroaggregationFunctions, getMicroaggregationStartIndex, initialize, setMax, setMin`

    - ### Methods inherited from class org.deidentifier.arx.metric.Metric

      `createAECSMetric, createAECSMetric, createAmbiguityMetric, createDiscernabilityMetric, createDiscernabilityMetric, createEntropyBasedInformationLossMetric, createEntropyBasedInformationLossMetric, createEntropyMetric, createEntropyMetric, createEntropyMetric, createEntropyMetric, createEntropyMetric, createEntropyMetric, createHeightMetric, createHeightMetric, createInstanceOfHighestScore, createInstanceOfLowestScore, createKLDivergenceMetric, createLossMetric, createLossMetric, createLossMetric, createLossMetric, createMetric, createNormalizedEntropyMetric, createNormalizedEntropyMetric, createPrecisionMetric, createPrecisionMetric, createPrecisionMetric, createPrecisionMetric, createPrecisionMetric, createPrecisionMetric, createPrecisionMetric, createPrecisionMetric, createPrecomputedEntropyMetric, createPrecomputedEntropyMetric, createPrecomputedEntropyMetric, createPrecomputedEntropyMetric, createPrecomputedEntropyMetric, createPrecomputedEntropyMetric, createPrecomputedLossMetric, createPrecomputedLossMetric, createPrecomputedLossMetric, createPrecomputedLossMetric, createPrecomputedNormalizedEntropyMetric, createPrecomputedNormalizedEntropyMetric, createPublisherPayoutMetric, createPublisherPayoutMetric, createStaticMetric, createStaticMetric, getConfiguration, getDescription, getDescription, getInformationLoss, getInformationLoss, getLowerBound, getLowerBound, getName, getNumRecords, getSubset, initialize, isAbleToHandleMicroaggregation, isGSFactorSupported, isMonotonic, isMonotonicWithGeneralization, isMonotonicWithSuppression, isMultiDimensional, isWeighted, list, render, round, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### createMaxInformationLoss

          public InformationLoss<?> createMaxInformationLoss()

      Description copied from class: `Metric`
      Returns an instance of the maximal value.
      Overrides:
        `createMaxInformationLoss` in class `AbstractMetricMultiDimensional`
      Returns:

    - #### createMinInformationLoss

          public InformationLoss<?> createMinInformationLoss()

      Description copied from class: `Metric`
      Returns an instance of the minimal value.
      Overrides:
        `createMinInformationLoss` in class `AbstractMetricMultiDimensional`
      Returns:

    - #### getAggregateFunction

          public Metric.AggregateFunction getAggregateFunction()

      Description copied from class: `Metric`
      Returns the aggregate function of a multi-dimensional metric, null otherwise.
      Overrides:
        `getAggregateFunction` in class `AbstractMetricMultiDimensional`
      Returns:

    - #### getGeneralizationFactor

          public double getGeneralizationFactor()

      Description copied from class: `Metric`
      Returns the factor used weight generalized values.
      Overrides:
        `getGeneralizationFactor` in class `Metric<AbstractILMultiDimensional>`
      Returns:

    - #### getGeneralizationSuppressionFactor

          public double getGeneralizationSuppressionFactor()

      Description copied from class: `Metric`
      Returns the factor weighting generalization and suppression.
      Overrides:
        `getGeneralizationSuppressionFactor` in class `Metric<AbstractILMultiDimensional>`
      Returns:
        A factor [0,1] weighting generalization and suppression. The default value is 0.5, which means that generalization and suppression will be treated equally. A factor of 0 will favor suppression, and a factor of 1 will favor generalization. The values in between can be used for balancing both methods.

    - #### getSuppressionFactor

          public double getSuppressionFactor()

      Description copied from class: `Metric`
      Returns the factor used to weight suppressed values.
      Overrides:
        `getSuppressionFactor` in class `Metric<AbstractILMultiDimensional>`
      Returns:

    - #### isIndependent

          public boolean isIndependent()

      Description copied from class: `Metric`
      Returns whether this metric requires the transformed data or groups to determine information loss.
      Overrides:
        `isIndependent` in class `Metric<AbstractILMultiDimensional>`
      Returns:

    - #### isPrecomputed

          public boolean isPrecomputed()

      Description copied from class: `Metric`
      Returns whether the metric is precomputed
      Overrides:
        `isPrecomputed` in class `Metric<AbstractILMultiDimensional>`
      Returns:

    - #### getDefaultMetric

          protected AbstractMetricMultiDimensional getDefaultMetric()

      Returns the default variant.
      Returns:

    - #### getInformationLossInternal

          protected InformationLossWithBound<AbstractILMultiDimensional> getInformationLossInternal(Transformation node,
                                                                                        HashGroupify groupify)

      Description copied from class: `Metric`
      Evaluates the metric for the given node.
      Specified by:
        `getInformationLossInternal` in class `Metric<AbstractILMultiDimensional>`
      Parameters:
        `node` - The node for which to compute the information loss
        `groupify` - The groupify operator of the previous check
      Returns:
        the double

    - #### getInformationLossInternal

          protected InformationLossWithBound<AbstractILMultiDimensional> getInformationLossInternal(Transformation node,
                                                                                        HashGroupifyEntry entry)

      Description copied from class: `Metric`
      Returns the information loss that would be induced by suppressing the given entry. The loss is not necessarily consistent with the loss that is computed by `getInformationLoss(node, groupify)` but is guaranteed to be comparable for different entries from the same groupify operator.
      Specified by:
        `getInformationLossInternal` in class `Metric<AbstractILMultiDimensional>`
      Returns:

    - #### getLowerBoundInternal

          protected AbstractILMultiDimensional getLowerBoundInternal(Transformation node)

      Description copied from class: `Metric`
      Returns a lower bound for the information loss for the given node. This can be used to expose the results of monotonic shares of a metric, which can significantly speed-up the anonymization process. If no such metric exists, simply return `null`.
      Specified by:
        `getLowerBoundInternal` in class `Metric<AbstractILMultiDimensional>`
      Returns:

    - #### getLowerBoundInternal

          protected AbstractILMultiDimensional getLowerBoundInternal(Transformation node,
                                                         HashGroupify groupify)

      Description copied from class: `Metric`
      Returns a lower bound for the information loss for the given node. This can be used to expose the results of monotonic shares of a metric, which can significantly speed-up the anonymization process. If no such metric exists, simply return `null`.
      This variant of the method allows computing a monotonic share based on a groupified data representation. IMPORTANT NOTE: The groups may not have been classified correctly when the method is called, i.e., HashGroupifyEntry.isNotOutlier may not be set correctly!
      Specified by:
        `getLowerBoundInternal` in class `Metric<AbstractILMultiDimensional>`
      Returns:

    - #### getPrecomputedMetric

          protected AbstractMetricMultiDimensional getPrecomputedMetric()

      Returns the precomputed variant.
      Returns:

    - #### getThreshold

          protected double getThreshold()

      Returns the threshold.
      Returns:

    - #### initializeInternal

          protected void initializeInternal(DataManager manager,
                                DataDefinition definition,
                                Data input,
                                GeneralizationHierarchy[] ahierarchies,
                                ARXConfiguration config)

      Description copied from class: `Metric`
      Implement this to initialize the metric.
      Overrides:
        `initializeInternal` in class `AbstractMetricMultiDimensional`