class_docstr: EarlyStopping class to keep NN from overfitting
      
docstr: EarlyStopping step on each epoch
  Arguments:
      metrics {float} -- metric value
docstr_tok: ["EarlyStopping","step","on","each","epoch","Arguments",":","metrics","{","float","}","--","metric","value"]
code: def step(self, metrics):
      """EarlyStopping step on each epoch
      Arguments:
          metrics {float} -- metric value
      """
  
      if self.best is None:
          self.best = metrics
          return False
  
      if np.isnan(metrics):
          return True
  
      if self.is_better(metrics, self.best):
          self.num_bad_epochs = 0
          self.best = metrics
      else:
          self.num_bad_epochs += 1
  
      if self.num_bad_epochs >= self.patience:
          return True
  
      return False
  
file_path: nni/examples/trials/network_morphism/FashionMNIST/utils.py
imports: import numpy
  import torch
  import torch.nn
  import torch.nn.init
  import torchvision.transforms
label_desc: Use image node_id 2 for calling the EarlyStopping obj's underlying member method code with example usage: obj.step(metrics) and returns: False, False, True, True