lgbm_sys/
lib.rs

1/* automatically generated by rust-bindgen 0.71.1 */
2
3pub const C_API_DTYPE_FLOAT32: u32 = 0;
4pub const C_API_DTYPE_FLOAT64: u32 = 1;
5pub const C_API_DTYPE_INT32: u32 = 2;
6pub const C_API_DTYPE_INT64: u32 = 3;
7pub const C_API_PREDICT_NORMAL: u32 = 0;
8pub const C_API_PREDICT_RAW_SCORE: u32 = 1;
9pub const C_API_PREDICT_LEAF_INDEX: u32 = 2;
10pub const C_API_PREDICT_CONTRIB: u32 = 3;
11pub const C_API_MATRIX_TYPE_CSR: u32 = 0;
12pub const C_API_MATRIX_TYPE_CSC: u32 = 1;
13pub const C_API_FEATURE_IMPORTANCE_SPLIT: u32 = 0;
14pub const C_API_FEATURE_IMPORTANCE_GAIN: u32 = 1;
15#[repr(C)]
16#[derive(Debug, Copy, Clone)]
17pub struct ArrowSchema {
18    pub format: *const ::std::os::raw::c_char,
19    pub name: *const ::std::os::raw::c_char,
20    pub metadata: *const ::std::os::raw::c_char,
21    pub flags: i64,
22    pub n_children: i64,
23    pub children: *mut *mut ArrowSchema,
24    pub dictionary: *mut ArrowSchema,
25    pub release: ::std::option::Option<unsafe extern "C" fn(arg1: *mut ArrowSchema)>,
26    pub private_data: *mut ::std::os::raw::c_void,
27}
28#[allow(clippy::unnecessary_operation, clippy::identity_op)]
29const _: () = {
30    ["Size of ArrowSchema"][::std::mem::size_of::<ArrowSchema>() - 72usize];
31    ["Alignment of ArrowSchema"][::std::mem::align_of::<ArrowSchema>() - 8usize];
32    ["Offset of field: ArrowSchema::format"][::std::mem::offset_of!(ArrowSchema, format) - 0usize];
33    ["Offset of field: ArrowSchema::name"][::std::mem::offset_of!(ArrowSchema, name) - 8usize];
34    ["Offset of field: ArrowSchema::metadata"]
35        [::std::mem::offset_of!(ArrowSchema, metadata) - 16usize];
36    ["Offset of field: ArrowSchema::flags"][::std::mem::offset_of!(ArrowSchema, flags) - 24usize];
37    ["Offset of field: ArrowSchema::n_children"]
38        [::std::mem::offset_of!(ArrowSchema, n_children) - 32usize];
39    ["Offset of field: ArrowSchema::children"]
40        [::std::mem::offset_of!(ArrowSchema, children) - 40usize];
41    ["Offset of field: ArrowSchema::dictionary"]
42        [::std::mem::offset_of!(ArrowSchema, dictionary) - 48usize];
43    ["Offset of field: ArrowSchema::release"]
44        [::std::mem::offset_of!(ArrowSchema, release) - 56usize];
45    ["Offset of field: ArrowSchema::private_data"]
46        [::std::mem::offset_of!(ArrowSchema, private_data) - 64usize];
47};
48#[repr(C)]
49#[derive(Debug, Copy, Clone)]
50pub struct ArrowArray {
51    pub length: i64,
52    pub null_count: i64,
53    pub offset: i64,
54    pub n_buffers: i64,
55    pub n_children: i64,
56    pub buffers: *mut *const ::std::os::raw::c_void,
57    pub children: *mut *mut ArrowArray,
58    pub dictionary: *mut ArrowArray,
59    pub release: ::std::option::Option<unsafe extern "C" fn(arg1: *mut ArrowArray)>,
60    pub private_data: *mut ::std::os::raw::c_void,
61}
62#[allow(clippy::unnecessary_operation, clippy::identity_op)]
63const _: () = {
64    ["Size of ArrowArray"][::std::mem::size_of::<ArrowArray>() - 80usize];
65    ["Alignment of ArrowArray"][::std::mem::align_of::<ArrowArray>() - 8usize];
66    ["Offset of field: ArrowArray::length"][::std::mem::offset_of!(ArrowArray, length) - 0usize];
67    ["Offset of field: ArrowArray::null_count"]
68        [::std::mem::offset_of!(ArrowArray, null_count) - 8usize];
69    ["Offset of field: ArrowArray::offset"][::std::mem::offset_of!(ArrowArray, offset) - 16usize];
70    ["Offset of field: ArrowArray::n_buffers"]
71        [::std::mem::offset_of!(ArrowArray, n_buffers) - 24usize];
72    ["Offset of field: ArrowArray::n_children"]
73        [::std::mem::offset_of!(ArrowArray, n_children) - 32usize];
74    ["Offset of field: ArrowArray::buffers"][::std::mem::offset_of!(ArrowArray, buffers) - 40usize];
75    ["Offset of field: ArrowArray::children"]
76        [::std::mem::offset_of!(ArrowArray, children) - 48usize];
77    ["Offset of field: ArrowArray::dictionary"]
78        [::std::mem::offset_of!(ArrowArray, dictionary) - 56usize];
79    ["Offset of field: ArrowArray::release"][::std::mem::offset_of!(ArrowArray, release) - 64usize];
80    ["Offset of field: ArrowArray::private_data"]
81        [::std::mem::offset_of!(ArrowArray, private_data) - 72usize];
82};
83pub type DatasetHandle = *mut ::std::os::raw::c_void;
84pub type BoosterHandle = *mut ::std::os::raw::c_void;
85pub type FastConfigHandle = *mut ::std::os::raw::c_void;
86pub type ByteBufferHandle = *mut ::std::os::raw::c_void;
87unsafe extern "C" {
88    #[doc = "Get string message of the last error.\n # Returns\n\nError information"]
89    pub fn LGBM_GetLastError() -> *const ::std::os::raw::c_char;
90}
91unsafe extern "C" {
92    #[doc = "Dump all parameter names with their aliases to JSON.\n # Arguments\n\n* `buffer_len` - String buffer length, if ``buffer_len < out_len``, you should re-allocate buffer\n * `out_len` (direction out) - Actual output length\n * `out_str` (direction out) - JSON format string of parameters, should pre-allocate memory\n # Returns\n\n0 when succeed, -1 when failure happens"]
93    pub fn LGBM_DumpParamAliases(
94        buffer_len: i64,
95        out_len: *mut i64,
96        out_str: *mut ::std::os::raw::c_char,
97    ) -> ::std::os::raw::c_int;
98}
99unsafe extern "C" {
100    #[doc = "Register a callback function for log redirecting.\n # Arguments\n\n* `callback` - The callback function to register\n # Returns\n\n0 when succeed, -1 when failure happens"]
101    pub fn LGBM_RegisterLogCallback(
102        callback: ::std::option::Option<unsafe extern "C" fn(arg1: *const ::std::os::raw::c_char)>,
103    ) -> ::std::os::raw::c_int;
104}
105unsafe extern "C" {
106    #[doc = "Get number of samples based on parameters and total number of rows of data.\n # Arguments\n\n* `num_total_row` - Number of total rows\n * `parameters` - Additional parameters, namely, ``bin_construct_sample_cnt`` is used to calculate returned value\n * `out` (direction out) - Number of samples. This value is used to pre-allocate memory to hold sample indices when calling ``LGBM_SampleIndices``\n # Returns\n\n0 when succeed, -1 when failure happens"]
107    pub fn LGBM_GetSampleCount(
108        num_total_row: i32,
109        parameters: *const ::std::os::raw::c_char,
110        out: *mut ::std::os::raw::c_int,
111    ) -> ::std::os::raw::c_int;
112}
113unsafe extern "C" {
114    #[doc = "Create sample indices for total number of rows.\n > **Note:** You should pre-allocate memory for ``out``, you can get its length by ``LGBM_GetSampleCount``.\n # Arguments\n\n* `num_total_row` - Number of total rows\n * `parameters` - Additional parameters, namely, ``bin_construct_sample_cnt`` and ``data_random_seed`` are used to produce the output\n * `out` (direction out) - Created indices, type is int32_t\n * `out_len` (direction out) - Number of indices\n # Returns\n\n0 when succeed, -1 when failure happens"]
115    pub fn LGBM_SampleIndices(
116        num_total_row: i32,
117        parameters: *const ::std::os::raw::c_char,
118        out: *mut ::std::os::raw::c_void,
119        out_len: *mut i32,
120    ) -> ::std::os::raw::c_int;
121}
122unsafe extern "C" {
123    #[doc = "Get a ByteBuffer value at an index.\n # Arguments\n\n* `handle` - Handle of byte buffer to be read\n * `index` - Index of value to return\n * `out_val` (direction out) - Byte value at index to return\n # Returns\n\n0 when succeed, -1 when failure happens"]
124    pub fn LGBM_ByteBufferGetAt(
125        handle: ByteBufferHandle,
126        index: i32,
127        out_val: *mut u8,
128    ) -> ::std::os::raw::c_int;
129}
130unsafe extern "C" {
131    #[doc = "Free space for byte buffer.\n # Arguments\n\n* `handle` - Handle of byte buffer to be freed\n # Returns\n\n0 when succeed, -1 when failure happens"]
132    pub fn LGBM_ByteBufferFree(handle: ByteBufferHandle) -> ::std::os::raw::c_int;
133}
134unsafe extern "C" {
135    #[doc = "Load dataset from file (like LightGBM CLI version does).\n # Arguments\n\n* `filename` - The name of the file\n * `parameters` - Additional parameters\n * `reference` - Used to align bin mapper with other dataset, nullptr means isn't used\n * `out` (direction out) - A loaded dataset\n # Returns\n\n0 when succeed, -1 when failure happens"]
136    pub fn LGBM_DatasetCreateFromFile(
137        filename: *const ::std::os::raw::c_char,
138        parameters: *const ::std::os::raw::c_char,
139        reference: DatasetHandle,
140        out: *mut DatasetHandle,
141    ) -> ::std::os::raw::c_int;
142}
143unsafe extern "C" {
144    #[doc = "Allocate the space for dataset and bucket feature bins according to sampled data.\n # Arguments\n\n* `sample_data` - Sampled data, grouped by the column\n * `sample_indices` - Indices of sampled data\n * `ncol` - Number of columns\n * `num_per_col` - Size of each sampling column\n * `num_sample_row` - Number of sampled rows\n * `num_local_row` - Total number of rows local to machine\n * `num_dist_row` - Number of total distributed rows\n * `parameters` - Additional parameters\n * `out` (direction out) - Created dataset\n # Returns\n\n0 when succeed, -1 when failure happens"]
145    pub fn LGBM_DatasetCreateFromSampledColumn(
146        sample_data: *mut *mut f64,
147        sample_indices: *mut *mut ::std::os::raw::c_int,
148        ncol: i32,
149        num_per_col: *const ::std::os::raw::c_int,
150        num_sample_row: i32,
151        num_local_row: i32,
152        num_dist_row: i64,
153        parameters: *const ::std::os::raw::c_char,
154        out: *mut DatasetHandle,
155    ) -> ::std::os::raw::c_int;
156}
157unsafe extern "C" {
158    #[doc = "Allocate the space for dataset and bucket feature bins according to reference dataset.\n # Arguments\n\n* `reference` - Used to align bin mapper with other dataset\n * `num_total_row` - Number of total rows\n * `out` (direction out) - Created dataset\n # Returns\n\n0 when succeed, -1 when failure happens"]
159    pub fn LGBM_DatasetCreateByReference(
160        reference: DatasetHandle,
161        num_total_row: i64,
162        out: *mut DatasetHandle,
163    ) -> ::std::os::raw::c_int;
164}
165unsafe extern "C" {
166    #[doc = "Initialize the Dataset for streaming.\n # Arguments\n\n* `dataset` - Handle of dataset\n * `has_weights` - Whether the dataset has Metadata weights\n * `has_init_scores` - Whether the dataset has Metadata initial scores\n * `has_queries` - Whether the dataset has Metadata queries/groups\n * `nclasses` - Number of initial score classes\n * `nthreads` - Number of external threads that will use the PushRows APIs\n * `omp_max_threads` - Maximum number of OpenMP threads (-1 for default)\n # Returns\n\n0 when succeed, -1 when failure happens"]
167    pub fn LGBM_DatasetInitStreaming(
168        dataset: DatasetHandle,
169        has_weights: i32,
170        has_init_scores: i32,
171        has_queries: i32,
172        nclasses: i32,
173        nthreads: i32,
174        omp_max_threads: i32,
175    ) -> ::std::os::raw::c_int;
176}
177unsafe extern "C" {
178    #[doc = "Allocate the space for dataset and bucket feature bins according to serialized reference dataset.\n # Arguments\n\n* `ref_buffer` - A binary representation of the dataset schema (feature groups, bins, etc.)\n * `ref_buffer_size` - The size of the reference array in bytes\n * `num_row` - Number of total rows the dataset will contain\n * `num_classes` - Number of classes (will be used only in case of multiclass and specifying initial scores)\n * `parameters` - Additional parameters\n * `out` (direction out) - Created dataset\n # Returns\n\n0 when succeed, -1 when failure happens"]
179    pub fn LGBM_DatasetCreateFromSerializedReference(
180        ref_buffer: *const ::std::os::raw::c_void,
181        ref_buffer_size: i32,
182        num_row: i64,
183        num_classes: i32,
184        parameters: *const ::std::os::raw::c_char,
185        out: *mut DatasetHandle,
186    ) -> ::std::os::raw::c_int;
187}
188unsafe extern "C" {
189    #[doc = "Push data to existing dataset, if ``nrow + start_row == num_total_row``, will call ``dataset->FinishLoad``.\n # Arguments\n\n* `dataset` - Handle of dataset\n * `data` - Pointer to the data space\n * `data_type` - Type of ``data`` pointer, can be ``C_API_DTYPE_FLOAT32`` or ``C_API_DTYPE_FLOAT64``\n * `nrow` - Number of rows\n * `ncol` - Number of columns\n * `start_row` - Row start index\n # Returns\n\n0 when succeed, -1 when failure happens"]
190    pub fn LGBM_DatasetPushRows(
191        dataset: DatasetHandle,
192        data: *const ::std::os::raw::c_void,
193        data_type: ::std::os::raw::c_int,
194        nrow: i32,
195        ncol: i32,
196        start_row: i32,
197    ) -> ::std::os::raw::c_int;
198}
199unsafe extern "C" {
200    #[doc = "Push data to existing dataset.\n The general flow for a streaming scenario is:\n 1. create Dataset \"schema\" (e.g. ``LGBM_DatasetCreateFromSampledColumn``)\n 2. init them for thread-safe streaming (``LGBM_DatasetInitStreaming``)\n 3. push data (``LGBM_DatasetPushRowsWithMetadata`` or ``LGBM_DatasetPushRowsByCSRWithMetadata``)\n 4. call ``LGBM_DatasetMarkFinished``\n # Arguments\n\n* `dataset` - Handle of dataset\n * `data` - Pointer to the data space\n * `data_type` - Type of ``data`` pointer, can be ``C_API_DTYPE_FLOAT32`` or ``C_API_DTYPE_FLOAT64``\n * `nrow` - Number of rows\n * `ncol` - Number of feature columns\n * `start_row` - Row start index, i.e., the index at which to start inserting data\n * `label` - Pointer to array with nrow labels\n * `weight` - Optional pointer to array with nrow weights\n * `init_score` - Optional pointer to array with nrow*nclasses initial scores, in column format\n * `query` - Optional pointer to array with nrow query values\n * `tid` - The id of the calling thread, from 0...N-1 threads\n # Returns\n\n0 when succeed, -1 when failure happens"]
201    pub fn LGBM_DatasetPushRowsWithMetadata(
202        dataset: DatasetHandle,
203        data: *const ::std::os::raw::c_void,
204        data_type: ::std::os::raw::c_int,
205        nrow: i32,
206        ncol: i32,
207        start_row: i32,
208        label: *const f32,
209        weight: *const f32,
210        init_score: *const f64,
211        query: *const i32,
212        tid: i32,
213    ) -> ::std::os::raw::c_int;
214}
215unsafe extern "C" {
216    #[doc = "Push data to existing dataset, if ``nrow + start_row == num_total_row``, will call ``dataset->FinishLoad``.\n # Arguments\n\n* `dataset` - Handle of dataset\n * `indptr` - Pointer to row headers\n * `indptr_type` - Type of ``indptr``, can be ``C_API_DTYPE_INT32`` or ``C_API_DTYPE_INT64``\n * `indices` - Pointer to column indices\n * `data` - Pointer to the data space\n * `data_type` - Type of ``data`` pointer, can be ``C_API_DTYPE_FLOAT32`` or ``C_API_DTYPE_FLOAT64``\n * `nindptr` - Number of rows in the matrix + 1\n * `nelem` - Number of nonzero elements in the matrix\n * `num_col` - Number of columns\n * `start_row` - Row start index\n # Returns\n\n0 when succeed, -1 when failure happens"]
217    pub fn LGBM_DatasetPushRowsByCSR(
218        dataset: DatasetHandle,
219        indptr: *const ::std::os::raw::c_void,
220        indptr_type: ::std::os::raw::c_int,
221        indices: *const i32,
222        data: *const ::std::os::raw::c_void,
223        data_type: ::std::os::raw::c_int,
224        nindptr: i64,
225        nelem: i64,
226        num_col: i64,
227        start_row: i64,
228    ) -> ::std::os::raw::c_int;
229}
230unsafe extern "C" {
231    #[doc = "Push CSR data to existing dataset. (See ``LGBM_DatasetPushRowsWithMetadata`` for more details.)\n # Arguments\n\n* `dataset` - Handle of dataset\n * `indptr` - Pointer to row headers\n * `indptr_type` - Type of ``indptr``, can be ``C_API_DTYPE_INT32`` or ``C_API_DTYPE_INT64``\n * `indices` - Pointer to column indices\n * `data` - Pointer to the data space\n * `data_type` - Type of ``data`` pointer, can be ``C_API_DTYPE_FLOAT32`` or ``C_API_DTYPE_FLOAT64``\n * `nindptr` - Number of rows in the matrix + 1\n * `nelem` - Number of nonzero elements in the matrix\n * `start_row` - Row start index\n * `label` - Pointer to array with nindptr-1 labels\n * `weight` - Optional pointer to array with nindptr-1 weights\n * `init_score` - Optional pointer to array with (nindptr-1)*nclasses initial scores, in column format\n * `query` - Optional pointer to array with nindptr-1 query values\n * `tid` - The id of the calling thread, from 0...N-1 threads\n # Returns\n\n0 when succeed, -1 when failure happens"]
232    pub fn LGBM_DatasetPushRowsByCSRWithMetadata(
233        dataset: DatasetHandle,
234        indptr: *const ::std::os::raw::c_void,
235        indptr_type: ::std::os::raw::c_int,
236        indices: *const i32,
237        data: *const ::std::os::raw::c_void,
238        data_type: ::std::os::raw::c_int,
239        nindptr: i64,
240        nelem: i64,
241        start_row: i64,
242        label: *const f32,
243        weight: *const f32,
244        init_score: *const f64,
245        query: *const i32,
246        tid: i32,
247    ) -> ::std::os::raw::c_int;
248}
249unsafe extern "C" {
250    #[doc = "Set whether or not the Dataset waits for a manual MarkFinished call or calls FinishLoad on itself automatically.\n Set to 1 for streaming scenario, and use ``LGBM_DatasetMarkFinished`` to manually finish the Dataset.\n # Arguments\n\n* `dataset` - Handle of dataset\n * `wait` - Whether to wait or not (1 or 0)\n # Returns\n\n0 when succeed, -1 when failure happens"]
251    pub fn LGBM_DatasetSetWaitForManualFinish(
252        dataset: DatasetHandle,
253        wait: ::std::os::raw::c_int,
254    ) -> ::std::os::raw::c_int;
255}
256unsafe extern "C" {
257    #[doc = "Mark the Dataset as complete by calling ``dataset->FinishLoad``.\n # Arguments\n\n* `dataset` - Handle of dataset\n # Returns\n\n0 when succeed, -1 when failure happens"]
258    pub fn LGBM_DatasetMarkFinished(dataset: DatasetHandle) -> ::std::os::raw::c_int;
259}
260unsafe extern "C" {
261    #[doc = "Create a dataset from CSR format.\n # Arguments\n\n* `indptr` - Pointer to row headers\n * `indptr_type` - Type of ``indptr``, can be ``C_API_DTYPE_INT32`` or ``C_API_DTYPE_INT64``\n * `indices` - Pointer to column indices\n * `data` - Pointer to the data space\n * `data_type` - Type of ``data`` pointer, can be ``C_API_DTYPE_FLOAT32`` or ``C_API_DTYPE_FLOAT64``\n * `nindptr` - Number of rows in the matrix + 1\n * `nelem` - Number of nonzero elements in the matrix\n * `num_col` - Number of columns\n * `parameters` - Additional parameters\n * `reference` - Used to align bin mapper with other dataset, nullptr means isn't used\n * `out` (direction out) - Created dataset\n # Returns\n\n0 when succeed, -1 when failure happens"]
262    pub fn LGBM_DatasetCreateFromCSR(
263        indptr: *const ::std::os::raw::c_void,
264        indptr_type: ::std::os::raw::c_int,
265        indices: *const i32,
266        data: *const ::std::os::raw::c_void,
267        data_type: ::std::os::raw::c_int,
268        nindptr: i64,
269        nelem: i64,
270        num_col: i64,
271        parameters: *const ::std::os::raw::c_char,
272        reference: DatasetHandle,
273        out: *mut DatasetHandle,
274    ) -> ::std::os::raw::c_int;
275}
276unsafe extern "C" {
277    #[doc = "Create a dataset from CSR format through callbacks.\n # Arguments\n\n* `get_row_funptr` - Pointer to ``std::function<void(int idx, std::vector<std::pair<int, double>>& ret)>``\n (called for every row and expected to clear and fill ``ret``)\n * `num_rows` - Number of rows\n * `num_col` - Number of columns\n * `parameters` - Additional parameters\n * `reference` - Used to align bin mapper with other dataset, nullptr means isn't used\n * `out` (direction out) - Created dataset\n # Returns\n\n0 when succeed, -1 when failure happens"]
278    pub fn LGBM_DatasetCreateFromCSRFunc(
279        get_row_funptr: *mut ::std::os::raw::c_void,
280        num_rows: ::std::os::raw::c_int,
281        num_col: i64,
282        parameters: *const ::std::os::raw::c_char,
283        reference: DatasetHandle,
284        out: *mut DatasetHandle,
285    ) -> ::std::os::raw::c_int;
286}
287unsafe extern "C" {
288    #[doc = "Create a dataset from CSC format.\n # Arguments\n\n* `col_ptr` - Pointer to column headers\n * `col_ptr_type` - Type of ``col_ptr``, can be ``C_API_DTYPE_INT32`` or ``C_API_DTYPE_INT64``\n * `indices` - Pointer to row indices\n * `data` - Pointer to the data space\n * `data_type` - Type of ``data`` pointer, can be ``C_API_DTYPE_FLOAT32`` or ``C_API_DTYPE_FLOAT64``\n * `ncol_ptr` - Number of columns in the matrix + 1\n * `nelem` - Number of nonzero elements in the matrix\n * `num_row` - Number of rows\n * `parameters` - Additional parameters\n * `reference` - Used to align bin mapper with other dataset, nullptr means isn't used\n * `out` (direction out) - Created dataset\n # Returns\n\n0 when succeed, -1 when failure happens"]
289    pub fn LGBM_DatasetCreateFromCSC(
290        col_ptr: *const ::std::os::raw::c_void,
291        col_ptr_type: ::std::os::raw::c_int,
292        indices: *const i32,
293        data: *const ::std::os::raw::c_void,
294        data_type: ::std::os::raw::c_int,
295        ncol_ptr: i64,
296        nelem: i64,
297        num_row: i64,
298        parameters: *const ::std::os::raw::c_char,
299        reference: DatasetHandle,
300        out: *mut DatasetHandle,
301    ) -> ::std::os::raw::c_int;
302}
303unsafe extern "C" {
304    #[doc = "Create dataset from dense matrix.\n # Arguments\n\n* `data` - Pointer to the data space\n * `data_type` - Type of ``data`` pointer, can be ``C_API_DTYPE_FLOAT32`` or ``C_API_DTYPE_FLOAT64``\n * `nrow` - Number of rows\n * `ncol` - Number of columns\n * `is_row_major` - 1 for row-major, 0 for column-major\n * `parameters` - Additional parameters\n * `reference` - Used to align bin mapper with other dataset, nullptr means isn't used\n * `out` (direction out) - Created dataset\n # Returns\n\n0 when succeed, -1 when failure happens"]
305    pub fn LGBM_DatasetCreateFromMat(
306        data: *const ::std::os::raw::c_void,
307        data_type: ::std::os::raw::c_int,
308        nrow: i32,
309        ncol: i32,
310        is_row_major: ::std::os::raw::c_int,
311        parameters: *const ::std::os::raw::c_char,
312        reference: DatasetHandle,
313        out: *mut DatasetHandle,
314    ) -> ::std::os::raw::c_int;
315}
316unsafe extern "C" {
317    #[doc = "Create dataset from array of dense matrices.\n # Arguments\n\n* `nmat` - Number of dense matrices\n * `data` - Pointer to the data space\n * `data_type` - Type of ``data`` pointer, can be ``C_API_DTYPE_FLOAT32`` or ``C_API_DTYPE_FLOAT64``\n * `nrow` - Number of rows\n * `ncol` - Number of columns\n * `is_row_major` - Pointer to the data layouts. 1 for row-major, 0 for column-major\n * `parameters` - Additional parameters\n * `reference` - Used to align bin mapper with other dataset, nullptr means isn't used\n * `out` (direction out) - Created dataset\n # Returns\n\n0 when succeed, -1 when failure happens"]
318    pub fn LGBM_DatasetCreateFromMats(
319        nmat: i32,
320        data: *mut *const ::std::os::raw::c_void,
321        data_type: ::std::os::raw::c_int,
322        nrow: *mut i32,
323        ncol: i32,
324        is_row_major: *mut ::std::os::raw::c_int,
325        parameters: *const ::std::os::raw::c_char,
326        reference: DatasetHandle,
327        out: *mut DatasetHandle,
328    ) -> ::std::os::raw::c_int;
329}
330unsafe extern "C" {
331    #[doc = "Create dataset from Arrow.\n # Arguments\n\n* `n_chunks` - The number of Arrow arrays passed to this function\n * `chunks` - Pointer to the list of Arrow arrays\n * `schema` - Pointer to the schema of all Arrow arrays\n * `parameters` - Additional parameters\n * `reference` - Used to align bin mapper with other dataset, nullptr means isn't used\n * `out` (direction out) - Created dataset\n # Returns\n\n0 when succeed, -1 when failure happens"]
332    pub fn LGBM_DatasetCreateFromArrow(
333        n_chunks: i64,
334        chunks: *const ArrowArray,
335        schema: *const ArrowSchema,
336        parameters: *const ::std::os::raw::c_char,
337        reference: DatasetHandle,
338        out: *mut DatasetHandle,
339    ) -> ::std::os::raw::c_int;
340}
341unsafe extern "C" {
342    #[doc = "Create subset of a data.\n # Arguments\n\n* `handle` - Handle of full dataset\n * `used_row_indices` - Indices used in subset\n * `num_used_row_indices` - Length of ``used_row_indices``\n * `parameters` - Additional parameters\n * `out` (direction out) - Subset of data\n # Returns\n\n0 when succeed, -1 when failure happens"]
343    pub fn LGBM_DatasetGetSubset(
344        handle: DatasetHandle,
345        used_row_indices: *const i32,
346        num_used_row_indices: i32,
347        parameters: *const ::std::os::raw::c_char,
348        out: *mut DatasetHandle,
349    ) -> ::std::os::raw::c_int;
350}
351unsafe extern "C" {
352    #[doc = "Save feature names to dataset.\n # Arguments\n\n* `handle` - Handle of dataset\n * `feature_names` - Feature names\n * `num_feature_names` - Number of feature names\n # Returns\n\n0 when succeed, -1 when failure happens"]
353    pub fn LGBM_DatasetSetFeatureNames(
354        handle: DatasetHandle,
355        feature_names: *mut *const ::std::os::raw::c_char,
356        num_feature_names: ::std::os::raw::c_int,
357    ) -> ::std::os::raw::c_int;
358}
359unsafe extern "C" {
360    #[doc = "Get feature names of dataset.\n # Arguments\n\n* `handle` - Handle of dataset\n * `len` - Number of ``char*`` pointers stored at ``out_strs``.\n If smaller than the max size, only this many strings are copied\n * `num_feature_names` (direction out) - Number of feature names\n * `buffer_len` - Size of pre-allocated strings.\n Content is copied up to ``buffer_len - 1`` and null-terminated\n * `out_buffer_len` (direction out) - String sizes required to do the full string copies\n * `feature_names` (direction out) - Feature names, should pre-allocate memory\n # Returns\n\n0 when succeed, -1 when failure happens"]
361    pub fn LGBM_DatasetGetFeatureNames(
362        handle: DatasetHandle,
363        len: ::std::os::raw::c_int,
364        num_feature_names: *mut ::std::os::raw::c_int,
365        buffer_len: usize,
366        out_buffer_len: *mut usize,
367        feature_names: *mut *mut ::std::os::raw::c_char,
368    ) -> ::std::os::raw::c_int;
369}
370unsafe extern "C" {
371    #[doc = "Free space for dataset.\n # Arguments\n\n* `handle` - Handle of dataset to be freed\n # Returns\n\n0 when succeed, -1 when failure happens"]
372    pub fn LGBM_DatasetFree(handle: DatasetHandle) -> ::std::os::raw::c_int;
373}
374unsafe extern "C" {
375    #[doc = "Save dataset to binary file.\n # Arguments\n\n* `handle` - Handle of dataset\n * `filename` - The name of the file\n # Returns\n\n0 when succeed, -1 when failure happens"]
376    pub fn LGBM_DatasetSaveBinary(
377        handle: DatasetHandle,
378        filename: *const ::std::os::raw::c_char,
379    ) -> ::std::os::raw::c_int;
380}
381unsafe extern "C" {
382    #[doc = "Create a dataset schema representation as a binary byte array (excluding data).\n # Arguments\n\n* `handle` - Handle of dataset\n * `out` (direction out) - The output byte array\n * `out_len` (direction out) - The length of the output byte array (returned for convenience)\n # Returns\n\n0 when succeed, -1 when failure happens"]
383    pub fn LGBM_DatasetSerializeReferenceToBinary(
384        handle: DatasetHandle,
385        out: *mut ByteBufferHandle,
386        out_len: *mut i32,
387    ) -> ::std::os::raw::c_int;
388}
389unsafe extern "C" {
390    #[doc = "Save dataset to text file, intended for debugging use only.\n # Arguments\n\n* `handle` - Handle of dataset\n * `filename` - The name of the file\n # Returns\n\n0 when succeed, -1 when failure happens"]
391    pub fn LGBM_DatasetDumpText(
392        handle: DatasetHandle,
393        filename: *const ::std::os::raw::c_char,
394    ) -> ::std::os::raw::c_int;
395}
396unsafe extern "C" {
397    #[doc = "Set vector to a content in info.\n > **Note:** - _group_ only works for ``C_API_DTYPE_INT32``;\n - _label_ and _weight_ only work for ``C_API_DTYPE_FLOAT32``;\n - _init_score_ only works for ``C_API_DTYPE_FLOAT64``.\n # Arguments\n\n* `handle` - Handle of dataset\n * `field_name` - Field name, can be _label,_ _weight,_ _init_score,_ _group_\n * `field_data` - Pointer to data vector\n * `num_element` - Number of elements in ``field_data``\n * `type` - Type of ``field_data`` pointer, can be ``C_API_DTYPE_INT32``, ``C_API_DTYPE_FLOAT32`` or ``C_API_DTYPE_FLOAT64``\n # Returns\n\n0 when succeed, -1 when failure happens"]
398    pub fn LGBM_DatasetSetField(
399        handle: DatasetHandle,
400        field_name: *const ::std::os::raw::c_char,
401        field_data: *const ::std::os::raw::c_void,
402        num_element: ::std::os::raw::c_int,
403        type_: ::std::os::raw::c_int,
404    ) -> ::std::os::raw::c_int;
405}
406unsafe extern "C" {
407    #[doc = "Set vector to a content in info.\n > **Note:** - _group_ converts input datatype into ``int32``;\n - _label_ and _weight_ convert input datatype into ``float32``;\n - _init_score_ converts input datatype into ``float64``.\n # Arguments\n\n* `handle` - Handle of dataset\n * `field_name` - Field name, can be _label,_ _weight,_ _init_score,_ _group_\n * `n_chunks` - The number of Arrow arrays passed to this function\n * `chunks` - Pointer to the list of Arrow arrays\n * `schema` - Pointer to the schema of all Arrow arrays\n # Returns\n\n0 when succeed, -1 when failure happens"]
408    pub fn LGBM_DatasetSetFieldFromArrow(
409        handle: DatasetHandle,
410        field_name: *const ::std::os::raw::c_char,
411        n_chunks: i64,
412        chunks: *const ArrowArray,
413        schema: *const ArrowSchema,
414    ) -> ::std::os::raw::c_int;
415}
416unsafe extern "C" {
417    #[doc = "Get info vector from dataset.\n # Arguments\n\n* `handle` - Handle of dataset\n * `field_name` - Field name\n * `out_len` (direction out) - Used to set result length\n * `out_ptr` (direction out) - Pointer to the result\n * `out_type` (direction out) - Type of result pointer, can be ``C_API_DTYPE_INT32``, ``C_API_DTYPE_FLOAT32`` or ``C_API_DTYPE_FLOAT64``\n # Returns\n\n0 when succeed, -1 when failure happens"]
418    pub fn LGBM_DatasetGetField(
419        handle: DatasetHandle,
420        field_name: *const ::std::os::raw::c_char,
421        out_len: *mut ::std::os::raw::c_int,
422        out_ptr: *mut *const ::std::os::raw::c_void,
423        out_type: *mut ::std::os::raw::c_int,
424    ) -> ::std::os::raw::c_int;
425}
426unsafe extern "C" {
427    #[doc = "Raise errors for attempts to update dataset parameters.\n # Arguments\n\n* `old_parameters` - Current dataset parameters\n * `new_parameters` - New dataset parameters\n # Returns\n\n0 when succeed, -1 when failure happens"]
428    pub fn LGBM_DatasetUpdateParamChecking(
429        old_parameters: *const ::std::os::raw::c_char,
430        new_parameters: *const ::std::os::raw::c_char,
431    ) -> ::std::os::raw::c_int;
432}
433unsafe extern "C" {
434    #[doc = "Get number of data points.\n # Arguments\n\n* `handle` - Handle of dataset\n * `out` (direction out) - The address to hold number of data points\n # Returns\n\n0 when succeed, -1 when failure happens"]
435    pub fn LGBM_DatasetGetNumData(
436        handle: DatasetHandle,
437        out: *mut ::std::os::raw::c_int,
438    ) -> ::std::os::raw::c_int;
439}
440unsafe extern "C" {
441    #[doc = "Get number of features.\n # Arguments\n\n* `handle` - Handle of dataset\n * `out` (direction out) - The address to hold number of features\n # Returns\n\n0 when succeed, -1 when failure happens"]
442    pub fn LGBM_DatasetGetNumFeature(
443        handle: DatasetHandle,
444        out: *mut ::std::os::raw::c_int,
445    ) -> ::std::os::raw::c_int;
446}
447unsafe extern "C" {
448    #[doc = "Get number of bins for feature.\n # Arguments\n\n* `handle` - Handle of dataset\n * `feature` - Index of the feature\n * `out` (direction out) - The address to hold number of bins\n # Returns\n\n0 when succeed, -1 when failure happens"]
449    pub fn LGBM_DatasetGetFeatureNumBin(
450        handle: DatasetHandle,
451        feature: ::std::os::raw::c_int,
452        out: *mut ::std::os::raw::c_int,
453    ) -> ::std::os::raw::c_int;
454}
455unsafe extern "C" {
456    #[doc = "Add features from ``source`` to ``target``.\n # Arguments\n\n* `target` - The handle of the dataset to add features to\n * `source` - The handle of the dataset to take features from\n # Returns\n\n0 when succeed, -1 when failure happens"]
457    pub fn LGBM_DatasetAddFeaturesFrom(
458        target: DatasetHandle,
459        source: DatasetHandle,
460    ) -> ::std::os::raw::c_int;
461}
462unsafe extern "C" {
463    #[doc = "Get int representing whether booster is fitting linear trees.\n # Arguments\n\n* `handle` - Handle of booster\n * `out` (direction out) - The address to hold linear trees indicator\n # Returns\n\n0 when succeed, -1 when failure happens"]
464    pub fn LGBM_BoosterGetLinear(
465        handle: BoosterHandle,
466        out: *mut ::std::os::raw::c_int,
467    ) -> ::std::os::raw::c_int;
468}
469unsafe extern "C" {
470    #[doc = "Create a new boosting learner.\n # Arguments\n\n* `train_data` - Training dataset\n * `parameters` - Parameters in format 'key1=value1 key2=value2'\n * `out` (direction out) - Handle of created booster\n # Returns\n\n0 when succeed, -1 when failure happens"]
471    pub fn LGBM_BoosterCreate(
472        train_data: DatasetHandle,
473        parameters: *const ::std::os::raw::c_char,
474        out: *mut BoosterHandle,
475    ) -> ::std::os::raw::c_int;
476}
477unsafe extern "C" {
478    #[doc = "Load an existing booster from model file.\n # Arguments\n\n* `filename` - Filename of model\n * `out_num_iterations` (direction out) - Number of iterations of this booster\n * `out` (direction out) - Handle of created booster\n # Returns\n\n0 when succeed, -1 when failure happens"]
479    pub fn LGBM_BoosterCreateFromModelfile(
480        filename: *const ::std::os::raw::c_char,
481        out_num_iterations: *mut ::std::os::raw::c_int,
482        out: *mut BoosterHandle,
483    ) -> ::std::os::raw::c_int;
484}
485unsafe extern "C" {
486    #[doc = "Load an existing booster from string.\n # Arguments\n\n* `model_str` - Model string\n * `out_num_iterations` (direction out) - Number of iterations of this booster\n * `out` (direction out) - Handle of created booster\n # Returns\n\n0 when succeed, -1 when failure happens"]
487    pub fn LGBM_BoosterLoadModelFromString(
488        model_str: *const ::std::os::raw::c_char,
489        out_num_iterations: *mut ::std::os::raw::c_int,
490        out: *mut BoosterHandle,
491    ) -> ::std::os::raw::c_int;
492}
493unsafe extern "C" {
494    #[doc = "Get parameters as JSON string.\n # Arguments\n\n* `handle` - Handle of booster\n * `buffer_len` - Allocated space for string\n * `out_len` (direction out) - Actual size of string\n * `out_str` (direction out) - JSON string containing parameters\n # Returns\n\n0 when succeed, -1 when failure happens"]
495    pub fn LGBM_BoosterGetLoadedParam(
496        handle: BoosterHandle,
497        buffer_len: i64,
498        out_len: *mut i64,
499        out_str: *mut ::std::os::raw::c_char,
500    ) -> ::std::os::raw::c_int;
501}
502unsafe extern "C" {
503    #[doc = "Free space for booster.\n # Arguments\n\n* `handle` - Handle of booster to be freed\n # Returns\n\n0 when succeed, -1 when failure happens"]
504    pub fn LGBM_BoosterFree(handle: BoosterHandle) -> ::std::os::raw::c_int;
505}
506unsafe extern "C" {
507    #[doc = "Shuffle models.\n # Arguments\n\n* `handle` - Handle of booster\n * `start_iter` - The first iteration that will be shuffled\n * `end_iter` - The last iteration that will be shuffled\n # Returns\n\n0 when succeed, -1 when failure happens"]
508    pub fn LGBM_BoosterShuffleModels(
509        handle: BoosterHandle,
510        start_iter: ::std::os::raw::c_int,
511        end_iter: ::std::os::raw::c_int,
512    ) -> ::std::os::raw::c_int;
513}
514unsafe extern "C" {
515    #[doc = "Merge model from ``other_handle`` into ``handle``.\n # Arguments\n\n* `handle` - Handle of booster, will merge another booster into this one\n * `other_handle` - Other handle of booster\n # Returns\n\n0 when succeed, -1 when failure happens"]
516    pub fn LGBM_BoosterMerge(
517        handle: BoosterHandle,
518        other_handle: BoosterHandle,
519    ) -> ::std::os::raw::c_int;
520}
521unsafe extern "C" {
522    #[doc = "Add new validation data to booster.\n # Arguments\n\n* `handle` - Handle of booster\n * `valid_data` - Validation dataset\n # Returns\n\n0 when succeed, -1 when failure happens"]
523    pub fn LGBM_BoosterAddValidData(
524        handle: BoosterHandle,
525        valid_data: DatasetHandle,
526    ) -> ::std::os::raw::c_int;
527}
528unsafe extern "C" {
529    #[doc = "Reset training data for booster.\n # Arguments\n\n* `handle` - Handle of booster\n * `train_data` - Training dataset\n # Returns\n\n0 when succeed, -1 when failure happens"]
530    pub fn LGBM_BoosterResetTrainingData(
531        handle: BoosterHandle,
532        train_data: DatasetHandle,
533    ) -> ::std::os::raw::c_int;
534}
535unsafe extern "C" {
536    #[doc = "Reset config for booster.\n # Arguments\n\n* `handle` - Handle of booster\n * `parameters` - Parameters in format 'key1=value1 key2=value2'\n # Returns\n\n0 when succeed, -1 when failure happens"]
537    pub fn LGBM_BoosterResetParameter(
538        handle: BoosterHandle,
539        parameters: *const ::std::os::raw::c_char,
540    ) -> ::std::os::raw::c_int;
541}
542unsafe extern "C" {
543    #[doc = "Get number of classes.\n # Arguments\n\n* `handle` - Handle of booster\n * `out_len` (direction out) - Number of classes\n # Returns\n\n0 when succeed, -1 when failure happens"]
544    pub fn LGBM_BoosterGetNumClasses(
545        handle: BoosterHandle,
546        out_len: *mut ::std::os::raw::c_int,
547    ) -> ::std::os::raw::c_int;
548}
549unsafe extern "C" {
550    #[doc = "Update the model for one iteration.\n # Arguments\n\n* `handle` - Handle of booster\n * `is_finished` (direction out) - 1 means the update was successfully finished (cannot split any more), 0 indicates failure\n # Returns\n\n0 when succeed, -1 when failure happens"]
551    pub fn LGBM_BoosterUpdateOneIter(
552        handle: BoosterHandle,
553        is_finished: *mut ::std::os::raw::c_int,
554    ) -> ::std::os::raw::c_int;
555}
556unsafe extern "C" {
557    #[doc = "Refit the tree model using the new data (online learning).\n # Arguments\n\n* `handle` - Handle of booster\n * `leaf_preds` - Pointer to predicted leaf indices\n * `nrow` - Number of rows of ``leaf_preds``\n * `ncol` - Number of columns of ``leaf_preds``\n # Returns\n\n0 when succeed, -1 when failure happens"]
558    pub fn LGBM_BoosterRefit(
559        handle: BoosterHandle,
560        leaf_preds: *const i32,
561        nrow: i32,
562        ncol: i32,
563    ) -> ::std::os::raw::c_int;
564}
565unsafe extern "C" {
566    #[doc = "Update the model by specifying gradient and Hessian directly\n (this can be used to support customized loss functions).\n > **Note:** The length of the arrays referenced by ``grad`` and ``hess`` must be equal to\n ``num_class * num_train_data``, this is not verified by the library, the caller must ensure this.\n # Arguments\n\n* `handle` - Handle of booster\n * `grad` - The first order derivative (gradient) statistics\n * `hess` - The second order derivative (Hessian) statistics\n * `is_finished` (direction out) - 1 means the update was successfully finished (cannot split any more), 0 indicates failure\n # Returns\n\n0 when succeed, -1 when failure happens"]
567    pub fn LGBM_BoosterUpdateOneIterCustom(
568        handle: BoosterHandle,
569        grad: *const f32,
570        hess: *const f32,
571        is_finished: *mut ::std::os::raw::c_int,
572    ) -> ::std::os::raw::c_int;
573}
574unsafe extern "C" {
575    #[doc = "Rollback one iteration.\n # Arguments\n\n* `handle` - Handle of booster\n # Returns\n\n0 when succeed, -1 when failure happens"]
576    pub fn LGBM_BoosterRollbackOneIter(handle: BoosterHandle) -> ::std::os::raw::c_int;
577}
578unsafe extern "C" {
579    #[doc = "Get index of the current boosting iteration.\n # Arguments\n\n* `handle` - Handle of booster\n * `out_iteration` (direction out) - Index of the current boosting iteration\n # Returns\n\n0 when succeed, -1 when failure happens"]
580    pub fn LGBM_BoosterGetCurrentIteration(
581        handle: BoosterHandle,
582        out_iteration: *mut ::std::os::raw::c_int,
583    ) -> ::std::os::raw::c_int;
584}
585unsafe extern "C" {
586    #[doc = "Get number of trees per iteration.\n # Arguments\n\n* `handle` - Handle of booster\n * `out_tree_per_iteration` (direction out) - Number of trees per iteration\n # Returns\n\n0 when succeed, -1 when failure happens"]
587    pub fn LGBM_BoosterNumModelPerIteration(
588        handle: BoosterHandle,
589        out_tree_per_iteration: *mut ::std::os::raw::c_int,
590    ) -> ::std::os::raw::c_int;
591}
592unsafe extern "C" {
593    #[doc = "Get number of weak sub-models.\n # Arguments\n\n* `handle` - Handle of booster\n * `out_models` (direction out) - Number of weak sub-models\n # Returns\n\n0 when succeed, -1 when failure happens"]
594    pub fn LGBM_BoosterNumberOfTotalModel(
595        handle: BoosterHandle,
596        out_models: *mut ::std::os::raw::c_int,
597    ) -> ::std::os::raw::c_int;
598}
599unsafe extern "C" {
600    #[doc = "Get number of evaluation metrics.\n # Arguments\n\n* `handle` - Handle of booster\n * `out_len` (direction out) - Total number of evaluation metrics\n # Returns\n\n0 when succeed, -1 when failure happens"]
601    pub fn LGBM_BoosterGetEvalCounts(
602        handle: BoosterHandle,
603        out_len: *mut ::std::os::raw::c_int,
604    ) -> ::std::os::raw::c_int;
605}
606unsafe extern "C" {
607    #[doc = "Get names of evaluation metrics.\n # Arguments\n\n* `handle` - Handle of booster\n * `len` - Number of ``char*`` pointers stored at ``out_strs``.\n If smaller than the max size, only this many strings are copied\n * `out_len` (direction out) - Total number of evaluation metrics\n * `buffer_len` - Size of pre-allocated strings.\n Content is copied up to ``buffer_len - 1`` and null-terminated\n * `out_buffer_len` (direction out) - String sizes required to do the full string copies\n * `out_strs` (direction out) - Names of evaluation metrics, should pre-allocate memory\n # Returns\n\n0 when succeed, -1 when failure happens"]
608    pub fn LGBM_BoosterGetEvalNames(
609        handle: BoosterHandle,
610        len: ::std::os::raw::c_int,
611        out_len: *mut ::std::os::raw::c_int,
612        buffer_len: usize,
613        out_buffer_len: *mut usize,
614        out_strs: *mut *mut ::std::os::raw::c_char,
615    ) -> ::std::os::raw::c_int;
616}
617unsafe extern "C" {
618    #[doc = "Get names of features.\n # Arguments\n\n* `handle` - Handle of booster\n * `len` - Number of ``char*`` pointers stored at ``out_strs``.\n If smaller than the max size, only this many strings are copied\n * `out_len` (direction out) - Total number of features\n * `buffer_len` - Size of pre-allocated strings.\n Content is copied up to ``buffer_len - 1`` and null-terminated\n * `out_buffer_len` (direction out) - String sizes required to do the full string copies\n * `out_strs` (direction out) - Names of features, should pre-allocate memory\n # Returns\n\n0 when succeed, -1 when failure happens"]
619    pub fn LGBM_BoosterGetFeatureNames(
620        handle: BoosterHandle,
621        len: ::std::os::raw::c_int,
622        out_len: *mut ::std::os::raw::c_int,
623        buffer_len: usize,
624        out_buffer_len: *mut usize,
625        out_strs: *mut *mut ::std::os::raw::c_char,
626    ) -> ::std::os::raw::c_int;
627}
628unsafe extern "C" {
629    #[doc = "Check that the feature names of the data match the ones used to train the booster.\n # Arguments\n\n* `handle` - Handle of booster\n * `data_names` - Array with the feature names in the data\n * `data_num_features` - Number of features in the data\n # Returns\n\n0 when succeed, -1 when failure happens"]
630    pub fn LGBM_BoosterValidateFeatureNames(
631        handle: BoosterHandle,
632        data_names: *mut *const ::std::os::raw::c_char,
633        data_num_features: ::std::os::raw::c_int,
634    ) -> ::std::os::raw::c_int;
635}
636unsafe extern "C" {
637    #[doc = "Get number of features.\n # Arguments\n\n* `handle` - Handle of booster\n * `out_len` (direction out) - Total number of features\n # Returns\n\n0 when succeed, -1 when failure happens"]
638    pub fn LGBM_BoosterGetNumFeature(
639        handle: BoosterHandle,
640        out_len: *mut ::std::os::raw::c_int,
641    ) -> ::std::os::raw::c_int;
642}
643unsafe extern "C" {
644    #[doc = "Get evaluation for training data and validation data.\n > **Note:** 1. You should call ``LGBM_BoosterGetEvalNames`` first to get the names of evaluation metrics.\n 2. You should pre-allocate memory for ``out_results``, you can get its length by ``LGBM_BoosterGetEvalCounts``.\n # Arguments\n\n* `handle` - Handle of booster\n * `data_idx` - Index of data, 0: training data, 1: 1st validation data, 2: 2nd validation data and so on\n * `out_len` (direction out) - Length of output result\n * `out_results` (direction out) - Array with evaluation results\n # Returns\n\n0 when succeed, -1 when failure happens"]
645    pub fn LGBM_BoosterGetEval(
646        handle: BoosterHandle,
647        data_idx: ::std::os::raw::c_int,
648        out_len: *mut ::std::os::raw::c_int,
649        out_results: *mut f64,
650    ) -> ::std::os::raw::c_int;
651}
652unsafe extern "C" {
653    #[doc = "Get number of predictions for training data and validation data\n (this can be used to support customized evaluation functions).\n # Arguments\n\n* `handle` - Handle of booster\n * `data_idx` - Index of data, 0: training data, 1: 1st validation data, 2: 2nd validation data and so on\n * `out_len` (direction out) - Number of predictions\n # Returns\n\n0 when succeed, -1 when failure happens"]
654    pub fn LGBM_BoosterGetNumPredict(
655        handle: BoosterHandle,
656        data_idx: ::std::os::raw::c_int,
657        out_len: *mut i64,
658    ) -> ::std::os::raw::c_int;
659}
660unsafe extern "C" {
661    #[doc = "Get prediction for training data and validation data.\n > **Note:** You should pre-allocate memory for ``out_result``, its length is equal to ``num_class * num_data``.\n # Arguments\n\n* `handle` - Handle of booster\n * `data_idx` - Index of data, 0: training data, 1: 1st validation data, 2: 2nd validation data and so on\n * `out_len` (direction out) - Length of output result\n * `out_result` (direction out) - Pointer to array with predictions\n # Returns\n\n0 when succeed, -1 when failure happens"]
662    pub fn LGBM_BoosterGetPredict(
663        handle: BoosterHandle,
664        data_idx: ::std::os::raw::c_int,
665        out_len: *mut i64,
666        out_result: *mut f64,
667    ) -> ::std::os::raw::c_int;
668}
669unsafe extern "C" {
670    #[doc = "Make prediction for file.\n # Arguments\n\n* `handle` - Handle of booster\n * `data_filename` - Filename of file with data\n * `data_has_header` - Whether file has header or not\n * `predict_type` - What should be predicted\n - ``C_API_PREDICT_NORMAL``: normal prediction, with transform (if needed);\n - ``C_API_PREDICT_RAW_SCORE``: raw score;\n - ``C_API_PREDICT_LEAF_INDEX``: leaf index;\n - ``C_API_PREDICT_CONTRIB``: feature contributions (SHAP values)\n * `start_iteration` - Start index of the iteration to predict\n * `num_iteration` - Number of iterations for prediction, <= 0 means no limit\n * `parameter` - Other parameters for prediction, e.g. early stopping for prediction\n * `result_filename` - Filename of result file in which predictions will be written\n # Returns\n\n0 when succeed, -1 when failure happens"]
671    pub fn LGBM_BoosterPredictForFile(
672        handle: BoosterHandle,
673        data_filename: *const ::std::os::raw::c_char,
674        data_has_header: ::std::os::raw::c_int,
675        predict_type: ::std::os::raw::c_int,
676        start_iteration: ::std::os::raw::c_int,
677        num_iteration: ::std::os::raw::c_int,
678        parameter: *const ::std::os::raw::c_char,
679        result_filename: *const ::std::os::raw::c_char,
680    ) -> ::std::os::raw::c_int;
681}
682unsafe extern "C" {
683    #[doc = "Get number of predictions.\n # Arguments\n\n* `handle` - Handle of booster\n * `num_row` - Number of rows\n * `predict_type` - What should be predicted\n - ``C_API_PREDICT_NORMAL``: normal prediction, with transform (if needed);\n - ``C_API_PREDICT_RAW_SCORE``: raw score;\n - ``C_API_PREDICT_LEAF_INDEX``: leaf index;\n - ``C_API_PREDICT_CONTRIB``: feature contributions (SHAP values)\n * `start_iteration` - Start index of the iteration to predict\n * `num_iteration` - Number of iterations for prediction, <= 0 means no limit\n * `out_len` (direction out) - Length of prediction\n # Returns\n\n0 when succeed, -1 when failure happens"]
684    pub fn LGBM_BoosterCalcNumPredict(
685        handle: BoosterHandle,
686        num_row: ::std::os::raw::c_int,
687        predict_type: ::std::os::raw::c_int,
688        start_iteration: ::std::os::raw::c_int,
689        num_iteration: ::std::os::raw::c_int,
690        out_len: *mut i64,
691    ) -> ::std::os::raw::c_int;
692}
693unsafe extern "C" {
694    #[doc = "Release FastConfig object.\n\n # Arguments\n\n* `fastConfig` - Handle to the FastConfig object acquired with a ``*FastInit()`` method.\n # Returns\n\n0 when it succeeds, -1 when failure happens"]
695    pub fn LGBM_FastConfigFree(fastConfig: FastConfigHandle) -> ::std::os::raw::c_int;
696}
697unsafe extern "C" {
698    #[doc = "Make prediction for a new dataset in CSR format.\n > **Note:** You should pre-allocate memory for ``out_result``:\n - for normal and raw score, its length is equal to ``num_class * num_data``;\n - for leaf index, its length is equal to ``num_class * num_data * num_iteration``;\n - for feature contributions, its length is equal to ``num_class * num_data * (num_feature + 1)``.\n # Arguments\n\n* `handle` - Handle of booster\n * `indptr` - Pointer to row headers\n * `indptr_type` - Type of ``indptr``, can be ``C_API_DTYPE_INT32`` or ``C_API_DTYPE_INT64``\n * `indices` - Pointer to column indices\n * `data` - Pointer to the data space\n * `data_type` - Type of ``data`` pointer, can be ``C_API_DTYPE_FLOAT32`` or ``C_API_DTYPE_FLOAT64``\n * `nindptr` - Number of rows in the matrix + 1\n * `nelem` - Number of nonzero elements in the matrix\n * `num_col` - Number of columns\n * `predict_type` - What should be predicted\n - ``C_API_PREDICT_NORMAL``: normal prediction, with transform (if needed);\n - ``C_API_PREDICT_RAW_SCORE``: raw score;\n - ``C_API_PREDICT_LEAF_INDEX``: leaf index;\n - ``C_API_PREDICT_CONTRIB``: feature contributions (SHAP values)\n * `start_iteration` - Start index of the iteration to predict\n * `num_iteration` - Number of iterations for prediction, <= 0 means no limit\n * `parameter` - Other parameters for prediction, e.g. early stopping for prediction\n * `out_len` (direction out) - Length of output result\n * `out_result` (direction out) - Pointer to array with predictions\n # Returns\n\n0 when succeed, -1 when failure happens"]
699    pub fn LGBM_BoosterPredictForCSR(
700        handle: BoosterHandle,
701        indptr: *const ::std::os::raw::c_void,
702        indptr_type: ::std::os::raw::c_int,
703        indices: *const i32,
704        data: *const ::std::os::raw::c_void,
705        data_type: ::std::os::raw::c_int,
706        nindptr: i64,
707        nelem: i64,
708        num_col: i64,
709        predict_type: ::std::os::raw::c_int,
710        start_iteration: ::std::os::raw::c_int,
711        num_iteration: ::std::os::raw::c_int,
712        parameter: *const ::std::os::raw::c_char,
713        out_len: *mut i64,
714        out_result: *mut f64,
715    ) -> ::std::os::raw::c_int;
716}
717unsafe extern "C" {
718    #[doc = "Make sparse prediction for a new dataset in CSR or CSC format. Currently only used for feature contributions.\n > **Note:** The outputs are pre-allocated, as they can vary for each invocation, but the shape should be the same:\n - for feature contributions, the shape of sparse matrix will be ``num_class * num_data * (num_feature + 1)``.\n The output indptr_type for the sparse matrix will be the same as the given input indptr_type.\n Call ``LGBM_BoosterFreePredictSparse`` to deallocate resources.\n # Arguments\n\n* `handle` - Handle of booster\n * `indptr` - Pointer to row headers for CSR or column headers for CSC\n * `indptr_type` - Type of ``indptr``, can be ``C_API_DTYPE_INT32`` or ``C_API_DTYPE_INT64``\n * `indices` - Pointer to column indices for CSR or row indices for CSC\n * `data` - Pointer to the data space\n * `data_type` - Type of ``data`` pointer, can be ``C_API_DTYPE_FLOAT32`` or ``C_API_DTYPE_FLOAT64``\n * `nindptr` - Number of entries in ``indptr``\n * `nelem` - Number of nonzero elements in the matrix\n * `num_col_or_row` - Number of columns for CSR or number of rows for CSC\n * `predict_type` - What should be predicted, only feature contributions supported currently\n - ``C_API_PREDICT_CONTRIB``: feature contributions (SHAP values)\n * `start_iteration` - Start index of the iteration to predict\n * `num_iteration` - Number of iterations for prediction, <= 0 means no limit\n * `parameter` - Other parameters for prediction, e.g. early stopping for prediction\n * `matrix_type` - Type of matrix input and output, can be ``C_API_MATRIX_TYPE_CSR`` or ``C_API_MATRIX_TYPE_CSC``\n * `out_len` (direction out) - Length of output data and output indptr (pointer to an array with two entries where to write them)\n * `out_indptr` (direction out) - Pointer to output row headers for CSR or column headers for CSC\n * `out_indices` (direction out) - Pointer to sparse column indices for CSR or row indices for CSC\n * `out_data` (direction out) - Pointer to sparse data space\n # Returns\n\n0 when succeed, -1 when failure happens"]
719    pub fn LGBM_BoosterPredictSparseOutput(
720        handle: BoosterHandle,
721        indptr: *const ::std::os::raw::c_void,
722        indptr_type: ::std::os::raw::c_int,
723        indices: *const i32,
724        data: *const ::std::os::raw::c_void,
725        data_type: ::std::os::raw::c_int,
726        nindptr: i64,
727        nelem: i64,
728        num_col_or_row: i64,
729        predict_type: ::std::os::raw::c_int,
730        start_iteration: ::std::os::raw::c_int,
731        num_iteration: ::std::os::raw::c_int,
732        parameter: *const ::std::os::raw::c_char,
733        matrix_type: ::std::os::raw::c_int,
734        out_len: *mut i64,
735        out_indptr: *mut *mut ::std::os::raw::c_void,
736        out_indices: *mut *mut i32,
737        out_data: *mut *mut ::std::os::raw::c_void,
738    ) -> ::std::os::raw::c_int;
739}
740unsafe extern "C" {
741    #[doc = "Method corresponding to ``LGBM_BoosterPredictSparseOutput`` to free the allocated data.\n # Arguments\n\n* `indptr` - Pointer to output row headers or column headers to be deallocated\n * `indices` - Pointer to sparse indices to be deallocated\n * `data` - Pointer to sparse data space to be deallocated\n * `indptr_type` - Type of ``indptr``, can be ``C_API_DTYPE_INT32`` or ``C_API_DTYPE_INT64``\n * `data_type` - Type of ``data`` pointer, can be ``C_API_DTYPE_FLOAT32`` or ``C_API_DTYPE_FLOAT64``\n # Returns\n\n0 when succeed, -1 when failure happens"]
742    pub fn LGBM_BoosterFreePredictSparse(
743        indptr: *mut ::std::os::raw::c_void,
744        indices: *mut i32,
745        data: *mut ::std::os::raw::c_void,
746        indptr_type: ::std::os::raw::c_int,
747        data_type: ::std::os::raw::c_int,
748    ) -> ::std::os::raw::c_int;
749}
750unsafe extern "C" {
751    #[doc = "Make prediction for a new dataset in CSR format. This method re-uses the internal predictor structure\n from previous calls and is optimized for single row invocation.\n > **Note:** You should pre-allocate memory for ``out_result``:\n - for normal and raw score, its length is equal to ``num_class * num_data``;\n - for leaf index, its length is equal to ``num_class * num_data * num_iteration``;\n - for feature contributions, its length is equal to ``num_class * num_data * (num_feature + 1)``.\n # Arguments\n\n* `handle` - Handle of booster\n * `indptr` - Pointer to row headers\n * `indptr_type` - Type of ``indptr``, can be ``C_API_DTYPE_INT32`` or ``C_API_DTYPE_INT64``\n * `indices` - Pointer to column indices\n * `data` - Pointer to the data space\n * `data_type` - Type of ``data`` pointer, can be ``C_API_DTYPE_FLOAT32`` or ``C_API_DTYPE_FLOAT64``\n * `nindptr` - Number of rows in the matrix + 1\n * `nelem` - Number of nonzero elements in the matrix\n * `num_col` - Number of columns\n * `predict_type` - What should be predicted\n - ``C_API_PREDICT_NORMAL``: normal prediction, with transform (if needed);\n - ``C_API_PREDICT_RAW_SCORE``: raw score;\n - ``C_API_PREDICT_LEAF_INDEX``: leaf index;\n - ``C_API_PREDICT_CONTRIB``: feature contributions (SHAP values)\n * `start_iteration` - Start index of the iteration to predict\n * `num_iteration` - Number of iterations for prediction, <= 0 means no limit\n * `parameter` - Other parameters for prediction, e.g. early stopping for prediction\n * `out_len` (direction out) - Length of output result\n * `out_result` (direction out) - Pointer to array with predictions\n # Returns\n\n0 when succeed, -1 when failure happens"]
752    pub fn LGBM_BoosterPredictForCSRSingleRow(
753        handle: BoosterHandle,
754        indptr: *const ::std::os::raw::c_void,
755        indptr_type: ::std::os::raw::c_int,
756        indices: *const i32,
757        data: *const ::std::os::raw::c_void,
758        data_type: ::std::os::raw::c_int,
759        nindptr: i64,
760        nelem: i64,
761        num_col: i64,
762        predict_type: ::std::os::raw::c_int,
763        start_iteration: ::std::os::raw::c_int,
764        num_iteration: ::std::os::raw::c_int,
765        parameter: *const ::std::os::raw::c_char,
766        out_len: *mut i64,
767        out_result: *mut f64,
768    ) -> ::std::os::raw::c_int;
769}
770unsafe extern "C" {
771    #[doc = "Initialize and return a ``FastConfigHandle`` for use with ``LGBM_BoosterPredictForCSRSingleRowFast``.\n\n Release the ``FastConfig`` by passing its handle to ``LGBM_FastConfigFree`` when no longer needed.\n\n # Arguments\n\n* `handle` - Booster handle\n * `predict_type` - What should be predicted\n - ``C_API_PREDICT_NORMAL``: normal prediction, with transform (if needed);\n - ``C_API_PREDICT_RAW_SCORE``: raw score;\n - ``C_API_PREDICT_LEAF_INDEX``: leaf index;\n - ``C_API_PREDICT_CONTRIB``: feature contributions (SHAP values)\n * `start_iteration` - Start index of the iteration to predict\n * `num_iteration` - Number of iterations for prediction, <= 0 means no limit\n * `data_type` - Type of ``data`` pointer, can be ``C_API_DTYPE_FLOAT32`` or ``C_API_DTYPE_FLOAT64``\n * `num_col` - Number of columns\n * `parameter` - Other parameters for prediction, e.g. early stopping for prediction\n * `out_fastConfig` (direction out) - FastConfig object with which you can call ``LGBM_BoosterPredictForCSRSingleRowFast``\n # Returns\n\n0 when it succeeds, -1 when failure happens"]
772    pub fn LGBM_BoosterPredictForCSRSingleRowFastInit(
773        handle: BoosterHandle,
774        predict_type: ::std::os::raw::c_int,
775        start_iteration: ::std::os::raw::c_int,
776        num_iteration: ::std::os::raw::c_int,
777        data_type: ::std::os::raw::c_int,
778        num_col: i64,
779        parameter: *const ::std::os::raw::c_char,
780        out_fastConfig: *mut FastConfigHandle,
781    ) -> ::std::os::raw::c_int;
782}
783unsafe extern "C" {
784    #[doc = "Faster variant of ``LGBM_BoosterPredictForCSRSingleRow``.\n\n Score single rows after setup with ``LGBM_BoosterPredictForCSRSingleRowFastInit``.\n\n By removing the setup steps from this call extra optimizations can be made like\n initializing the config only once, instead of once per call.\n\n > **Note:** Setting up the number of threads is only done once at ``LGBM_BoosterPredictForCSRSingleRowFastInit``\n instead of at each prediction.\n If you use a different number of threads in other calls, you need to start the setup process over,\n or that number of threads will be used for these calls as well.\n\n > **Note:** You should pre-allocate memory for ``out_result``:\n - for normal and raw score, its length is equal to ``num_class * num_data``;\n - for leaf index, its length is equal to ``num_class * num_data * num_iteration``;\n - for feature contributions, its length is equal to ``num_class * num_data * (num_feature + 1)``.\n\n # Arguments\n\n* `fastConfig_handle` - FastConfig object handle returned by ``LGBM_BoosterPredictForCSRSingleRowFastInit``\n * `indptr` - Pointer to row headers\n * `indptr_type` - Type of ``indptr``, can be ``C_API_DTYPE_INT32`` or ``C_API_DTYPE_INT64``\n * `indices` - Pointer to column indices\n * `data` - Pointer to the data space\n * `nindptr` - Number of rows in the matrix + 1\n * `nelem` - Number of nonzero elements in the matrix\n * `out_len` (direction out) - Length of output result\n * `out_result` (direction out) - Pointer to array with predictions\n # Returns\n\n0 when succeed, -1 when failure happens"]
785    pub fn LGBM_BoosterPredictForCSRSingleRowFast(
786        fastConfig_handle: FastConfigHandle,
787        indptr: *const ::std::os::raw::c_void,
788        indptr_type: ::std::os::raw::c_int,
789        indices: *const i32,
790        data: *const ::std::os::raw::c_void,
791        nindptr: i64,
792        nelem: i64,
793        out_len: *mut i64,
794        out_result: *mut f64,
795    ) -> ::std::os::raw::c_int;
796}
797unsafe extern "C" {
798    #[doc = "Make prediction for a new dataset in CSC format.\n > **Note:** You should pre-allocate memory for ``out_result``:\n - for normal and raw score, its length is equal to ``num_class * num_data``;\n - for leaf index, its length is equal to ``num_class * num_data * num_iteration``;\n - for feature contributions, its length is equal to ``num_class * num_data * (num_feature + 1)``.\n # Arguments\n\n* `handle` - Handle of booster\n * `col_ptr` - Pointer to column headers\n * `col_ptr_type` - Type of ``col_ptr``, can be ``C_API_DTYPE_INT32`` or ``C_API_DTYPE_INT64``\n * `indices` - Pointer to row indices\n * `data` - Pointer to the data space\n * `data_type` - Type of ``data`` pointer, can be ``C_API_DTYPE_FLOAT32`` or ``C_API_DTYPE_FLOAT64``\n * `ncol_ptr` - Number of columns in the matrix + 1\n * `nelem` - Number of nonzero elements in the matrix\n * `num_row` - Number of rows\n * `predict_type` - What should be predicted\n - ``C_API_PREDICT_NORMAL``: normal prediction, with transform (if needed);\n - ``C_API_PREDICT_RAW_SCORE``: raw score;\n - ``C_API_PREDICT_LEAF_INDEX``: leaf index;\n - ``C_API_PREDICT_CONTRIB``: feature contributions (SHAP values)\n * `start_iteration` - Start index of the iteration to predict\n * `num_iteration` - Number of iteration for prediction, <= 0 means no limit\n * `parameter` - Other parameters for prediction, e.g. early stopping for prediction\n * `out_len` (direction out) - Length of output result\n * `out_result` (direction out) - Pointer to array with predictions\n # Returns\n\n0 when succeed, -1 when failure happens"]
799    pub fn LGBM_BoosterPredictForCSC(
800        handle: BoosterHandle,
801        col_ptr: *const ::std::os::raw::c_void,
802        col_ptr_type: ::std::os::raw::c_int,
803        indices: *const i32,
804        data: *const ::std::os::raw::c_void,
805        data_type: ::std::os::raw::c_int,
806        ncol_ptr: i64,
807        nelem: i64,
808        num_row: i64,
809        predict_type: ::std::os::raw::c_int,
810        start_iteration: ::std::os::raw::c_int,
811        num_iteration: ::std::os::raw::c_int,
812        parameter: *const ::std::os::raw::c_char,
813        out_len: *mut i64,
814        out_result: *mut f64,
815    ) -> ::std::os::raw::c_int;
816}
817unsafe extern "C" {
818    #[doc = "Make prediction for a new dataset.\n > **Note:** You should pre-allocate memory for ``out_result``:\n - for normal and raw score, its length is equal to ``num_class * num_data``;\n - for leaf index, its length is equal to ``num_class * num_data * num_iteration``;\n - for feature contributions, its length is equal to ``num_class * num_data * (num_feature + 1)``.\n # Arguments\n\n* `handle` - Handle of booster\n * `data` - Pointer to the data space\n * `data_type` - Type of ``data`` pointer, can be ``C_API_DTYPE_FLOAT32`` or ``C_API_DTYPE_FLOAT64``\n * `nrow` - Number of rows\n * `ncol` - Number of columns\n * `is_row_major` - 1 for row-major, 0 for column-major\n * `predict_type` - What should be predicted\n - ``C_API_PREDICT_NORMAL``: normal prediction, with transform (if needed);\n - ``C_API_PREDICT_RAW_SCORE``: raw score;\n - ``C_API_PREDICT_LEAF_INDEX``: leaf index;\n - ``C_API_PREDICT_CONTRIB``: feature contributions (SHAP values)\n * `start_iteration` - Start index of the iteration to predict\n * `num_iteration` - Number of iteration for prediction, <= 0 means no limit\n * `parameter` - Other parameters for prediction, e.g. early stopping for prediction\n * `out_len` (direction out) - Length of output result\n * `out_result` (direction out) - Pointer to array with predictions\n # Returns\n\n0 when succeed, -1 when failure happens"]
819    pub fn LGBM_BoosterPredictForMat(
820        handle: BoosterHandle,
821        data: *const ::std::os::raw::c_void,
822        data_type: ::std::os::raw::c_int,
823        nrow: i32,
824        ncol: i32,
825        is_row_major: ::std::os::raw::c_int,
826        predict_type: ::std::os::raw::c_int,
827        start_iteration: ::std::os::raw::c_int,
828        num_iteration: ::std::os::raw::c_int,
829        parameter: *const ::std::os::raw::c_char,
830        out_len: *mut i64,
831        out_result: *mut f64,
832    ) -> ::std::os::raw::c_int;
833}
834unsafe extern "C" {
835    #[doc = "Make prediction for a new dataset. This method re-uses the internal predictor structure\n from previous calls and is optimized for single row invocation.\n > **Note:** You should pre-allocate memory for ``out_result``:\n - for normal and raw score, its length is equal to ``num_class * num_data``;\n - for leaf index, its length is equal to ``num_class * num_data * num_iteration``;\n - for feature contributions, its length is equal to ``num_class * num_data * (num_feature + 1)``.\n # Arguments\n\n* `handle` - Handle of booster\n * `data` - Pointer to the data space\n * `data_type` - Type of ``data`` pointer, can be ``C_API_DTYPE_FLOAT32`` or ``C_API_DTYPE_FLOAT64``\n * `ncol` - Number columns\n * `is_row_major` - 1 for row-major, 0 for column-major\n * `predict_type` - What should be predicted\n - ``C_API_PREDICT_NORMAL``: normal prediction, with transform (if needed);\n - ``C_API_PREDICT_RAW_SCORE``: raw score;\n - ``C_API_PREDICT_LEAF_INDEX``: leaf index;\n - ``C_API_PREDICT_CONTRIB``: feature contributions (SHAP values)\n * `start_iteration` - Start index of the iteration to predict\n * `num_iteration` - Number of iteration for prediction, <= 0 means no limit\n * `parameter` - Other parameters for prediction, e.g. early stopping for prediction\n * `out_len` (direction out) - Length of output result\n * `out_result` (direction out) - Pointer to array with predictions\n # Returns\n\n0 when succeed, -1 when failure happens"]
836    pub fn LGBM_BoosterPredictForMatSingleRow(
837        handle: BoosterHandle,
838        data: *const ::std::os::raw::c_void,
839        data_type: ::std::os::raw::c_int,
840        ncol: ::std::os::raw::c_int,
841        is_row_major: ::std::os::raw::c_int,
842        predict_type: ::std::os::raw::c_int,
843        start_iteration: ::std::os::raw::c_int,
844        num_iteration: ::std::os::raw::c_int,
845        parameter: *const ::std::os::raw::c_char,
846        out_len: *mut i64,
847        out_result: *mut f64,
848    ) -> ::std::os::raw::c_int;
849}
850unsafe extern "C" {
851    #[doc = "Initialize and return a ``FastConfigHandle`` for use with ``LGBM_BoosterPredictForMatSingleRowFast``.\n\n Release the ``FastConfig`` by passing its handle to ``LGBM_FastConfigFree`` when no longer needed.\n\n # Arguments\n\n* `handle` - Booster handle\n * `predict_type` - What should be predicted\n - ``C_API_PREDICT_NORMAL``: normal prediction, with transform (if needed);\n - ``C_API_PREDICT_RAW_SCORE``: raw score;\n - ``C_API_PREDICT_LEAF_INDEX``: leaf index;\n - ``C_API_PREDICT_CONTRIB``: feature contributions (SHAP values)\n * `start_iteration` - Start index of the iteration to predict\n * `num_iteration` - Number of iterations for prediction, <= 0 means no limit\n * `data_type` - Type of ``data`` pointer, can be ``C_API_DTYPE_FLOAT32`` or ``C_API_DTYPE_FLOAT64``\n * `ncol` - Number of columns\n * `parameter` - Other parameters for prediction, e.g. early stopping for prediction\n * `out_fastConfig` (direction out) - FastConfig object with which you can call ``LGBM_BoosterPredictForMatSingleRowFast``\n # Returns\n\n0 when it succeeds, -1 when failure happens"]
852    pub fn LGBM_BoosterPredictForMatSingleRowFastInit(
853        handle: BoosterHandle,
854        predict_type: ::std::os::raw::c_int,
855        start_iteration: ::std::os::raw::c_int,
856        num_iteration: ::std::os::raw::c_int,
857        data_type: ::std::os::raw::c_int,
858        ncol: i32,
859        parameter: *const ::std::os::raw::c_char,
860        out_fastConfig: *mut FastConfigHandle,
861    ) -> ::std::os::raw::c_int;
862}
863unsafe extern "C" {
864    #[doc = "Faster variant of ``LGBM_BoosterPredictForMatSingleRow``.\n\n Score a single row after setup with ``LGBM_BoosterPredictForMatSingleRowFastInit``.\n\n By removing the setup steps from this call extra optimizations can be made like\n initializing the config only once, instead of once per call.\n\n > **Note:** Setting up the number of threads is only done once at ``LGBM_BoosterPredictForMatSingleRowFastInit``\n instead of at each prediction.\n If you use a different number of threads in other calls, you need to start the setup process over,\n or that number of threads will be used for these calls as well.\n\n # Arguments\n\n* `fastConfig_handle` - FastConfig object handle returned by ``LGBM_BoosterPredictForMatSingleRowFastInit``\n * `data` - Single-row array data (no other way than row-major form).\n * `out_len` (direction out) - Length of output result\n * `out_result` (direction out) - Pointer to array with predictions\n # Returns\n\n0 when it succeeds, -1 when failure happens"]
865    pub fn LGBM_BoosterPredictForMatSingleRowFast(
866        fastConfig_handle: FastConfigHandle,
867        data: *const ::std::os::raw::c_void,
868        out_len: *mut i64,
869        out_result: *mut f64,
870    ) -> ::std::os::raw::c_int;
871}
872unsafe extern "C" {
873    #[doc = "Make prediction for a new dataset presented in a form of array of pointers to rows.\n > **Note:** You should pre-allocate memory for ``out_result``:\n - for normal and raw score, its length is equal to ``num_class * num_data``;\n - for leaf index, its length is equal to ``num_class * num_data * num_iteration``;\n - for feature contributions, its length is equal to ``num_class * num_data * (num_feature + 1)``.\n # Arguments\n\n* `handle` - Handle of booster\n * `data` - Pointer to the data space\n * `data_type` - Type of ``data`` pointer, can be ``C_API_DTYPE_FLOAT32`` or ``C_API_DTYPE_FLOAT64``\n * `nrow` - Number of rows\n * `ncol` - Number columns\n * `predict_type` - What should be predicted\n - ``C_API_PREDICT_NORMAL``: normal prediction, with transform (if needed);\n - ``C_API_PREDICT_RAW_SCORE``: raw score;\n - ``C_API_PREDICT_LEAF_INDEX``: leaf index;\n - ``C_API_PREDICT_CONTRIB``: feature contributions (SHAP values)\n * `start_iteration` - Start index of the iteration to predict\n * `num_iteration` - Number of iteration for prediction, <= 0 means no limit\n * `parameter` - Other parameters for prediction, e.g. early stopping for prediction\n * `out_len` (direction out) - Length of output result\n * `out_result` (direction out) - Pointer to array with predictions\n # Returns\n\n0 when succeed, -1 when failure happens"]
874    pub fn LGBM_BoosterPredictForMats(
875        handle: BoosterHandle,
876        data: *mut *const ::std::os::raw::c_void,
877        data_type: ::std::os::raw::c_int,
878        nrow: i32,
879        ncol: i32,
880        predict_type: ::std::os::raw::c_int,
881        start_iteration: ::std::os::raw::c_int,
882        num_iteration: ::std::os::raw::c_int,
883        parameter: *const ::std::os::raw::c_char,
884        out_len: *mut i64,
885        out_result: *mut f64,
886    ) -> ::std::os::raw::c_int;
887}
888unsafe extern "C" {
889    #[doc = "Make prediction for a new dataset.\n > **Note:** You should pre-allocate memory for ``out_result``:\n - for normal and raw score, its length is equal to ``num_class * num_data``;\n - for leaf index, its length is equal to ``num_class * num_data * num_iteration``;\n - for feature contributions, its length is equal to ``num_class * num_data * (num_feature + 1)``.\n # Arguments\n\n* `handle` - Handle of booster\n * `n_chunks` - The number of Arrow arrays passed to this function\n * `chunks` - Pointer to the list of Arrow arrays\n * `schema` - Pointer to the schema of all Arrow arrays\n * `predict_type` - What should be predicted\n - ``C_API_PREDICT_NORMAL``: normal prediction, with transform (if needed);\n - ``C_API_PREDICT_RAW_SCORE``: raw score;\n - ``C_API_PREDICT_LEAF_INDEX``: leaf index;\n - ``C_API_PREDICT_CONTRIB``: feature contributions (SHAP values)\n * `start_iteration` - Start index of the iteration to predict\n * `num_iteration` - Number of iteration for prediction, <= 0 means no limit\n * `parameter` - Other parameters for prediction, e.g. early stopping for prediction\n * `out_len` (direction out) - Length of output result\n * `out_result` (direction out) - Pointer to array with predictions\n # Returns\n\n0 when succeed, -1 when failure happens"]
890    pub fn LGBM_BoosterPredictForArrow(
891        handle: BoosterHandle,
892        n_chunks: i64,
893        chunks: *const ArrowArray,
894        schema: *const ArrowSchema,
895        predict_type: ::std::os::raw::c_int,
896        start_iteration: ::std::os::raw::c_int,
897        num_iteration: ::std::os::raw::c_int,
898        parameter: *const ::std::os::raw::c_char,
899        out_len: *mut i64,
900        out_result: *mut f64,
901    ) -> ::std::os::raw::c_int;
902}
903unsafe extern "C" {
904    #[doc = "Save model into file.\n # Arguments\n\n* `handle` - Handle of booster\n * `start_iteration` - Start index of the iteration that should be saved\n * `num_iteration` - Index of the iteration that should be saved, <= 0 means save all\n * `feature_importance_type` - Type of feature importance, can be ``C_API_FEATURE_IMPORTANCE_SPLIT`` or ``C_API_FEATURE_IMPORTANCE_GAIN``\n * `filename` - The name of the file\n # Returns\n\n0 when succeed, -1 when failure happens"]
905    pub fn LGBM_BoosterSaveModel(
906        handle: BoosterHandle,
907        start_iteration: ::std::os::raw::c_int,
908        num_iteration: ::std::os::raw::c_int,
909        feature_importance_type: ::std::os::raw::c_int,
910        filename: *const ::std::os::raw::c_char,
911    ) -> ::std::os::raw::c_int;
912}
913unsafe extern "C" {
914    #[doc = "Save model to string.\n # Arguments\n\n* `handle` - Handle of booster\n * `start_iteration` - Start index of the iteration that should be saved\n * `num_iteration` - Index of the iteration that should be saved, <= 0 means save all\n * `feature_importance_type` - Type of feature importance, can be ``C_API_FEATURE_IMPORTANCE_SPLIT`` or ``C_API_FEATURE_IMPORTANCE_GAIN``\n * `buffer_len` - String buffer length, if ``buffer_len < out_len``, you should re-allocate buffer\n * `out_len` (direction out) - Actual output length\n * `out_str` (direction out) - String of model, should pre-allocate memory\n # Returns\n\n0 when succeed, -1 when failure happens"]
915    pub fn LGBM_BoosterSaveModelToString(
916        handle: BoosterHandle,
917        start_iteration: ::std::os::raw::c_int,
918        num_iteration: ::std::os::raw::c_int,
919        feature_importance_type: ::std::os::raw::c_int,
920        buffer_len: i64,
921        out_len: *mut i64,
922        out_str: *mut ::std::os::raw::c_char,
923    ) -> ::std::os::raw::c_int;
924}
925unsafe extern "C" {
926    #[doc = "Dump model to JSON.\n # Arguments\n\n* `handle` - Handle of booster\n * `start_iteration` - Start index of the iteration that should be dumped\n * `num_iteration` - Index of the iteration that should be dumped, <= 0 means dump all\n * `feature_importance_type` - Type of feature importance, can be ``C_API_FEATURE_IMPORTANCE_SPLIT`` or ``C_API_FEATURE_IMPORTANCE_GAIN``\n * `buffer_len` - String buffer length, if ``buffer_len < out_len``, you should re-allocate buffer\n * `out_len` (direction out) - Actual output length\n * `out_str` (direction out) - JSON format string of model, should pre-allocate memory\n # Returns\n\n0 when succeed, -1 when failure happens"]
927    pub fn LGBM_BoosterDumpModel(
928        handle: BoosterHandle,
929        start_iteration: ::std::os::raw::c_int,
930        num_iteration: ::std::os::raw::c_int,
931        feature_importance_type: ::std::os::raw::c_int,
932        buffer_len: i64,
933        out_len: *mut i64,
934        out_str: *mut ::std::os::raw::c_char,
935    ) -> ::std::os::raw::c_int;
936}
937unsafe extern "C" {
938    #[doc = "Get leaf value.\n # Arguments\n\n* `handle` - Handle of booster\n * `tree_idx` - Index of tree\n * `leaf_idx` - Index of leaf\n * `out_val` (direction out) - Output result from the specified leaf\n # Returns\n\n0 when succeed, -1 when failure happens"]
939    pub fn LGBM_BoosterGetLeafValue(
940        handle: BoosterHandle,
941        tree_idx: ::std::os::raw::c_int,
942        leaf_idx: ::std::os::raw::c_int,
943        out_val: *mut f64,
944    ) -> ::std::os::raw::c_int;
945}
946unsafe extern "C" {
947    #[doc = "Set leaf value.\n # Arguments\n\n* `handle` - Handle of booster\n * `tree_idx` - Index of tree\n * `leaf_idx` - Index of leaf\n * `val` - Leaf value\n # Returns\n\n0 when succeed, -1 when failure happens"]
948    pub fn LGBM_BoosterSetLeafValue(
949        handle: BoosterHandle,
950        tree_idx: ::std::os::raw::c_int,
951        leaf_idx: ::std::os::raw::c_int,
952        val: f64,
953    ) -> ::std::os::raw::c_int;
954}
955unsafe extern "C" {
956    #[doc = "Get model feature importance.\n # Arguments\n\n* `handle` - Handle of booster\n * `num_iteration` - Number of iterations for which feature importance is calculated, <= 0 means use all\n * `importance_type` - Method of importance calculation:\n - ``C_API_FEATURE_IMPORTANCE_SPLIT``: result contains numbers of times the feature is used in a model;\n - ``C_API_FEATURE_IMPORTANCE_GAIN``: result contains total gains of splits which use the feature\n * `out_results` (direction out) - Result array with feature importance\n # Returns\n\n0 when succeed, -1 when failure happens"]
957    pub fn LGBM_BoosterFeatureImportance(
958        handle: BoosterHandle,
959        num_iteration: ::std::os::raw::c_int,
960        importance_type: ::std::os::raw::c_int,
961        out_results: *mut f64,
962    ) -> ::std::os::raw::c_int;
963}
964unsafe extern "C" {
965    #[doc = "Get model upper bound value.\n # Arguments\n\n* `handle` - Handle of booster\n * `out_results` (direction out) - Result pointing to max value\n # Returns\n\n0 when succeed, -1 when failure happens"]
966    pub fn LGBM_BoosterGetUpperBoundValue(
967        handle: BoosterHandle,
968        out_results: *mut f64,
969    ) -> ::std::os::raw::c_int;
970}
971unsafe extern "C" {
972    #[doc = "Get model lower bound value.\n # Arguments\n\n* `handle` - Handle of booster\n * `out_results` (direction out) - Result pointing to min value\n # Returns\n\n0 when succeed, -1 when failure happens"]
973    pub fn LGBM_BoosterGetLowerBoundValue(
974        handle: BoosterHandle,
975        out_results: *mut f64,
976    ) -> ::std::os::raw::c_int;
977}
978unsafe extern "C" {
979    #[doc = "Initialize the network.\n # Arguments\n\n* `machines` - List of machines in format 'ip1:port1,ip2:port2'\n * `local_listen_port` - TCP listen port for local machines\n * `listen_time_out` - Socket time-out in minutes\n * `num_machines` - Total number of machines\n # Returns\n\n0 when succeed, -1 when failure happens"]
980    pub fn LGBM_NetworkInit(
981        machines: *const ::std::os::raw::c_char,
982        local_listen_port: ::std::os::raw::c_int,
983        listen_time_out: ::std::os::raw::c_int,
984        num_machines: ::std::os::raw::c_int,
985    ) -> ::std::os::raw::c_int;
986}
987unsafe extern "C" {
988    #[doc = "Finalize the network.\n # Returns\n\n0 when succeed, -1 when failure happens"]
989    pub fn LGBM_NetworkFree() -> ::std::os::raw::c_int;
990}
991unsafe extern "C" {
992    #[doc = "Initialize the network with external collective functions.\n # Arguments\n\n* `num_machines` - Total number of machines\n * `rank` - Rank of local machine\n * `reduce_scatter_ext_fun` - The external reduce-scatter function\n * `allgather_ext_fun` - The external allgather function\n # Returns\n\n0 when succeed, -1 when failure happens"]
993    pub fn LGBM_NetworkInitWithFunctions(
994        num_machines: ::std::os::raw::c_int,
995        rank: ::std::os::raw::c_int,
996        reduce_scatter_ext_fun: *mut ::std::os::raw::c_void,
997        allgather_ext_fun: *mut ::std::os::raw::c_void,
998    ) -> ::std::os::raw::c_int;
999}
1000unsafe extern "C" {
1001    #[doc = "Set maximum number of threads used by LightGBM routines in this process.\n # Arguments\n\n* `num_threads` - maximum number of threads used by LightGBM. -1 means defaulting to omp_get_num_threads().\n # Returns\n\n0 when succeed, -1 when failure happens"]
1002    pub fn LGBM_SetMaxThreads(num_threads: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
1003}
1004unsafe extern "C" {
1005    #[doc = "Get current maximum number of threads used by LightGBM routines in this process.\n # Arguments\n\n* `out` (direction out) - current maximum number of threads used by LightGBM. -1 means defaulting to omp_get_num_threads().\n # Returns\n\n0 when succeed, -1 when failure happens"]
1006    pub fn LGBM_GetMaxThreads(out: *mut ::std::os::raw::c_int) -> ::std::os::raw::c_int;
1007}