lightgbm_R.h 15.2 KB
Newer Older
1
2
3
4
/*!
 * Copyright (c) 2017 Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See LICENSE file in the project root for license information.
 */
Guolin Ke's avatar
Guolin Ke committed
5
6
7
8
#ifndef LIGHTGBM_R_H_
#define LIGHTGBM_R_H_

#include <LightGBM/c_api.h>
9
#include "R_object_helper.h"
Guolin Ke's avatar
Guolin Ke committed
10
11
12

/*!
* \brief get string message of the last error
13
*  all functions in this file will return 0 on success
14
15
16
*  and -1 when an error occurred
* \return err_msg error information
* \return error information
Guolin Ke's avatar
Guolin Ke committed
17
*/
18
LIGHTGBM_C_EXPORT SEXP LGBM_GetLastError_R();
Guolin Ke's avatar
Guolin Ke committed
19
20
21
22

// --- start Dataset interface

/*!
23
* \brief load data set from file like the command_line LightGBM does
Guolin Ke's avatar
Guolin Ke committed
24
25
* \param filename the name of the file
* \param parameters additional parameters
26
* \param reference used to align bin mapper with other dataset, nullptr means not used
Guolin Ke's avatar
Guolin Ke committed
27
28
29
* \param out created dataset
* \return 0 when succeed, -1 when failure happens
*/
30
LIGHTGBM_C_EXPORT SEXP LGBM_DatasetCreateFromFile_R(
31
  LGBM_SE filename,
Guolin Ke's avatar
Guolin Ke committed
32
33
  LGBM_SE parameters,
  LGBM_SE reference,
34
  LGBM_SE out
35
);
Guolin Ke's avatar
Guolin Ke committed
36
37
38
39
40
41
42
43
44
45

/*!
* \brief create a dataset from CSC format
* \param indptr pointer to row headers
* \param indices findex
* \param data fvalue
* \param nindptr number of cols in the matrix + 1
* \param nelem number of nonzero elements in the matrix
* \param num_row number of rows
* \param parameters additional parameters
46
* \param reference used to align bin mapper with other dataset, nullptr means not used
Guolin Ke's avatar
Guolin Ke committed
47
48
49
* \param out created dataset
* \return 0 when succeed, -1 when failure happens
*/
50
LIGHTGBM_C_EXPORT SEXP LGBM_DatasetCreateFromCSC_R(
51
  LGBM_SE indptr,
Guolin Ke's avatar
Guolin Ke committed
52
53
54
55
56
57
58
  LGBM_SE indices,
  LGBM_SE data,
  LGBM_SE nindptr,
  LGBM_SE nelem,
  LGBM_SE num_row,
  LGBM_SE parameters,
  LGBM_SE reference,
59
  LGBM_SE out
60
);
Guolin Ke's avatar
Guolin Ke committed
61
62
63
64
65
66
67

/*!
* \brief create dataset from dense matrix
* \param data matric data
* \param nrow number of rows
* \param ncol number columns
* \param parameters additional parameters
68
* \param reference used to align bin mapper with other dataset, nullptr means not used
Guolin Ke's avatar
Guolin Ke committed
69
70
71
* \param out created dataset
* \return 0 when succeed, -1 when failure happens
*/
72
LIGHTGBM_C_EXPORT SEXP LGBM_DatasetCreateFromMat_R(
73
  LGBM_SE data,
Guolin Ke's avatar
Guolin Ke committed
74
75
76
77
  LGBM_SE nrow,
  LGBM_SE ncol,
  LGBM_SE parameters,
  LGBM_SE reference,
78
  LGBM_SE out
79
);
Guolin Ke's avatar
Guolin Ke committed
80
81
82
83
84
85
86
87
88
89

/*!
* \brief Create subset of a data
* \param handle handle of full dataset
* \param used_row_indices Indices used in subset
* \param len_used_row_indices length of Indices used in subset
* \param parameters additional parameters
* \param out created dataset
* \return 0 when succeed, -1 when failure happens
*/
90
LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetSubset_R(
91
  LGBM_SE handle,
Guolin Ke's avatar
Guolin Ke committed
92
93
94
  LGBM_SE used_row_indices,
  LGBM_SE len_used_row_indices,
  LGBM_SE parameters,
95
  LGBM_SE out
96
);
Guolin Ke's avatar
Guolin Ke committed
97
98
99
100
101
102
103

