Making Predictions with a Trained Model

43 views
Skip to first unread message

Abhishek Majumder

unread,
May 22, 2015, 4:24:40 PM5/22/15
to wekamooc...@googlegroups.com
First of all, thanks Ian and other staff for making such a wonderful introductory course!

I want to get some further idea regarding how to evaluate a trained model on test data and have a predicted values column appended to the actual file.

Referring to this link:- Making predictions

I understand this can be achieved from the explorer by checking Output predictions options, doing which we get the predictions on the test set in the results pane.

My question is, what is the simplest way to get this predicted values column appended to the original test data file using the Explorer.

I reckon this can done from the KnowledgeFlow option (as given later in the above link)? But as I'm new to Weka (thus only acquainted with the Explorer) , just wanted to know if the same thing can be done from the Explorer itself.

Thanks,
Abhishek

Ian Witten

unread,
May 28, 2015, 1:36:54 AM5/28/15
to wekamooc...@googlegroups.com
On 23/05/2015, at 8:24 am, Abhishek Majumder <avish...@gmail.com> wrote:

First of all, thanks Ian and other staff for making such a wonderful introductory course!

I want to get some further idea regarding how to evaluate a trained model on test data and have a predicted values column appended to the actual file.

Referring to this link:- Making predictions

I understand this can be achieved from the explorer by checking Output predictions options, doing which we get the predictions on the test set in the results pane.

My question is, what is the simplest way to get this predicted values column appended to the original test data file using the Explorer.

Putting “first-last” in the “Output additional attributes” box (after the Output predictions options you mention) will output the attribute values of each instance. However, the format is not a pretty one.

This feature is greatly improved in the next version of Weka, Weka 3.7 (you can easily download this and try it).  Select “CSV” output and configure it by clicking the CSV; there you can determine which attributes to use and whether to output the probability distribution or just the prediction.

Using J48 on the weather data, selecting CSV output and the attributes "first-last” and just the prediction (not the distribution), you get this output:

inst#,actual,predicted,error,prediction,outlook,temperature,humidity,windy
1,2:no,2:no,,1,sunny,hot,high,FALSE
2,2:no,2:no,,1,sunny,hot,high,TRUE
3,1:yes,1:yes,,1,overcast,hot,high,FALSE
4,1:yes,1:yes,,1,rainy,mild,high,FALSE
5,1:yes,1:yes,,1,rainy,cool,normal,FALSE
6,2:no,2:no,,1,rainy,cool,normal,TRUE
7,1:yes,1:yes,,1,overcast,cool,normal,TRUE
8,2:no,2:no,,1,sunny,mild,high,FALSE
9,1:yes,1:yes,,1,sunny,cool,normal,FALSE
10,1:yes,1:yes,,1,rainy,mild,normal,FALSE
11,1:yes,1:yes,,1,sunny,mild,normal,TRUE
12,1:yes,1:yes,,1,overcast,mild,high,TRUE
13,1:yes,1:yes,,1,overcast,hot,normal,FALSE
14,2:no,2:no,,1,rainy,mild,high,TRUE

Here I just evaluated on the training set, but with a test set you would just get the output for the test set.
(Sorry for the late reply)
cheers
ian


I reckon this can done from the KnowledgeFlow option (as given later in the above link)? But as I'm new to Weka (thus only acquainted with the Explorer) , just wanted to know if the same thing can be done from the Explorer itself.

Thanks,
Abhishek

--
You received this message because you are subscribed to the Google Groups "WekaMOOC-general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wekamooc-gener...@googlegroups.com.
To post to this group, send email to wekamooc...@googlegroups.com.
Visit this group at http://groups.google.com/group/wekamooc-general.
To view this discussion on the web, visit https://groups.google.com/d/msgid/wekamooc-general/7552fce9-8ab5-421d-ac24-498e34139ceb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Abhishek Majumder

unread,
May 28, 2015, 4:05:41 PM5/28/15
to wekamooc...@googlegroups.com
Thanks professor for your detailed guidance! Will definitely try out v3.7.

Eagerly looking forward to June 1st for the More Data Mining course... :-)

Regards
Abhishek
Reply all
Reply to author
Forward
0 new messages