# MetricMDNMLoss (ARX GUI Documentation)

org.deidentifier.arx.metric.v2

## Class MetricMDNMLoss

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

- All Implemented Interfaces:
    java.io.Serializable
  Direct Known Subclasses:
    MetricMDNMLossPrecomputed

      public class MetricMDNMLoss
      extends AbstractMetricMultiDimensional

  This class implements a variant of the Loss metric.
  See Also:
    Serialized Form

- - ### Nested Class Summary

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

      `Metric.AggregateFunction`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MetricMDNMLoss()` Default constructor which treats all transformation methods equally.
    `MetricMDNMLoss(double gsFactor, Metric.AggregateFunction function)` A constructor that allows to define a factor weighting generalization and suppression.
    `MetricMDNMLoss(Metric.AggregateFunction function)` Default constructor which treats all transformation methods equally.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `MetricConfiguration` | `getConfiguration()` Returns the configuration of this metric.
    `double` | `getGeneralizationFactor()` Returns the factor used weight generalized values.
    `double` | `getGeneralizationSuppressionFactor()` Returns the factor weighting generalization and suppression.
    `protected ILMultiDimensionalWithBound` | `getInformationLossInternal(org.deidentifier.arx.framework.lattice.Transformation node, org.deidentifier.arx.framework.check.groupify.HashGroupify g)` Evaluates the metric for the given node.
    `protected ILMultiDimensionalWithBound` | `getInformationLossInternal(org.deidentifier.arx.framework.lattice.Transformation node, org.deidentifier.arx.framework.check.groupify.HashGroupifyEntry entry)` Returns the information loss that would be induced by suppressing the given entry.
    `protected AbstractILMultiDimensional` | `getLowerBoundInternal(org.deidentifier.arx.framework.lattice.Transformation node)` Returns a lower bound for the information loss for the given node.
    `protected AbstractILMultiDimensional` | `getLowerBoundInternal(org.deidentifier.arx.framework.lattice.Transformation node, org.deidentifier.arx.framework.check.groupify.HashGroupify g)` Returns a lower bound for the information loss for the given node.
    `java.lang.String` | `getName()` Returns the name of metric.
    `protected DomainShare[]` | `getShares()` For subclasses.
    `double` | `getSuppressionFactor()` Returns the factor used to weight suppressed values.
    `protected void` | `initializeInternal(org.deidentifier.arx.framework.data.DataManager manager, DataDefinition definition, org.deidentifier.arx.framework.data.Data input, org.deidentifier.arx.framework.data.GeneralizationHierarchy[] hierarchies, ARXConfiguration config)` Implement this to initialize the metric.
    `boolean` | `isAbleToHandleMicroaggregation()` Returns whether this metric handles microaggregation
    `boolean` | `isGSFactorSupported()` Returns whether a generalization/suppression factor is supported
    `protected double` | `normalizeAggregated(double aggregate)` Normalizes the aggregate.
    `protected double` | `normalizeGeneralized(double aggregate, int dimension)` Normalizes the aggregate.
    `ElementData` | `render(ARXConfiguration config)` Renders the privacy model
    `java.lang.String` | `toString()` Returns the name of metric.

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

      `createInformationLoss, createInformationLossWithBound, createInformationLossWithoutBound, createMaxInformationLoss, createMinInformationLoss, getAggregateFunction, 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, getDescription, getDescription, getInformationLoss, getInformationLoss, getLowerBound, getLowerBound, getNumRecords, getSubset, initialize, isIndependent, isMonotonic, isMonotonicWithGeneralization, isMonotonicWithSuppression, isMultiDimensional, isPrecomputed, isWeighted, list, round`

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

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

- - ### Constructor Detail

    - #### MetricMDNMLoss

          public MetricMDNMLoss()

      Default constructor which treats all transformation methods equally.

    - #### MetricMDNMLoss

          public MetricMDNMLoss(Metric.AggregateFunction function)

      Default constructor which treats all transformation methods equally.
      Parameters:
        `function` -

    - #### MetricMDNMLoss

          public MetricMDNMLoss(double gsFactor,
                        Metric.AggregateFunction function)

      A constructor that allows to define a factor weighting generalization and suppression.
      Parameters:
        `gsFactor` - 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.
        `function` -

  - ### Method Detail

    - #### getConfiguration

          public MetricConfiguration getConfiguration()

      Returns the configuration of this metric.
      Overrides:
        `getConfiguration` in class `Metric<AbstractILMultiDimensional>`
      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.

    - #### getName

          public java.lang.String getName()

      Description copied from class: `Metric`
      Returns the name of metric.
      Overrides:
        `getName` in class `Metric<AbstractILMultiDimensional>`
      Returns:

    - #### getSuppressionFactor

          public double getSuppressionFactor()

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

    - #### isAbleToHandleMicroaggregation

          public boolean isAbleToHandleMicroaggregation()

      Description copied from class: `Metric`
      Returns whether this metric handles microaggregation
      Overrides:
        `isAbleToHandleMicroaggregation` in class `Metric<AbstractILMultiDimensional>`
      Returns:

    - #### isGSFactorSupported

          public boolean isGSFactorSupported()

      Description copied from class: `Metric`
      Returns whether a generalization/suppression factor is supported
      Overrides:
        `isGSFactorSupported` in class `Metric<AbstractILMultiDimensional>`
      Returns:

    - #### render

          public ElementData render(ARXConfiguration config)

      Description copied from class: `Metric`
      Renders the privacy model
      Specified by:
        `render` in class `Metric<AbstractILMultiDimensional>`
      Returns:

    - #### toString

          public java.lang.String toString()

      Description copied from class: `Metric`
      Returns the name of metric.
      Overrides:
        `toString` in class `Metric<AbstractILMultiDimensional>`

    - #### getInformationLossInternal

          protected ILMultiDimensionalWithBound getInformationLossInternal(org.deidentifier.arx.framework.lattice.Transformation node,
                                                               org.deidentifier.arx.framework.check.groupify.HashGroupify g)

      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
        `g` - The groupify operator of the previous check
      Returns:
        the double

    - #### getInformationLossInternal

          protected ILMultiDimensionalWithBound getInformationLossInternal(org.deidentifier.arx.framework.lattice.Transformation node,
                                                               org.deidentifier.arx.framework.check.groupify.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(org.deidentifier.arx.framework.lattice.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(org.deidentifier.arx.framework.lattice.Transformation node,
                                                         org.deidentifier.arx.framework.check.groupify.HashGroupify g)

      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:

    - #### getShares

          protected DomainShare[] getShares()

      For subclasses.
      Returns:

    - #### initializeInternal

          protected void initializeInternal(org.deidentifier.arx.framework.data.DataManager manager,
                                DataDefinition definition,
                                org.deidentifier.arx.framework.data.Data input,
                                org.deidentifier.arx.framework.data.GeneralizationHierarchy[] hierarchies,
                                ARXConfiguration config)

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

    - #### normalizeAggregated

          protected double normalizeAggregated(double aggregate)

      Normalizes the aggregate.
      Parameters:
        `aggregate` -
        `dimension` -
      Returns:

    - #### normalizeGeneralized

          protected double normalizeGeneralized(double aggregate,
                                    int dimension)

      Normalizes the aggregate.
      Parameters:
        `aggregate` -
        `dimension` -
      Returns: