custom-components
Use this sub-skill when a task needs to author, repair, register, or restrict
auto-sklearn components rather than merely run an existing estimator. The package
imports as autosklearn; the inspected package version was 0.16.0dev /
0.16.0.dev0.
Route here for
- Creating or fixing subclasses of:
AutoSklearnClassificationAlgorithm
AutoSklearnRegressionAlgorithm
AutoSklearnPreprocessingAlgorithm
- Implementing
get_properties(), get_hyperparameter_search_space(),
fit(), predict(), predict_proba(), and transform() for custom
components.
- Calling
add_classifier(), add_regressor(), or the feature/data
add_preprocessor() registry functions.
- Choosing the correct custom component ID for
include / exclude after
registration.
- Replacing a broad built-in component search space with a custom wrapper that
exposes fewer hyperparameters or narrower ranges.
Route elsewhere
- Basic
AutoSklearnClassifier, AutoSklearnRegressor, or AutoSklearn2Classifier
usage: use ../estimators/SKILL.md.
- Ordinary built-in
include / exclude, Dask, SMAC, budget, or ensemble
configuration with no custom component code: use
../search-and-parallelism/SKILL.md.
- Pandas dtypes,
feat_type, target validation, custom metrics, resampling, or
dataset compression: use
../data-metrics-validation/SKILL.md.
- Long AutoML training runs for a new component: do not start them from this
sub-skill. Validate the class, registry entry, and configuration space first.
Operating procedure
- Identify the component kind and registry:
- classifier: base class
AutoSklearnClassificationAlgorithm, registry
autosklearn.pipeline.components.classification.add_classifier, include key
"classifier".
- regressor: base class
AutoSklearnRegressionAlgorithm, registry
autosklearn.pipeline.components.regression.add_regressor, include key
"regressor".
- feature preprocessor: base class
AutoSklearnPreprocessingAlgorithm,
registry autosklearn.pipeline.components.feature_preprocessing.add_preprocessor,
include key "feature_preprocessor".
- data preprocessor: base class
AutoSklearnPreprocessingAlgorithm, registry
autosklearn.pipeline.components.data_preprocessing.add_preprocessor,
include key "data_preprocessor".
- Read
references/component-contracts.md
before editing code. It contains the required properties, constants, built-in
IDs, registry rules, and ConfigSpace rules.
- If a safe starting file is useful, generate a no-training template:
python scripts/component_skeleton.py --kind classifier --class-name MyClassifier
or write it with --output my_components.py.
- Keep the registration call in code that is imported before constructing the
auto-sklearn estimator. For custom components, the ID used in
include /
exclude is the class name, for example {"classifier": ["MyClassifier"]}.
- Validate without long training: import the module, call
get_properties(),
call get_hyperparameter_search_space(), register the class, and confirm the
choice appears in the relevant component catalog or estimator configuration
space.
- For complete recipes, use
references/workflows.md.
For errors, use references/troubleshooting.md.
Quick validation snippets
Classifier registry check after importing the module that defines the class:
from autosklearn.pipeline.components.classification import ClassifierChoice, add_classifier
from my_components import MyClassifier
add_classifier(MyClassifier) # harmless if your module did not self-register
props = MyClassifier.get_properties()
required = {
"shortname", "name", "handles_regression", "handles_classification",
"handles_multiclass", "handles_multilabel", "handles_multioutput",
"is_deterministic", "input", "output",
}
assert set(props) == required
cs = MyClassifier.get_hyperparameter_search_space()
assert "MyClassifier" in ClassifierChoice.get_components()
Estimator restriction check without starting a long run:
import autosklearn.classification
automl = autosklearn.classification.AutoSklearnClassifier(
time_left_for_this_task=30,
per_run_time_limit=10,
include={"classifier": ["MyClassifier"]},
initial_configurations_via_metalearning=0,
smac_scenario_args={"runcount_limit": 1},
)
# Build or inspect the configuration space with tiny in-memory X/y before any
# expensive fit. If the ID is wrong, this should fail before training.
Native evidence anchors for later verification
Relevant native candidates are the component registration unit checks, component
base-contract checks, and the extension examples. The extension examples are
fit-heavy and should remain skip-expensive unless a verifier deliberately bounds
them; prefer the bundled skeleton --help check and static registry/config-space
checks first.
1---2name: custom-components3description: "Extend auto-sklearn with custom classifiers, regressors, feature4 preprocessors, data preprocessors, ConfigSpace search spaces, registration,5 and component IDs."6disable-model-invocation: true7metadata:8 source: https://skillmd.com/skills/vectorspacelab/custom-components9 disco-role: operating10license: BSD 3-Clause11---1213# custom-components1415Use this sub-skill when a task needs to author, repair, register, or restrict16auto-sklearn components rather than merely run an existing estimator. The package17imports as `autosklearn`; the inspected package version was `0.16.0dev` /18`0.16.0.dev0`.1920## Route here for2122- Creating or fixing subclasses of:23 - `AutoSklearnClassificationAlgorithm`24 - `AutoSklearnRegressionAlgorithm`25 - `AutoSklearnPreprocessingAlgorithm`26- Implementing `get_properties()`, `get_hyperparameter_search_space()`,27 `fit()`, `predict()`, `predict_proba()`, and `transform()` for custom28 components.29- Calling `add_classifier()`, `add_regressor()`, or the feature/data30 `add_preprocessor()` registry functions.31- Choosing the correct custom component ID for `include` / `exclude` after32 registration.33- Replacing a broad built-in component search space with a custom wrapper that34 exposes fewer hyperparameters or narrower ranges.3536## Route elsewhere3738- Basic `AutoSklearnClassifier`, `AutoSklearnRegressor`, or `AutoSklearn2Classifier`39 usage: use [`../estimators/SKILL.md`](../estimators/SKILL.md).40- Ordinary built-in `include` / `exclude`, Dask, SMAC, budget, or ensemble41 configuration with no custom component code: use42 [`../search-and-parallelism/SKILL.md`](../search-and-parallelism/SKILL.md).43- Pandas dtypes, `feat_type`, target validation, custom metrics, resampling, or44 dataset compression: use45 [`../data-metrics-validation/SKILL.md`](../data-metrics-validation/SKILL.md).46- Long AutoML training runs for a new component: do not start them from this47 sub-skill. Validate the class, registry entry, and configuration space first.4849## Operating procedure50511. Identify the component kind and registry:52 - classifier: base class `AutoSklearnClassificationAlgorithm`, registry53 `autosklearn.pipeline.components.classification.add_classifier`, include key54 `"classifier"`.55 - regressor: base class `AutoSklearnRegressionAlgorithm`, registry56 `autosklearn.pipeline.components.regression.add_regressor`, include key57 `"regressor"`.58 - feature preprocessor: base class `AutoSklearnPreprocessingAlgorithm`,59 registry `autosklearn.pipeline.components.feature_preprocessing.add_preprocessor`,60 include key `"feature_preprocessor"`.61 - data preprocessor: base class `AutoSklearnPreprocessingAlgorithm`, registry62 `autosklearn.pipeline.components.data_preprocessing.add_preprocessor`,63 include key `"data_preprocessor"`.642. Read [`references/component-contracts.md`](references/component-contracts.md)65 before editing code. It contains the required properties, constants, built-in66 IDs, registry rules, and ConfigSpace rules.673. If a safe starting file is useful, generate a no-training template:68 `python scripts/component_skeleton.py --kind classifier --class-name MyClassifier`69 or write it with `--output my_components.py`.704. Keep the registration call in code that is imported before constructing the71 auto-sklearn estimator. For custom components, the ID used in `include` /72 `exclude` is the class name, for example `{"classifier": ["MyClassifier"]}`.735. Validate without long training: import the module, call `get_properties()`,74 call `get_hyperparameter_search_space()`, register the class, and confirm the75 choice appears in the relevant component catalog or estimator configuration76 space.776. For complete recipes, use [`references/workflows.md`](references/workflows.md).78 For errors, use [`references/troubleshooting.md`](references/troubleshooting.md).7980## Quick validation snippets8182Classifier registry check after importing the module that defines the class:8384```python85from autosklearn.pipeline.components.classification import ClassifierChoice, add_classifier86from my_components import MyClassifier8788add_classifier(MyClassifier) # harmless if your module did not self-register89props = MyClassifier.get_properties()90required = {91 "shortname", "name", "handles_regression", "handles_classification",92 "handles_multiclass", "handles_multilabel", "handles_multioutput",93 "is_deterministic", "input", "output",94}95assert set(props) == required96cs = MyClassifier.get_hyperparameter_search_space()97assert "MyClassifier" in ClassifierChoice.get_components()98```99100Estimator restriction check without starting a long run:101102```python103import autosklearn.classification104105automl = autosklearn.classification.AutoSklearnClassifier(106 time_left_for_this_task=30,107 per_run_time_limit=10,108 include={"classifier": ["MyClassifier"]},109 initial_configurations_via_metalearning=0,110 smac_scenario_args={"runcount_limit": 1},111)112# Build or inspect the configuration space with tiny in-memory X/y before any113# expensive fit. If the ID is wrong, this should fail before training.114```115116## Native evidence anchors for later verification117118Relevant native candidates are the component registration unit checks, component119base-contract checks, and the extension examples. The extension examples are120fit-heavy and should remain skip-expensive unless a verifier deliberately bounds121them; prefer the bundled skeleton `--help` check and static registry/config-space122checks first.