Inferencer¶
mllabs._inferencer.Inferencer
¶
Applies trained processors to new data for inference.
Created by :meth:~mllabs._trainer.Trainer.to_inferencer. Self-contained —
no dependency on Experimenter or Trainer at serve time.
Attributes:
| Name | Type | Description |
|---|---|---|
pipeline |
Pipeline
|
Minimal pipeline (selected nodes only). |
selected_stages |
list[str]
|
Stage node names. |
selected_heads |
list[str]
|
Head node names. |
n_splits |
int
|
Number of cross-validation splits. |
node_objs |
dict
|
|
v |
Output column filter applied to Head outputs. |
process(data, agg='mean')
¶
Run inference on new data and aggregate across splits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Input dataset (pandas/polars DataFrame or numpy array). |
required | |
agg
|
str | callable | None
|
Aggregation strategy across splits.
|
'mean'
|
Returns:
| Type | Description |
|---|---|
|
DataFrame | list: Aggregated predictions, or a list of per-split |
|
|
predictions when |
save(path)
¶
Serialize the Inferencer to a single file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Directory to save into. Creates
|
required |
load(path)
classmethod
¶
Load a saved Inferencer from disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Directory containing |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Inferencer |
Restored inferencer. |