8. A non-transitory computer-readable storage medium storing instructions that when executed by a computer cause the computer to perform a method, the method comprising: computing a first set of activity probabilities based on contextual information for a first set of historical activities and an activity-prediction model for a target activity, wherein an activity probability indicates a likelihood that the target activity has occurred; comparing a first set of probability thresholds with the first set of activity probabilities to determine a prediction success rate for each probability threshold; computing a utility score for each probability threshold based on the prediction success rates and a utility function, wherein the utility function has the form: 
 U ( P th )= U 1 (TP)+ U 2 (FP)+ U 3 (FN)+ U 4 (TN); wherein P th is the threshold value used to determine whether a historical activity matches the target activity, wherein U 1 (TP) and U 4 (TN) compute a benefit of making a recommendation based on predicting a true positive and a true negative, respectively, and wherein U 2 (FP) and U 3 (FN) compute a cost of making a recommendation based on predicting a false positive and a false negative, respectively; selecting a first probability threshold whose utility score is greater than or equal to a baseline utility score and other utility scores of the first set of thresholds; and assigning the first probability threshold to the activity-prediction model.
11. The storage medium of claim 8 , wherein the method further comprises: determining that the utility score for the first probability threshold is greater than or equal to the baseline utility score; selecting a second set of probability thresholds whose range includes the first probability threshold and is smaller than that of the first set of probability thresholds, and wherein the second set of probability thresholds has an average-deviation that is lower than that of the first set of probability thresholds; scoring each probability threshold in the second set of probability threshold using the utility function to produce a second set of utility scores; and determining, based on the second set of utility scores, a second probability threshold that has the highest utility score.