benhamner/MachineLearning.jl — pull request #2 by dchudz (2014-06-15 04:11:36+00:00)
Title: adds pretty show for decision branches, with test

This adds a nicer `show` method for `DecisionBranch`. So instead of getting:

DecisionBranch(1,0.5,DecisionBranch(2,1.5,DecisionBranch(3,2.5,RegressionLeaf(10.0),RegressionLeaf(12.0)),RegressionLeaf(20.0)),RegressionLeaf(30.0))

... you get:

DecisionBranch(1, 0.500000,
|DecisionBranch(2, 1.500000,
||DecisionBranch(3, 2.500000,
|||RegressionLeaf(10.0)
|||RegressionLeaf(12.0))
||RegressionLeaf(20.0))
|RegressionLeaf(30.0))

But it's possible the output of this will too many lines for you to want it as a default `show` method, though.

I also might not have thought through every case, so it's possible this isn't general enough? Anyway, won't be offended if you think this doesn't belong in the package, but here it is if you want it.