Inferencer¶
mllabs.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 |
|---|---|---|
node_specs |
dict
|
|
selected_nodes |
list[str]
|
Pipeline node names, topologically ordered. |
selected_predictors |
list[str]
|
Predictor names producing the output. |
n_splits |
int
|
Number of cross-validation splits. |
node_objs |
dict
|
|
v |
Output column filter applied to Predictor outputs. |
|
trainer_spec |
dict | None
|
Where this came from — strings and primitives only, so a deployed pickle can say which Trainer and which pipeline version produced it without carrying either. |
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. |
process(data, agg='mean', nodes=None)
¶
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'
|
nodes
|
str | list[str] | None
|
Predictor node(s) to include.
|
None
|
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 |