igrigorik / decisiontree

ID3-based implementation of the ML Decision Tree algorithm
1.44k stars 130 forks source link

stack level too deep #13

Closed Numerico closed 11 years ago

Numerico commented 11 years ago

I think I found a weird behaviour too. Getting

Failure/Error: Unable to find matching line from backtrace
     SystemStackError:
       stack level too deep
     # /home/numerico/.rvm/gems/ruby-1.9.3-p392/gems/decisiontree-0.4.1/lib/decisiontree/id3_tree.rb:122

when I give it attributes with numerical names for eg.

attributes = ['1', '2'] # NUMERICAL
training = [[1, 1, true], [1,2,false] #... ]

but this would work

attributes = ['one', 'two'] #NON NUMERICAL
training = #...

does this make any sense?

igrigorik commented 11 years ago

Could you post a full example? Trying to reproduce it here, but so far no luck.. "works here".

Numerico commented 11 years ago

Hold on please, I'll build a test for this asap.

Numerico commented 11 years ago

Ok, this commit reproduces the issue https://github.com/Numerico/decisiontree/commit/c820a56802d4502dcab9e9415fa2fb8184670e66 I'm trying to submit a pull request but my Firefox is kind of old school it seems..

igrigorik commented 11 years ago

The code really needs a refactor.. but this does the trick. :)