Closed XScarlett closed 4 years ago
The JPMML software project does not provide any visualization tools right now.
How would you like to visualize if free to choose? Any favourite tools/frameworks/libraries?
I would suggest using some "bridge" data format - instead of developing PMML visualizations tools from scratch, there would simply be a conversion tool that translates PMML models to some already supported data format, which can then be visualized using existing tools.
I know that Scikit-Learn uses DOT data format for tree visualization. So, one way to address this issue would be to build a PMML-to-DOT converter.
Thanks for your suggestion, i used DOT data format for tree visualization in scikit-learn and performed good, that is what i want, and how can i build a PMML-to-DOT converter?
how can i build a PMML-to-DOT converter?
You could develop an XSL stylesheet, or a Java application using the Visitor API of the JPMML-Model library.
The Java application way is probably easier - a new AbstractVisitor
subclass that prints out a DOT graph vertex every time it visits an org.dmg.pmml.tree.Node
object.
a Java application using the Visitor API of the JPMML-Model library.
The Java application way is probably easier - a new
AbstractVisitor
subclass that prints out a DOT graph vertex every time it visits anorg.dmg.pmml.tree.Node
object.
I know very little about the Visitor API. Would you help to give me an example? Thanks so much!
I know very little about the Visitor API.
It's time to learn something new then!
Would you help to give me an example?
PMML pmml = ...;
System.out.println("digraph PMML {");
Visitor dotPrinter = new AbstractVisitor(){
@Override
public VisitorAction visit(Node node){
List<Node> children = node.getNodes();
for(Node child : children){
System.out.println(node.getId() + " -> " child.getId() + ";");
}
return super.visit(node);
}
};
dotPrinter.applyTo(pmml);
System.out.println("}");
Add node attributes as necessary.
You are a great man, thank you every much!
Is there a better way to visualize PMML tree model?
ths.