Trainer¶
mllabs._trainer.Trainer
¶
Runs cross-validation training on a subset of Pipeline nodes.
Created via :meth:~mllabs.Experimenter.add_trainer. Shares the
Experimenter's Pipeline and DataCache.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Trainer name. |
selected_stages |
list[str]
|
Stage nodes included in training. |
selected_heads |
list[str]
|
Head nodes to train. |
split_indices |
list[tuple] | None
|
|
node_objs |
dict
|
|
select_head(nodes)
¶
Specify Head nodes to train and auto-collect their upstream Stages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nodes
|
Node query — |
required |
train()
¶
Train all unbuilt selected nodes across all splits.
Nodes are trained in topological order. Each node completes all splits before the next node begins.
process(data, v=None)
¶
Apply trained processors to new data, yielding one result per split.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Input dataset. |
required | |
v
|
Output column filter applied to Head outputs. |
None
|
Yields:
| Name | Type | Description |
|---|---|---|
DataFrame |
Concatenated Head outputs for each split. |
to_inferencer(v=None)
¶
Export trained processors to a standalone :class:~mllabs.Inferencer.
All selected nodes must be in built state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Output column filter passed to the Inferencer. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Inferencer |
Independent inferencer ready for deployment. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If any selected node is not built. |