Skip to content

Commit 1a6393a

Browse files
committed
Added constants for data types [skip ci]
1 parent dce4dd9 commit 1a6393a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/lightgbm/dataset.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def construct
177177
c_data.write_array_of_double(flat_data)
178178
end
179179

180-
check_result FFI.LGBM_DatasetCreateFromMat(c_data, 1, nrow, ncol, 1, parameters, reference, handle)
180+
check_result FFI.LGBM_DatasetCreateFromMat(c_data, FFI::C_API_DTYPE_FLOAT64, nrow, ncol, 1, parameters, reference, handle)
181181
end
182182
if used_indices
183183
@handle = handle.read_pointer

lib/lightgbm/ffi.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ module FFI
1515
# https://github.com/microsoft/LightGBM/blob/master/include/LightGBM/c_api.h
1616
# keep same order
1717

18+
C_API_DTYPE_FLOAT32 = 0
19+
C_API_DTYPE_FLOAT64 = 1
20+
C_API_DTYPE_INT32 = 2
21+
C_API_DTYPE_INT64 = 3
22+
1823
C_API_PREDICT_NORMAL = 0
1924
C_API_PREDICT_RAW_SCORE = 1
2025
C_API_PREDICT_LEAF_INDEX = 2

0 commit comments

Comments
 (0)