code: def ensemble(subresults):
      """
      Identifies the best prediction given the results from the submodels.
  
      Parameters
      ----------
      index : int
          The index within this index to ensemble
  
      subresults : List[Dict[str, torch.Tensor]]
  
      Returns
      -------
      The index of the best submodel.
      """
  
      # Choose the highest average confidence span.
  
      span_start_probs = sum(
          subresult["span_start_probs"] for subresult in subresults
      ) / len(subresults)
      span_end_probs = sum(
          subresult["span_end_probs"] for subresult in subresults
      ) / len(subresults)
      return BidirectionalAttentionFlow.get_best_span(
          span_start_probs.log(), span_end_probs.log()
      )
  
file_path: magnitude/pymagnitude/third_party/allennlp/models/reading_comprehension/bidaf_ensemble.py
imports: from __future__ import division
  from __future__ import absolute_import
  import torch
  from allennlp.common.checks import ConfigurationError
  from allennlp.models.ensemble import Ensemble
  from allennlp.models.archival import load_archive
  from allennlp.models.model import Model
  from allennlp.models.reading_comprehension.bidaf import BidirectionalAttentionFlow
  from allennlp.common import Params
  from allennlp.data import Vocabulary
  from allennlp.training.metrics import SquadEmAndF1
label_desc: Use image node_id 1 for calling a global function with example usage: ensemble(subresults) and returns: BidirectionalAttentionFlow