Algorithm#
- class Algorithm(dataset: Dataset, k: int)#
Bases:
ABCAbstract class for implementing k-anonymization algorithms.
- Parameters:
dataset (Dataset) – The Dataset object holding the original data and its metadata.
k (int) – The privacy parameter k.
- Variables:
k (int) – The privacy parameter k.
dataset (Dataset) – The Dataset object holding the original data and its metadata.
org_data (ITableDF) – The original data extracted from
dataset.anon_data (ITableDF or None) – The anonymized data.
suppressed_qids (list) – The records suppressed (removed) from the original data.
Methods
Helper method to finalize and wrap the anonymized data.
The core anonymization logic to be implemented by subclasses.
- _construct_anon_data(data, columns, table_name='Anonymized Data')#
Helper method to finalize and wrap the anonymized data.
Converts anonymized data into an
ITableDFobject for standardized display and further analysis.- Parameters:
data (array-like) – The anonymized data.
columns (list) – The list of column names for the new dataframe.
table_name (str, optional) – A descriptive label for the resulting table.
- abstractmethod anonymize()#
The core anonymization logic to be implemented by subclasses.
This method should transform
self.anon_datasuch that it satisfies the k-anonymity requirement.
Attributes
- org_data#