Skip main navigation

How would you apply this in real life?

Ian Witten previews how you would use a classifier that Weka has built.

So, you can use Weka to build a classifier. So what?

In the video I showed you how to use Weka to build a J48 classifier for the glass.arff dataset, and look at the evaluation results – the percentage accuracy – and the tree produced by J48. In the quiz you built J48 classifiers for that dataset and another, labor.arff, and looked at the confusion matrix and percentage of correctly classified instances.

But the real goal is to use the classifier on new data. How do you do that? Well, you could imagine following down the decision tree that I showed in the video manually, with a new instance. (To aid readability I’ve made this tree slightly smaller than the one in the video by specifying minNumObj=15):

Example decision tree

You know the values of the attributes but not the class, and you want to find it. First look at the Barium (Ba) content. If it’s large ((>0.27)), then the class must be headlamps. If it’s small ((leq 0.27)), then look at Magnesium (Mg). If that’s small ((leq 2.41)), then look at potassium (K), and if that’s small ((leq 0.12)), then we’ve got tableware.

Suppose you had these two instances:

RI Na Mg Al Si K Ca Ba Fe
1.5 14.2 0 2.8 73.5 0 9.0 0.4 0.09
1.5 14.1 2.2 1.7 72.7 0 9.3 0 0

The first one has Ba = 0.4, which is (>0.27), so this instance must be headlamps. For the second, Ba = 0, which is (leq 0.27); Mg = 2.2, which is (leq 2.41); and K = 0, which is (leq 0.12); so this instance must be tableware.

But there’s no need to do this manually! Weka can apply any classifier to a test file of new instances, or save the classifier for future use. It’s all very easy, and you’ll learn how to do such things later in the course.

Remember, this week is a whirlwind tour, and consequently superficial. You’re going to learn much more about how to build, evaluate, and apply classifiers in subsequent weeks. But, for now, let’s press on with our tour.

This article is from the free online

Data Mining with Weka

Created by
FutureLearn - Learning For Life

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education