SeldonIO / alibi-detect

Algorithms for outlier, adversarial and drift detection
https://docs.seldon.io/projects/alibi-detect/en/stable/
Other
2.21k stars 220 forks source link

Type detector kwarg's as Literal where relevant #463

Open ascillitoe opened 2 years ago

ascillitoe commented 2 years ago

Some detector kwarg's are "magic strings" with a limited set of options, e.g. correction and alternative is the univariate detectors. We should update these kwarg's to type them as Literal. For example, in ksdrift.py:

            correction: str = 'bonferroni',
            alternative: str = 'two-sided',

would become:

            correction: str = Literal['bonferroni', 'fdr']
            alternative: str = Literal['two-sided', 'less', 'greater']

The same changes should be made in the pydantic schema's once the config PR is merged (#389), in order to tighten the validation of these kwarg's.

ascillitoe commented 1 year ago

The same should also be done for other public facing classes, such as DeepKernel.