  Electrocardiography is the most common method to investigate the condition of
the heart through the observation of cardiac rhythm and electrical activity,
for both diagnosis and monitoring purposes. Analysis of electrocardiograms
(ECGs) is commonly performed through the investigation of specific patterns,
which are visually recognizable by trained physicians and are known to reflect
cardiac (dis)function. In this work we study the use of $\beta$-variational
autoencoders (VAEs) as an explainable feature extractor, and improve on its
predictive capacities by jointly optimizing signal reconstruction and cardiac
function prediction. The extracted features are then used for cardiac function
prediction using logistic regression. The method is trained and tested on data
from 7255 patients, who were treated for acute coronary syndrome at the Leiden
University Medical Center between 2010 and 2021. The results show that our
method significantly improved prediction and explainability compared to a
vanilla $\beta$-VAE, while still yielding similar reconstruction performance.