/*!
* \brief save feature names to Dataset
* \param handle handle
* \param feature_names feature names
* \return 0 when succeed, -1 when failure happens
*/
104
LIGHTGBM_C_EXPORT SEXP LGBM_DatasetSetFeatureNames_R(
105
  LGBM_SE handle,
106
  LGBM_SE feature_names
107
);
Guolin Ke's avatar
Guolin Ke committed
108
109
110
111
112
113
114

/*!
* \brief save feature names to Dataset
* \param handle handle
* \param feature_names feature names
* \return 0 when succeed, -1 when failure happens
*/
115
LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetFeatureNames_R(
116
  LGBM_SE handle,
Guolin Ke's avatar
Guolin Ke committed
117
118
  LGBM_SE buf_len,
  LGBM_SE actual_len,
119
  LGBM_SE feature_names
120
);
Guolin Ke's avatar
Guolin Ke committed
121
122

/*!
123
* \brief save dataset to binary file
124
* \param handle an instance of dataset
Guolin Ke's avatar
Guolin Ke committed
125
126
127
* \param filename file name
* \return 0 when succeed, -1 when failure happens
*/
128
LIGHTGBM_C_EXPORT SEXP LGBM_DatasetSaveBinary_R(
129
  LGBM_SE handle,
130
  LGBM_SE filename
131
);
Guolin Ke's avatar
Guolin Ke committed
132
133
134

/*!
* \brief free dataset
135
* \param handle an instance of dataset
Guolin Ke's avatar
Guolin Ke committed
136
137
* \return 0 when succeed, -1 when failure happens
*/
138
139
LIGHTGBM_C_EXPORT SEXP LGBM_DatasetFree_R(
  LGBM_SE handle
140
);
Guolin Ke's avatar
Guolin Ke committed
141
142
143

/*!
* \brief set vector to a content in info
144
*        Note: group and group_id only work for C_API_DTYPE_INT32
Guolin Ke's avatar
Guolin Ke committed
145
*              label and weight only work for C_API_DTYPE_FLOAT32
146
* \param handle an instance of dataset
Guolin Ke's avatar
Guolin Ke committed
147
148
149
150
151
* \param field_name field name, can be label, weight, group, group_id
* \param field_data pointer to vector
* \param num_element number of element in field_data
* \return 0 when succeed, -1 when failure happens
*/
152
LIGHTGBM_C_EXPORT SEXP LGBM_DatasetSetField_R(
153
  LGBM_SE handle,
Guolin Ke's avatar
Guolin Ke committed
154
155
  LGBM_SE field_name,
  LGBM_SE field_data,
156
  LGBM_SE num_element
157
);
Guolin Ke's avatar
Guolin Ke committed
158
159
160

/*!
* \brief get size of info vector from dataset
161
* \param handle an instance of dataset
Guolin Ke's avatar
Guolin Ke committed
162
163
164
165
* \param field_name field name
* \param out size of info vector from dataset
* \return 0 when succeed, -1 when failure happens
*/
166
LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetFieldSize_R(
167
  LGBM_SE handle,
Guolin Ke's avatar
Guolin Ke committed
168
  LGBM_SE field_name,
169
  LGBM_SE out
170
);
Guolin Ke's avatar
Guolin Ke committed
171
172
173

/*!
* \brief get info vector from dataset
174
* \param handle an instance of dataset
Guolin Ke's avatar
Guolin Ke committed
175
176
177
178
* \param field_name field name
* \param field_data pointer to vector
* \return 0 when succeed, -1 when failure happens
*/
179
LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetField_R(
180
  LGBM_SE handle,
Guolin Ke's avatar
Guolin Ke committed
181
  LGBM_SE field_name,
182
  LGBM_SE field_data
183
);
Guolin Ke's avatar
Guolin Ke committed
184

