28 registry->Register(callback);
33 const void* data,
const char* data_type_str,
const uint32_t* col_ind,
const size_t* row_ptr,
37 std::unique_ptr<DMatrix> matrix
38 = CSRDMatrix::Create(data_type, data, col_ind, row_ptr, num_row, num_col);
44 const void* data,
const char* data_type_str,
size_t num_row,
size_t num_col,
48 std::unique_ptr<DMatrix> matrix
49 = DenseDMatrix::Create(data_type, data, missing_value, num_row, num_col);
60 *out_num_row = dmat->GetNumRow();
61 *out_num_col = dmat->GetNumCol();
62 *out_nelem = dmat->GetNumElem();
68 delete static_cast<DMatrix*
>(handle);
#define API_BEGIN()
macro to guard beginning and end section of all functions
int TreeliteDMatrixFree(DMatrixHandle handle)
delete DMatrix from memory
int TreeliteDMatrixCreateFromCSR(const void *data, const char *data_type_str, const uint32_t *col_ind, const size_t *row_ptr, size_t num_row, size_t num_col, DMatrixHandle *out)
create DMatrix from a (in-memory) CSR matrix
Input data structure of Treelite.
logging facility for Treelite
TypeInfo
Types used by thresholds and leaf outputs.
void * DMatrixHandle
handle to a data matrix
entry to to easily hold returning information
Helper class for thread-local storage.
Error handling for C API.
int TreeliteRegisterLogCallback(void(*callback)(const char *))
register callback function for LOG(INFO) messages – helpful messages that are not errors...
TypeInfo GetTypeInfoByName(const std::string &str)
conversion table from string to TypeInfo, defined in tables.cc
C API of Treelite, used for interfacing with other languages This header is used by both the runtime ...
int TreeliteDMatrixGetDimension(DMatrixHandle handle, size_t *out_num_row, size_t *out_num_col, size_t *out_nelem)
get dimensions of a DMatrix
std::string ret_str
result holder for returning string
int TreeliteDMatrixCreateFromMat(const void *data, const char *data_type_str, size_t num_row, size_t num_col, const void *missing_value, DMatrixHandle *out)
create DMatrix from a (in-memory) dense matrix
#define API_END()
every function starts with API_BEGIN(); and finishes with API_END() or API_END_HANDLE_ERROR ...