Closed Webovani closed 5 years ago
Hello, I tried example from machine_learning_workbench and was perplexed why it wasn't working for me. After some debugging I found out that Numo::NMath.log method was returning unexpected results when used on a diagonal (DFloat(view) ?)
machine_learning_workbench
Numo::NMath.log
DFloat(view)
2.6.1 :001 > require 'numo/narray' => true 2.6.1 :002 > Numo::NArray::VERSION => "0.9.1.3" 2.6.1 :003 > n1 = Numo::DFloat.new(9).fill(1) => Numo::DFloat#shape=[9] [1, 1, 1, 1, 1, 1, 1, 1, 1] 2.6.1 :004 > Numo::NMath.log(n1) => Numo::DFloat#shape=[9] [0, 0, 0, 0, 0, 0, 0, 0, 0] # <==== as expected 2.6.1 :005 > n2 = n1.diag.diagonal => Numo::DFloat(view)#shape=[9] [1, 1, 1, 1, 1, 1, 1, 1, 1] 2.6.1 :006 > Numo::NMath.log(n2) => Numo::DFloat#shape=[9] [0, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf] # <==== NOPE :(
Rolled back a bit and found out that it is working correctly in 0.9.1.2.
0.9.1.2
2.6.1 :001 > require 'numo/narray' => true 2.6.1 :002 > Numo::NArray::VERSION => "0.9.1.2" 2.6.1 :003 > n1 = Numo::DFloat.new(9).fill(1) => Numo::DFloat#shape=[9] [1, 1, 1, 1, 1, 1, 1, 1, 1] 2.6.1 :004 > Numo::NMath.log(n1) => Numo::DFloat#shape=[9] [0, 0, 0, 0, 0, 0, 0, 0, 0] # <==== as expected 2.6.1 :005 > n2 = n1.diag.diagonal => Numo::DFloat(view)#shape=[9] [1, 1, 1, 1, 1, 1, 1, 1, 1] 2.6.1 :006 > Numo::NMath.log(n2) => Numo::DFloat#shape=[9] [0, 0, 0, 0, 0, 0, 0, 0, 0] # <==== as expected
This bug is fixed by the commit https://github.com/ruby-numo/numo-narray/commit/a6e21997019c29d7bf14f0e6917662dab9d78116 . Thank you for reporting.
Thanks for quick reaction, much appreciated!
Hello, I tried example from
machine_learning_workbench
and was perplexed why it wasn't working for me. After some debugging I found out thatNumo::NMath.log
method was returning unexpected results when used on a diagonal (DFloat(view)
?)Rolled back a bit and found out that it is working correctly in
0.9.1.2
.