Getting class probabilities w/ SMO

View: New views
5 Messages — Rating Filter:   Alert me  

Getting class probabilities w/ SMO

by prog_lady :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

First of all, sorry for the naive question i'm new to weka and
to classification so...

I have trained text data using SMO to classify as positive and negative
when I test an instance, I would like to get the probability of the prediction,
I was reading that I could do this using -M however when I use this
option for training, when I do the test I still get the output below,
which doesn't give a probability of the class prediction, just the prediction
itself.  What am I doing wrong here???

btw this is the command I am using to build the model...
java -Xmx2048m -classpath /Users/lisa/Desktop/weka-3-5-8/weka.jar weka.classifiers.functions.SMO -d /tmp/movie_model.model -c first -t movie_training.arff -M

...
 +       0.0019 * (normalized) young
 +      -0.0679 * (normalized) your
 -       0.7147

Number of kernel evaluations: 372592 (97.499% cached)



Time taken to build model: 6.07 seconds

=== Predictions on test set ===

 inst#,    actual, predicted, error, probability distribution
     1      1:neg      1:neg         *1      0    

=== Evaluation on test set ===
=== Summary ===

Correctly Classified Instances           1              100      %
Incorrectly Classified Instances         0                0      %
Kappa statistic                          1    
Mean absolute error                      0    
Root mean squared error                  0    
Relative absolute error                  0      %
Root relative squared error              0      %
Total Number of Instances                1    

=== Detailed Accuracy By Class ===

TP Rate   FP Rate   Precision   Recall  F-Measure   Class
  1         0          1         1         1        neg
  0         0          0         0         0        pos

=== Confusion Matrix ===

 a b   <-- classified as
 1 0 | a = neg
 0 0 | b = pos

Re: Getting class probabilities w/ SMO

by Mark Hall-9 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2/7/09 5:11 AM, prog_lady wrote:

> First of all, sorry for the naive question i'm new to weka and
> to classification so...
>
> I have trained text data using SMO to classify as positive and negative
> when I test an instance, I would like to get the probability of the
> prediction,
> I was reading that I could do this using -M however when I use this
> option for training, when I do the test I still get the output below,
> which doesn't give a probability of the class prediction, just the
> prediction
> itself.  What am I doing wrong here???
>
> btw this is the command I am using to build the model...
> java -Xmx2048m -classpath /Users/lisa/Desktop/weka-3-5-8/weka.jar
> weka.classifiers.functions.SMO -d /tmp/movie_model.model -c first -t
> movie_training.arff -M

I can't see a problem with how you are applying SMO. Can you post the command
you use to load the model and apply it to your test data?

Cheers,
Mark.



--
Mark Hall
Senior Developer/Consultant, Pentaho Open Source Business Intelligence
Citadel International, Suite 340, 5950 Hazeltine National Dr., Orlando, FL
32822, USA
+64 7 847-3537 office, +64 21 399-132 mobile, +1 815 550-8637 fax,
Skype: mark.andrew.hall, Yahoo: mark_andrew_hall
Download the latest release today <http://www.sourceforge.net/projects/pentaho>


_______________________________________________
Wekalist mailing list
Send posts to: Wekalist@...
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

Re: Getting class probabilities w/ SMO

by prog_lady :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Mark,
 The command I'm using to test the data is...
java weka.classifiers.functions.SMO -l model.model T  data.arff -c first -p 0

when I try to use the -M option here I get that it is an illegal option

Mark Hall-9 wrote:
On 2/7/09 5:11 AM, prog_lady wrote:
> First of all, sorry for the naive question i'm new to weka and
> to classification so...
>
> I have trained text data using SMO to classify as positive and negative
> when I test an instance, I would like to get the probability of the
> prediction,
> I was reading that I could do this using -M however when I use this
> option for training, when I do the test I still get the output below,
> which doesn't give a probability of the class prediction, just the
> prediction
> itself.  What am I doing wrong here???
>
> btw this is the command I am using to build the model...
> java -Xmx2048m -classpath /Users/lisa/Desktop/weka-3-5-8/weka.jar
> weka.classifiers.functions.SMO -d /tmp/movie_model.model -c first -t
> movie_training.arff -M

