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

Predictor for the DecomposableAttention model.


DecomposableAttentionPredictor.predict(self, premise:str, hypothesis:str) -> Dict[str, Any]

Predicts whether the hypothesis is entailed by the premise text.


  • premise : str A passage representing what is assumed to be true.

  • hypothesis : str A sentence that may be entailed by the premise.


A dictionary where the key "label_probs" determines the probabilities of each of [entailment, contradiction, neutral].


DecomposableAttentionPredictor.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.