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. |
train_folds |
list[TrainFold]
|
Per-split data flows and artifact stores. |
select_head(nodes)
¶
Specify Head nodes to train and auto-collect their upstream Stages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nodes
|
Node query — |
required |
train(n_jobs=1, gpu_id_list=None)
¶
Train all unbuilt selected nodes across all splits.
Stages are trained first (topological order), then Head nodes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_jobs
|
int
|
Number of parallel workers. Default 1 (sequential). |
1
|
gpu_id_list
|
list
|
GPU IDs for GPU-enabled nodes. |
None
|
get_status(node_name)
¶
Return the disk status of a node across all folds.
Returns 'built', 'finalized', 'error', None (init),
or 'inconsistent' if folds differ.
get_node_error(node_name)
¶
Return error dict for a node in error state, or None.
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. |