added general function to collect prediction data