pdstools.adm.trees._multi¶
The MultiTrees collection — multiple snapshots of one config.
Attributes¶
Classes¶
A collection of |
Module Contents¶
- logger¶
- class MultiTrees¶
A collection of
ADMTreesModelsnapshots indexed by timestamp.Construct via
from_datamart().- __getitem__(index: int | str) pdstools.adm.trees._model.ADMTreesModel¶
Return the
ADMTreesModelatindex.Integer indices select by insertion order; string indices select by snapshot timestamp. Use
items()if you need both keys and values together.- Parameters:
- Return type:
- items()¶
Iterate
(timestamp, model)pairs in insertion order.
- values()¶
Iterate
ADMTreesModelinstances in insertion order.
- keys()¶
Iterate snapshot timestamps in insertion order.
- __iter__()¶
- __add__(other: MultiTrees | pdstools.adm.trees._model.ADMTreesModel) MultiTrees¶
- Parameters:
other (MultiTrees | pdstools.adm.trees._model.ADMTreesModel)
- Return type:
- property first: pdstools.adm.trees._model.ADMTreesModel¶
- Return type:
- property last: pdstools.adm.trees._model.ADMTreesModel¶
- Return type:
- classmethod from_datamart(df: polars.DataFrame, n_threads: int = 1, configuration: str | None = None) MultiTrees¶
Decode every Modeldata blob in
dffor a single configuration.Returns one
MultiTreescontaining oneADMTreesModelper snapshot.- Parameters:
df (pl.DataFrame) – Datamart slice. Must contain
Modeldata,SnapshotTimeandConfigurationcolumns and cover exactly one Configuration. Usefrom_datamart_grouped()ifdfspans multiple configurations.n_threads (int) – Worker count for parallel base64+zlib decoding.
configuration (str | None) – Optional explicit Configuration name; required if
dfdoesn’t already contain a single Configuration.
- Return type:
- classmethod from_datamart_grouped(df: polars.DataFrame, n_threads: int = 1) dict[str, MultiTrees]¶
Decode every Modeldata blob in
df, grouped by Configuration.Returns a mapping of configuration name to
MultiTrees. Usefrom_datamart()instead when the input has only one configuration.- Parameters:
df (polars.DataFrame)
n_threads (int)
- Return type:
- static _decode_datamart_frame(df: polars.DataFrame, n_threads: int = 1) list[tuple[str, str, pdstools.adm.trees._model.ADMTreesModel]]¶
Decode every blob in
dfand return(config, timestamp, model)rows.
- compute_over_time(predictor_categorization: collections.abc.Callable | None = None) polars.DataFrame¶
Return per-tree categorisation counts across snapshots, with a
SnapshotTimecolumn per row.- Parameters:
predictor_categorization (collections.abc.Callable | None)
- Return type:
polars.DataFrame