0

I want to create a GUI using NetBeans and using the WEKA library. One button to upload an arff file that contains the data and another to generate a decision tree using J48 algorithm. All the tutorials online shows how to generate using the WEKA explorer but how can I do this in our GUI?

Mike Laren
  • 8,028
  • 17
  • 51
  • 70

1 Answers1

1

So you are trying to build a classifier programatically without the weka explorer?

This will build your classifier:

Reader r = new FileReader("/path/to/file.arff");

Instances i = new Instances(r);

Classifier c = new J48();
c.buildClassifier(i);

The necessary imports are:

import weka.classifiers.Classifier;
import weka.classifiers.trees.J48;
import weka.core.Instances;

The only thing your GUI has to do is to provide the path to the ARFF file.

I hope this will answer your question.

user
  • 735
  • 1
  • 6
  • 21