Source code for fl4health.feature_alignment.tabular_type
from __future__ import annotations
from enum import Enum
from flwr.common.typing import Scalar
[docs]
class TabularType(str, Enum):
NUMERIC = "numeric"
BINARY = "binary"
ORDINAL = "ordinal"
STRING = "string"
[docs]
@staticmethod
def get_default_fill_value(tabular_type: TabularType | str) -> Scalar:
if tabular_type is TabularType.NUMERIC:
return 0.0
elif tabular_type is TabularType.BINARY:
return 0
elif tabular_type is TabularType.STRING:
return "N/A"
elif tabular_type is TabularType.ORDINAL:
return "UNKNOWN"
else:
raise ValueError("Invalid Tabular Data Type.")