Skip to content

Conversation

@printfinn
Copy link

Hi there, not sure if this is related to the project or Ruby, I noticed a warning when using the example code in README, it seems related to the new implementation of Ruby after 3.2:

The warning is warning: undefining the allocator of T_DATA class Libsvm::Model, to reproduce:

irb --simple-prompt
>> require 'libsvm'
>> 
>> # This library is namespaced.
>> problem = Libsvm::Problem.new
>> parameter = Libsvm::SvmParameter.new
>> 
>> parameter.cache_size = 1 # in megabytes
>> 
>> parameter.eps = 0.001
>> parameter.c = 10
>> 
>> examples = [ [1,0,1], [-1,0,-1] ].map {|ary| Libsvm::Node.features(ary) }
>> labels = [1, -1]
>> 
>> problem.set_examples(labels, examples)
>> 
>> model = Libsvm::Model.train(problem, parameter)
>> 
>> pred = model.predict(Libsvm::Node.features(1, 1, 1))
>> puts "Example [1, 1, 1] - Predicted #{pred}"
(irb):17: warning: undefining the allocator of T_DATA class Libsvm::Model
Example [1, 1, 1] - Predicted 1.0
=> nil
>> RUBY_VERSION
=> "3.4.1"

I did some research, found a potential solution, but I'm not very experienced in Ruby-C bindings. If experienced dev have time, please review the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant