本文介绍了Graphviz和Weka仅生成空树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了Graphviz并为其安装了Weka 3.9软件包,并按照 https://github.com/fracpete/graphviz-treevisualize-weka-package 内容:

I downloaded Graphviz and installed their package for Weka 3.9, created the props file as indicated on https://github.com/fracpete/graphviz-treevisualize-weka-package with content:

Executable ="C:\ Program Files(x86)\ Graphviz2.38 \ bin \ dot.exe"(尝试使用引号和不使用引号)

Executable="C:\Program Files (x86)\Graphviz2.38\bin\dot.exe"(Tried with and without quotation marks)

它只会通过plugin-> visualize tree(Graphviz)生成空树.

And it will only generate empty trees through plugin->visualize tree (Graphviz).

我有点压力,因为我需要在今天晚上之前交付一个项目,并在最后一刻发现一个错误,有人可以帮忙吗?我可以在没有树木的情况下进行运送,但是它们会提供很大的帮助.

I'm in a bit of stress because I need to deliver a project by this night and discovered an error last moment, can anyone please help? I can deliver without the trees, but theyd be a major help.

提前谢谢!

推荐答案

首先,感谢您将此有用的Weka插件带到我的面前!我认为它是由Weka开发人员之一编写的,而不是Graphviz的作者编写的.

First of all, thanks for bringing this useful Weka plugin to my notice! I think it's written by one of the Weka developers fwiw, not by the authors of Graphviz.

要回答您的问题,尽管对您的截止日期为时已晚,但您确定已正确创建了props文件吗?特别是,用于指定可执行路径的格式显示在链接为的项目页面上(例如):

To answer your question, although it's too late for your deadline sorry, are you sure you have created the props file correctly? In particular, the format for specifying the executable path is shown on the project page you linked to as (for example):

Executable=C:/Program Files (x86)/Graphviz2.38/bin/dot.exe

即使用正斜杠作为路径分隔符,即使在Windows上也是如此.当我用反斜杠替换正斜杠时,它也给了我一个空的窗口,所以我怀疑这可能是你的问题.

i.e. with forward slashes as the path separator, even on Windows. When I replaced the forward slashes with backslashes it gave me an empty window too, so I suspect this might be your problem.

但是,在没有插件的情况下,从Weka输出手动编写用于决策树结构的Graphviz代码非常容易,而编写一个将脚本相互转换的脚本也不太困难.这是一个示例:

However, in the absence of the plugin it's quite easy to write the Graphviz code for a decision tree structure by hand from the Weka output, and not too hard to code up a script to convert one to the other. Here's an example:

digraph myTree {
Node_1 [label="Predictor1"]
Node_1 -> Node_2 [label="<= 3.14"]
Node_1 -> Node_3 [label="> 3.14"]
Node_2 [label="Class 1", shape=box,style=filled,color=lightgray]
Node_3 [label="Predictor2"]
Node_3 -> Node_4 [label="<= 42"]
Node_3 -> Node_5 [label="> 42"]
Node_4 [label="Class 2", shape=box,style=filled,color=lightgray]
Node_5 [label="Class 3", shape=box,style=filled,color=lightgray]
}

和相应的输出,例如来自dot -Tpng -O path\to\myTree.gv:

and the corresponding output, obtained e.g. from dot -Tpng -O path\to\myTree.gv:

这篇关于Graphviz和Weka仅生成空树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 04:26