[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wekalist
Subject:    Re: [Wekalist] Load model - Different resutls between gui and java code
From:       Nantia Makrynioti <nantiamakr () gmail ! com>
Date:       2012-11-24 10:54:56
Message-ID: CAN9i3-ERT+agEEcFR2FEux=PViQ3KDyvATu6QNW9ZAt0MTWbFA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


I figured it out last night. It was enconding problem once again. Many
characters were not read correctly from
java and this caused the difference between the code and the gui. I was
going to send you an email today to tell
that I solved my problem.

Nevertheless, thank you for checking!

Nantia

2012/11/24 Mark Hall <mhall@pentaho.com>

> From: Nantia Makrynioti <nantiamakr@gmail.com>
> Reply-To: "Weka machine learning workbench list." <
> wekalist@list.scms.waikato.ac.nz>
> Date: Sunday, 18 November 2012 12:06 PM
> To: "Weka machine learning workbench list." <
> wekalist@list.scms.waikato.ac.nz>
> Subject: [Wekalist] Load model - Different resutls between gui and java
> code
>
>  Hello all,
>
> I have saved a model with explorer's gui with the following options:
> - * FilteredClassifier* using
> - *weka.classifiers.functions.SMO -C 1.0 -L 0.0010 -P 1.0E-12 -N 0 -V -1
> -W 1 -K "weka.classifiers.functions.supportVector.PolyKernel -C 250007 -E
> 1.0" *
>   on data filtered through
> - *weka.filters.MultiFilter -F
> "weka.filters.unsupervised.attribute.StringToWordVector -R 2 -W 1000
> -prune-rate -1.0 -N 0 -S -stemmer weka.core.stemmers.NullStemmer -M 1
> -stopwords \"C:\\\\Program Files (x86)\\\\Weka-3-6\\\\stopwords2.txt\"
> -tokenizer \"weka.core.tokenizers.WordTokenizer -delimiters \\\"
> \\\\r\\\\n\\\\t.,;:\\\\\\\'\\\\\\\"()?!\\\"\"" -F
> "weka.filters.supervised.attribute.AttributeSelection -E
> \"weka.attributeSelection.InfoGainAttributeEval \" -S
> \"weka.attributeSelection.Ranker -T 0.0 -N -1\""*
>
> When I re-evaluate the model to a test set from gui, I get 82.21 %
> correctly classified instances.
> Then I load the same model with java code and evaluate the model on the
> same test set. The number of correctly classified instances is different,
> 48.32%.
>
> My code looks like this:
>
> public class LoadModel{
>>     public static void main(String args[]){
>>          try{
>>
>                Instances test = null;
>>
>                DataSource source = new DataSource("C:/Program Files
>> (x86)/Weka-3-6/test300.arff");
>>                test = source.getDataSet();
>>                test.setClassIndex(0);
>>
>
>>
>                FilteredClassifier cl1 = (FilteredClassifier)
>> weka.core.SerializationHelper.read("C:/Program Files
>> (x86)/Weka-3-6/train3.model");
>>
>
>>                Evaluation evaluation = new Evaluation(test);
>>                evaluation.evaluateModel(cl1, test);
>>                System.out.println("Results:" +
>> evaluation.toSummaryString());
>>
>
>>
>          }catch(Exception e){
>>                System.out.println(e);
>>          }
>>     }
>>
>> }
>>
>
> Another weird thing is that when I changed the classifier to ZeroR the
> results from both gui and java code were the same.
>
>  Do you have any explanation why this might be happening? Part of my data
> is in greek but I don't think that it has to do anything with the encoding.
>  Am I missing something?
>
> I am using the version 3.6.7.
>
> I would appreciate any help as I have trained successfully my system and
> got good results. Now I just want to load the model so I don't have to
> do the training every time.
>
>
> Perhaps you have the class index set incorrectly? I just tried your setup
> + code with the Reuters corn data set and got the same results as the GUI.
>
> Cheers,
> Mark.
>
>
> _______________________________________________
> Wekalist mailing list
> Send posts to: Wekalist@list.scms.waikato.ac.nz
> List info and subscription status:
> https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
> List etiquette:
> http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
>
>

[Attachment #5 (text/html)]

I figured it out last night. It was enconding problem once again. Many characters \
were not read correctly from<br>java and this caused the difference between the code \
and the gui. I was going to send you an email today to tell<br> that I solved my \
problem.<br><br>Nevertheless, thank you for checking!<br><br>Nantia<br><br><div \
class="gmail_quote">2012/11/24 Mark Hall <span dir="ltr">&lt;<a \
href="mailto:mhall@pentaho.com" target="_blank">mhall@pentaho.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div \
style="font-size:14px;font-family:Calibri,sans-serif;word-wrap:break-word"><span><div \
style="border-right:medium \
none;padding-right:0in;padding-left:0in;padding-top:3pt;text-align:left;font-size:11pt;border-bottom:medium \
none;font-family:Calibri;border-top:#b5c4df 1pt \
solid;padding-bottom:0in;border-left:medium none">

<span style="font-weight:bold">From: </span> Nantia Makrynioti &lt;<a \
href="mailto:nantiamakr@gmail.com" \
target="_blank">nantiamakr@gmail.com</a>&gt;<br><span \
style="font-weight:bold">Reply-To: </span> &quot;Weka machine learning workbench \
list.&quot; &lt;<a href="mailto:wekalist@list.scms.waikato.ac.nz" \
target="_blank">wekalist@list.scms.waikato.ac.nz</a>&gt;<br>

<span style="font-weight:bold">Date: </span> Sunday, 18 November 2012 12:06 \
PM<br><span style="font-weight:bold">To: </span> &quot;Weka machine learning \
workbench list.&quot; &lt;<a href="mailto:wekalist@list.scms.waikato.ac.nz" \
target="_blank">wekalist@list.scms.waikato.ac.nz</a>&gt;<br>

<span style="font-weight:bold">Subject: </span> [Wekalist] Load model - Different \
resutls between gui and java code<br></div><div><div><div><br></div><blockquote \
style="BORDER-LEFT:#b5c4df 5 solid;PADDING:0 0 0 5;MARGIN:0 0 0 5">

<div><div>
Hello all,<br><br>
I have saved a model with explorer&#39;s gui with the following options:<br>
- <b> FilteredClassifier</b> using <br>
- <b>weka.classifiers.functions.SMO -C 1.0 -L 0.0010 -P 1.0E-12 -N 0 -V -1 -W 1 -K \
&quot;weka.classifiers.functions.supportVector.PolyKernel -C 250007 -E 1.0&quot; \
</b><br>  on data filtered through <br>
- <b>weka.filters.MultiFilter -F \
&quot;weka.filters.unsupervised.attribute.StringToWordVector -R 2 -W 1000 -prune-rate \
-1.0 -N 0 -S -stemmer weka.core.stemmers.NullStemmer -M 1 -stopwords \
\&quot;C:\\\\Program Files (x86)\\\\Weka-3-6\\\\stopwords2.txt\&quot; -tokenizer \
                \&quot;weka.core.tokenizers.WordTokenizer
 -delimiters \\\&quot; \
\\\\r\\\\n\\\\t.,;:\\\\\\\&#39;\\\\\\\&quot;()?!\\\&quot;\&quot;&quot; -F \
&quot;weka.filters.supervised.attribute.AttributeSelection -E \
\&quot;weka.attributeSelection.InfoGainAttributeEval \&quot; -S \
\&quot;weka.attributeSelection.Ranker -T 0.0 -N -1\&quot;&quot;</b><br>

<br>
When I re-evaluate the model to a test set from gui, I get 82.21 % correctly \
classified instances. <br>
Then I load the same model with java code and evaluate the model on the same test \
set. The number of correctly classified instances is different, 48.32%.<br><br> My \
code looks like this:<br><br><blockquote style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"> \
public class LoadModel{<br>  public static void main(String args[]){<br>
         try{<br></blockquote><blockquote style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" \
class="gmail_quote"><div>               Instances test = null; \
<br></div></blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px \
solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">

<div style="text-align:left">               DataSource source = new \
DataSource(&quot;C:/Program Files (x86)/Weka-3-6/test300.arff&quot;);<br>  test = \
source.getDataSet();<br>  test.setClassIndex(0); <br></div></blockquote><blockquote \
style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div> \
</div></blockquote><div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px \
solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">


               FilteredClassifier cl1 = (FilteredClassifier) \
weka.core.SerializationHelper.read(&quot;C:/Program Files \
(x86)/Weka-3-6/train3.model&quot;); <br></blockquote><blockquote style="margin:0px \
0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" \
class="gmail_quote"><br></blockquote></div><blockquote style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">

<div>               Evaluation evaluation = new Evaluation(test);<br>
               evaluation.evaluateModel(cl1, test);<br>
               System.out.println(&quot;Results:&quot; + \
evaluation.toSummaryString()); <br></div></blockquote><blockquote style="margin:0px \
0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" \
class="gmail_quote">

<div> </div></blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px \
solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div>         \
}catch(Exception e){<br>  System.out.println(e);<br>
         }<br>
    }<br>
    <br>
} <br></div></blockquote><div> <br>
Another weird thing is that when I changed the classifier to ZeroR the results from \
both gui and java code were the same.<br><br></div><div> Do you have any explanation \
why this might be happening? Part of my data is in greek but I don&#39;t think that \
it has to do anything with the encoding.<br>


 Am I missing something?<br><br>
I am using the version 3.6.7.<br><br>
I would appreciate any help as I have trained successfully my system and got good \
results. Now I just want to load the model so I don&#39;t have to <br>
do the training every \
time.</div></div></div></blockquote></div></div></span><div><br></div><div>Perhaps \
you have the class index set incorrectly? I just tried your setup + code with the \
Reuters corn data set and got the same results as the GUI.</div>

<div><br></div><div>Cheers,</div><div>Mark.</div><div><br></div></div>
<br>_______________________________________________<br>
Wekalist mailing list<br>
Send posts to: <a href="mailto:Wekalist@list.scms.waikato.ac.nz" \
target="_blank">Wekalist@list.scms.waikato.ac.nz</a><br> List info and subscription \
status: <a href="https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist" \
target="_blank">https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist</a><br> \
List etiquette: <a href="http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html" \
target="_blank">http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html</a><br>
 <br></blockquote></div><br>



_______________________________________________
Wekalist mailing list
Send posts to: Wekalist@list.scms.waikato.ac.nz
List info and subscription status: https://list.scms.waikato.ac.nz/mailman/=
listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.=
html


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic