task¶
Shared target validation and explicit supervised-task routing.
prepare_target(y, task='auto')
¶
Prepare a target for explicit task routing without altering auto behavior.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
array - like
|
Target values. |
required |
task
|
str
|
Explicit task or legacy, unvalidated array conversion. |
'auto'
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Unchanged values in auto mode, finite floats for regression, or contiguous integer-encoded labels for classification. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the task is unsupported or an explicit target is incompatible. |
Source code in featcopilot/utils/task.py
resolve_task(y, task='auto')
¶
Resolve and validate a single-output supervised task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
array - like
|
Non-empty, one-dimensional target with no missing values. |
required |
task
|
str
|
Explicit task or sklearn target-type inference. Regression requires finite real numeric values; numeric strings are not coerced. Classification requires discrete binary or multiclass labels. |
'auto'
|
Returns:
| Type | Description |
|---|---|
{classification, regression}
|
Validated task. In auto mode, integer-valued targets are classified as discrete regardless of their cardinality. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the task or target is unsupported or incompatible. |
Notes
Existing selectors retain their own historical heuristics in auto mode; this helper does not replace those defaults.
Source code in featcopilot/utils/task.py
validate_task(task)
¶
Validate a supervised task option.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
str
|
One of 'auto', 'classification', or 'regression'. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the task option is unsupported. |