apply_threshold function

Filter predictions based on score and rank