185
/*!
186
187
188
189
190
 * \brief Raise errors for attempts to update dataset parameters
 * \param old_params Current dataset parameters
 * \param new_params New dataset parameters
 * \return 0 when succeed, -1 when failure happens
 */
191
LIGHTGBM_C_EXPORT SEXP LGBM_DatasetUpdateParamChecking_R(
192
  LGBM_SE old_params,
193
  LGBM_SE new_params
194
);
195

Guolin Ke's avatar
Guolin Ke committed
196
197
198
199
200
201
/*!
* \brief get number of data.
* \param handle the handle to the dataset
* \param out The address to hold number of data
* \return 0 when succeed, -1 when failure happens
*/
202
LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetNumData_R(
203
  LGBM_SE handle,
204
  LGBM_SE out
205
);
Guolin Ke's avatar
Guolin Ke committed
206
207
208
209
210
211
212

/*!
* \brief get number of features
* \param handle the handle to the dataset
* \param out The output of number of features
* \return 0 when succeed, -1 when failure happens
*/
213
LIGHTGBM_C_EXPORT SEXP LGBM_DatasetGetNumFeature_R(
214
  LGBM_SE handle,
215
  LGBM_SE out
216
);
Guolin Ke's avatar
Guolin Ke committed
217
218
219
220

// --- start Booster interfaces

/*!
221
* \brief create a new boosting learner
Guolin Ke's avatar
Guolin Ke committed
222
223
* \param train_data training data set
* \param parameters format: 'key1=value1 key2=value2'
224
* \param out handle of created Booster
Guolin Ke's avatar
Guolin Ke committed
225
226
* \return 0 when succeed, -1 when failure happens
*/
227
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterCreate_R(
228
  LGBM_SE train_data,
Guolin Ke's avatar
Guolin Ke committed
229
  LGBM_SE parameters,
230
  LGBM_SE out
231
);
Guolin Ke's avatar
Guolin Ke committed
232
233
234
235
236
237

/*!
* \brief free obj in handle
* \param handle handle to be freed
* \return 0 when succeed, -1 when failure happens
*/
238
239
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterFree_R(
  LGBM_SE handle
240
);
Guolin Ke's avatar
Guolin Ke committed
241
242
243
244

/*!
* \brief load an existing boosting from model file
* \param filename filename of model
245
* \param out handle of created Booster
Guolin Ke's avatar
Guolin Ke committed
246
247
* \return 0 when succeed, -1 when failure happens
*/
248
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterCreateFromModelfile_R(
249
  LGBM_SE filename,
250
  LGBM_SE out
251
);
Guolin Ke's avatar
Guolin Ke committed
252

253
254
255
256
257
258
/*!
* \brief load an existing boosting from model_str
* \param model_str string containing the model
* \param out handle of created Booster
* \return 0 when succeed, -1 when failure happens
*/
259
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterLoadModelFromString_R(
260
  LGBM_SE model_str,
261
  LGBM_SE out
262
);
263

Guolin Ke's avatar
Guolin Ke committed
264
/*!
265
* \brief Merge model in two boosters to first handle
Guolin Ke's avatar
Guolin Ke committed
266
267
268
269
* \param handle handle, will merge other handle to this
* \param other_handle
* \return 0 when succeed, -1 when failure happens
*/
270
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterMerge_R(
271
  LGBM_SE handle,
272
  LGBM_SE other_handle
273
);
Guolin Ke's avatar
Guolin Ke committed
274
275
276
277
278
279
280

/*!
* \brief Add new validation to booster
* \param handle handle
* \param valid_data validation data set
* \return 0 when succeed, -1 when failure happens
*/
281
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterAddValidData_R(
282
  LGBM_SE handle,
283
  LGBM_SE valid_data
284
);
Guolin Ke's avatar
Guolin Ke committed
285
286
287
288
289
290
291

/*!
* \brief Reset training data for booster
* \param handle handle
* \param train_data training data set
* \return 0 when succeed, -1 when failure happens
*/
292
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterResetTrainingData_R(
293
  LGBM_SE handle,
294
  LGBM_SE train_data
295
);
Guolin Ke's avatar
Guolin Ke committed
296
297
298
299
300
301
302

