Skip to content

Use enums instead of custom dictionaries where possible #362

Description

@EZoni

I think the code would be more readable and robust if we used enums instead of custom dictionaries where possible.

One use case that I think would be ready to switch is the ML model type. For example, this

class ModelType(Enum):
    neural_network_single = "Neural Network (single)"
    neural_network_ensemble = "Neural Network (ensemble)"
    gaussian_process = "Gaussian Process"

would allow to stop relying on string checks like if model_type == "NN", where the correspondence between "NN" and "Neural Network (single)" is defined in a custom dictionary, currently

model_type_tag_dict = {
"Gaussian Process": "GP",
"Neural Network (single)": "NN",
"Neural Network (ensemble)": "ensemble_NN",
}

and replace them with if model_type == ModelType.neural_network, while still leaving access to a user-friendly string representation to be exposed in the UI (e.g., "Neural Network (single)").

Something similar probably can be done for other variables related to selectors and other UI components.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cleaningChanges related to code cleaningdashboardChanges related to the dashboard

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions