metasyn.distribution.uniquekey

Unique key distributions, often for primary key columns.

Classes

UniqueKeyDistribution(lower, consecutive)

Unique key distribution for identifiers.

UniqueKeyFitter(privacy)

Fitter for unique key distribution.

class metasyn.distribution.uniquekey.UniqueKeyDistribution(lower, consecutive)

Bases: BaseDistribution

Unique key distribution for identifiers.

Discrete distribution that ensures the uniqueness of the drawn values.

Parameters:
  • lower (int) – Minimum value for the keys.

  • consecutive (bool) – True if keys are consecutive and increasing, False otherwise.

Examples

>>> UniqueKeyDistribution(lower=0, consecutive=True)
name

core.unique_key

unique

True

version

1.0

var_type

discrete

draw_reset()

Reset the drawing of elements to start again.

draw()

Draw a random element from the fitted distribution.

information_criterion(values)

Get the BIC value for a particular set of values.

Parameters:

values (array_like) – Values to determine the BIC value of.

classmethod default_distribution(var_type=None)

Get a distribution with default parameters.

Return type:

TypeVar(UKeyT, bound= UniqueKeyDistribution)

name: str = 'core.unique_key'

The identifier for the implemented distribution

unique: bool = True

Whether the distribution creates only unique values

var_type: Union[str, Sequence[str]] = 'discrete'

The variable type of the distribution

class metasyn.distribution.uniquekey.UniqueKeyFitter(privacy)

Bases: BaseFitter

Fitter for unique key distribution.

Parameters:

privacy (BasePrivacy)

dist_class

<class ‘metasyn.distribution.uniquekey.UniqueKeyDistribution’>

version

1.0

var_type

discrete

privacy

none

distribution

alias of UniqueKeyDistribution