Summary
Replace raw string values for categorical options with str-inheriting Enums.
Current pattern
"algorithm": "vb",
"init": "random",
"compat_mode": "strict_legacy",
"explained_var_solver": "auto",
Manual string comparisons scattered throughout _pca_full.py, _full_update.py, etc.
Proposed change
from enum import Enum
class Algorithm(str, Enum):
VB = "vb"
MAP = "map"
class InitMethod(str, Enum):
RANDOM = "random"
CUSTOM = "custom"
str inheritance makes this non-breaking — existing string arguments coerce automatically and == comparisons still work.
Benefits
- IDE autocomplete and type-checking for option values
- Invalid values caught at construction time
- mypy can verify exhaustive match
Scope
~40 lines of Enum definitions + validators. Non-breaking.
Summary
Replace raw string values for categorical options with
str-inheriting Enums.Current pattern
Manual string comparisons scattered throughout
_pca_full.py,_full_update.py, etc.Proposed change
strinheritance makes this non-breaking — existing string arguments coerce automatically and==comparisons still work.Benefits
Scope
~40 lines of Enum definitions + validators. Non-breaking.