Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to do you create a J48 Design Tree Classifier in Java? Hi I'm a bit confused as to how to create a J48 Decision

How to do you create a J48 Design Tree Classifier in Java?

Hi I'm a bit confused as to how to create a J48 Decision Tree. I'm supposed to use the weather.nominal.arff file as the training data set, which is located in Weka's data folder. I need help figuring out how to load in an ARFF file (I was told to load it into an Instances object) and then use it to build a J48 classifier. After doing all of that, I need to produce a similar output like the one shown below. Can anyone please with figuring out how to program this in Java?

Figure 1:

J48 pruned tree

------------------

outlook = sunny

| humidity = high: no (3.0)

| humidity = normal: yes (2.0)

outlook = overcast: yes (4.0)

outlook = rainy

| windy = TRUE: no (2.0)

| windy = FALSE: yes (3.0)

Number of Leaves : 5

Size of the tree : 8

Correctly Classified Instances 7 50 %

Incorrectly Classified Instances 7 50 %

Kappa statistic -0.0426

Mean absolute error 0.4167

Root mean squared error 0.5984

Relative absolute error 87.5 %

Root relative squared error 121.2987 %

Total Number of Instances 14

=== Detailed Accuracy By Class ===

TP Rate FP Rate Precision Recall F-Measure MCC ROC Area PRC Area Class

0.556 0.600 0.625 0.556 0.588 -0.043 0.633 0.758 yes

0.400 0.444 0.333 0.400 0.364 -0.043 0.633 0.457 no

Weighted Avg. 0.500 0.544 0.521 0.500 0.508 -0.043 0.633 0.650

=== Confusion Matrix ===

a b <-- classified as

5 4 | a = yes

3 2 | b = no

Some of the classes that may be needed while working include:

J48 this is the actual classifier

Instance a single data record

Instances basically a collection of Instance objects; used to hold your training data set

DataSource aids in reading an ARFF file and converting it to an Instances object.

Evaluation used to evaluate a classifier and to provide nearly all of the summary and detailed output you need. (Look closely at the crossValidateModel method)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning VB 2008 Databases

Authors: Vidya Vrat Agarwal, James Huddleston

1st Edition

1590599470, 978-1590599471

More Books

Students also viewed these Databases questions

Question

Explain the pros and cons of incorporating.

Answered: 1 week ago