Closed flare9x closed 6 years ago
It uses TikzGraphs.jl
, which generates an SVG through calls to lualatex and pdf2svg.
If you want it pretty-printed in text, then I think we can use some of the print_tree
functionality in AbstractTrees.jl
. If you don't need it pretty-printed, then you can just display the expression (example based on the example Julia notebook):
results_mc = optimize(p, grammar, :Real, loss)
results_mc.expr
Thanks Andrew, feel free to star the repo and tell your friends!
I think saving the SVG image file is the best for visualizing the tree, or results_mc.expr
for just displaying the expression, as Mykel said.
You can visualize the tree in text format and save it to text file as well. The package is compatible with AbstractTrees.jl
.
using AbstractTrees
results_mc = optimize(p, grammar, :Real, loss)
f = open("./tree.txt")
print_tree(f, results_mc.expr) #labels are the terminals
#alternatively,
#print_tree(f, results_mc.tree) #labels are the rule numbers in the grammar
close(f)
I added a demo of the AbstractTrees.jl
interface to the example notebook of ExprRules.jl
.
Gentlemen - Thank you kindly!!
You can also use https://github.com/sisl/D3Trees.jl if the tree is large enough to be unwieldy to print. it should work with anything that implements the AbstractTrees interface
On Tue, Apr 17, 2018 at 6:02 AM Andrew Bannerman notifications@github.com wrote:
Gentlemen - Thank you kindly!!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sisl/ExprOptimization.jl/issues/8#issuecomment-381980574, or mute the thread https://github.com/notifications/unsubscribe-auth/AEC0a2rrS50ow0Lsbk5LpgHtcSp5qE9Tks5tpefVgaJpZM4TVRt_ .
Sure, happy to help. I'm going to close. Feel free to reopen if the issue is not solved.
Hi!
So the output:
display(results_ge.tree, grammar)
Can I save it as .txt file?
I use the Atom - juno IDE. It runs but not sure how I see the display?
Thanks Andrew
PS loving this package