spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yanboliang <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...
Date Fri, 29 Apr 2016 13:53:25 GMT
Github user yanboliang commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r61580506
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/classification/Classifier.scala ---
    @@ -37,8 +37,38 @@ private[spark] trait ClassifierParams
           schema: StructType,
           fitting: Boolean,
           featuresDataType: DataType): StructType = {
    -    val parentSchema = super.validateAndTransformSchema(schema, fitting, featuresDataType)
    -    SchemaUtils.appendColumn(parentSchema, $(rawPredictionCol), new VectorUDT)
    +    // TODO: Support casting Array[Double] and Array[Float] to Vector when FeaturesType
= Vector
    +    SchemaUtils.checkColumnType(schema, $(featuresCol), featuresDataType)
    +    if (fitting) {
    +      SchemaUtils.checkNumericType(schema, $(labelCol))
    +    }
    +    val newSchema = SchemaUtils.appendColumn(schema, $(predictionCol), DoubleType,
    +      nullable = false, generatePredictionMetadata(schema))
    +    SchemaUtils.appendColumn(newSchema, $(rawPredictionCol), new VectorUDT)
    +  }
    +
    +  protected def generatePredictionMetadata(schema: StructType): Metadata = {
    +    // The label column for base binary classifier of OneVsRest will not be retained
during
    --- End diff --
    
    Yes. The annotation is to clarify if the current ```Classifier``` is act as the base binary
classifier of OneVsRest estimator(rather than the OneVsRest itself), its label column will
not be retained and we should check whether it exists.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message