fairxai.explain.explainer_manager package

Submodules

fairxai.explain.explainer_manager.basic_io_handler module

class fairxai.explain.explainer_manager.basic_io_handler.BaseIoHandler[source]

Bases: ABC

Abstract base class for all wizard interaction handlers.

Defines a standard interface for interactive framework usage. Subclasses (e.g., CLIHandler, GUIHandler, APIHandler) must implement these methods to handle user input/output according to their respective interaction mode.

abstract ask_choice(title: str, options: List[Any], message: str) Any[source]

Displays a list of options to the user and returns the selected one.

Parameters:
  • title (str) – Title of the current step or dialog.

  • options (List[Any]) – List of available options to choose from.

  • message (str) – Instruction or prompt message to the user.

Returns:

The selected option.

Return type:

Any

abstract confirm(message: str) bool[source]

Asks the user for confirmation (yes/no) and returns their response.

Parameters:

message (str) – The confirmation question.

Returns:

True if the user confirms, False otherwise.

Return type:

bool

abstract show_message(message: str)[source]

Displays a message, notification, or log entry to the user.

Parameters:

message (str) – The message to display.

fairxai.explain.explainer_manager.explainer_manager module

class fairxai.explain.explainer_manager.explainer_manager.ExplainerManager(dataset_type: str, model_type: str)[source]

Bases: object

Manages explainer discovery, compatibility filtering, and instantiation.

Auto-discovers all adapters in the adapter package, filters those compatible with the dataset type and model type, and allows easy instantiation of explainers by name.

Initialize the manager for a specific dataset type and model type.

Parameters:
  • dataset_type – Type of dataset (e.g., ‘tabular’, ‘image’, ‘text’).

  • model_type – Type of model (class name, e.g., ‘SklearnRandomForestClassifier’, ‘XGBoostClassifier’).

create_explainer(explainer_name: str, model_instance, dataset_instance) GenericExplainerAdapter[source]

Instantiate an explainer by name using the provided model and dataset.

Parameters:
  • explainer_name – Name of the explainer class.

  • model_instance – The trained model object.

  • dataset_instance – Dataset object.

Returns:

An initialized explainer instance.

Raises:

ValueError if explainer not found or not compatible.

list_available_compatible_explainers() List[Type[GenericExplainerAdapter]][source]

Return all explainer classes compatible with the current dataset/model.

fairxai.explain.explainer_manager.explainer_manager.import_all_adapters(package)[source]

Dynamically imports all modules in a package and its subpackages so that all subclasses of GenericExplainerAdapter are loaded.

fairxai.explain.explainer_manager.guided_explanation_wizard module

class fairxai.explain.explainer_manager.guided_explanation_wizard.GuidedExplanationWizard(io_handler)[source]

Bases: object

Interactive wizard that guides the user step-by-step through selecting:
  1. Dataset

  2. Model / Black Box

  3. Explainer (filtered by compatibility)

  4. Visualization mode

The wizard dynamically filters only compatible options at each step. It is interface-agnostic and can use CLI or GUI handlers for user interaction.

Represents a class responsible for managing explanations and handling input/output operations.

Attributes: manager (ExplainerManager): An instance of ExplainerManager for handling explanation-related tasks. io (Any): Input/output handler used for processing input/output operations. state (dict): Maintains the state information related to the class usage and its processing.

run(datasets_available: List[str], models_available: List[str]) dict[source]

Runs the guided selection process sequentially.

Parameters:
  • datasets_available – List of available dataset names or types.

  • models_available – List of available model names or types.

Returns:

Final configuration with dataset, model, explainer, and visualization.

Return type:

dict

Module contents