Knocktorius Maxima
Knocktorius Maxima

Reputation: 371

Building a classifier with J48

Weka is meant to make it very easy to build classifiers. There are many different kinds, and here I want to use a scheme called “J48” that produces decision trees.

Weka can read Comma Separated Values (.csv) format files by selecting the appropriate File Format in the Open file dialog.

I've created a small spreadsheet file (see the next image), saved it .csv format, and loaded it into Weka.

weka

The first row of the .csv file have the attribute names, separated by commas, which for this case is classe real and resultado modelo.

I've got the dataset opened in the Explorer. If I go to the Classify panel, choose a classifier, open trees and click J48, i should just run it (I have the dataset, the classifier). (see the next image) j48

Well, it doesn't allow to press start. (see the next image) enter image description here

What do I need to do to fix this?

Upvotes: 1

Views: 828

Answers (1)

zbicyclist
zbicyclist

Reputation: 696

If you look back at the Preprocess, you will see that resultado modelo is probably being treated as a numeric attribute. J48 only works with nominal class attributes. (Predictor attributes can be numeric, as a commenter @nekomatic noted.)

You can change this by using a filter in the Preprocess tab. Choose the unsupervised attribute filter NumericToNominal and this will convert all your variables (or a subset of them) from numeric to nominal. Then you should be able to run J48 just fine.

Upvotes: 2

Related Questions