PDA

View Full Version : How to use a decision tree



Pask
01-25-2008, 01:12 PM
Hello,
I'm Pasquale Caiazza, a student of the University of Salerno, Italy. I'm sorry if my english isn't quite good but I'm still learning.

I need to create and use a decison tree for my thesis (measurement of atipical network in ELM images), and using training set I've already learnt how to create one.

Well, that's the point: now I have to classificate some istances (i.e. records of the database whose class I don't know) using the decision tree I've created before.
I've solved this problem converting the report of WEKA in Mathscript. For istances, if I get this simple report:


J48 pruned tree
------------------
AreaSigma <= 0.000042
| IntensitaSigma <= 49.38: Tipica (54.0/34.0)
| IntensitaSigma > 49.38: Atipica (4.0)
AreaSigma > 0.000042: Assente (2.0)I must convert (writing) in this one:


if AreaSigma <= 0.000042
if IntensitaSigma <= 49.38
tipo = 'La rete è TIPICA';
else
tipo = 'La rete è ATIPICA';
end
else
tipo = 'La rete è ASSENTE';
end and use Labview to classificate. But can I automate this process?
Can I use WEKA to classificate unknown-class istances directly AFTER have created a decision tree based on training set?

Thanks,
goodbye.

Mark
01-28-2008, 05:57 PM
Hi,

Yes you can train a model in Weka and then use it to classify new data. In the Explorer, there is an option (accessed by right-clicking over the entry for the model in the result history list) "re-evaluate model on current test set." This allows you to load a separate test set and then evaluate the trained classifier on it. Using this in conjunction with options accessible from the "More options" button will allow you to print out predictions for each instance in the test data.

You can also export the trained model from Weka as a serialized Java object. This can then be loaded into your own programs and used classify new data.

HTH.

Cheers,
Mark.

Pask
01-28-2008, 07:06 PM
Hello,
thanks for your answer. I had already tried in that way, but I always got this error: "Train and test set are not compatible", so I thought that wasn't the right way...

But after I've read your input, I've tried again... and I've just found out I forgot an attribute! :p

Well, now it works... thank you very much!

Bye,
Pasquale.

P.S.: what about my english? :)