update weighted_pred function