Mapping Utilities
Generic mapping utilities shared across solver backends.
- class Mapper(mapping=None, *, columns=None, validate=True)[source]
Bases:
Mapping[Key,V],GenericMap original feature names to transformed columns.
Both the counterfactual point \(x\) and the query \(\hat{x}\) are represented in this transformed coordinate system. The mapper is the low-level bridge between original feature semantics and processed columns.
Initialize a mapper from feature metadata and transformed columns.
- Parameters:
mapping – Mapping from original feature names to metadata objects.
columns – Processed pandas index describing the transformed coordinates.
validate – Whether to verify that
mappingandcolumnsare consistent.
- CODE_LEVEL = 1
- NAME_LEVEL = 0
- apply(func)[source]
Transform the mapped values while preserving the column structure.
- Returns:
New mapper with transformed values and the same columns.
- Return type:
Mapper[U]
- property codes
- property columns
- property idx
- property is_multi_level
- property n_columns
- property n_levels
- property names