How to ACTUALLY USE a saved model in Weka!

This was a frusterating 30 minutes of searching to find out how to get Weka to do something that really should have been obvious.

In this data mining competition I was trying out, they give you a final test set without the actual answers and your job is to predict that the actual values are, and well, send them in. I did manage to get it figured out after a lot of searching. So I’m back on my path to winning ;-)

So here’s the easiest way to use a model to simply get its predictions without training it again:

If you right-click on the result list you’ll get a popup
with options including “Load model” which allows you to load
some saved model; and there is another option “Re-evaluate
model on the current test-set”; obviously before you can
do that, you will have to load some test-set: tick “Supplied
test set” and then the “Set” button and select your file …

I found that answer here, and later in the thread they also mention a way to do it with the command line interface (CLI).

If that quoted answer above still isn’t clear, allow me to summarize:

1. You open Weka and get that little window with the four buttons.
2. Click on Explorer.
3. load any old bogus data set you’re not going to need just so it allows you to get to the classifier tab.
4. Then under test options you choose “supplied test set” and point it to the data you want it to make predictions on. (Note: this 5. must have all of the same attributes, in the same order that you trained your model on.).
6. Finally right click in the result list area and select load model.
7. Point it to your saved model.
8. Next right click to model you just loaded and tell it to re-evaluate on current test set.

Here’s what your output might look like:
Weka actually using a model to make predictions without retraining OMG

You know, all frusteration aside, Weka really is an incredibly useful, free program, and perhaps I should be glad the developers are spending time on the machine learning side of development instead of my personal needs…

My search terms (see the frusteration build):

  1. weka run a model on test data
  2. weka use a model
  3. weka + “use a model”
  4. weka + (get OR output) + predictions + without + training
  5. weka + “without training”
  6. weka don’t have actual
  7. weka cli
  8. weka + sucks
  9. “weka sucks”

Here is more information about saving models in Weka.

[tags]Weka, machine learning, data mining, predictions[/tags]

2 Responses to “How to ACTUALLY USE a saved model in Weka!”

  1. fracpete says:

    Posting to the Wekalist in the first place could have saved you a lot of frustration… Not being able to find the information you’re looking for doesn’t mean that it’s not out there – it’s only the current search engines that make it hard to find it.

  2. Good point, fracpete. I always just assume Google indexes everything out there but that isn’t always the case. But at least thanks to this post Google will point to something, hopefully. I may well try posting to the weka list first if I hit another frusteration.

    And again just for the record, I love Weka! No hard feelings, my beloved Weka!