igrigorik/decisiontree — pull request #22 by newx (2014-05-22 22:17:58+00:00)
Title: export ruleset to ruby conditional blocks and method

Generated ruby code example

def classify(hunger, happiness)
if (hunger >= 4.5 and
happiness >= 4.0)
then 'angry'
elsif (hunger >= 4.5 and
happiness < 4.0)
then 'not angry'
elsif (hunger < 4.5)
then 'not angry'
else nil
end
end

def classify(hunger, color)
if (hunger == 'no')
then 'not angry'
elsif (hunger == 'yes' and
color == 'blue')
then 'not angry'
elsif (hunger == 'yes' and
color == 'red')
then 'angry'
else nil
end
end