You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there!
First of all thanks for writing this awsome crate!
I just run into a problem. When loading a model from a file, the feature names get truncated to a n_features -1 length (i.e if I have 3 features, the names get truncated to 2 characters.)
I'm trying to fix the issue myself and if I can, I submit a PR :). But I'm new to rust, and not very good with C, so I'm not sure I'll be able to fix it. The problem must be around like 173 in booster.rs
The text was updated successfully, but these errors were encountered:
I think I've got it, I think you swapped num_features and feature_name_length when you call LGBM_BoosterGetFeatureNames. The call is currently:
lgbm_call!(lightgbm_sys::LGBM_BoosterGetFeatureNames(
self.handle,
feature_name_length as i32,
&mut num_feature_names,
num_feature as u64,
&mut out_buffer_len,
out_strs.as_ptr() as *mut *mut c_char
))?;
but should be (c api as comment for reference)
lgbm_call!(lightgbm_sys::LGBM_BoosterGetFeatureNames(
self.handle,
num_feature as i32, // len: Number of char* pointers stored at out_strs. If smaller than the max size, only this many strings are copied
&mut num_feature_names, // [out] num_feature_names: Number of feature names
feature_name_length as u64, //buffer_len: Size of pre-allocated strings. Content is copied up to buffer_len - 1 and null-terminated
&mut out_buffer_len,//
out_strs.as_ptr() as *mut *mut c_char
))?;
Let me know if you want me to make a PR or would it be easier to fix it yourself.
Hi there!
First of all thanks for writing this awsome crate!
I just run into a problem. When loading a model from a file, the feature names get truncated to a n_features -1 length (i.e if I have 3 features, the names get truncated to 2 characters.)
I'm trying to fix the issue myself and if I can, I submit a PR :). But I'm new to rust, and not very good with C, so I'm not sure I'll be able to fix it. The problem must be around like 173 in booster.rs
The text was updated successfully, but these errors were encountered: