MRFTerm.ordered_labels

MRFTerm.ordered_labels#

property MRFTerm.ordered_labels: list[str] | None#

Ordered labels, if they are available.

Ordering is such that the order corresponds to the columns of the basis and penalty matrices. Only available for unconstrained MRF.

Examples

>>> import pandas as pd
>>> import liesel_gam as gam
>>> df = pd.DataFrame({"region": ["b", "a", "b"]})
>>> term = gam.TermBuilder.from_df(df).mrf(
...     "region",
...     nb={"a": ["b"], "b": ["a"]},
...     absorb_cons=False,
...     diagonal_penalty=False,
...     scale_penalty=False,
...     scale=1.0,
... )
>>> term.ordered_labels
['a', 'b']