You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Luvsandondov Lkhamsuren (JIRA)" <ji...@apache.org> on 2015/09/06 00:22:45 UTC
[jira] [Commented] (SPARK-9716) BinaryClassificationEvaluator
should accept Double prediction column
[ https://issues.apache.org/jira/browse/SPARK-9716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14732119#comment-14732119 ]
Luvsandondov Lkhamsuren commented on SPARK-9716:
------------------------------------------------
I was thinking on having method that checks if the dataType equals one of the list of dataTypes inside SchemaUtils (similar to checkColumnType),
{code:title=SchemUtils.scala | borderStyle=solid}
def checkColumnType(schema: StructType, colName: String, dataTypes: Array[DataType], msg: String = "") = ???
{code}
then use the method to check if the rawPredictionColumn is either Vector or Double as follows:
{code:title=BinaryClassificationEvaluator.scala | borderStyle=solid}
override def evaluate(dataset: DataFrame): Double = {
val schema = dataset.schema
SchemaUtils.checkColumnType(schema, $(rawPredictionCol), Array(new VectorUDT, DoubleType))
SchemaUtils.checkColumnType(schema, $(labelCol), DoubleType)
val scoreAndLabels = dataset.select($(rawPredictionCol), $(labelCol))
.map ( row => row match {
case Row(rawPrediction: Vector, label: Double) =>
(rawPrediction(1), label)
case Row(rawPrediction: Double, label: Double) =>
(rawPrediction, label)
}
)
val metrics = new BinaryClassificationMetrics(scoreAndLabels)
val metric = $(metricName) match {
case "areaUnderROC" => metrics.areaUnderROC()
case "areaUnderPR" => metrics.areaUnderPR()
}
metrics.unpersist()
metric
}
{code}
How does it sound?
> BinaryClassificationEvaluator should accept Double prediction column
> --------------------------------------------------------------------
>
> Key: SPARK-9716
> URL: https://issues.apache.org/jira/browse/SPARK-9716
> Project: Spark
> Issue Type: Improvement
> Components: ML
> Reporter: Joseph K. Bradley
> Priority: Minor
>
> BinaryClassificationEvaluator currently expects the rawPrediction column, of type Vector. It should also accept a Double prediction column, with a different set of supported 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