/*!
* \brief Reset config for current booster
* \param handle handle
* \param parameters format: 'key1=value1 key2=value2'
* \return 0 when succeed, -1 when failure happens
*/
303
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterResetParameter_R(
304
  LGBM_SE handle,
305
  LGBM_SE parameters
306
);
Guolin Ke's avatar
Guolin Ke committed
307
308

/*!
309
* \brief Get number of classes
Guolin Ke's avatar
Guolin Ke committed
310
311
312
313
* \param handle handle
* \param out number of classes
* \return 0 when succeed, -1 when failure happens
*/
314
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetNumClasses_R(
315
  LGBM_SE handle,
316
  LGBM_SE out
317
);
Guolin Ke's avatar
Guolin Ke committed
318
319
320
321
322
323

/*!
* \brief update the model in one round
* \param handle handle
* \return 0 when succeed, -1 when failure happens
*/
324
325
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterUpdateOneIter_R(
  LGBM_SE handle
326
);
Guolin Ke's avatar
Guolin Ke committed
327
328
329
330
331
332
333
334
335
336

/*!
* \brief update the model, by directly specify gradient and second order gradient,
*       this can be used to support customized loss function
* \param handle handle
* \param grad gradient statistics
* \param hess second order gradient statistics
* \param len length of grad/hess
* \return 0 when succeed, -1 when failure happens
*/
337
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterUpdateOneIterCustom_R(
338
  LGBM_SE handle,
Guolin Ke's avatar
Guolin Ke committed
339
340
  LGBM_SE grad,
  LGBM_SE hess,
341
  LGBM_SE len
342
);
Guolin Ke's avatar
Guolin Ke committed
343
344
345
346
347
348

/*!
* \brief Rollback one iteration
* \param handle handle
* \return 0 when succeed, -1 when failure happens
*/
349
350
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterRollbackOneIter_R(
  LGBM_SE handle
351
);
Guolin Ke's avatar
Guolin Ke committed
352
353
354
355
356
357

/*!
* \brief Get iteration of current boosting rounds
* \param out iteration of boosting rounds
* \return 0 when succeed, -1 when failure happens
*/
358
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetCurrentIteration_R(
359
  LGBM_SE handle,
360
  LGBM_SE out
361
);
Guolin Ke's avatar
Guolin Ke committed
362

363
364
365
366
367
368
/*!
* \brief Get model upper bound value.
* \param handle Handle of booster
* \param[out] out_results Result pointing to max value
* \return 0 when succeed, -1 when failure happens
*/
369
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetUpperBoundValue_R(
370
    LGBM_SE handle,
371
    LGBM_SE out_result
372
373
374
375
376
377
378
379
);

/*!
* \brief Get model lower bound value.
* \param handle Handle of booster
* \param[out] out_results Result pointing to min value
* \return 0 when succeed, -1 when failure happens
*/
380
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetLowerBoundValue_R(
381
    LGBM_SE handle,
382
    LGBM_SE out_result
383
384
);

Guolin Ke's avatar
Guolin Ke committed
385
386
387
388
389
/*!
* \brief Get Name of eval
* \param eval_names eval names
* \return 0 when succeed, -1 when failure happens
*/
390
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetEvalNames_R(
391
  LGBM_SE handle,
Guolin Ke's avatar
Guolin Ke committed
392
393
  LGBM_SE buf_len,
  LGBM_SE actual_len,
394
  LGBM_SE eval_names
395
);
Guolin Ke's avatar
Guolin Ke committed
396
397
398
399
400

/*!
* \brief get evaluation for training data and validation data
* \param handle handle
* \param data_idx 0:training data, 1: 1st valid data, 2:2nd valid data ...
401
* \param out_result float array contains result
Guolin Ke's avatar
Guolin Ke committed
402
403
* \return 0 when succeed, -1 when failure happens
*/
404
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetEval_R(
405
  LGBM_SE handle,
Guolin Ke's avatar
Guolin Ke committed
406
  LGBM_SE data_idx,
407
  LGBM_SE out_result
408
);
Guolin Ke's avatar
Guolin Ke committed
409
410
411
412
413
414
415
416

