\brief Allgather function, each node have a segment of data in the ring of sendrecvbuf,
the data provided by current node k is [slice_begin, slice_end),
the next node’s segment must start with slice_end
after the call of Allgather, sendrecvbuf_ contains all the contents including all segments
use a ring based algorithm
\brief checkpoint the model, meaning we finished a stage of execution
every time we call check point, there is a version number which will increase by one
\brief get name of processor
\param out_name hold output string
\param out_len hold length of output string
\param max_len maximum buffer length of input
\brief initialize the rabit module,
call this once before using anything
The additional arguments is not necessary.
Usually rabit will detect settings
from environment variables.
\param argc number of arguments in argv
\param argv the array of input arguments
\return true if rabit is initialized successfully otherwise false
\brief a Dummy function,
used to cause force link of C API into the DLL.
\code
//force link rabit C API library.
static int must_link_rabit_ = RabitLinkTag();
\endcode
\return a dummy integer.
\brief load latest check point
\param out_global_model hold output of serialized global_model
\param out_global_len the output length of serialized global model
\param out_local_model hold output of serialized local_model, can be NULL
\param out_local_len the output length of serialized local model, can be NULL
\brief print the msg to the tracker,
this function can be used to communicate the information of the progress to
the user who monitors the tracker
\param msg the message to be printed
\brief Get current global configuration (collection of parameters that apply globally).
\param json_str pointer to received returned global configuration, represented as a JSON string.
\return 0 for success, -1 for failure
\brief register callback function for LOG(INFO) messages – helpful messages
that are not errors.
Note: this function can be called by multiple threads. The callback function
will run on the thread that registered it
\return 0 for success, -1 for failure
\brief Set global configuration (collection of parameters that apply globally). This function
accepts the list of key-value pairs representing the global-scope parameters to be
configured. The list of key-value pairs are passed in as a JSON string.
\param json_str a JSON string representing the list of key-value pairs. The JSON object shall
be flat: no value can be a JSON object or an array.
\return 0 for success, -1 for failure
\brief update the model, by directly specify gradient and second order gradient,
this can be used to replace UpdateOneIter, to support customized loss function
\param handle handle
\param dtrain training data
\param grad gradient statistics
\param hess second order gradient statistics
\param len length of grad/hess array
\return 0 when success, -1 when failure happens
\brief Get number of boosted rounds from gradient booster. When process_type is
update, this number might drop due to removed tree.
\param handle Handle to booster.
\param out Pointer to output integer.
\return 0 when success, -1 when failure happens
\brief create xgboost learner
\param dmats matrices that are set to be cached
\param len length of dmats
\param out handle to the result booster
\return 0 when success, -1 when failure happens
\brief dump model, return array of strings representing model dump
\param handle handle
\param fmap name to fmap can be empty string
\param with_stats whether to dump with statistics
\param out_len length of output array
\param out_dump_array pointer to hold representing dump of each model
\return 0 when success, -1 when failure happens
\brief dump model, return array of strings representing model dump
\param handle handle
\param fmap name to fmap can be empty string
\param with_stats whether to dump with statistics
\param format the format to dump the model in
\param out_len length of output array
\param out_dump_array pointer to hold representing dump of each model
\return 0 when success, -1 when failure happens
\brief dump model, return array of strings representing model dump
\param handle handle
\param fnum number of features
\param fname names of features
\param ftype types of features
\param with_stats whether to dump with statistics
\param format the format to dump the model in
\param out_len length of output array
\param out_models pointer to hold representing dump of each model
\return 0 when success, -1 when failure happens
\brief dump model, return array of strings representing model dump
\param handle handle
\param fnum number of features
\param fname names of features
\param ftype types of features
\param with_stats whether to dump with statistics
\param out_len length of output array
\param out_models pointer to hold representing dump of each model
\return 0 when success, -1 when failure happens
\brief get evaluation statistics for xgboost
\param handle handle
\param iter current iteration rounds
\param dmats pointers to data to be evaluated
\param evnames pointers to names of each data
\param len length of dmats
\param out_result the string containing evaluation statistics
\return 0 when success, -1 when failure happens
\brief Calculate feature scores for tree models. When used on linear model, only the
weight importance type is defined, and output scores is a row major matrix with shape
[n_features, n_classes] for multi-class model. For tree model, out_n_feature is always
equal to out_n_scores and has multiple definitions of importance type.
\brief Get string attribute from Booster.
\param handle handle
\param key The key of the attribute.
\param out The result attribute, can be NULL if the attribute do not exist.
\param success Whether the result is contained in out.
\return 0 when success, -1 when failure happens
\brief Get the names of all attribute from Booster.
\param handle handle
\param out_len the argument to hold the output length
\param out pointer to hold the output attribute stings
\return 0 when success, -1 when failure happens
\brief save model into binary raw bytes, return header of the array
user must copy the result out, before next xgboost call
\param handle handle
\param out_len the argument to hold the output length
\param out_dptr the argument to hold the output data pointer
\return 0 when success, -1 when failure happens
\brief Load XGBoost’s internal configuration from a JSON document. Currently the
support is experimental, function signature may change in the future without
notice.
\brief load model from in memory buffer
\param handle handle
\param buf pointer to the buffer
\param len the length of the buffer
\return 0 when success, -1 when failure happens
\brief Initialize the booster from rabit checkpoint.
This is used in distributed training API.
\param handle handle
\param version The output version of the model.
\return 0 when success, -1 when failure happens
\brief make prediction based on dmat (deprecated, use XGBoosterPredictFromDMatrix instead)
\param handle handle
\param dmat data matrix
\param 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
\param 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
\param training Whether the prediction function is used as part of a training loop.
Prediction can be run in 2 scenarios:
\brief Save XGBoost’s internal configuration into a JSON document. Currently the
support is experimental, function signature may change in the future without
notice.
\brief Slice a model using boosting index. The slice m:n indicates taking all trees
that were fit during the boosting rounds m, (m+1), (m+2), …, (n-1).
\brief update the model in one round using dtrain
\param handle handle
\param iter current iteration rounds
\param dtrain training data
\return 0 when success, -1 when failure happens
\brief create a matrix content from CSC format
\param col_ptr pointer to col headers
\param indices findex
\param data fvalue
\param nindptr number of rows in the matrix + 1
\param nelem number of nonzero elements in the matrix
\param num_row number of rows; when it’s set to 0, then guess from data
\param out created dmatrix
\return 0 when success, -1 when failure happens
\brief Create a matrix from CSR matrix.
\param indptr JSON encoded array_interface to row pointers in CSR.
\param indices JSON encoded array_interface to column indices in CSR.
\param data JSON encoded array_interface to values in CSR.
\param num_col Number of columns.
\param json_config JSON encoded configuration. Required values are:
\brief create a matrix content from CSR format
\param indptr pointer to row headers
\param indices findex
\param data fvalue
\param nindptr number of rows in the matrix + 1
\param nelem number of nonzero elements in the matrix
\param num_col number of columns; when it’s set to kAdapterUnknownSize, then guess from data
\param out created dmatrix
\return 0 when success, -1 when failure happens
\brief Create DMatrix from CUDA columnar format. (cuDF)
\param data Array of JSON encoded cuda_array_interface for each column.
\param json_config JSON encoded configuration. Required values are:
\brief create matrix content from python data table
\param data pointer to pointer to column data
\param feature_stypes pointer to strings
\param nrow number of rows
\param ncol number columns
\param out created dmatrix
\param nthread number of threads (up to maximum cores available, if <=0 use all cores)
\return 0 when success, -1 when failure happens
\brief Create a DMatrix from a data iterator.
\param data_handle The handle to the data.
\param callback The callback to get the data.
\param cache_info Additional information about cache file, can be null.
\param out The created DMatrix
\return 0 when success, -1 when failure happens.
\brief load a data matrix
\param fname the name of the file
\param silent whether print messages during loading
\param out a loaded data matrix
\return 0 when success, -1 when failure happens
\brief create matrix content from dense matrix
\param data pointer to the data space
\param nrow number of rows
\param ncol number columns
\param missing which value to represent missing value
\param out created dmatrix
\return 0 when success, -1 when failure happens
\brief create matrix content from dense matrix
\param data pointer to the data space
\param nrow number of rows
\param ncol number columns
\param missing which value to represent missing value
\param out created dmatrix
\param nthread number of threads (up to maximum cores available, if <=0 use all cores)
\return 0 when success, -1 when failure happens
\brief get float info vector from matrix.
\param handle a instance of data matrix
\param field field name
\param out_len used to set result length
\param out_dptr pointer to the result
\return 0 when success, -1 when failure happens
\brief get uint32 info vector from matrix
\param handle a instance of data matrix
\param field field name
\param out_len The length of the field.
\param out_dptr pointer to the result
\return 0 when success, -1 when failure happens
\brief get number of columns
\param handle the handle to the DMatrix
\param out The output of number of columns
\return 0 when success, -1 when failure happens
\brief get number of rows.
\param handle the handle to the DMatrix
\param out The address to hold number of rows.
\return 0 when success, -1 when failure happens
\brief load a data matrix into binary file
\param handle a instance of data matrix
\param fname file name
\param silent print statistics when saving
\return 0 when success, -1 when failure happens
\brief set float vector to a content in info
\param handle a instance of data matrix
\param field field name, can be label, weight
\param array pointer to float vector
\param len length of array
\return 0 when success, -1 when failure happens
\brief (deprecated) Use XGDMatrixSetUIntInfo instead. Set group of the training matrix
\param handle a instance of data matrix
\param group pointer to group size
\param len length of array
\return 0 when success, -1 when failure happens
\brief Set content in array interface to a content in info.
\param handle a instance of data matrix
\param field field name.
\param c_interface_str JSON string representation of array interface.
\return 0 when success, -1 when failure happens
\brief set uint32 vector to a content in info
\param handle a instance of data matrix
\param field field name
\param array pointer to unsigned int vector
\param len length of array
\return 0 when success, -1 when failure happens
\brief create a new dmatrix from sliced content of existing matrix
\param handle instance of data matrix to be sliced
\param idxset index set
\param len length of index set
\param out a sliced new matrix
\return 0 when success, -1 when failure happens
\brief create a new dmatrix from sliced content of existing matrix
\param handle instance of data matrix to be sliced
\param idxset index set
\param len length of index set
\param out a sliced new matrix
\param allow_groups allow slicing of an array with groups
\return 0 when success, -1 when failure happens