I can't see a problem with how you are applying SMO. Can you post the command
you use to load the model and apply it to your test data?

Cheers,
Mark.



--
Mark Hall
Senior Developer/Consultant, Pentaho Open Source Business Intelligence
Citadel International, Suite 340, 5950 Hazeltine National Dr., Orlando, FL
32822, USA
+64 7 847-3537 office, +64 21 399-132 mobile, +1 815 550-8637 fax,
Skype: mark.andrew.hall, Yahoo: mark_andrew_hall
Download the latest release today <http://www.sourceforge.net/projects/pentaho>


_______________________________________________
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

Re: Getting class probabilities w/ SMO

by Mark Hall-9 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2/7/09 10:36 AM, prog_lady wrote:
> Hi Mark,
>   The command I'm using to test the data is...
> java weka.classifiers.functions.SMO -l model.model T  data.arff -c first -p
> 0

You don't need to add the -M option again. You will need to add the
-distribution option (in conjunction with -p) to get the probability
distributions output.

Cheers,
Mark.

--
Mark Hall
Senior Developer/Consultant, Pentaho Open Source Business Intelligence
Citadel International, Suite 340, 5950 Hazeltine National Dr., Orlando, FL
32822, USA
+64 7 847-3537 office, +64 21 399-132 mobile, +1 815 550-8637 fax,
Skype: mark.andrew.hall, Yahoo: mark_andrew_hall
Download the latest release today <http://www.sourceforge.net/projects/pentaho>


_______________________________________________
Wekalist mailing list
Send posts to: Wekalist@...
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

Re: Getting class probabilities w/ SMO

by prog_lady :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I used this command
 java weka.classifiers.functions.SMO -l model.model -T data.arff -c first -p 0 -distribution
and got the output below, i thought the prediction and distribution would be somewhere
between 0 and 1 not 1 itself? I am attaching my training and test files if someone wouldn't
mind looking at them :)  I am wanting to get the probability of a test instance
being positive or negative so that I can classify a sentence as being not only positive or negative
but the probability of being positive or negative...
movie_review_630.arff
testFile8001.arff
....
Logistic Regression with ridge parameter of 1.0E-8
Coefficients...
                Class
Variable          neg
=====================
pred         -95.7603
Intercept   -101.5845


Odds Ratios...
                Class
Variable          neg
=====================
pred                0





=== Error on test data ===

Correctly Classified Instances           0                0      %
Incorrectly Classified Instances         1              100      %
Kappa statistic                          0    
Mean absolute error                      1    
Root mean squared error                  1    
Total Number of Instances                1    


=== Confusion Matrix ===

 a b   <-- classified as
 0 1 | a = neg
 0 0 | b = pos


=== Predictions on test data ===

 inst#     actual  predicted error distribution
     1      1:neg      2:pos   +   0,*1

Mark Hall-9 wrote:
On 2/7/09 10:36 AM, prog_lady wrote:
> Hi Mark,
>   The command I'm using to test the data is...
> java weka.classifiers.functions.SMO -l model.model T  data.arff -c first -p
> 0

You don't need to add the -M option again. You will need to add the
-distribution option (in conjunction with -p) to get the probability
distributions output.

Cheers,
Mark.

--
Mark Hall
Senior Developer/Consultant, Pentaho Open Source Business Intelligence
Citadel International, Suite 340, 5950 Hazeltine National Dr., Orlando, FL
32822, USA
+64 7 847-3537 office, +64 21 399-132 mobile, +1 815 550-8637 fax,
Skype: mark.andrew.hall, Yahoo: mark_andrew_hall
Download the latest release today <http://www.sourceforge.net/projects/pentaho>


_______________________________________________
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