class_docstr: Wrapper class that wraps GBDT models as DeepChem models.
  
  This class supports LightGBM/XGBoost models.
class_docstr_tok: ["Wrapper","class","that","wraps","GBDT","models","as","DeepChem","models",".","This","class","supports","LightGBM\/XGBoost","models","."]
docstr: Parameters
  ----------
  model: BaseEstimator
      The model instance of scikit-learn wrapper LightGBM/XGBoost models.
  model_dir: str, optional (default None)
      Path to directory where model will be stored.
  early_stopping_rounds: int, optional (default 50)
      Activates early stopping. Validation metric needs to improve at least once
      in every early_stopping_rounds round(s) to continue training.
  eval_metric: Union[str, Callable]
      If string, it should be a built-in evaluation metric to use.
      If callable, it should be a custom evaluation metric, see official note for more details.
docstr_tok: ["Parameters","--","--","--","--","--","model",":","BaseEstimator","The","model","instance","of","scikit-learn","wrapper","LightGBM\/XGBoost","models",".","model_dir",":","str",",","optional","(","default","None",")","Path","to","directory","where","model","will","be","stored",".","early_stopping_rounds",":","int",",","optional","(","default","50",")","Activates","early","stopping",".","Validation","metric","needs","to","improve","at","least","once","in","every","early_stopping_rounds","round","(","s",")","to","continue","training",".","eval_metric",":","Union","[","str",",","Callable","]","If","string",",","it","should","be","a","built-in","evaluation","metric","to","use",".","If","callable",",","it","should","be","a","custom","evaluation","metric",",","see","official","note","for","more","details","."]
code: def __init__(
      self,
      model: BaseEstimator,
      model_dir: Optional[str] = None,
      early_stopping_rounds: int = 50,
      eval_metric: Optional[Union[str, Callable]] = None,
      **kwargs,
  ):
      """
      Parameters
      ----------
      model: BaseEstimator
          The model instance of scikit-learn wrapper LightGBM/XGBoost models.
      model_dir: str, optional (default None)
          Path to directory where model will be stored.
      early_stopping_rounds: int, optional (default 50)
          Activates early stopping. Validation metric needs to improve at least once
          in every early_stopping_rounds round(s) to continue training.
      eval_metric: Union[str, Callable]
          If string, it should be a built-in evaluation metric to use.
          If callable, it should be a custom evaluation metric, see official note for more details.
      """
  
      try:
          import xgboost
          import lightgbm
      except:
          raise ModuleNotFoundError(
              "XGBoost or LightGBM modules not found. This function requires these modules to be installed."
          )
  
      if model_dir is not None:
          if not os.path.exists(model_dir):
              os.makedirs(model_dir)
      else:
          model_dir = tempfile.mkdtemp()
      self.model_dir = model_dir
      self.model = model
      self.model_class = model.__class__
      self.early_stopping_rounds = early_stopping_rounds
      self.model_type = self._check_model_type()
  
      if self.early_stopping_rounds <= 0:
          raise ValueError(
              "Early Stopping Rounds cannot be less than 1."
          )
  
      if self.model.__class__.__name__.startswith("XGB"):
          self.callbacks = [
              xgboost.callback.EarlyStopping(
                  rounds=self.early_stopping_rounds
              )
          ]
      elif self.model.__class__.__name__.startswith("LGBM"):
          self.callbacks = [
              lightgbm.early_stopping(
                  stopping_rounds=self.early_stopping_rounds
              ),
          ]
  
      if eval_metric is None:
          if self.model_type == "classification":
              self.eval_metric: Optional[Union[str, Callable]] = "auc"
          elif self.model_type == "regression":
              self.eval_metric = "mae"
          else:
              self.eval_metric = eval_metric
      else:
          self.eval_metric = eval_metric
  
file_path: deepchem/deepchem/models/gbdt_models/gbdt_model.py
imports: import os
  import logging
  import tempfile
  import warnings
  from typing import Callable, Optional, Union
  import numpy
  from sklearn.base import BaseEstimator
  from sklearn.model_selection import train_test_split
  from deepchem.data import Dataset
  from deepchem.models.sklearn_models import SklearnModel
label_desc: Use image node_id 1 to create a new GBDTModel object from inherited base classes: SklearnModel with example: obj = GBDTModel(model, model_dir, early_stopping_rounds, eval_metric)