aboutsummaryrefslogtreecommitdiff
path: root/.venv/lib/python3.12/site-packages/azure/ai/ml/entities/_component/automl_component.py
blob: 3e7be727f80e88ee870d78aa45f974c02087916f (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------

from typing import Any, Optional

from azure.ai.ml._schema import PathAwareSchema
from azure.ai.ml._schema.component.automl_component import AutoMLComponentSchema
from azure.ai.ml.constants._common import COMPONENT_TYPE
from azure.ai.ml.constants._component import NodeType
from azure.ai.ml.entities._component.component import Component


class AutoMLComponent(Component):
    """AutoML component entity, used to define an automl component.

    AutoML Component will only be used "internally" for the mentioned scenarios that need it. AutoML Component schema is
    not intended to be used by the end users and therefore it won't be provided to the end users and it won't have
    public documentation for the users.

    :param task: Task of the component.
    :type task: str
    """

    def __init__(
        self,
        *,
        task: Optional[str] = None,
        **kwargs: Any,
    ) -> None:
        kwargs[COMPONENT_TYPE] = NodeType.AUTOML
        super(AutoMLComponent, self).__init__(**kwargs)
        self._task = task

    @property
    def task(self) -> Optional[str]:
        """Returns task of the component."""
        return self._task

    @classmethod
    def _create_schema_for_validation(cls, context: Any) -> PathAwareSchema:
        return AutoMLComponentSchema(context=context)