class_docstr: Class which stores a list of layers describing the model. Can train the layer
  weights on a dataset, evaluate on a test set and serialize the model.
  Additional functionality can be added to the fit method through callback functions.
  
  Arguments:
      layers: layer container, a list of layers (that will be containerized),
              or a serialized model description
      dataset (NervanaDataIterator): Data set (ignored, will be removed)
      weights_only (bool): set to True if you do not want to recreate layers
                           and states during deserialization from a serialized model
                           description.  Defaults to False.
      name (str): Model name.  Defaults to "model"
      optimizer (Optimizer): Optimizer object which defines the learning rule for updating
                             model parameters (i.e., GradientDescentMomentum, Adadelta)
class_docstr_tok: ["Class","which","stores","a","list","of","layers","describing","the","model",".","Can","train","the","layer","weights","on","a","dataset",",","evaluate","on","a","test","set","and","serialize","the","model",".","Additional","functionality","can","be","added","to","the","fit","method","through","callback","functions",".","Arguments",":","layers",":","layer","container",",","a","list","of","layers","(","that","will","be","containerized",")",",","or","a","serialized","model","description","dataset","(","NervanaDataIterator",")",":","Data","set","(","ignored",",","will","be","removed",")","weights_only","(","bool",")",":","set","to","True","if","you","do","not","want","to","recreate","layers","and","states","during","deserialization","from","a","serialized","model","description",".","Defaults","to","False",".","name","(","str",")",":","Model","name",".","Defaults","to","``","model","''","optimizer","(","Optimizer",")",":","Optimizer","object","which","defines","the","learning","rule","for","updating","model","parameters","(","i.e.",",","GradientDescentMomentum",",","Adadelta",")"]
docstr: Evaluates a model on a dataset according to an input metric.
  
  Arguments:
      datasets (NervanaDataIterator): dataset to evaluate on.
      metric (Cost): what function to evaluate dataset on.
  
  Returns:
      Host numpy array: the error of the final layer for the evaluation dataset
docstr_tok: ["Evaluates","a","model","on","a","dataset","according","to","an","input","metric",".","Arguments",":","datasets","(","NervanaDataIterator",")",":","dataset","to","evaluate","on",".","metric","(","Cost",")",":","what","function","to","evaluate","dataset","on",".","Returns",":","Host","numpy","array",":","the","error","of","the","final","layer","for","the","evaluation","dataset"]
code: def eval(self, dataset, metric):
      """
      Evaluates a model on a dataset according to an input metric.
  
      Arguments:
          datasets (NervanaDataIterator): dataset to evaluate on.
          metric (Cost): what function to evaluate dataset on.
  
      Returns:
          Host numpy array: the error of the final layer for the evaluation dataset
      """
      self.initialize(dataset)
      running_error = np.zeros(
          (len(metric.metric_names)), dtype=np.float32
      )
      nprocessed = 0
      dataset.reset()
      if hasattr(dataset, "seq_length"):
          ndata = dataset.ndata * dataset.seq_length
      else:
          ndata = dataset.ndata
      for x, t in dataset:
          x = self.fprop(x, inference=True)
  
          # This logic is for handling partial batch sizes at the end of the dataset
          nsteps = (
              x.shape[1] // self.be.bsz
              if not isinstance(x, list)
              else x[0].shape[1] // self.be.bsz
          )
  
          bsz = min(ndata - nprocessed, self.be.bsz)
          running_error += (
              metric(x, t, calcrange=slice(0, nsteps * bsz))
              * nsteps
              * bsz
          )
          nprocessed += bsz * nsteps
      running_error /= nprocessed
      return running_error
  
imports: from __future__ import division, print_function
  from builtins import str, zip
  from collections import OrderedDict
  import logging
  from neon import __version__
  from neon import NervanaObject, logger
  from neon.backends.backend import Block
  from neon.transforms import CrossEntropyBinary, Logistic
  from neon.util.persist import load_obj, save_obj, load_class
  from neon.util.modeldesc import ModelDescription
  from neon.layers import Sequential, Activation
  from neon.layers.container import DeltasTree, SkipThought
  from neon.util.beamsearch import BeamSearch
  from neon.optimizers.optimizer import get_param_list
  import numpy
label_desc: Use image node_id 11 for calling the Model obj's underlying member method code with example usage: obj.eval(dataset, metric) and returns: running_error