MRFTerm.polygons

Contents

MRFTerm.polygons#

property MRFTerm.polygons: dict[str, Array | ndarray | bool | number | bool | int | float | complex] | None#

Dictionary of arrays. The keys of the dict are the region labels. The corresponding values define each region through a 2-D array of polygon information.

Examples

>>> import pandas as pd
>>> import liesel_gam as gam
>>> df = pd.DataFrame({"region": ["a", "b", "a"]})
>>> polys = {
...     "a": jnp.array([[0.0, 0.0], [1.0, 0.0]]),
...     "b": jnp.array([[1.0, 0.0], [2.0, 0.0]]),
... }
>>> term = gam.TermBuilder.from_df(df).mrf(
...     "region",
...     polys=polys,
...     absorb_cons=False,
...     diagonal_penalty=False,
...     scale_penalty=False,
...     scale=1.0,
... )
>>> sorted(term.polygons)
['a', 'b']