Пример #1
0
    def predict(self, Xs, context=None, **kwargs):
        """
        Produces list of most likely class labels as determined by the fine-tuned model.

        :param \*Xs: lists of text inputs, shape [batch, n_fields]
        :returns: list of class labels.
        """
        return BaseModel.predict(self, Xs, context=context, **kwargs)
Пример #2
0
    def predict(self, pairs):
        """
        Produces a list of most likely class labels as determined by the fine-tuned model.


        :param pairs: Array of text, shape [batch, 2]
        :returns: list of class labels.
        """
        return BaseModel.predict(self, pairs)
Пример #3
0
    def predict(self, Xs, max_length=None):
        """
        Produces list of most likely class labels as determined by the fine-tuned model.

        :param \*Xs: lists of text inputs, shape [batch, n_fields]
        :param max_length: the number of tokens to be included in the document representation.
                           Providing more than `max_length` tokens as input will result in truncation.
        :returns: list of class labels.
        """
        return BaseModel.predict(self, Xs, max_length=max_length)
Пример #4
0
    def predict(self, questions, answers):
        """
        Produces a list of most likely class labels as determined by the fine-tuned model.


        :param question: List or array of text, shape [batch]
        :param answers: List or array of text, shape [batch, n_answers]
        :returns: list of class labels.
        """
        raw_ids = BaseModel.predict(self, list(zip(questions, answers)))
        return [ans[i] for ans, i in zip(answers, raw_ids)]
Пример #5
0
    def predict(self, pairs, max_length=None):
        """
        Produces a list of most likely class labels as determined by the fine-tuned model.


        :param pairs: Array of text, shape [batch, 2]
        :param max_length: the number of byte-pair encoded tokens to be included in the document representation.
                           Providing more than `max_length` tokens as input will result in truncation.
        :returns: list of class labels.
        """
        return BaseModel.predict(self, pairs, max_length=max_length)
Пример #6
0
    def predict_proba(self, X1, X2, max_length=None):
        """
        Produces a probability distribution over classes for each example in X.


        :param X1: List or array of text, shape [batch]
        :param X2: List or array of text, shape [batch]
        :param max_length: the number of byte-pair encoded tokens to be included in the document representation.
                           Providing more than `max_length` tokens as input will result in truncation.
        :returns: list of dictionaries.  Each dictionary maps from a class label to its assigned class probability.
        """
        return BaseModel.predict(self, X1, X2, max_length=max_length)
Пример #7
0
    def predict(self, questions, answers, max_length=None):
        """
        Produces a list of most likely class labels as determined by the fine-tuned model.


        :param question: List or array of text, shape [batch]
        :param answers: List or array of text, shape [batch, n_answers]
        :param max_length: the number of byte-pair encoded tokens to be included in the document representation.
                           Providing more than `max_length` tokens as input will result in truncation.
        :returns: list of class labels.
        """
        raw_ids = BaseModel.predict(self,
                                    list(zip(questions, answers)),
                                    max_length=max_length)
        return [ans[i] for ans, i in zip(zip(*answers), raw_ids)]