org.deidentifier.arx.criteria

## Class KMap

- java.lang.Object
- - org.deidentifier.arx.criteria.PrivacyCriterion
  - - org.deidentifier.arx.criteria.ImplicitPrivacyCriterion
    - - org.deidentifier.arx.criteria.KMap

All Implemented Interfaces:
  java.io.Serializable

    public class KMap
    extends ImplicitPrivacyCriterion

This class implements the k-map privacy model as proposed by Latanya Sweeney.
As an alternative to explicitly providing data about the underlying population, cell sizes can be can be estimated with the D3 (Poisson) and D4 (zero-truncated Poisson) estimators proposed in:
K. El Emam and F. Dankar, "Protecting privacy using k-anonymity" JAMIA, vol. 15, no. 5, pp. 627-637, 2008.
The estimator D3 was first published in:
J. Pannekoek, "Statistical methods for some simple disclosure limitation rules," Statistica Neerlandica, vol. 53, no. 1, pp. 55-67, 1999.

Author:
  Fabian Prasser, Florian Kohlmayer
See Also:
  Serialized Form

### Nested Class Summary

Nested Classes
`static class` `KMap.CellSizeEstimator` Estimators for cell sizes in the population.

### Constructor Summary

Constructors
Constructor and Description
`KMap(int k, DataSubset subset)` Creates a new instance of the k-map criterion as proposed by Latanya Sweeney
`KMap(int k, double significanceLevel, ARXPopulationModel populationModel)` Creates a new instance of the criterion using thr Poisson estimator proposed by Pannekoek.
`KMap(int k, double significanceLevel, ARXPopulationModel populationModel, KMap.CellSizeEstimator estimator)` Creates a new instance of the criterion using the Poisson estimator proposed by Pannekoek or by El Emam.

### Method Summary

All Methods Instance Methods Concrete Methods
`KMap` `clone()` Clone
`PrivacyCriterion` `clone(DataSubset subset)` Clone for local recoding
`DataSubset` `getDataSubset()` If a privacy model uses a data subset, it must overwrite this method
`int` `getDerivedK()` Returns the derived parameter k.
`KMap.CellSizeEstimator` `getEstimator()` Returns the specified estimator.
`int` `getK()` Returns k.
`int` `getMinimalClassSize()` If a privacy model provides a prosecutor risk threshold, it should override this method to enable optimizations
`ARXPopulationModel` `getPopulationModel()` Returns the associated population model, `null` if there is none.
`int` `getRequirements()` Returns the criterion's requirements.
`double` `getRiskThresholdJournalist()` Return journalist risk threshold, 1 if there is none
`double` `getRiskThresholdMarketer()` Return marketer risk threshold, 1 if there is none
`double` `getRiskThresholdProsecutor()` Return journalist risk threshold, 1 if there is none
`double` `getSignificanceLevel()` Returns the specified significance level.
`double` `getType1Error()` Returns the calculated type I error.
`void` `initialize(DataManager manager, ARXConfiguration config)` Override this to initialize the criterion.
`boolean` `isAccurate()` Return true if the population has been modeled explicitly.
`boolean` `isAnonymous(Transformation<?> node, HashGroupifyEntry entry)` Implement this, to enforce the criterion.
`boolean` `isLocalRecodingSupported()` Returns whether the criterion supports local recoding.
`boolean` `isMinimalClassSizeAvailable()` If a privacy model provides a prosecutor risk threshold, it should override this method to enable optimizations
`boolean` `isSubsetAvailable()` If a privacy model uses a data subset, it must overwrite this method
`ElementData` `render()` Renders the privacy model
`java.lang.String` `toString()` Returns a string representation.

### Methods inherited from class org.deidentifier.arx.criteria.PrivacyCriterion

`getSubset, isHeuristicSearchSupported, isHeuristicSearchWithTimeLimitSupported, isMonotonicWithGeneralization, isMonotonicWithSuppression, isOptimalSearchSupported, isSampleBased`

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

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

### Constructor Detail

#### KMap

    public KMap(int k,
                DataSubset subset)

Creates a new instance of the k-map criterion as proposed by Latanya Sweeney

Parameters:
  `k` -
  `subset` - Research subset

#### KMap

    public KMap(int k,
                double significanceLevel,
                ARXPopulationModel populationModel)

Creates a new instance of the criterion using thr Poisson estimator proposed by Pannekoek.

#### KMap

    public KMap(int k,
                double significanceLevel,
                ARXPopulationModel populationModel,
                KMap.CellSizeEstimator estimator)

