[−][src]Function lightgbm_sys::LGBM_BoosterPredictForCSRSingleRow
pub unsafe extern "C" fn LGBM_BoosterPredictForCSRSingleRow(
handle: BoosterHandle,
indptr: *const c_void,
indptr_type: c_int,
indices: *const i32,
data: *const c_void,
data_type: c_int,
nindptr: i64,
nelem: i64,
num_col: i64,
predict_type: c_int,
start_iteration: c_int,
num_iteration: c_int,
parameter: *const c_char,
out_len: *mut i64,
out_result: *mut f64
) -> c_int
\brief Make prediction for a new dataset in CSR format. This method re-uses the internal predictor structure
from previous calls and is optimized for single row invocation.
\note
You should pre-allocate memory for out_result
:
- for normal and raw score, its length is equal to
num_class * num_data
; - for leaf index, its length is equal to
num_class * num_data * num_iteration
; - for feature contributions, its length is equal to
num_class * num_data * (num_feature + 1)
. \param handle Handle of booster \param indptr Pointer to row headers \param indptr_type Type ofindptr
, can beC_API_DTYPE_INT32
orC_API_DTYPE_INT64
\param indices Pointer to column indices \param data Pointer to the data space \param data_type Type ofdata
pointer, can beC_API_DTYPE_FLOAT32
orC_API_DTYPE_FLOAT64
\param nindptr Number of rows in the matrix + 1 \param nelem Number of nonzero elements in the matrix \param num_col Number of columns \param predict_type What should be predicted C_API_PREDICT_NORMAL
: normal prediction, with transform (if needed);C_API_PREDICT_RAW_SCORE
: raw score;C_API_PREDICT_LEAF_INDEX
: leaf index;C_API_PREDICT_CONTRIB
: feature contributions (SHAP values) \param start_iteration Start index of the iteration to predict \param num_iteration Number of iterations for prediction, <= 0 means no limit \param parameter Other parameters for prediction, e.g. early stopping for prediction \param[out] out_len Length of output result \param[out] out_result Pointer to array with predictions \return 0 when succeed, -1 when failure happens