## Roles


Column → set of role names.


Usage

``` python
Roles(mapping=None)
```


Every column carries **zero or more** roles stored as a `set[str]`. The standard roles are `"target"`, `"feature"`, and `"case_weights"`; users may register arbitrary custom roles. A column may hold several roles at once, but nonsensical combinations are rejected at assignment time: `"target"` and `"feature"` cannot share a column.

A column that carries no role is not selected by role selectors. Note that when a recipe declares no `"feature"` columns at all, fitting assigns the role to every column that is not a target or a case-weights column, custom roles included; declare features explicitly to keep, say, an ID column out of them.


## Examples

Construct from a column → roles mapping, then query it:


``` python
roles = Roles(
    {"price": {"target"}, "age": {"feature"}, "city": {"feature"}}
)
roles.columns_with_role("feature"), roles.of("price")
```


    (['age', 'city'], {'target'})
