コード例 #1
0
    def predict(self, num):
        """Predicts the label for num samples with self.classifier.

        Args:
            num: int. The number of samples to predict the label for.
        """
        if not self.classifier_model_dict:
            raise Exception('No classifier found')
        string_classifier = StringClassifier()
        string_classifier.from_dict(self.classifier_model_dict)
        doc_ids = string_classifier.add_docs_for_predicting(
            self.docs_to_classify[:num])
        for doc_id in doc_ids:
            string_classifier.predict_label_for_doc(doc_id)
コード例 #2
0
    def predict(self, num):
        """Predicts the label for num samples with self.classifier.

        Args:
            num: int. The number of samples to predict the label for.
        """
        if not self.classifier_model_dict:
            raise Exception('No classifier found')
        string_classifier = StringClassifier()
        string_classifier.from_dict(self.classifier_model_dict)
        doc_ids = string_classifier.add_docs_for_predicting(
            self.docs_to_classify[:num])
        for doc_id in doc_ids:
            string_classifier.predict_label_for_doc(doc_id)