  Counterfactual explanations (CEs) aim to enhance the interpretability of
machine learning models by illustrating how alterations in input features would
affect the resulting predictions. Common CE approaches require an additional
model and are typically constrained to binary counterfactuals. In contrast, we
propose a novel method that operates directly on the latent space of a
generative model, specifically a Diffusion Autoencoder (DAE). This approach
offers inherent interpretability by enabling the generation of CEs and the
continuous visualization of the model's internal representation across decision
boundaries.
  Our method leverages the DAE's ability to encode images into a semantically
rich latent space in an unsupervised manner, eliminating the need for labeled
data or separate feature extraction models. We show that these latent
representations are helpful for medical condition classification and the
ordinal regression of severity pathologies, such as vertebral compression
fractures (VCF) and diabetic retinopathy (DR). Beyond binary CEs, our method
supports the visualization of ordinal CEs using a linear model, providing
deeper insights into the model's decision-making process and enhancing
interpretability.
  Experiments across various medical imaging datasets demonstrate the method's
advantages in interpretability and versatility. The linear manifold of the
DAE's latent space allows for meaningful interpolation and manipulation, making
it a powerful tool for exploring medical image properties. Our code is
available at https://github.com/matanat/dae_counterfactual.
