View source on GitHub |
Validates that struct
is a valid Counterfactual structure.
model_remediation.counterfactual.keras.utils.validate_counterfactual_structure(
struct, struct_name='struct', element_type=None
)
Arguments | |
---|---|
struct
|
Structure that will be validated. |
struct_name
|
Name of struct, used only for error messages. |
element_type
|
Type of elements. If None , types are not checked.
|
A struct
is a valid Counterfactual structure if it is either a single
element (including tuples) or is an unnested dictionary (with string keys). If
element_type
is set, the function will also validate that all elements are
of the correct type.