precision_metric function

Method to calculate the precision.