[ 
https://issues.apache.org/jira/browse/SPARK-2222?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14040034#comment-14040034
 ] 

Jun Xie commented on SPARK-2222:
--------------------------------

Nice work.

I am reading the implementation of MulticlassMetrics. According to your code, 
for Micro average, you calculate the recall and then let precision and f1 
measure equal to the recall. I am not sure whether this makes sense. 

According to this post: 
http://rushdishams.blogspot.com/2011/08/micro-and-macro-average-of-precision.html

Assume we just have three classes. For each class, we have three numbers, true 
positive(tp), false positive(fp), false negative(fn). Hence, we have tp1, fp1 
and fn1 for class 1. so on so forth.

For Micro-Average Precision: (tp1 + tp2 + tp3) / (tp1 + tp2 + tp3 + fp1 + fp2 + 
fp3)
For Micro-Average Recall: (tp1 + tp2 + tp3) / (tp1 + tp2 + tp3 + fn1 + fn2 + 
fn3)
For Micro-Average F1Measure: it is just the harmonic mean of precision and 
recall.

Based on the above definition, recall and precision should not be the same. Is 
it correct?

> Add multiclass evaluation metrics
> ---------------------------------
>
>                 Key: SPARK-2222
>                 URL: https://issues.apache.org/jira/browse/SPARK-2222
>             Project: Spark
>          Issue Type: New Feature
>          Components: MLlib
>    Affects Versions: 1.0.0
>            Reporter: Alexander Ulanov
>
> There is no class in Spark MLlib for measuring the performance of multiclass 
> classifiers. This task involves adding such class and unit tests. The 
> following measures are to be implemented: per class, micro averaged and 
> weighted averaged Precision, Recall and F1-Measure.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to