Open elestrade opened 10 years ago
@elestrade nice catch. The code definitely needs some careful refactoring. If you spot any other gotchas like that, let me know (pull's are welcome too :))
I can't make a pull request but maybe @nicomahler can do it.
I guess this line can be simply removed: its goal was surely to capture the case where gain
is nil
but that means that values
, at the beginning of the method, has only one element, which is already captured here.
Thank you Ilya for your great job. I work with @nicomahler and we look forward contributing to this project.
As I worked on #19, I remarked that the last line of the code snippet below, extracted from
ID3Tree#id3_continuous
(line 117 inid3_tree.rb
) seems to have no effect at all:gain
is a result ofEnumerable#max
method applied on an array of 2-elements arrays. Its value is eithernil
, if the array is empty (case wherethresholds
is empty - I don't know if it can happen, we never met that case), or a 2-elements array. It can never be an empty array. Sogain.size
is never 0.