def evaluate(self, text): """ Given a string of `text`, compute confusion matrix for the classification task. """ cx = BinaryConfusion() for (L, P, R, gold, _) in self.candidates(text): guess = self.predict(L, P, R) cx.update(gold, guess) if not gold and guess: logging.debug("False pos.: L='{}', R='{}'.".format(L, R)) elif gold and not guess: logging.debug("False neg.: L='{}', R='{}'.".format(L, R)) return cx
def evaluate(self, text): """ Given a string of `text`, compute confusion matrix for the classification task. """ cx = BinaryConfusion() for (L, P, R, gold, _) in Detector.candidates(text): guess = self.predict(L, P, R) cx.update(gold, guess) if not gold and guess: logging.debug("False pos.: L='{}', R='{}'.".format(L, R)) elif gold and not guess: logging.debug("False neg.: L='{}', R='{}'.".format(L, R)) return cx