TextClassifierPredictor(self, model:allennlp.models.model.Model, -> None

Predictor for any model that takes in a sentence and returns a single class for it. In particular, it can be used with the BasicClassifier model.


TextClassifierPredictor.predictions_to_labeled_instances(self,, outputs:Dict[str, numpy.ndarray]) -> List[]

This function takes a model's outputs for an Instance, and it labels that instance according to the output. For example, in classification this function labels the instance according to the class with the highest probability. This function is used to to compute gradients of what the model predicted. The return type is a list because in some tasks there are multiple predictions in the output (e.g., in NER a model predicts multiple spans). In this case, each instance in the returned list of Instances contains an individual entity prediction as the label.