simplify cross entropy calculation