Skip to content

API Reference

This page is generated from the public objects declared in src/xwhy/**/__init__.py. Adding or removing an object from a package's __all__ updates this index during the next documentation build.

Select an object for its full signature, parameters, return values, and documented members.

Explainers

Object Description
xwhy.ImageClassificationExplainer Explainer for image classification models.
xwhy.ImageGenerationAndEditingExplainer Explainer for image generation and editing tasks.
xwhy.LLMExplainer Explainer for LLM tasks integrating the full GSMILE pipeline.
xwhy.PointCloudExplainer Explainer for Pointcloud tasks.
xwhy.TabularExplainer Explainer for Tabular models utilizing the SMILE algorithm.
xwhy.TextExplainer Explainer for natural language processing (NLP) text classification tasks.

Core abstractions and results

Object Description
xwhy.core.BaseExplainer Abstract base class for all xwhy explainers.
xwhy.core.BaseXWhyResult Abstract base container for shared explanation results.
xwhy.core.ExplainerConfig Explainer config.
xwhy.core.ExplanationPipeline Abstract pipeline orchestrator for explanation process.
xwhy.core.ImageClassificationConfig Configuration for the Image Classification explainer.
xwhy.core.LLMConfig Configuration for the LLM explainer.
xwhy.core.TabularConfig Configuration for the Tabular explainer.
xwhy.core.XWhyError Base exception for xwhy package.

Plots

Object Description
xwhy.plots.bar Create a bar plot of a set of XWhy values.
xwhy.plots.BaseTextPlotter Abstract base class for text plots.
xwhy.plots.beeswarm Create a beeswarm plot (requires multiple instances/2D data).
xwhy.plots.decision Visualize model decisions using cumulative XWhy values.
xwhy.plots.embedding Use the XWhy values as an embedding projected to 2D (requires 2D data).
xwhy.plots.Explanation Container for attribution values, mirroring shap.Explanation.
xwhy.plots.force Visualize the given XWhy values with an additive force layout.
xwhy.plots.group_difference Plot the difference in mean XWhy values between two groups (2D data).
xwhy.plots.heatmap Create a heatmap plot (requires multiple instances/2D data).
xwhy.plots.image Plot XWhy values for image inputs.
xwhy.plots.image_heatmap Plot a heatmap of feature importance over image superpixels.
xwhy.plots.image_to_text Plot XWhy values for image inputs with text outputs.
xwhy.plots.initjs Do nothing; kept so SHAP-style notebooks keep running unchanged.
xwhy.plots.monitoring Create a monitoring plot over time or indices (requires 2D data).
xwhy.plots.NativeHeatmapPlotter Native matplotlib implementation of text heatmap plot.
xwhy.plots.partial_dependence Plot the partial dependence of a model on a single feature.
xwhy.plots.plot_dataset Plot dataset or single point with flexible matplotlib-style arguments.
xwhy.plots.plot_explanation_waterfall Create a dynamic waterfall plot for explanation method coefficients.
xwhy.plots.plot_feature_bar_chart Generate and optionally save a Plotly bar chart for feature contributions.
xwhy.plots.plot_feature_box_plot Generate and optionally save a Plotly box plot for feature contributions.
xwhy.plots.plot_feature_contributions Visualize feature contributions using a horizontal bar chart.
xwhy.plots.plot_image Display an image (Tensor, Numpy, PIL, or Path).
xwhy.plots.plot_method_contributions Visualize feature contributions for a given explanation method.
xwhy.plots.scatter Create a dependence scatter plot (requires multiple instances/2D data).
xwhy.plots.text Plot a text explanation using coloured, self-contained HTML.
xwhy.plots.text_heatmap Plot a heatmap visualization for the given explanation result.
xwhy.plots.TextPlotterFactory Factory for creating text visualization instances.
xwhy.plots.TextPlotterType Enumeration for supported text plot backends.
xwhy.plots.violin Create a violin plot (requires multiple instances/2D data).
xwhy.plots.waterfall Plot an explanation of a single prediction as a waterfall plot.

Distances

