Add a avg precision cal function.