Closed newx closed 8 years ago
Hmm, neat. Sure, open a pull and we can iterate from there?
Hi Igrigorik,
Sorry for the delay. But only now I had time to contribute. Can you give me permission to push it to a branch?
Thanks
@newx you can fork this repository, push your changes to it and then submit a pull request, as said in this GitHub guide.
(e legal ver outros brasileiros aqui :)
Obrigado Carlos Agarie. I ll do it now
Just did it Carlos. Thanks again!
Hi,
I'm using Decisiontree gem on a project of mine and I wrote some simple code to export the ruleset generated by this gem into ruby if/elsif conditions.
Would that be interesting to add to your gem? If so I would push it.
Thanks
Code generated example:
def classify(sepallength, sepalwidth, petallength, petalwidth) if petallength >= 2.45 and petalwidth >= 1.75 and petallength >= 4.85 then 'virginica' elsif petallength >= 2.45 and petalwidth >= 1.75 and petallength < 4.85 and sepallength >= 5.95 then 'virginica' elsif petallength >= 2.45 and petalwidth >= 1.75 and petallength < 4.85 and sepallength < 5.95 then 'versicolor' elsif petallength >= 2.45 and petalwidth < 1.75 and petallength >= 4.95 and petalwidth >= 1.55 and sepallength >= 6.95 then 'virginica' elsif petallength >= 2.45 and petalwidth < 1.75 and petallength >= 4.95 and petalwidth >= 1.55 and sepallength < 6.95 then 'versicolor' elsif petallength >= 2.45 and petalwidth < 1.75 and petallength >= 4.95 and petalwidth < 1.55 then 'virginica' elsif petallength >= 2.45 and petalwidth < 1.75 and petallength < 4.95 and petalwidth >= 1.65 then 'virginica' elsif petallength >= 2.45 and petalwidth < 1.75 and petallength < 4.95 and petalwidth < 1.65 then 'versicolor' elsif petallength < 2.45 then 'setosa' else false end end
Usage example: puts classify(5.4,3.4,1.5,0.4) #setosa puts classify(7.2,3.0,5.8,1.6) #virginica puts classify(5.0,2.0,3.5,1.0) #versicolor