Skip to content

Commit

Permalink
Fixed feature_name=
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Nov 13, 2024
1 parent a397204 commit a030213
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/lightgbm/dataset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ def group=(group)
def feature_name=(feature_names)
@feature_names = feature_names
c_feature_names = ::FFI::MemoryPointer.new(:pointer, feature_names.size)
c_feature_names.write_array_of_pointer(feature_names.map { |v| ::FFI::MemoryPointer.from_string(v) })
# keep reference to string pointers
str_ptrs = feature_names.map { |v| ::FFI::MemoryPointer.from_string(v) }
c_feature_names.write_array_of_pointer(str_ptrs)
check_result FFI.LGBM_DatasetSetFeatureNames(handle_pointer, c_feature_names, feature_names.size)
end
alias_method :feature_names=, :feature_name=
Expand Down

0 comments on commit a030213

Please sign in to comment.