pred_acc function

Compute prediction accuracy