/*!
* \brief Get number of prediction for training data and validation data
* \param handle handle
* \param data_idx 0:training data, 1: 1st valid data, 2:2nd valid data ...
* \param out size of predict
* \return 0 when succeed, -1 when failure happens
*/
417
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetNumPredict_R(
418
  LGBM_SE handle,
Guolin Ke's avatar
Guolin Ke committed
419
  LGBM_SE data_idx,
420
  LGBM_SE out
421
);
Guolin Ke's avatar
Guolin Ke committed
422
423

/*!
424
425
* \brief Get prediction for training data and validation data.
*        This can be used to support customized eval function
Guolin Ke's avatar
Guolin Ke committed
426
427
428
429
430
* \param handle handle
* \param data_idx 0:training data, 1: 1st valid data, 2:2nd valid data ...
* \param out_result, used to store predict result, should pre-allocate memory
* \return 0 when succeed, -1 when failure happens
*/
431
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterGetPredict_R(
432
  LGBM_SE handle,
Guolin Ke's avatar
Guolin Ke committed
433
  LGBM_SE data_idx,
434
  LGBM_SE out_result
435
);
Guolin Ke's avatar
Guolin Ke committed
436
437
438
439
440
441
442
443
444
445
446
447

/*!
* \brief make prediction for file
* \param handle handle
* \param data_filename filename of data file
* \param data_has_header data file has header or not
* \param is_rawscore
* \param is_leafidx
* \param num_iteration number of iteration for prediction, <= 0 means no limit
* \return 0 when succeed, -1 when failure happens
* \return 0 when succeed, -1 when failure happens
*/
448
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterPredictForFile_R(
449
  LGBM_SE handle,
Guolin Ke's avatar
Guolin Ke committed
450
451
452
453
  LGBM_SE data_filename,
  LGBM_SE data_has_header,
  LGBM_SE is_rawscore,
  LGBM_SE is_leafidx,
454
  LGBM_SE is_predcontrib,
455
  LGBM_SE start_iteration,
Guolin Ke's avatar
Guolin Ke committed
456
  LGBM_SE num_iteration,
457
  LGBM_SE parameter,
458
  LGBM_SE result_filename
459
);
Guolin Ke's avatar
Guolin Ke committed
460
461
462
463
464
465
466
467

/*!
* \brief Get number of prediction
* \param handle handle
* \param num_row
* \param is_rawscore
* \param is_leafidx
* \param num_iteration number of iteration for prediction, <= 0 means no limit
468
* \param out_len length of prediction
Guolin Ke's avatar
Guolin Ke committed
469
470
* \return 0 when succeed, -1 when failure happens
*/
471
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterCalcNumPredict_R(
472
  LGBM_SE handle,
Guolin Ke's avatar
Guolin Ke committed
473
474
475
  LGBM_SE num_row,
  LGBM_SE is_rawscore,
  LGBM_SE is_leafidx,
476
  LGBM_SE is_predcontrib,
477
  LGBM_SE start_iteration,
Guolin Ke's avatar
Guolin Ke committed
478
  LGBM_SE num_iteration,
479
  LGBM_SE out_len
480
);
Guolin Ke's avatar
Guolin Ke committed
481
482

/*!
483
* \brief make prediction for a new data set
Guolin Ke's avatar
Guolin Ke committed
484
*        Note:  should pre-allocate memory for out_result,
485
*               for normal and raw score: its length is equal to num_class * num_data
Guolin Ke's avatar
Guolin Ke committed
486
487
488
489
490
491
*               for leaf index, its length is equal to num_class * num_data * num_iteration
* \param handle handle
* \param indptr pointer to row headers
* \param indices findex
* \param data fvalue
* \param nindptr number of cols in the matrix + 1
492
* \param nelem number of non-zero elements in the matrix
Guolin Ke's avatar
Guolin Ke committed
493
494
495
496
497
498
499
* \param num_row number of rows
* \param is_rawscore
* \param is_leafidx
* \param num_iteration number of iteration for prediction, <= 0 means no limit
* \param out prediction result
* \return 0 when succeed, -1 when failure happens
*/
500
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterPredictForCSC_R(
501
  LGBM_SE handle,
Guolin Ke's avatar
Guolin Ke committed
502
503
504
505
506
507
508
509
  LGBM_SE indptr,
  LGBM_SE indices,
  LGBM_SE data,
  LGBM_SE nindptr,
  LGBM_SE nelem,
  LGBM_SE num_row,
  LGBM_SE is_rawscore,
  LGBM_SE is_leafidx,
510
  LGBM_SE is_predcontrib,
511
  LGBM_SE start_iteration,
Guolin Ke's avatar
Guolin Ke committed
512
  LGBM_SE num_iteration,
513
  LGBM_SE parameter,
514
  LGBM_SE out_result
515
);
Guolin Ke's avatar
Guolin Ke committed
516
517

