Source code for gunz_ml.consts

"""
Defines project-wide constant enumerations.

This module contains enumerations used for configuration and for controlling
the application's execution mode. Using enums ensures that choices are
consistent and type-safe.
"""
# =============================================================================
# METADATA
# =============================================================================
__author__ = "Yeremia Gunawan Adhisantoso"
__email__ = "adhisant@tnt.uni-hannover.de"
__license__ = "Clear BSD"
__version__ = "1.2.0"

# =============================================================================
# STANDARD LIBRARY IMPORTS
# =============================================================================
from gunz_utils.enums import BaseStrEnum

# =============================================================================
# CONSTANT DEFINITIONS
# =============================================================================

[docs] class OptunaType(BaseStrEnum): """ Defines the types of suggestion methods available in Optuna. This enum uses string values for improved readability in configuration files. It also includes a converter to handle legacy or case-insensitive values. """ INT = "int" FLOAT = "float" LOGARITHM = "logarithm" CATEGORICAL = "categorical" @classmethod def _missing_(cls, value): """ Handles conversion of legacy or non-standard string values. """ if not isinstance(value, str): return super()._missing_(value) value_lower = value.lower() #? Handle special shorthand cases first. if value_lower == "log": return cls.LOGARITHM if value_lower == "cat": return cls.CATEGORICAL return super()._missing_(value)
[docs] class Mode(BaseStrEnum): """ Defines the primary execution modes for the application. This enum is case-insensitive, so "OPTIMIZE" and "optimize" are treated as the same member. """ OPTIMIZE = "optimize" RUN = "run" INIT = "init" LOAD = "load" EXPORT = "export" PLOT = "plot" ANALYZE = "analyze" CLEANUP = "cleanup"