Association#
synthesized.common.rules.Association
- class Association(binding_mask, associations=None, nan_associations=None)#
Define a relationship between two categorical variables that the synthesizer must obey.
The index to value mapping is determined from the order of the categories in the appropriate meta class
- Parameters
binding_mask (np.ndarray) – boolean mask representing the allowed associations between categorical values.
associations (List[str]) – list of column names to associate.
nan_associations (List[str]) – list of nan indicator columns to associate.
Methods
detect_association
(df, df_meta[, ...])Constructor that automatically generates a binding mask for the association based on a dataframe and masks all combinations of inputs that don't appear in the dataframe.
- classmethod detect_association(df, df_meta, associations=None, nan_associations=None)#
Constructor that automatically generates a binding mask for the association based on a dataframe and masks all combinations of inputs that don’t appear in the dataframe.
- Parameters
df (pd.DataFrame) – input DataFrame.
df_meta (DataFrameMeta) – extracted DataFrameMeta
associations (List[str]) – list of regular columns to check for associations.
nan_associations (List[str]) – list of columns to check nan value associations.
- Returns
new Association object with automatically generated binding mask.
- Return type
association