docstr: Averages model parameters of serialized models based on the selected
  model strategy and metric.
  IMPORTANT: Depending on the metric the user might want to minimize or
  maximize. The maximize flag has to be chosen appropriately to reflect
  this.
  
  Parameters
  ----------
  model_path
      Path to the models directory.
  
  Returns
  -------
  Path to file with the averaged model.
docstr_tok: ["Averages","model","parameters","of","serialized","models","based","on","the","selected","model","strategy","and","metric",".","IMPORTANT",":","Depending","on","the","metric","the","user","might","want","to","minimize","or","maximize",".","The","maximize","flag","has","to","be","chosen","appropriately","to","reflect","this",".","Parameters","--","--","--","--","--","model_path","Path","to","the","models","directory",".","Returns","--","--","--","-","Path","to","file","with","the","averaged","model","."]
code: def apply(self, model_path: str) -> str:
      r"""
      Averages model parameters of serialized models based on the selected
      model strategy and metric.
      IMPORTANT: Depending on the metric the user might want to minimize or
      maximize. The maximize flag has to be chosen appropriately to reflect
      this.
  
      Parameters
      ----------
      model_path
          Path to the models directory.
  
      Returns
      -------
      Path to file with the averaged model.
      """
      checkpoints = self.get_checkpoint_information(model_path)
  
      checkpoint_paths, weights = self.select_checkpoints(checkpoints)
  
      average_parms = self.average(checkpoint_paths, weights)
  
      average_parms_path = model_path + "/averaged_model-0000.params"
      mx.nd.save(average_parms_path, average_parms)
      return average_parms_path
  
imports: import glob
  import json
  import logging
  from typing import Dict, List, Tuple
  import mxnet
  import mxnet.gluon.nn
  import numpy
  from gluonts.core.component import validated
  from .callback import Callback
label_desc: Use image node_id 2 for calling the AveragingStrategy obj's underlying member method code with example usage: obj.apply(model_path) and returns: average_parms_path