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