dianna
dianna copied to clipboard
Unclear error message when mistyping a method name
It should have given the valid options as well (RISE, LIME, kernelSHAP).
I happend to have fixed this in my attempt to split the method classes, see PR #325
try:
method_submodule = importlib.import_module(f'dianna.methods.{method.lower()}')
except ImportError as err:
raise Exception(f"Method {method} does not exist") from err
try:
method_class = getattr(method_submodule, f"{method}{modality}")
except AttributeError as err:
raise Exception(f"Data modality {modality} is not available for method {method}") from err```
This also handles the case of KernelSHAP for text, which isn't available.
My version doesn't give the valid methods / modalities though. Would it be doable to automatically get a list of those? I guess having them hardcoded in init.py is much easier.
@loostrum can we close this issue?
Not yet I think. The method name is no longer case sensitive and the error is better:
ValueError: Method RRISE does not exist
, but you don't get a list of the available methods yet, which was also part of this issue. I can add some code to do that as well.