class_docstr: This class implements the Biattentive Classification Network model described
  in section 5 of `Learned in Translation: Contextualized Word Vectors (NIPS 2017)
  <https://arxiv.org/abs/1708.00107>`_ for text classification. We assume we're
  given a piece of text, and we predict some output label.
  
  At a high level, the model starts by embedding the tokens and running them through
  a feed-forward neural net (``pre_encode_feedforward``). Then, we encode these
  representations with a ``Seq2SeqEncoder`` (``encoder``). We run biattention
  on the encoder output represenatations (self-attention in this case, since
  the two representations that typically go into biattention are identical) and
  get out an attentive vector representation of the text. We combine this text
  representation with the encoder outputs computed earlier, and then run this through
  yet another ``Seq2SeqEncoder`` (the ``integrator``). Lastly, we take the output of the
  integrator and max, min, mean, and self-attention pool to create a final representation,
  which is passed through a maxout network or some feed-forward layers
  to output a classification (``output_layer``).
  
  Parameters
  ----------
  vocab : ``Vocabulary``, required
      A Vocabulary, required in order to compute sizes for input/output projections.
  text_field_embedder : ``TextFieldEmbedder``, required
      Used to embed the ``tokens`` ``TextField`` we get as input to the model.
  embedding_dropout : ``float``
      The amount of dropout to apply on the embeddings.
  pre_encode_feedforward : ``FeedForward``
      A feedforward network that is run on the embedded tokens before they
      are passed to the encoder.
  encoder : ``Seq2SeqEncoder``
      The encoder to use on the tokens.
  integrator : ``Seq2SeqEncoder``
      The encoder to use when integrating the attentive text encoding
      with the token encodings.
  integrator_dropout : ``float``
      The amount of dropout to apply on integrator output.
  output_layer : ``Union[Maxout, FeedForward]``
      The maxout or feed forward network that takes the final representations and produces
      a classification prediction.
  elmo : ``Elmo``, optional (default=``None``)
      If provided, will be used to concatenate pretrained ELMo representations to
      either the integrator output (``use_integrator_output_elmo``) or the
      input (``use_input_elmo``).
  use_input_elmo : ``bool`` (default=``False``)
      If true, concatenate pretrained ELMo representations to the input vectors.
  use_integrator_output_elmo : ``bool`` (default=``False``)
      If true, concatenate pretrained ELMo representations to the integrator output.
  initializer : ``InitializerApplicator``, optional (default=``InitializerApplicator()``)
      Used to initialize the model parameters.
  regularizer : ``RegularizerApplicator``, optional (default=``None``)
      If provided, will be used to calculate the regularization penalty during training.