Creates a new instance of the criterion using the Poisson estimator proposed by Pannekoek or by El Emam.

### Method Detail

#### clone

    public KMap clone()

Description copied from class: `PrivacyCriterion`
Clone

Specified by:
  `clone` in class `PrivacyCriterion`

#### clone

    public PrivacyCriterion clone(DataSubset subset)

Description copied from class: `PrivacyCriterion`
Clone for local recoding

Overrides:
  `clone` in class `PrivacyCriterion`

#### getDataSubset

    public DataSubset getDataSubset()

Description copied from class: `PrivacyCriterion`
If a privacy model uses a data subset, it must overwrite this method

Overrides:
  `getDataSubset` in class `PrivacyCriterion`
Returns:

#### getDerivedK

    public int getDerivedK()

Returns the derived parameter k.

Returns:

#### getEstimator

    public KMap.CellSizeEstimator getEstimator()

Returns the specified estimator.

Returns:

#### getK

    public int getK()

Returns k.

Returns:

#### getMinimalClassSize

    public int getMinimalClassSize()

Description copied from class: `PrivacyCriterion`
If a privacy model provides a prosecutor risk threshold, it should override this method to enable optimizations

Overrides:
  `getMinimalClassSize` in class `PrivacyCriterion`
Returns:

#### getPopulationModel

    public ARXPopulationModel getPopulationModel()

Description copied from class: `PrivacyCriterion`
Returns the associated population model, `null` if there is none.

Overrides:
  `getPopulationModel` in class `PrivacyCriterion`
Returns:
  the populationModel

#### getRequirements

    public int getRequirements()

Description copied from class: `PrivacyCriterion`
Returns the criterion's requirements.

Specified by:
  `getRequirements` in class `PrivacyCriterion`
Returns:

#### getRiskThresholdJournalist

    public double getRiskThresholdJournalist()

Return journalist risk threshold, 1 if there is none

Overrides:
  `getRiskThresholdJournalist` in class `PrivacyCriterion`
Returns:

#### getRiskThresholdMarketer

    public double getRiskThresholdMarketer()

Return marketer risk threshold, 1 if there is none

Overrides:
  `getRiskThresholdMarketer` in class `PrivacyCriterion`
Returns:

#### getRiskThresholdProsecutor

    public double getRiskThresholdProsecutor()

Return journalist risk threshold, 1 if there is none

Overrides:
  `getRiskThresholdProsecutor` in class `PrivacyCriterion`
Returns:

#### getSignificanceLevel

    public double getSignificanceLevel()

Returns the specified significance level.

Returns:

#### getType1Error

    public double getType1Error()

Returns the calculated type I error.

Returns:

#### initialize

    public void initialize(DataManager manager,
                           ARXConfiguration config)

Description copied from class: `PrivacyCriterion`
Override this to initialize the criterion.

Overrides:
  `initialize` in class `PrivacyCriterion`
  `config` - TODO

#### isAccurate

    public boolean isAccurate()

Return true if the population has been modeled explicitly. This implies that no approximation is performed.

Returns:

#### isAnonymous

    public boolean isAnonymous(Transformation<?> node,
                               HashGroupifyEntry entry)

Description copied from class: `PrivacyCriterion`
Implement this, to enforce the criterion.

Specified by:
  `isAnonymous` in class `PrivacyCriterion`
Parameters:
  `node` - TODO
Returns:

#### isLocalRecodingSupported

    public boolean isLocalRecodingSupported()

Description copied from class: `PrivacyCriterion`
Returns whether the criterion supports local recoding.

Specified by:
  `isLocalRecodingSupported` in class `PrivacyCriterion`
Returns:

#### isMinimalClassSizeAvailable

    public boolean isMinimalClassSizeAvailable()

Description copied from class: `PrivacyCriterion`
If a privacy model provides a prosecutor risk threshold, it should override this method to enable optimizations

Overrides:
  `isMinimalClassSizeAvailable` in class `PrivacyCriterion`
Returns:

#### isSubsetAvailable

    public boolean isSubsetAvailable()

Description copied from class: `PrivacyCriterion`
If a privacy model uses a data subset, it must overwrite this method

Overrides:
  `isSubsetAvailable` in class `PrivacyCriterion`
Returns:

#### render

    public ElementData render()

Description copied from class: `PrivacyCriterion`
Renders the privacy model

Specified by:
  `render` in class `PrivacyCriterion`
Returns:

#### toString

    public java.lang.String toString()

Description copied from class: `PrivacyCriterion`
Returns a string representation.

Specified by:
  `toString` in class `PrivacyCriterion`