Description
Hi Alberto,
Your inference module looks useful, I could definitely see myself using a Ruby wrapper for the apache commons math library. I'm not sure if you need the java functions for part of your gem, or you're trying to present a unified interface of some sort, but if not you may want to think about focusing on wrapping the functions which aren't already included in statsample, since some of the more popular ones like student's t are already implemented.
Other than that I just noticed one formatting issue and a couple of other small things. First, you may want to replace all of your hard "tab" characters with spaces, since having a mix of tabs and spaces for indentation makes it harder to read on github. It also makes forking and contributing to your code more difficult since whatever editor you load it into may not properly handle the indentation. Still not really a huge deal, but I had the same problem with a lot of my code earlier in the summer, so I thought I'd mention it.
As for specific coding/style issues, it mostly looks good to me. I think on lines 21-22:
first = Core::Utils::double_to_a(array_1)
second = Core::Utils::double_to_a(array_2)
you probably probably can just call array_1.to_a
instead of Core::Utils::double_to_a(array_1)
, since jruby handles java -> ruby conversion pretty seamlessly. I tried it out myself, but I'm not super familiar with jruby's internals so if you've found otherwise feel free to ignore this.
Also, you rarely need to explicitly return
the results of a method, as on line 68, 77, 89, etc. Ruby automatically returns the result of the last evaluated statement in the method, so usually people won't bother writing in the return unless they're using it to break out of a method early.
Thanks for letting me review your code, looking forward to working on some semweb/data mining stuff in the next few weeks!
Will