[][src]Function lightgbm_sys::LGBM_BoosterPredictSparseOutput

pub unsafe extern "C" fn LGBM_BoosterPredictSparseOutput(
    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_or_row: i64,
    predict_type: c_int,
    start_iteration: c_int,
    num_iteration: c_int,
    parameter: *const c_char,
    matrix_type: c_int,
    out_len: *mut i64,
    out_indptr: *mut *mut c_void,
    out_indices: *mut *mut i32,
    out_data: *mut *mut c_void
) -> c_int

\brief Make sparse prediction for a new dataset in CSR or CSC format. Currently only used for feature contributions. \note The outputs are pre-allocated, as they can vary for each invocation, but the shape should be the same:

  • for feature contributions, the shape of sparse matrix will be num_class * num_data * (num_feature + 1). The output indptr_type for the sparse matrix will be the same as the given input indptr_type. Call LGBM_BoosterFreePredictSparse to deallocate resources. \param handle Handle of booster \param indptr Pointer to row headers for CSR or column headers for CSC \param indptr_type Type of indptr, can be C_API_DTYPE_INT32 or C_API_DTYPE_INT64 \param indices Pointer to column indices for CSR or row indices for CSC \param data Pointer to the data space \param data_type Type of data pointer, can be C_API_DTYPE_FLOAT32 or C_API_DTYPE_FLOAT64 \param nindptr Number of rows in the matrix + 1 \param nelem Number of nonzero elements in the matrix \param num_col_or_row Number of columns for CSR or number of rows for CSC \param predict_type What should be predicted, only feature contributions supported currently
  • 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 matrix_type Type of matrix input and output, can be C_API_MATRIX_TYPE_CSR or C_API_MATRIX_TYPE_CSC \param[out] out_len Length of output indices and data \param[out] out_indptr Pointer to output row headers for CSR or column headers for CSC \param[out] out_indices Pointer to sparse column indices for CSR or row indices for CSC \param[out] out_data Pointer to sparse data space \return 0 when succeed, -1 when failure happens