class_docstr: Implementation of the scikit-learn API for LightGBM.
class_docstr_tok: ["Implementation","of","the","scikit-learn","API","for","LightGBM","."]
docstr: Docstring is set after definition, using a template.
code: def predict(
      self,
      X: _LGBM_ScikitMatrixLike,
      raw_score: bool = False,
      start_iteration: int = 0,
      num_iteration: Optional[int] = None,
      pred_leaf: bool = False,
      pred_contrib: bool = False,
      validate_features: bool = False,
      **kwargs: Any,
  ):
      """Docstring is set after definition, using a template."""
      if not self.__sklearn_is_fitted__():
          raise LGBMNotFittedError(
              "Estimator not fitted, call fit before exploiting the model."
          )
      if not isinstance(X, (pd_DataFrame, dt_DataTable)):
          X = _LGBMCheckArray(
              X, accept_sparse=True, force_all_finite=False
          )
      n_features = X.shape[1]
      if self._n_features != n_features:
          raise ValueError(
              "Number of features of the model must "
              f"match the input. Model n_features_ is {self._n_features} and "
              f"input n_features is {n_features}"
          )
      # retrive original params that possibly can be used in both training and prediction
      # and then overwrite them (considering aliases) with params that were passed directly in prediction
      predict_params = self._process_params(stage="predict")
      for alias in _ConfigAliases.get_by_alias(
          "data",
          "X",
          "raw_score",
          "start_iteration",
          "num_iteration",
          "pred_leaf",
          "pred_contrib",
          *kwargs.keys(),
      ):
          predict_params.pop(alias, None)
      predict_params.update(kwargs)
  
      # number of threads can have values with special meaning which is only applied
      # in the scikit-learn interface, these should not reach the c++ side as-is
      predict_params = _choose_param_value(
          "num_threads", predict_params, self.n_jobs
      )
      predict_params["num_threads"] = self._process_n_jobs(
          predict_params["num_threads"]
      )
  
      return self._Booster.predict(  # type: ignore[union-attr]
          X,
          raw_score=raw_score,
          start_iteration=start_iteration,
          num_iteration=num_iteration,
          pred_leaf=pred_leaf,
          pred_contrib=pred_contrib,
          validate_features=validate_features,
          **predict_params,
      )
  
imports: import copy
  from inspect import signature
  from pathlib import Path
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import numpy
  import scipy.sparse
  from .basic import Booster, Dataset, LightGBMError, _choose_param_value, _ConfigAliases, _LGBM_BoosterBestScoreType, _LGBM_CategoricalFeatureConfiguration, _LGBM_EvalFunctionResultType, _LGBM_FeatureNameConfiguration, _LGBM_GroupType, _LGBM_InitScoreType, _LGBM_LabelType, _LGBM_WeightType, _log_warning
  from .callback import _EvalResultDict, record_evaluation
  from .compat import SKLEARN_INSTALLED, LGBMNotFittedError, _LGBMAssertAllFinite, _LGBMCheckArray, _LGBMCheckClassificationTargets, _LGBMCheckSampleWeight, _LGBMCheckXY, _LGBMClassifierBase, _LGBMComputeSampleWeight, _LGBMCpuCount, _LGBMLabelEncoder, _LGBMModelBase, _LGBMRegressorBase, dt_DataTable, np_random_Generator, pd_DataFrame
  from .engine import train
label_desc: Use image node_id 9 for calling the LGBMModel obj's underlying member method code with example usage: obj.predict(X, raw_score, start_iteration, num_iteration, pred_leaf, pred_contrib, validate_features) and returns: self