class_docstr: Stop training when a monitored metric has stopped improving.
  
  The earlystopping callback will be triggered each time validation ends.
  It will examine the metrics produced in validation,
  and get the metric with name ``monitor` (``monitor`` is ``reward`` by default),
  to check whether it's no longer increasing / decreasing.
  It takes ``min_delta`` and ``patience`` if applicable.
  If it's found to be not increasing / decreasing any more.
  ``trainer.should_stop`` will be set to true,
  and the training terminates.
  
  Implementation reference: https://github.com/keras-team/keras/blob/v2.9.0/keras/callbacks.py#L1744-L1893
class_docstr_tok: ["Stop","training","when","a","monitored","metric","has","stopped","improving",".","The","earlystopping","callback","will","be","triggered","each","time","validation","ends",".","It","will","examine","the","metrics","produced","in","validation",",","and","get","the","metric","with","name","``","monitor","`","(","``","monitor","``","is","``","reward","``","by","default",")",",","to","check","whether","it","'s","no","longer","increasing","\/","decreasing",".","It","takes","``","min_delta","``","and","``","patience","``","if","applicable",".","If","it","'s","found","to","be","not","increasing","\/","decreasing","any","more",".","``","trainer.should_stop","``","will","be","set","to","true",",","and","the","training","terminates",".","Implementation","reference",":","https",":","\/\/github.com\/keras-team\/keras\/blob\/v2.9.0\/keras\/callbacks.py","#","L1744-L1893"]
code: def get_monitor_value(self, trainer: Trainer) -> Any:
      monitor_value = trainer.metrics.get(self.monitor)
      if monitor_value is None:
          _logger.warning(
              "Early stopping conditioned on metric `%s` which is not available. Available metrics are: %s",
              self.monitor,
              ",".join(list(trainer.metrics.keys())),
          )
      return monitor_value
  
imports: from __future__ import annotations
  import copy
  import os
  import shutil
  import time
  from datetime import datetime
  from pathlib import Path
  from typing import Any, List, TYPE_CHECKING
  import numpy
  import pandas
  import torch
  from qlib.log import get_module_logger
  from qlib.typehint import Literal
label_desc: Use image node_id 6 for calling the EarlyStopping obj's underlying member method code with example usage: obj.get_monitor_value(trainer) and returns: monitor_value