spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joseph K. Bradley (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SPARK-13435) Add Weighted Cohen's kappa to MulticlassMetrics
Date Wed, 04 Jan 2017 02:48:58 GMT

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

Joseph K. Bradley commented on SPARK-13435:
-------------------------------------------

Thanks!  We just have not been able to get to this.  But please keep the branch in case we
are able to add it to the DataFrame-based API in the future (but not right now, unless people
have a pressing need for it).

> Add Weighted Cohen's kappa to MulticlassMetrics
> -----------------------------------------------
>
>                 Key: SPARK-13435
>                 URL: https://issues.apache.org/jira/browse/SPARK-13435
>             Project: Spark
>          Issue Type: Improvement
>          Components: MLlib
>            Reporter: zhengruifeng
>            Priority: Minor
>
> Add the missing Weighted Cohen's kappa to MulticlassMetrics.
> Kappa is widely used in Competition and Statistics.
> https://en.wikipedia.org/wiki/Cohen's_kappa
> Some usage examples:
> val metrics = new MulticlassMetrics(predictionAndLabels)
> // The default kappa value (Unweighted kappa)
> val kappa = metrics.kappa
> // Three built-in weighting type ("default":unweighted, "linear":linear weighted, "quadratic":quadratic
weighted)
> val kappa = metrics.kappa("quadratic")
> // User-defined weighting matrix
> val matrix = Matrices.dense(n, n, values)
> val kappa = metrics.kappa(matrix)
> // User-defined weighting function
> def getWeight(i: Int, j:Int):Double = {
>           if (i == j) {
>             0.0
>           } else {
>             1.0
>           }
> }
> val kappa = metrics.kappa(getWeight) // equals to the unweighted kappa
> The calculation correctness was tested on several small data, and compared to two python's
package:  sklearn and ml_metrics.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org


Mime
View raw message