How to interpret weka classification? - Stack Overflow

Join Stack Overflow to learn, share knowledge, and build your career.

Email Sign Up or sign in with
Google
Facebook

# How to interpret weka classification?

up vote 49 down vote favorite
28

How can we interpret the classification result in weka using naive bayes?

How is mean, std deviation, weight sum and precision calculated?

How is kappa statistic, mean absolute error, root mean squared error etc calculated?

What is the interpretation of the confusion matrix?

classification weka
edited Nov 6 '17 at 16:32
Vishrant
3,3562348
asked May 25 '10 at 10:55
user349821
249144

- @Atilla Ozgur: I got confused after reading that this question belongs to `computer-vision` tag, could you please elaborate your edit for that tag. – Vishrant Nov 5 '17 at 22:42
- @Vishrant original owner of question though that this question should have computer-vision, not me. I did not change any tags. – Atilla Ozgur Nov 6 '17 at 11:10

add a comment |

## 4 Answers 4

active oldest votes
up vote 83 down vote

Below is some sample output for a naive Bayes classifier, using 10-fold cross-validation. There's a lot of information there, and what you should focus on depends on your application. I'll explain some of the results below, to get you started.

    === Stratified cross-validation ===
    === Summary ===

    Correctly Classified Instances          71               71      %
    Incorrectly Classified Instances        29               29      %
    Kappa statistic                          0.3108
    Mean absolute error                      0.3333
    Root mean squared error                  0.4662
    Relative absolute error                 69.9453 %
    Root relative squared error             95.5466 %
    Total Number of Instances              100

    === Detailed Accuracy By Class ===

                   TP Rate   FP Rate   Precision   Recall  F-Measure   ROC Area  Class
                     0.967     0.692      0.686     0.967     0.803      0.709    0
                     0.308     0.033      0.857     0.308     0.453      0.708    1
    Weighted Avg.    0.71      0.435      0.753     0.71      0.666      0.709

    === Confusion Matrix ===

      a  b   <-- classified as
     59  2 |  a = 0
     27 12 |  b = 1

The correctly and incorrectly classified instances show the percentage of test instances that were correctly and incorrectly classified. The raw numbers are shown in the confusion matrix, with `a` and `b` representing the class labels. Here there were 100 instances, so the percentages and raw numbers add up, `aa` + `bb` = 59 + 12 = 71, `ab` + `ba` = 27 + 2 = 29.

The percentage of correctly classified instances is often called accuracy or sample accuracy. It has some disadvantages as a performance estimate (not chance corrected, not sensitive to class distribution), so you'll probably want to look at some of the other numbers. ROC Area, or area under the ROC curve, is my preferred measure.

Kappa is a chance-corrected measure of agreement between the classifications and the true classes. It's calculated by taking the agreement expected by chance away from the observed agreement and dividing by the maximum possible agreement. A value greater than 0 means that your classifier is doing better than chance (it really should be!).

The error rates are used for numeric prediction rather than classification. In numeric prediction, predictions aren't just right or wrong, the error has a magnitude, and these measures reflect that.

Hopefully that will get you started.

edited Nov 5 '17 at 22:45
Vishrant
3,3562348
answered Aug 16 '10 at 0:33
michaeltwofish
3,27832131

- 1
  Kappa is not really a chance-corrected measure of agreement. See this and this – Lior Kogan May 10 '16 at 17:45

add a comment |
up vote 26 down vote

To elaborate on michaeltwofish's answer, some notes on the remaining values:

- TP Rate: rate of true positives (instances correctly classified as a given class)

- FP Rate: rate of false positives (instances falsely classified as a given class)

- Precision: proportion of instances that are truly of a class divided by the total instances classified as that class

- Recall: proportion of instances classified as a given class divided by the actual total in that class (equivalent to TP rate)

- F-Measure: A combined measure for precision and recall calculated as 2 * Precision * Recall / (Precision + Recall)

As for the ROC area measurement, I agree with michaeltwofish that this is one of the most important values output by Weka. An "optimal" classifier will have ROC area values approaching 1, with 0.5 being comparable to "random guessing" (similar to a Kappa statistic of 0).

It should be noted that the "balance" of the data set needs to be taken into account when interpreting results. Unbalanced data sets in which a disproportionately large amount of instances belong to a certain class may lead to high accuracy rates even though the classifier may not necessarily be particularly good.

Further reading:

- https://www.cs.auckland.ac.nz/courses/compsci367s1c/tutorials/IntroductionToWeka.pdf
- http://en.wikipedia.org/wiki/Receiver_operating_characteristic#Basic_concept
- http://en.wikipedia.org/wiki/Information_retrieval#Performance_and_correctness_measures

edited Mar 19 '14 at 16:30
it-freelancer-magazin.de
11112
answered Feb 4 '14 at 11:31
Hybrid System
5981023

- The Further Reading Links were absolutely useful! – yara Mar 16 '16 at 4:13

add a comment |
up vote 1 down vote

### What is Naive Bayes?

This explanation might help clarify what Naive Bayes means; it assumes independence of variables. To make this concrete, say we want to predict whether someone has walked through Prospect Park in Brooklyn. We have data on whether they

a) live in New York City

b) live in a city

Naive Bayes would assume those two variables are independent. But clearly, if they live in NYC, they also live in a city. This is a stupid example because (hopefully) no one would ever use data science with these variables, but it shows what independence means. If a, then b. Also, if not b, then not a.

There is dependence, so Naive Bayes' naive assumption does not hold.

### Weka Tutorial

This page may be of use to newbies. It's helping me a lot; it walks through

I am not affiliated with Jason Brownlee. He seems kind of sales-y, but the benefit of that is he keeps it simple since he's targeting beginners

edited Jan 28 at 18:38
answered Jan 28 at 18:08
frank
878

add a comment |
up vote 0 down vote

It is giving each value of "50050000" for some algorithms while for other classifiers these values are around 49.7, 87.4, 98.2, and so on.

answered Jun 15 '15 at 7:07
user5001496
1

- 1
  Could you please elaborate more your answer adding a little more description about the solution you provide? – abarisone Jun 15 '15 at 7:26

add a comment |

## protected by Community♦ Jul 19 '15 at 12:24

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?

## Not the answer you're looking for? Browse other questions tagged classification weka or ask your own question.

question feed