Error when running kmeans-clusterer gem; narray_ext.rb:21:in `new': Argument required (ArgumentError)

59 views Asked by At

I'm trying to run kmeans-clusterer with narray in Ruby. But when it comes to this line in narray_ext.rb:

 na = self.new(type,*shape)

I get this error:

narray_ext.rb:21:in new': Argument required (ArgumentError)

I'm using these gems:

  • kmeans-clusterer-0.11.4
  • narray-0.6.1.2
  • zombie_writer-0.2.0

Stacktrace:

/home/mikael/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/narray-0.6.1.2/narray/narray_ext.rb:21:in `new': Argument required (ArgumentError)
        from /home/mikael/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/narray-0.6.1.2/narray/narray_ext.rb:21:in `cast'
        from /home/mikael/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/kmeans-clusterer-0.11.4/lib/kmeans-clusterer.rb:13:in `ensure_matrix'
        from /home/mikael/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/kmeans-clusterer-0.11.4/lib/kmeans-clusterer.rb:130:in `run'
        from /home/mikael/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/zombie_writer-0.2.0/lib/zombie_writer.rb:80:in `generate_clusters'
        from /home/mikael/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/zombie_writer-0.2.0/lib/zombie_writer.rb:56:in `generate_articles'
        from main.rb:17:in `<main>'

And my code:

require 'zombie_writer'

zombie = ZombieWriter::MachineLearning.new

zombie.add_string(content: "Lorem ipsum dolor sit amet.",
sourcetext: "Cicero's Great Speech On Ethics",
sourceurl: "http://example.com/lorem-ipsum")

array = zombie.generate_articles

Fairly new to Ruby myself, and I can't figure it out, so. Does anyone know what is going on and how I can fix it?

1

There are 1 answers

0
Mikael Gyth On BEST ANSWER

This was resolved for me by the developer of ZombieWriter. Read the developers reply on the issue on Github if you have the same problem.