signxai.tf_signxai package
Subpackages
Submodules
signxai.tf_signxai.methods module
Refactored TensorFlow explanation methods with a unified execution entry point.
signxai.tf_signxai.methods_family module
TensorFlow integration for Method Family Architecture. This module provides an alternative entry point that uses the new family-based approach.
- signxai.tf_signxai.methods_family.calculate_relevancemap_with_families(method: str, x: ndarray, model, neuron_selection: int, **kwargs)[source]
Calculate relevance map using the Method Family Architecture. Falls back to original wrappers if needed.
- Parameters:
method – The XAI method to use
x – Input data as numpy array
model – TensorFlow/Keras model (without softmax)
neuron_selection – Target class/neuron index
**kwargs – Additional method-specific parameters
- Returns:
Relevance map as numpy array
Module contents
- signxai.tf_signxai.validate_input(*args, **kwargs)[source]
Dummy validate_input function. Does nothing.
- signxai.tf_signxai.calculate_relevancemap(method: str, x: ndarray, model, neuron_selection: int, **kwargs)[source]
Calculates the relevance map for a given input and model using the specified TensorFlow-based method.
- Parameters:
method (str) – The XAI method to use (e.g., “gradient”, “lrp.epsilon”).
x (np.ndarray) – The input data (e.g., image) as a NumPy array.
model – The TensorFlow/Keras model (must be a model without softmax for many methods).
neuron_selection (int) – The index of the output neuron for which to generate the explanation.
**kwargs – Additional arguments specific to the chosen XAI method.
- Returns:
The calculated relevance map.
- Return type:
np.ndarray
- Raises:
ValueError – If the method is not supported or if inputs are invalid.