class_docstr: A learningrate sheduler for annealing on plateau.
  
  This class is a modification of
  torch.optim.lr_scheduler.ReduceLROnPlateau that enables
  setting an "auxiliary metric" to break ties.
  Reduce learning rate when a metric has stopped improving.
  Models often benefit from reducing the learning rate by a factor
  of 2-10 once learning stagnates. This scheduler reads a metrics
  quantity and if no improvement is seen for a 'patience' number
  of epochs, the learning rate is reduced.
  
  Args:
  ----
      optimizer (Optimizer): Wrapped optimizer.
      mode (str): One of `min`, `max`. In `min` mode, lr will
          be reduced when the quantity monitored has stopped
          decreasing; in `max` mode it will be reduced when the
          quantity monitored has stopped increasing. Default: 'min'.
      factor (float): Factor by which the learning rate will be
          reduced. new_lr = lr * factor. Default: 0.1.
      patience (int): Number of epochs with no improvement after
          which learning rate will be reduced. For example, if
          `patience = 2`, then we will ignore the first 2 epochs
          with no improvement, and will only decrease the LR after the
          3rd epoch if the loss still hasn't improved then.
          Default: 10.
      verbose (bool): If ``True``, prints a message to stdout for
          each update. Default: ``False``.
      cooldown (int): Number of epochs to wait before resuming
          normal operation after lr has been reduced. Default: 0.
      min_lr (float or list): A scalar or a list of scalars. A
          lower bound on the learning rate of all param groups
          or each group respectively. Default: 0.
      eps (float): Minimal decay applied to lr. If the difference
          between new and old lr is smaller than eps, the update is
          ignored. Default: 1e-8.
  
  Example:
  -------
      >>> optimizer = torch.optim.SGD(model.parameters(), lr=0.1, momentum=0.9)
      >>> scheduler = ReduceLROnPlateau(optimizer, 'min')
      >>> for epoch in range(10):
      >>>     train(...)
      >>>     val_loss = validate(...)
      >>>     # Note that step should be called after validate()
      >>>     scheduler.step(val_loss)
class_docstr_tok: ["A","learningrate","sheduler","for","annealing","on","plateau",".","This","class","is","a","modification","of","torch.optim.lr_scheduler.ReduceLROnPlateau","that","enables","setting","an","``","auxiliary","metric","''","to","break","ties",".","Reduce","learning","rate","when","a","metric","has","stopped","improving",".","Models","often","benefit","from","reducing","the","learning","rate","by","a","factor","of","2-10","once","learning","stagnates",".","This","scheduler","reads","a","metrics","quantity","and","if","no","improvement","is","seen","for","a","'patience","'","number","of","epochs",",","the","learning","rate","is","reduced",".","Args",":","--","--","optimizer","(","Optimizer",")",":","Wrapped","optimizer",".","mode","(","str",")",":","One","of","`","min","`",",","`","max","`",".","In","`","min","`","mode",",","lr","will","be","reduced","when","the","quantity","monitored","has","stopped","decreasing",";","in","`","max","`","mode","it","will","be","reduced","when","the","quantity","monitored","has","stopped","increasing",".","Default",":","'min","'",".","factor","(","float",")",":","Factor","by","which","the","learning","rate","will","be","reduced",".","new_lr","=","lr","*","factor",".","Default",":","0.1.","patience","(","int",")",":","Number","of","epochs","with","no","improvement","after","which","learning","rate","will","be","reduced",".","For","example",",","if","`","patience","=","2","`",",","then","we","will","ignore","the","first","2","epochs","with","no","improvement",",","and","will","only","decrease","the","LR","after","the","3rd","epoch","if","the","loss","still","has","n't","improved","then",".","Default",":","10.","verbose","(","bool",")",":","If","``","True","``",",","prints","a","message","to","stdout","for","each","update",".","Default",":","``","False","``",".","cooldown","(","int",")",":","Number","of","epochs","to","wait","before","resuming","normal","operation","after","lr","has","been","reduced",".","Default",":","0.","min_lr","(","float","or","list",")",":","A","scalar","or","a","list","of","scalars",".","A","lower","bound","on","the","learning","rate","of","all","param","groups","or","each","group","respectively",".","Default",":","0.","eps","(","float",")",":","Minimal","decay","applied","to","lr",".","If","the","difference","between","new","and","old","lr","is","smaller","than","eps",",","the","update","is","ignored",".","Default",":","1e-8",".","Example",":","--","--","--","-",">",">",">","optimizer","=","torch.optim.SGD","(","model.parameters","(",")",",","lr=0.1",",","momentum=0.9",")",">",">",">","scheduler","=","ReduceLROnPlateau","(","optimizer",",","'min","'",")",">",">",">","for","epoch","in","range","(","10",")",":",">",">",">","train","(","...",")",">",">",">","val_loss","=","validate","(","...",")",">",">",">","#","Note","that","step","should","be","called","after","validate","(",")",">",">",">","scheduler.step","(","val_loss",")"]
code: def in_cooldown(self):
      return self.cooldown_counter > 0
  
imports: import logging
  import random
  import sys
  from collections import defaultdict
  from enum import Enum
  from functools import reduce
  from math import inf
  from pathlib import Path
  from typing import Dict, List, Optional, Union
  from scipy.stats import pearsonr, spearmanr
  from sklearn.metrics import mean_absolute_error, mean_squared_error
  from torch.optim import Optimizer
  from torch.utils.data import Dataset
  import flair
  from flair.data import DT, Dictionary, Sentence, _iter_dataset
label_desc: Use image node_id 5 for calling the AnnealOnPlateau obj's underlying member method code with example usage: obj.in_cooldown() and returns: unknown