generic prediction function for multiple models