xgboost
|
These functions are used for running prediction and explanation algorithms. More...
Functions | |
int | XGBoosterPredict (BoosterHandle handle, DMatrixHandle dmat, int option_mask, unsigned ntree_limit, int training, bst_ulong *out_len, const float **out_result) |
make prediction based on dmat (deprecated, use XGBoosterPredictFromDMatrix instead) More... | |
int | XGBoosterPredictFromDMatrix (BoosterHandle handle, DMatrixHandle dmat, char const *config, bst_ulong const **out_shape, bst_ulong *out_dim, float const **out_result) |
Make prediction from DMatrix, replacing XGBoosterPredict. More... | |
int | XGBoosterPredictFromDense (BoosterHandle handle, char const *values, char const *config, DMatrixHandle m, bst_ulong const **out_shape, bst_ulong *out_dim, const float **out_result) |
Inplace prediction from CPU dense matrix. More... | |
int | XGBoosterPredictFromColumnar (BoosterHandle handle, char const *array_interface, char const *c_json_config, DMatrixHandle m, bst_ulong const **out_shape, bst_ulong *out_dim, const float **out_result) |
Inplace prediction from CPU columnar data. (Table) More... | |
int | XGBoosterPredictFromCSR (BoosterHandle handle, char const *indptr, char const *indices, char const *values, bst_ulong ncol, char const *config, DMatrixHandle m, bst_ulong const **out_shape, bst_ulong *out_dim, const float **out_result) |
Inplace prediction from CPU CSR matrix. More... | |
int | XGBoosterPredictFromCudaArray (BoosterHandle handle, char const *values, char const *config, DMatrixHandle m, bst_ulong const **out_shape, bst_ulong *out_dim, const float **out_result) |
Inplace prediction from CUDA Dense matrix (cupy in Python). More... | |
int | XGBoosterPredictFromCudaColumnar (BoosterHandle handle, char const *values, char const *config, DMatrixHandle m, bst_ulong const **out_shape, bst_ulong *out_dim, const float **out_result) |
Inplace prediction from CUDA dense dataframe (cuDF in Python). More... | |
These functions are used for running prediction and explanation algorithms.
int XGBoosterPredict | ( | BoosterHandle | handle, |
DMatrixHandle | dmat, | ||
int | option_mask, | ||
unsigned | ntree_limit, | ||
int | training, | ||
bst_ulong * | out_len, | ||
const float ** | out_result | ||
) |
make prediction based on dmat (deprecated, use XGBoosterPredictFromDMatrix instead)
handle | handle |
dmat | data matrix |
option_mask | bit-mask of options taken in prediction, possible values 0:normal prediction 1:output margin instead of transformed value 2:output leaf index of trees instead of leaf value, note leaf index is unique per tree 4:output feature contributions to individual predictions |
ntree_limit | limit number of trees used for prediction, this is only valid for boosted trees when the parameter is set to 0, we will use all the trees |
training | Whether the prediction function is used as part of a training loop. Prediction can be run in 2 scenarios:
|
out_len | used to store length of returning result |
out_result | used to set a pointer to array |
int XGBoosterPredictFromColumnar | ( | BoosterHandle | handle, |
char const * | array_interface, | ||
char const * | c_json_config, | ||
DMatrixHandle | m, | ||
bst_ulong const ** | out_shape, | ||
bst_ulong * | out_dim, | ||
const float ** | out_result | ||
) |
Inplace prediction from CPU columnar data. (Table)
handle | Booster handle. |
values | An JSON array of array_interface for each column. |
config | See XGBoosterPredictFromDMatrix for more info. Additional fields for inplace prediction are:
|
m | An optional (NULL if not available) proxy DMatrix instance storing meta info. |
out_shape | See XGBoosterPredictFromDMatrix for more info. |
out_dim | See XGBoosterPredictFromDMatrix for more info. |
out_result | See XGBoosterPredictFromDMatrix for more info. |
int XGBoosterPredictFromCSR | ( | BoosterHandle | handle, |
char const * | indptr, | ||
char const * | indices, | ||
char const * | values, | ||
bst_ulong | ncol, | ||
char const * | config, | ||
DMatrixHandle | m, | ||
bst_ulong const ** | out_shape, | ||
bst_ulong * | out_dim, | ||
const float ** | out_result | ||
) |
Inplace prediction from CPU CSR matrix.
handle | Booster handle. |
indptr | JSON encoded array_interface to row pointer in CSR. |
indices | JSON encoded array_interface to column indices in CSR. |
values | JSON encoded array_interface to values in CSR.. |
ncol | Number of features in data. |
config | See XGBoosterPredictFromDMatrix for more info. Additional fields for inplace prediction are:
|
m | An optional (NULL if not available) proxy DMatrix instance storing meta info. |
out_shape | See XGBoosterPredictFromDMatrix for more info. |
out_dim | See XGBoosterPredictFromDMatrix for more info. |
out_result | See XGBoosterPredictFromDMatrix for more info. |
int XGBoosterPredictFromCudaArray | ( | BoosterHandle | handle, |
char const * | values, | ||
char const * | config, | ||
DMatrixHandle | m, | ||
bst_ulong const ** | out_shape, | ||
bst_ulong * | out_dim, | ||
const float ** | out_result | ||
) |
Inplace prediction from CUDA Dense matrix (cupy in Python).
handle | Booster handle |
values | JSON encoded cuda_array_interface to values. |
config | See XGBoosterPredictFromDMatrix for more info. Additional fields for inplace prediction are:
|
m | An optional (NULL if not available) proxy DMatrix instance storing meta info. |
out_shape | See XGBoosterPredictFromDMatrix for more info. |
out_dim | See XGBoosterPredictFromDMatrix for more info. |
out_result | See XGBoosterPredictFromDMatrix for more info. |
int XGBoosterPredictFromCudaColumnar | ( | BoosterHandle | handle, |
char const * | values, | ||
char const * | config, | ||
DMatrixHandle | m, | ||
bst_ulong const ** | out_shape, | ||
bst_ulong * | out_dim, | ||
const float ** | out_result | ||
) |
Inplace prediction from CUDA dense dataframe (cuDF in Python).
handle | Booster handle |
values | List of cuda_array_interface for all columns encoded in JSON list. |
config | See XGBoosterPredictFromDMatrix for more info. Additional fields for inplace prediction are:
|
m | An optional (NULL if not available) proxy DMatrix instance storing meta info. |
out_shape | See XGBoosterPredictFromDMatrix for more info. |
out_dim | See XGBoosterPredictFromDMatrix for more info. |
out_result | See XGBoosterPredictFromDMatrix for more info. |
int XGBoosterPredictFromDense | ( | BoosterHandle | handle, |
char const * | values, | ||
char const * | config, | ||
DMatrixHandle | m, | ||
bst_ulong const ** | out_shape, | ||
bst_ulong * | out_dim, | ||
const float ** | out_result | ||
) |
Inplace prediction from CPU dense matrix.
handle | Booster handle. |
values | JSON encoded array_interface to values. |
config | See XGBoosterPredictFromDMatrix for more info. Additional fields for inplace prediction are:
|
m | An optional (NULL if not available) proxy DMatrix instance storing meta info. |
out_shape | See XGBoosterPredictFromDMatrix for more info. |
out_dim | See XGBoosterPredictFromDMatrix for more info. |
out_result | See XGBoosterPredictFromDMatrix for more info. |
int XGBoosterPredictFromDMatrix | ( | BoosterHandle | handle, |
DMatrixHandle | dmat, | ||
char const * | config, | ||
bst_ulong const ** | out_shape, | ||
bst_ulong * | out_dim, | ||
float const ** | out_result | ||
) |
Make prediction from DMatrix, replacing XGBoosterPredict.
handle | Booster handle |
dmat | DMatrix handle |
config | String encoded predict configuration in JSON format, with following available fields in the JSON object: |
"type": [0, 6]
Prediction can be run in 2 scenarios:
Example JSON input for running a normal prediction with strict output shape, 2 dim for softprob , 1 dim for others.
out_shape | Shape of output prediction (copy before use). |
out_dim | Dimension of output prediction. |
out_result | Buffer storing prediction value (copy before use). |