class_docstr: A :py:class:`~ray.train.Checkpoint` with XGBoost-specific functionality.
docstr: Create a :py:class:`~ray.train.Checkpoint` that stores an XGBoost
  model.
  
  Args:
      booster: The XGBoost model to store in the checkpoint.
      preprocessor: A fitted preprocessor to be applied before inference.
  
  Returns:
      An :py:class:`XGBoostCheckpoint` containing the specified ``Estimator``.
  
  Examples:
  
      ... testcode::
  
          import numpy as np
          import ray
          from ray.train.xgboost import XGBoostCheckpoint
          import xgboost
  
          train_X = np.array([[1, 2], [3, 4]])
          train_y = np.array([0, 1])
  
          model = xgboost.XGBClassifier().fit(train_X, train_y)
          checkpoint = XGBoostCheckpoint.from_model(model.get_booster())
docstr_tok: ["Create","a",":","py",":","class",":","`","~ray.train.Checkpoint","`","that","stores","an","XGBoost","model",".","Args",":","booster",":","The","XGBoost","model","to","store","in","the","checkpoint",".","preprocessor",":","A","fitted","preprocessor","to","be","applied","before","inference",".","Returns",":","An",":","py",":","class",":","`","XGBoostCheckpoint","`","containing","the","specified","``","Estimator","``",".","Examples",":","...","testcode",":",":","import","numpy","as","np","import","ray","from","ray.train.xgboost","import","XGBoostCheckpoint","import","xgboost","train_X","=","np.array","(","[","[","1",",","2","]",",","[","3",",","4","]","]",")","train_y","=","np.array","(","[","0",",","1","]",")","model","=","xgboost.XGBClassifier","(",")",".fit","(","train_X",",","train_y",")","checkpoint","=","XGBoostCheckpoint.from_model","(","model.get_booster","(",")",")"]
code: def from_model(
      cls,
      booster: xgboost.Booster,
      *,
      preprocessor: Optional["Preprocessor"] = None,
  ) -> "XGBoostCheckpoint":
      """Create a :py:class:`~ray.train.Checkpoint` that stores an XGBoost
      model.
  
      Args:
          booster: The XGBoost model to store in the checkpoint.
          preprocessor: A fitted preprocessor to be applied before inference.
  
      Returns:
          An :py:class:`XGBoostCheckpoint` containing the specified ``Estimator``.
  
      Examples:
  
          ... testcode::
  
              import numpy as np
              import ray
              from ray.train.xgboost import XGBoostCheckpoint
              import xgboost
  
              train_X = np.array([[1, 2], [3, 4]])
              train_y = np.array([0, 1])
  
              model = xgboost.XGBClassifier().fit(train_X, train_y)
              checkpoint = XGBoostCheckpoint.from_model(model.get_booster())
  
      """
      tmpdir = tempfile.mkdtemp()
      booster.save_model(os.path.join(tmpdir, cls.MODEL_FILENAME))
  
      checkpoint = cls.from_directory(tmpdir)
      if preprocessor:
          checkpoint.set_preprocessor(preprocessor)
      return checkpoint
  
file_path: ray/python/ray/train/xgboost/xgboost_checkpoint.py
imports: import os
  import tempfile
  from typing import TYPE_CHECKING, Optional
  import xgboost
  from ray.train._internal.framework_checkpoint import FrameworkCheckpoint
  from ray.util.annotations import PublicAPI
label_desc: Use image node_id 1 for calling the XGBoostCheckpoint obj's underlying member method code with example usage: obj.from_model(cls, booster) and returns: checkpoint