class_docstr_tok: ["This","class","implements","the","Biattentive","Classification","Network","model","described","in","section","5","of","`","Learned","in","Translation",":","Contextualized","Word","Vectors","(","NIPS","2017",")","<","https",":","\/\/arxiv.org\/abs\/1708.00107",">","`","_","for","text","classification",".","We","assume","we're","given","a","piece","of","text",",","and","we","predict","some","output","label",".","At","a","high","level",",","the","model","starts","by","embedding","the","tokens","and","running","them","through","a","feed-forward","neural","net","(","``","pre_encode_feedforward","``",")",".","Then",",","we","encode","these","representations","with","a","``","Seq2SeqEncoder","``","(","``","encoder","``",")",".","We","run","biattention","on","the","encoder","output","represenatations","(","self-attention","in","this","case",",","since","the","two","representations","that","typically","go","into","biattention","are","identical",")","and","get","out","an","attentive","vector","representation","of","the","text",".","We","combine","this","text","representation","with","the","encoder","outputs","computed","earlier",",","and","then","run","this","through","yet","another","``","Seq2SeqEncoder","``","(","the","``","integrator","``",")",".","Lastly",",","we","take","the","output","of","the","integrator","and","max",",","min",",","mean",",","and","self-attention","pool","to","create","a","final","representation",",","which","is","passed","through","a","maxout","network","or","some","feed-forward","layers","to","output","a","classification","(","``","output_layer","``",")",".","Parameters","--","--","--","--","--","vocab",":","``","Vocabulary","``",",","required","A","Vocabulary",",","required","in","order","to","compute","sizes","for","input\/output","projections",".","text_field_embedder",":","``","TextFieldEmbedder","``",",","required","Used","to","embed","the","``","tokens","``","``","TextField","``","we","get","as","input","to","the","model",".","embedding_dropout",":","``","float","``","The","amount","of","dropout","to","apply","on","the","embeddings",".","pre_encode_feedforward",":","``","FeedForward","``","A","feedforward","network","that","is","run","on","the","embedded","tokens","before","they","are","passed","to","the","encoder",".","encoder",":","``","Seq2SeqEncoder","``","The","encoder","to","use","on","the","tokens",".","integrator",":","``","Seq2SeqEncoder","``","The","encoder","to","use","when","integrating","the","attentive","text","encoding","with","the","token","encodings",".","integrator_dropout",":","``","float","``","The","amount","of","dropout","to","apply","on","integrator","output",".","output_layer",":","``","Union","[","Maxout",",","FeedForward","]","``","The","maxout","or","feed","forward","network","that","takes","the","final","representations","and","produces","a","classification","prediction",".","elmo",":","``","Elmo","``",",","optional","(","default=","``","None","``",")","If","provided",",","will","be","used","to","concatenate","pretrained","ELMo","representations","to","either","the","integrator","output","(","``","use_integrator_output_elmo","``",")","or","the","input","(","``","use_input_elmo","``",")",".","use_input_elmo",":","``","bool","``","(","default=","``","False","``",")","If","true",",","concatenate","pretrained","ELMo","representations","to","the","input","vectors",".","use_integrator_output_elmo",":","``","bool","``","(","default=","``","False","``",")","If","true",",","concatenate","pretrained","ELMo","representations","to","the","integrator","output",".","initializer",":","``","InitializerApplicator","``",",","optional","(","default=","``","InitializerApplicator","(",")","``",")","Used","to","initialize","the","model","parameters",".","regularizer",":","``","RegularizerApplicator","``",",","optional","(","default=","``","None","``",")","If","provided",",","will","be","used","to","calculate","the","regularization","penalty","during","training","."]
docstr: Does a simple argmax over the class probabilities, converts indices to string labels, and
  adds a ``"label"`` key to the dictionary with the result.
docstr_tok: ["Does","a","simple","argmax","over","the","class","probabilities",",","converts","indices","to","string","labels",",","and","adds","a","``","``","label","''","``","key","to","the","dictionary","with","the","result","."]
code: def decode(self, output_dict):
      """
      Does a simple argmax over the class probabilities, converts indices to string labels, and
      adds a ``"label"`` key to the dictionary with the result.
      """
      predictions = (
          output_dict["class_probabilities"].cpu().data.numpy()
      )
      argmax_indices = numpy.argmax(predictions, axis=-1)
      labels = [
          self.vocab.get_token_from_index(x, namespace="labels")
          for x in argmax_indices
      ]
      output_dict["label"] = labels
      return output_dict
  
imports: from __future__ import division
  from __future__ import absolute_import
  import numpy
  import torch
  from torch import nn
  import torch.nn.functional
  from allennlp.common import Params
  from allennlp.common.checks import check_dimensions_match, ConfigurationError
  from allennlp.data import Vocabulary
  from allennlp.modules import Elmo, FeedForward, Maxout, Seq2SeqEncoder, TextFieldEmbedder
  from allennlp.models.model import Model
  from allennlp.nn import InitializerApplicator, RegularizerApplicator
  from allennlp.nn import util
  from allennlp.training.metrics import CategoricalAccuracy
label_desc: Use image node_id 3 for calling the BiattentiveClassificationNetwork obj's underlying member method code with example usage: obj.decode(output_dict) and returns: output_dict