class_docstr: Context manager that enables widget with learning curves in
  JupyterLab / Jupyter Notebook
class_docstr_tok: ["Context","manager","that","enables","widget","with","learning","curves","in","JupyterLab","\/","Jupyter","Notebook"]
docstr: Constructor that defines metrics to be plotted and total iterations count.
  
  Parameters
  ----------
  train_metrics : list of str or list of dict
      List of train metrics to be tracked.
      Each item in list can be either string with metric name or dict
      with the following format:
      {
          "name": "{metric_name}",
          "best_value": "Max|Min|Undefined",
      }
  
  test_metrics : list of str or list of dict, optional (default=None)
      List of test metrics to be tracked.
      Has the same format as train_metrics. Equals to train_metrics, if not defined
  
  total_iterations: int, optional (default=None)
      Total number of iterations, allows for remaining time estimation.
docstr_tok: ["Constructor","that","defines","metrics","to","be","plotted","and","total","iterations","count",".","Parameters","--","--","--","--","--","train_metrics",":","list","of","str","or","list","of","dict","List","of","train","metrics","to","be","tracked",".","Each","item","in","list","can","be","either","string","with","metric","name","or","dict","with","the","following","format",":","{","``","name","''",":","``","{","metric_name","}","''",",","``","best_value","''",":","``","Max|Min|Undefined","''",",","}","test_metrics",":","list","of","str","or","list","of","dict",",","optional","(","default=None",")","List","of","test","metrics","to","be","tracked",".","Has","the","same","format","as","train_metrics",".","Equals","to","train_metrics",",","if","not","defined","total_iterations",":","int",",","optional","(","default=None",")","Total","number","of","iterations",",","allows","for","remaining","time","estimation","."]
code: def __init__(
      self,
      train_metrics: List[Union[str, tp.Dict[str, str]]],
      test_metrics: Optional[
          List[Union[str, tp.Dict[str, str]]]
      ] = None,
      total_iterations: Optional[int] = None,
  ) -> None:
      """
      Constructor that defines metrics to be plotted and total iterations count.
  
      Parameters
      ----------
      train_metrics : list of str or list of dict
          List of train metrics to be tracked.
          Each item in list can be either string with metric name or dict
          with the following format:
          {
              "name": "{metric_name}",
              "best_value": "Max|Min|Undefined",
          }
  
      test_metrics : list of str or list of dict, optional (default=None)
          List of test metrics to be tracked.
          Has the same format as train_metrics. Equals to train_metrics, if not defined
  
      total_iterations: int, optional (default=None)
          Total number of iterations, allows for remaining time estimation.
      """
  
      self._widget = MetricsWidget()
  
      self._values = {
          "iterations": [],
          "meta": {
              "launch_mode": "Train",
              "parameters": "",
              "name": "experiment",
              "iteration_count": None,  # set later
              "learn_sets": ["learn"],
              "learn_metrics": None,  # set later
              "test_sets": ["test"],
              "test_metrics": None,  # set later
          },
      }
  
      self._content = {
          "passed_iterations": 0,
          "total_iterations": None,  # set later
          "data": self._values,
      }
  
      # data propagated to widget class
      self._data = {
          "test_path": {
              "path": "test_path",
              "name": "experiment",
              "content": self._content,
          }
      }
  
      test_metrics = test_metrics or train_metrics
      train_metrics_meta: List[
          tp.Dict[str, str]
      ] = self.construct_metrics_meta(train_metrics)
      test_metrics_meta: List[
          tp.Dict[str, str]
      ] = self.construct_metrics_meta(test_metrics)
  
      self._train_metrics_positions = {
          meta["name"]: pos
          for pos, meta in enumerate(train_metrics_meta)
      }
      self._test_metrics_positions = {
          meta["name"]: pos
          for pos, meta in enumerate(test_metrics_meta)
      }
  
      self._values["meta"].update(
          {
              "learn_metrics": train_metrics_meta,
              "test_metrics": test_metrics_meta,
          }
      )
  
      self.passed_iterations = 0
      self.total_iterations = total_iterations
  
      if total_iterations is not None:
          self._values["meta"]["iteration_count"] = total_iterations
  
      self._content["total_iterations"] = total_iterations or 0
  
      self._start_time = time.time()
  
file_path: catboost/catboost/python-package/catboost/widget/metrics_plotter.py
imports: import time
  import logging
  import typing
  from IPython.display import display
  from copy import deepcopy
  from typing import List, Optional, Any, Union
  from .ipythonwidget import MetricWidget
label_desc: Use image node_id 1 to create a new MetricsPlotter object  with example: obj = MetricsPlotter(train_metrics, test_metrics, total_iterations)