結果 : find average cost from cost function