class_docstr: Checkpointing operation. Users are encouraged to create their own callbacks for
  checkpoint as XGBoost doesn't handle distributed file systems. When checkpointing on
  distributed systems, be sure to know the rank of the worker to avoid multiple
  workers checkpointing to the same place.
  
  .. versionadded:: 1.3.0
  
  Since XGBoost 2.1.0, the default format is changed to UBJSON.
  
  Parameters
  ----------
  
  directory :
      Output model directory.
  name :
      pattern of output model file.  Models will be saved as name_0.ubj, name_1.ubj,
      name_2.ubj ....
  as_pickle :
      When set to True, all training parameters will be saved in pickle format,
      instead of saving only the model.
  interval :
      Interval of checkpointing.  Checkpointing is slow so setting a larger number can
      reduce performance hit.
class_docstr_tok: ["Checkpointing","operation",".","Users","are","encouraged","to","create","their","own","callbacks","for","checkpoint","as","XGBoost","does","n't","handle","distributed","file","systems",".","When","checkpointing","on","distributed","systems",",","be","sure","to","know","the","rank","of","the","worker","to","avoid","multiple","workers","checkpointing","to","the","same","place",".","..","versionadded",":",":","1.3.0","Since","XGBoost","2.1.0",",","the","default","format","is","changed","to","UBJSON",".","Parameters","--","--","--","--","--","directory",":","Output","model","directory",".","name",":","pattern","of","output","model","file",".","Models","will","be","saved","as","name_0.ubj",",","name_1.ubj",",","name_2.ubj","....","as_pickle",":","When","set","to","True",",","all","training","parameters","will","be","saved","in","pickle","format",",","instead","of","saving","only","the","model",".","interval",":","Interval","of","checkpointing",".","Checkpointing","is","slow","so","setting","a","larger","number","can","reduce","performance","hit","."]
code: def __init__(
      self,
      directory: Union[str, os.PathLike],
      name: str = "model",
      as_pickle: bool = False,
      interval: int = 100,
  ) -> None:
      self._path = os.fspath(directory)
      self._name = name
      self._as_pickle = as_pickle
      self._iterations = interval
      self._epoch = 0  # counter for iterval
      self._start = 0  # beginning iteration
      super().__init__()
  
imports: import collections
  import os
  import pickle
  from abc import ABC
  from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, TypeVar, Union, cast
  import numpy
  from .None import collective
  from .core import Booster, DMatrix, XGBoostError, _parse_eval_str
label_desc: Use image node_id 1 to create a new TrainingCheckPoint object from inherited base classes: TrainingCallback with example: obj = TrainingCheckPoint(directory, name, as_pickle, interval)