quantus.helpers.warn module
This modules holds a collection of perturbation functions i.e., ways to perturb an input or an explanation.
- quantus.helpers.warn.check_kwargs(kwargs)
Check that no additional kwargs are passed, i.e. the kwargs dict is empty. Raises an exception with helpful suggestions to fix the issue.
- Parameters:
- kwargs: optional
Keyword arguments.
- Returns:
- None
- quantus.helpers.warn.deprecation_warnings(kwargs: dict) None
Run deprecation warnings.
- Parameters:
- kwargs: optional
Keyword arguments.
- Returns:
- None
- quantus.helpers.warn.warn_absolute_operation(word: str = '') None
Warn if an absolute operation is applied, where the metric is defined otherwise.
- Parameters:
- word: string
A string for which is ‘’ or ‘not ‘.
- Returns:
- None
- quantus.helpers.warn.warn_different_array_lengths() None
Warn if the array lengths are different, for plotting.
- Returns:
- None
- quantus.helpers.warn.warn_empty_segmentation() None
Warn if the segmentation mask is empty.
- Returns:
- None
- quantus.helpers.warn.warn_iterations_exceed_patch_number(n_iterations: int, n_patches: int) None
Warn if the number of non-overlapping patches is lower than the number of iterations specified for this metric.
- Parameters:
- n_iterations: integer
The number of iterations specified in the metric.
- n_patches: integer
The number of patches specified in the metric.
- Returns:
- None
- quantus.helpers.warn.warn_max_size() None
Warns if the ratio is smaller than the maximum size, for attribution_localisaiton metric. Returns ——- None
- quantus.helpers.warn.warn_noise_zero(noise: float) None
Warn if noise is zero.
- Parameters:
- noise: float
The amount of noise.
- Returns:
- None
- quantus.helpers.warn.warn_normalise_operation(word: str = '') None
Warn if a normalisation operation is applied, where the metric is defined otherwise.
- Parameters:
- word: string
A string for which is ‘’ or ‘not ‘.
- Returns:
- None
- quantus.helpers.warn.warn_parameterisation(metric_name: str = 'Metric', sensitive_params: str = 'X, Y and Z.', data_domain_applicability: str = '', citation: str = 'INSERT CITATION')
Warn the parameterisation of the metric.
- Parameters:
- metric_name: string
The metric name.
- sensitive_params: string
The sensitive parameters of the metric.
- data_domain_applicability string
The applicability when it comes to data domains, default = “”.
- citation: string
The citation.
- Returns:
- None
- quantus.helpers.warn.warn_perturbation_caused_no_change(x: ndarray, x_perturbed: ndarray) None
Warn that perturbation applied to input caused no change so that input and perturbed input is the same.
- Parameters:
- x: np.ndarray
The original input that is considered unperturbed.
- x_perturbed: np.ndarray
The perturbed input.
- Returns:
- None
- quantus.helpers.warn.warn_segmentation(inside_attribution: float, total_attribution: float) None
Warn if the inside explanation is greater than total explanation.
- Parameters:
- inside_attribution: float
The size of inside attribution.
- total_attribution: float
The size of total attribution.
- Returns:
- None