Github user jkbradley commented on a diff in the pull request: https://github.com/apache/spark/pull/12066#discussion_r61474455 --- Diff: mllib/src/main/scala/org/apache/spark/ml/classification/ProbabilisticClassifier.scala --- @@ -138,22 +138,7 @@ abstract class ProbabilisticClassificationModel[ } predictUDF(col($(featuresCol))) } - // The label column for base binary classifier of OneVsRest will not be retained during - // model transformation, so we should not handle label column metadata as well. - if (dataset.schema.fieldNames.contains($(labelCol))) { - // determine number of classes either from metadata if provided. - val labelSchema = dataset.schema($(labelCol)) - // extract label metadata from label column if present, or create a nominal attribute - // to output the number of labels - val labelAttribute = Attribute.fromStructField(labelSchema) match { - case _: NumericAttribute | UnresolvedAttribute => - NominalAttribute.defaultAttr.withName("label").withNumValues(numClasses) - case attr: Attribute => attr - } - outputData = outputData.withColumn(getPredictionCol, predUDF, labelAttribute.toMetadata) - } else { - outputData = outputData.withColumn(getPredictionCol, predUDF) - } + outputData = outputData.withColumn($(predictionCol), predUDF, predictionMetadata) --- End diff -- Same here; set name
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org