A data-driven study of variability in X-ray binaries using machine learning