0

I created a C# program using the weka library.

I was following the WekaManual.pdf, example builds a J48 classifier on a dataset and displays the generated tree visually using the TreeVisualizer class.

Code is,

Instances data = ... // from somewhere
// train classifier
J48 cls = new J48();
cls.buildClassifier(data);

weka.gui.treevisualizer.TreeVisualizer tv = new weka.gui.treevisualizer.TreeVisualizer(null,cls.graph(), new weka.gui.treevisualizer.PlaceNode2());

javax.swing.JFrame jf = new javax.swing.JFrame("Weka Classifier Tree Visualizer : J48");

jf.setDefaultCloseOperation(2);
jf.setSize(1280, 1024);
jf.getContentPane();
jf.setLayout(new java.awt.BorderLayout());
jf.add(tv, java.awt.BorderLayout.CENTER);

jf.setVisible(true);

tv.fitToScreen();

As a result of the code, the Java Swing form is created, but tree figure does not appear.

Could anyone please guide me how to get the tree diagram in C# environment?

jonsca
  • 10,218
  • 26
  • 54
  • 62
EQusJin
  • 21
  • 2
  • 2
    This looks like Java, not C#. – SomeWritesReserved Sep 24 '12 at 13:18
  • Yes, it`s Java code, but i want to use C# environment in visual studio 2010 – EQusJin Sep 25 '12 at 14:54
  • Maybe you can explain what you mean by "use a C# environment in visual studio 2010", are you trying to use the gui designer? Visual Studio 2010 is not meant for developing Java so I would not think this would be possible, and even if it is, I'm not sure why you would want to or need to. Perhaps I'm just missing what you're asking. – Tristan McPherson Oct 16 '14 at 04:57

0 Answers0