/*!
518
* \brief make prediction for a new data set
Guolin Ke's avatar
Guolin Ke committed
519
*        Note:  should pre-allocate memory for out_result,
520
*               for normal and raw score: its length is equal to num_class * num_data
Guolin Ke's avatar
Guolin Ke committed
521
522
523
524
525
526
527
528
529
530
531
*               for leaf index, its length is equal to num_class * num_data * num_iteration
* \param handle handle
* \param data pointer to the data space
* \param nrow number of rows
* \param ncol number columns
* \param is_rawscore
* \param is_leafidx
* \param num_iteration number of iteration for prediction, <= 0 means no limit
* \param out prediction result
* \return 0 when succeed, -1 when failure happens
*/
532
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterPredictForMat_R(
533
  LGBM_SE handle,
Guolin Ke's avatar
Guolin Ke committed
534
535
536
537
538
  LGBM_SE data,
  LGBM_SE nrow,
  LGBM_SE ncol,
  LGBM_SE is_rawscore,
  LGBM_SE is_leafidx,
539
  LGBM_SE is_predcontrib,
540
  LGBM_SE start_iteration,
Guolin Ke's avatar
Guolin Ke committed
541
  LGBM_SE num_iteration,
542
  LGBM_SE parameter,
543
  LGBM_SE out_result
544
);
Guolin Ke's avatar
Guolin Ke committed
545
546
547
548
549
550
551
552

/*!
* \brief save model into file
* \param handle handle
* \param num_iteration, <= 0 means save all
* \param filename file name
* \return 0 when succeed, -1 when failure happens
*/
553
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterSaveModel_R(
554
  LGBM_SE handle,
Guolin Ke's avatar
Guolin Ke committed
555
  LGBM_SE num_iteration,
556
  LGBM_SE feature_importance_type,
557
  LGBM_SE filename
558
);
Guolin Ke's avatar
Guolin Ke committed
559

560
561
562
563
564
565
566
/*!
* \brief create string containing model
* \param handle handle
* \param num_iteration, <= 0 means save all
* \param out_str string of model
* \return 0 when succeed, -1 when failure happens
*/
567
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterSaveModelToString_R(
568
  LGBM_SE handle,
569
  LGBM_SE num_iteration,
570
  LGBM_SE feature_importance_type,
571
572
  LGBM_SE buffer_len,
  LGBM_SE actual_len,
573
  LGBM_SE out_str
574
);
575

Guolin Ke's avatar
Guolin Ke committed
576
577
578
579
580
581
582
/*!
* \brief dump model to json
* \param handle handle
* \param num_iteration, <= 0 means save all
* \param out_str json format string of model
* \return 0 when succeed, -1 when failure happens
*/
583
LIGHTGBM_C_EXPORT SEXP LGBM_BoosterDumpModel_R(
584
  LGBM_SE handle,
Guolin Ke's avatar
Guolin Ke committed
585
  LGBM_SE num_iteration,
586
  LGBM_SE feature_importance_type,
Guolin Ke's avatar
Guolin Ke committed
587
588
  LGBM_SE buffer_len,
  LGBM_SE actual_len,
589
  LGBM_SE out_str
590
);
Guolin Ke's avatar
Guolin Ke committed
591

592
#endif  // LIGHTGBM_R_H_