Skip to content

Tags

yohou.utils.tags.Tags dataclass

Metadata tags for yohou estimators.

This dataclass holds metadata about estimator capabilities and requirements, following the same pattern as sklearn.utils.Tags but tailored for time series forecasting.

Parameters

Name Type Description Default
estimator_type (transformer, forecaster, scorer, similarity, splitter)

Type of estimator. Determines which specialized tags are relevant.

"transformer"
requires_fit bool

Whether the estimator needs to be fitted before use.

True
non_deterministic bool

Whether the estimator produces non-deterministic results (e.g., uses random sampling).

False
input_tags InputTags or None

Tags describing input requirements. Automatically initialized if None

None
target_tags TargetTags or None

Tags describing target requirements. Automatically initialized if None.

None
transformer_tags TransformerTags or None

Tags specific to transformers. Only relevant when estimator_type="transformer". Automatically initialized if None and estimator_type="transformer".

None
forecaster_tags ForecasterTags or None

Tags specific to forecasters. Only relevant when estimator_type="forecaster". Automatically initialized if None and estimator_type="forecaster".

None
scorer_tags ScorerTags or None

Tags specific to scorers/metrics. Only relevant when estimator_type="scorer". Automatically initialized if None and estimator_type="scorer".

None
similarity_tags SimilarityTags or None

Tags specific to similarity measures. Only relevant when estimator_type="similarity". Automatically initialized if None and estimator_type="similarity".

None
splitter_tags SplitterTags or None

Tags specific to cross-validation splitters. Only relevant when estimator_type="splitter". Automatically initialized if None and estimator_type="splitter".

None

Source Code

Show/Hide source
@dataclass
class Tags:
    """Metadata tags for yohou estimators.

    This dataclass holds metadata about estimator capabilities and requirements,
    following the same pattern as sklearn.utils.Tags but tailored for time series
    forecasting.

    Parameters
    ----------
    estimator_type : {"transformer", "forecaster", "scorer", "similarity", "splitter"} or None, default=None
        Type of estimator. Determines which specialized tags are relevant.
    requires_fit : bool, default=True
        Whether the estimator needs to be fitted before use.
    non_deterministic : bool, default=False
        Whether the estimator produces non-deterministic results (e.g., uses
        random sampling).
    input_tags : InputTags or None, default=None
        Tags describing input requirements. Automatically initialized if None
    target_tags : TargetTags or None, default=None
        Tags describing target requirements. Automatically initialized if None.
    transformer_tags : TransformerTags or None, default=None
        Tags specific to transformers. Only relevant when estimator_type="transformer".
        Automatically initialized if None and estimator_type="transformer".
    forecaster_tags : ForecasterTags or None, default=None
        Tags specific to forecasters. Only relevant when estimator_type="forecaster".
        Automatically initialized if None and estimator_type="forecaster".
    scorer_tags : ScorerTags or None, default=None
        Tags specific to scorers/metrics. Only relevant when estimator_type="scorer".
        Automatically initialized if None and estimator_type="scorer".
    similarity_tags : SimilarityTags or None, default=None
        Tags specific to similarity measures. Only relevant when estimator_type="similarity".
        Automatically initialized if None and estimator_type="similarity".
    splitter_tags : SplitterTags or None, default=None
        Tags specific to cross-validation splitters. Only relevant when estimator_type="splitter".
        Automatically initialized if None and estimator_type="splitter".

    """

    estimator_type: Literal["transformer", "forecaster", "scorer", "similarity", "splitter"] | None = None
    requires_fit: bool = True
    non_deterministic: bool = False
    input_tags: InputTags | None = None
    target_tags: TargetTags | None = None
    transformer_tags: TransformerTags | None = None
    splitter_tags: SplitterTags | None = None
    forecaster_tags: ForecasterTags | None = None
    scorer_tags: ScorerTags | None = None
    similarity_tags: SimilarityTags | None = None

    def __post_init__(self):
        """Initialize nested tags after dataclass initialization."""
        # Always initialize input_tags and target_tags
        if self.input_tags is None:
            self.input_tags = InputTags()
        if self.target_tags is None:
            self.target_tags = TargetTags()

        # Initialize type-specific tags based on estimator_type
        if self.estimator_type == "transformer" and self.transformer_tags is None:
            self.transformer_tags = TransformerTags()
        elif self.estimator_type == "forecaster" and self.forecaster_tags is None:
            self.forecaster_tags = ForecasterTags()
        elif self.estimator_type == "scorer" and self.scorer_tags is None:
            self.scorer_tags = ScorerTags()
        elif self.estimator_type == "similarity" and self.similarity_tags is None:
            self.similarity_tags = SimilarityTags()
        elif self.estimator_type == "splitter" and self.splitter_tags is None:
            self.splitter_tags = SplitterTags()

Methods

__post_init__()

Initialize nested tags after dataclass initialization.

Source Code
Show/Hide source
def __post_init__(self):
    """Initialize nested tags after dataclass initialization."""
    # Always initialize input_tags and target_tags
    if self.input_tags is None:
        self.input_tags = InputTags()
    if self.target_tags is None:
        self.target_tags = TargetTags()

    # Initialize type-specific tags based on estimator_type
    if self.estimator_type == "transformer" and self.transformer_tags is None:
        self.transformer_tags = TransformerTags()
    elif self.estimator_type == "forecaster" and self.forecaster_tags is None:
        self.forecaster_tags = ForecasterTags()
    elif self.estimator_type == "scorer" and self.scorer_tags is None:
        self.scorer_tags = ScorerTags()
    elif self.estimator_type == "similarity" and self.similarity_tags is None:
        self.similarity_tags = SimilarityTags()
    elif self.estimator_type == "splitter" and self.splitter_tags is None:
        self.splitter_tags = SplitterTags()