Exemple #1
0
class FilterConfig(NamedTuple):
    attribution_method: str = IntegratedGradients.get_name()
    attribution_arguments: Dict[str, Any] = {
        arg: config.value
        for arg, config in ATTRIBUTION_METHOD_CONFIG[
            IntegratedGradients.get_name()].items()
    }
    prediction: str = "all"
    classes: List[str] = []
    count: int = 4
Exemple #2
0
class FilterConfig(NamedTuple):
    attribution_method: str = IntegratedGradients.get_name()
    # issue with mypy github.com/python/mypy/issues/8376
    attribution_arguments: Dict[str, Any] = {
        arg: config.value  # type: ignore
        for arg, config in ATTRIBUTION_METHOD_CONFIG[
            IntegratedGradients.get_name()].params.items()
    }
    prediction: str = "all"
    classes: List[str] = []
    num_examples: int = 4
Exemple #3
0
    for cls in SUPPORTED_ATTRIBUTION_METHODS
}


def _str_to_tuple(s):
    if isinstance(s, tuple):
        return s
    return tuple([int(i) for i in s.split()])


def _str_to_bool(s):
    return False if s == "False" else True


ATTRIBUTION_METHOD_CONFIG: Dict[str, ConfigParameters] = {
    IntegratedGradients.get_name():
    ConfigParameters(
        params={
            "n_steps":
            NumberConfig(value=25, limit=(2, None)),
            "method":
            StrEnumConfig(limit=SUPPORTED_METHODS, value="gausslegendre"),
        },
        post_process={"n_steps": int},
    ),
    FeatureAblation.get_name():
    ConfigParameters(params={
        "perturbations_per_eval":
        NumberConfig(value=1, limit=(1, 100))
    }, ),
    Deconvolution.get_name():