@@ -44,7 +44,7 @@ def save_config
4444 length = ::FFI ::MemoryPointer . new ( :uint64 )
4545 json_string = ::FFI ::MemoryPointer . new ( :pointer )
4646 check_call FFI . XGBoosterSaveJsonConfig ( handle , length , json_string )
47- json_string . read_pointer . read_string ( read_uint64 ( length ) ) . force_encoding ( Encoding ::UTF_8 )
47+ json_string . read_pointer . read_string ( length . read_uint64 ) . force_encoding ( Encoding ::UTF_8 )
4848 end
4949
5050 def attr ( key )
@@ -114,7 +114,7 @@ def predict(data, ntree_limit: nil)
114114 out_len = ::FFI ::MemoryPointer . new ( :uint64 )
115115 out_result = ::FFI ::MemoryPointer . new ( :pointer )
116116 check_call FFI . XGBoosterPredict ( handle , data . handle , 0 , ntree_limit , 0 , out_len , out_result )
117- out = out_result . read_pointer . read_array_of_float ( read_uint64 ( out_len ) )
117+ out = out_result . read_pointer . read_array_of_float ( out_len . read_uint64 )
118118 num_class = out . size / data . num_row
119119 out = out . each_slice ( num_class ) . to_a if num_class > 1
120120 out
@@ -149,7 +149,7 @@ def num_boosted_rounds
149149 def num_features
150150 features = ::FFI ::MemoryPointer . new ( :uint64 )
151151 check_call FFI . XGBoosterGetNumFeature ( handle , features )
152- read_uint64 ( features )
152+ features . read_uint64
153153 end
154154
155155 def dump_model ( fout , fmap : "" , with_stats : false , dump_format : "text" )
@@ -182,7 +182,7 @@ def dump(fmap: "", with_stats: false, dump_format: "text")
182182
183183 check_call FFI . XGBoosterDumpModelExWithFeatures ( handle , names . size , fnames , ftypes , with_stats ? 1 : 0 , dump_format , out_len , out_result )
184184
185- out_result . read_pointer . get_array_of_string ( 0 , read_uint64 ( out_len ) )
185+ out_result . read_pointer . get_array_of_string ( 0 , out_len . read_uint64 )
186186 end
187187
188188 def fscore ( fmap : "" )
0 commit comments