Refactor classifier_base::classify