Object Description
xwhy.distance.AndersonDarlingDistance Anderson-Darling distance metric (Custom Implementation).
xwhy.distance.BaseDistance Abstract base class for unified distance implementations.
xwhy.distance.BaseNumericDistance Base class for handling dimensionality of numerical distances.
xwhy.distance.CosineDistance Cosine distance metric.
xwhy.distance.CvMDistance Cramer-Von Mises distance metric (Custom Implementation).
xwhy.distance.DistanceNormalizer Normalize distance values into similarity scores.
xwhy.distance.DistanceType Enumeration for supported distance metrics.
xwhy.distance.DTSDistance DTS distance metric (Custom Implementation: Combination of AD and CVM).
xwhy.distance.KSDistance Kolmogorov-Smirnov distance metric (Custom Implementation).
xwhy.distance.KuiperDistance Kuiper distance metric (Custom Implementation).
xwhy.distance.WassersteinDistance Wasserstein distance metric (Custom Implementation).
xwhy.distance.WMDDistance Word Mover's Distance implementation for Text Data.

Models

Object Description
xwhy.models.BaseClassification Base class for all classification implementations.
xwhy.models.BaseEmbedding Base class for all embedding implementations.
xwhy.models.BaseSegmentation Base class for all segmentation implementations.
xwhy.models.ClassificationFactory Manage classification model instantiation via a registry.
xwhy.models.ClassificationType Supported classification backends.
xwhy.models.EmbeddingFactory Manage embedding model instantiation via a registry.
xwhy.models.EmbeddingType Supported embedding backends.
xwhy.models.SegmentationFactory Manage segmentation model instantiation via a registry.
xwhy.models.SegmentationType Supported segmentation backends.
xwhy.models.TabularModelAdapter Wrap tabular models to provide a unified prediction interface.
xwhy.models.TorchvisionClassification Classification backend for standard torchvision models.
xwhy.models.TorchvisionSegmentation Segmentation backend for standard torchvision models.
xwhy.models.Word2VecEmbedding Word2Vec embedding backend.

Providers

Object Description
xwhy.providers.BaseProvider Abstract interface for external AI providers.
xwhy.providers.OpenAIProvider OpenAI implementation of the provider interface.
xwhy.providers.ProviderFactory Factory for provider implementations.
xwhy.providers.ProviderResolver Resolver mapping provider types to default instantiation logic.
xwhy.providers.ProviderType Supported provider types.

Perturbation

Object Description
xwhy.perturbation.BasePerturbation Abstract base class for perturbation strategies.
xwhy.perturbation.ImagePerturbation Perturbation strategy for images using superpixels and Bernoulli sampling.
xwhy.perturbation.TextPerturbation Generate binary perturbations for text.

Surrogate models

Object Description
xwhy.surrogate.BaseSurrogate Abstract base class for all surrogate models.
xwhy.surrogate.LinearRegressionSurrogate Surrogate wrapper for linear models like OLS and Ridge.
xwhy.surrogate.SurrogateFactory Factory class for instantiating surrogate models.
xwhy.surrogate.SurrogateTrainer Service for training and evaluating surrogate models.
xwhy.surrogate.SurrogateType Enumeration for supported surrogate model types.
xwhy.surrogate.TreeBasedSurrogate Surrogate wrapper for tree-based models like Random Forest and XGBoost.

Metrics

Object Description
xwhy.metrics.calculate_stability_score Calculate stability metrics between two explanation results.
xwhy.metrics.calculate_token_auc Calculate the Area Under the ROC Curve (AUC) for token importance.
xwhy.metrics.ImageCoverageMetrics Metrics for evaluating image explanation coverage.
xwhy.metrics.RegressionMetricResult Data container for regression evaluation metrics.
xwhy.metrics.RegressionMetrics Utility for calculating comprehensive regression metrics.

Configuration

Object Description
xwhy.config.Settings Global application settings.
xwhy.settings Public XWhy API object settings.

Utilities

Object Description
xwhy.utils.denormalize_tensor Reverse the normalization applied to an image tensor.
xwhy.utils.load_image_as_tensor Load an image from disk and apply preprocessing transforms.
xwhy.utils.numpy_image_to_tensor Preprocess a numpy image array using the specified transforms.
xwhy.utils.tensor_to_numpy_image Convert a batch tensor (1, C, H, W) to a NumPy image (H, W, C).

Datasets

Object Description
xwhy.datasets.download_i2ebench_dataset Download the I2EBench dataset from Google Drive and extract it.
xwhy.datasets.load_i2ebench_data Parse the I2EBench dataset with limits and file validation.

Module-level documentation is also generated under reference/xwhy/ for maintainers and existing deep links, but it is intentionally excluded from the public API index.