evaluation and buildclassifier confusion

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

evaluation and buildclassifier confusion

ashish godbole

i am confused as to why only Evaluation class has the ability to save output model ?

i have the following code 
----------------------------------------------------------------------------------------------------------------------------------
J48 dtree = new J48();

 dtree.setOptions(str1);    //str1 is a list of options

Instances trainfile = new Instances(new FileReader(str2));    //str2 is filepath

trainfile.setClassIndex(trainfile.numAttributes()-1);

dtree.buildClassifier(trainfile);    // can i save this built classifier model ??

 Evaluation eval = new Evaluation(trainfile);

 String options[] = {"-d",str4[0],"-t",str2};   //str4[0] is output filename for model

 System.out.println(eval.evaluateModel(dtree, options));

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

my question is. why do i need to 'buildClassifier' if the 'evaluateModel' does the same thing ?

secondly, why doesnt J48, or buildClassifier have ability to save a created model as one of the options ?

thanks in advance

Ashish

p.s. i checked the mailing list for a clarification but couldnt find one. thanks


_______________________________________________
Wekalist mailing list
[hidden email]
https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: evaluation and buildclassifier confusion

Satanjeev Banerjee
Hi Ashish,
 
I'm not completely sure if this is an answer to all your questions, but I am working on something similar today and thought it might help you.
 
You can save the dtree that you created below after you .buildClassifier() it by writing it out as an ObjectOutputStream. Here are some lines:
 
// create the object output stream
ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream(filename));
// Write out the classifier
objectOutputStream.writeObject(model);
objectOutputStream.close();
 
Later you can read your classifier back in using an ObjectInputStream.
 
Good luck!
Bano
 


On 5/10/05, ashish godbole <[hidden email]> wrote:

i am confused as to why only Evaluation class has the ability to save output model ?

i have the following code 
----------------------------------------------------------------------------------------------------------------------------------
J48 dtree = new J48();

 dtree.setOptions(str1);    //str1 is a list of options

Instances trainfile = new Instances(new FileReader(str2));    //str2 is filepath

trainfile.setClassIndex(trainfile.numAttributes()-1);

dtree.buildClassifier(trainfile);    // can i save this built classifier model ??

 Evaluation eval = new Evaluation(trainfile);

 String options[] = {"-d",str4[0],"-t",str2};   //str4[0] is output filename for model

 System.out.println(eval.evaluateModel(dtree, options));

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

my question is. why do i need to 'buildClassifier' if the 'evaluateModel' does the same thing ?

secondly, why doesnt J48, or buildClassifier have ability to save a created model as one of the options ?

thanks in advance

Ashish

p.s. i checked the mailing list for a clarification but couldnt find one. thanks


_______________________________________________
Wekalist mailing list
[hidden email]
<a onclick="return top.js.OpenExtLink(window,event,this)" href="https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist" target="_blank">https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist




_______________________________________________
Wekalist mailing list
[hidden email]
https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
Loading...