MRFTerm.neighbors

MRFTerm.neighbors#

property MRFTerm.neighbors: dict[str, list[str]] | None#

Dictionary of neighborhood structure (if available).

The keys are region labels. The values are lists of the labels of neighboring regions.

Examples

>>> import pandas as pd
>>> import liesel_gam as gam
>>> df = pd.DataFrame({"region": ["a", "b", "a"]})
>>> 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.neighbors["a"]
['b']