An optimisation-driven prediction method for automated diagnosis and prognosis