You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by yanboliang <gi...@git.apache.org> on 2016/03/30 18:19:29 UTC

[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

GitHub user yanboliang opened a pull request:

    https://github.com/apache/spark/pull/12066

    [SPARK-7424] [ML] ML ClassificationModel should add metadata to output column

    ## What changes were proposed in this pull request?
    ML ```ClassificationModel``` should add metadata to output column from label column if present, or create a nominal attribute to output the number of labels.
    
    ## How was this patch tested?
    Will add test case soon.
    
    cc @jkbradley @mengxr 
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/yanboliang/spark spark-7424

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/12066.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #12066
    
----
commit 7a1139bb03c19f9d5ad572466a72af7a6cb5ecc2
Author: Yanbo Liang <yb...@gmail.com>
Date:   2016-03-30T16:11:36Z

    ML ClassificationModel should add metadata to output column

----


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r61474754
  
    --- Diff: mllib/src/test/scala/org/apache/spark/ml/classification/NaiveBayesSuite.scala ---
    @@ -193,6 +195,30 @@ class NaiveBayesSuite extends SparkFunSuite with MLlibTestSparkContext with Defa
             assert(expected.theta === actual.theta)
           }
       }
    +
    +  test("copy label column metadata to prediction column") {
    +    val data = sc.parallelize(Seq((Vectors.dense(0.0), "a"), (Vectors.dense(1.0), "b"),
    +      (Vectors.dense(2.0), "c"), (Vectors.dense(3.0), "a"), (Vectors.dense(4.0), "a")), 2)
    +    var df = sqlContext.createDataFrame(data).toDF("features", "label")
    +
    +    val indexer = new StringIndexer()
    +      .setInputCol("label")
    +      .setOutputCol("labelIndex")
    +      .fit(df)
    +    df = indexer.transform(df)
    +
    +    val naiveBayes = new NaiveBayes().setLabelCol("labelIndex")
    +    val naiveBayesModel = naiveBayes.fit(df)
    +    df = naiveBayesModel.transform(df)
    +
    +    val schema = df.schema
    +    val labelAttr = Attribute.fromStructField(schema(naiveBayesModel.getLabelCol))
    +      .asInstanceOf[NominalAttribute]
    +    val predictionAttr = Attribute.fromStructField(schema(naiveBayesModel.getPredictionCol))
    +      .asInstanceOf[NominalAttribute]
    +    assert(labelAttr.attrType === predictionAttr.attrType)
    --- End diff --
    
    Check that the "name" field matches predictionCol too


---
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


[GitHub] spark issue #12066: [SPARK-7424] [ML] ML ClassificationModel should add meta...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/12066
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution-unified/4678/
    Test PASSed.


---

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


[GitHub] spark issue #12066: [SPARK-7424] [ML] ML ClassificationModel should add meta...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/12066
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution-unified/3692/
    Test PASSed.


---

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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-216540476
  
    @jkbradley Addressed your comments about passing ```numClasses``` to ```generatePredictionMetadata```. This PR is ready for reviewing now. Thanks!


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-214136838
  
    @jkbradley Thanks for your comments, please see my inline reply to your concerns. Because there are no attributes were stored in label column metadata of ```PredictionModel``` currently, I only made changes for ```ClassificationModel``` in this PR. Any thoughts, please let me know.
    I have add one test case for ```NaiveBayesModel```. If needed, I can add test for other classification model.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215379968
  
    **[Test build #57244 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/57244/consoleFull)** for PR 12066 at commit [`d5c5689`](https://github.com/apache/spark/commit/d5c5689787a29e37b01c531c5fc0c45666acfe20).


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
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 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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r61474700
  
    --- Diff: mllib/src/test/scala/org/apache/spark/ml/classification/NaiveBayesSuite.scala ---
    @@ -193,6 +195,30 @@ class NaiveBayesSuite extends SparkFunSuite with MLlibTestSparkContext with Defa
             assert(expected.theta === actual.theta)
           }
       }
    +
    +  test("copy label column metadata to prediction column") {
    +    val data = sc.parallelize(Seq((Vectors.dense(0.0), "a"), (Vectors.dense(1.0), "b"),
    +      (Vectors.dense(2.0), "c"), (Vectors.dense(3.0), "a"), (Vectors.dense(4.0), "a")), 2)
    +    var df = sqlContext.createDataFrame(data).toDF("features", "label")
    --- End diff --
    
    Use 2 vals instead of a var


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215513423
  
    Thanks!  Done with pass


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r61142716
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/classification/Classifier.scala ---
    @@ -115,7 +116,16 @@ abstract class ClassificationModel[FeaturesType, M <: ClassificationModel[Featur
             }
             predictUDF(col(getFeaturesCol))
           }
    -      outputData = outputData.withColumn(getPredictionCol, predUDF)
    +      // 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 {
    --- End diff --
    
    1.  This is why we try to keep the constructors private for as long as possible.  : )  But we could get around it by creating a ```private[ml]``` setter method which can set the labelAttribute after the model is created.
    2. You're right; I think that's a bug technically.  Here's a JIRA: https://issues.apache.org/jira/browse/SPARK-14926


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-216536793
  
    **[Test build #57639 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/57639/consoleFull)** for PR 12066 at commit [`449f824`](https://github.com/apache/spark/commit/449f824fa633ea5b742af8cc8a078cd1561178f5).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215389914
  
    **[Test build #57244 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/57244/consoleFull)** for PR 12066 at commit [`d5c5689`](https://github.com/apache/spark/commit/d5c5689787a29e37b01c531c5fc0c45666acfe20).
     * This patch **fails SparkR unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-214127359
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/56874/
    Test PASSed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-203512201
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/54530/
    Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215448778
  
    Merged build finished. Test PASSed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-213470102
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/56703/
    Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-213503363
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/56702/
    Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-203534419
  
    Merged build finished. Test PASSed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r61474448
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/classification/Classifier.scala ---
    @@ -116,22 +165,7 @@ abstract class ClassificationModel[FeaturesType, M <: ClassificationModel[Featur
             }
             predictUDF(col(getFeaturesCol))
           }
    -      // 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(getPredictionCol, predUDF, predictionMetadata)
    --- End diff --
    
    Set ```predictionMetadata.withName(getPredictionCol)``` here in case user updated predictionCol 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 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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-220585349
  
    **[Test build #58982 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/58982/consoleFull)** for PR 12066 at commit [`449f824`](https://github.com/apache/spark/commit/449f824fa633ea5b742af8cc8a078cd1561178f5).


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-216536924
  
    Merged build finished. Test PASSed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r61619308
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/classification/Classifier.scala ---
    @@ -62,6 +92,14 @@ abstract class Classifier[
       /** @group setParam */
       def setRawPredictionCol(value: String): E = set(rawPredictionCol, value).asInstanceOf[E]
     
    +  override def fit(dataset: Dataset[_]): M = {
    +    // This handles a few items such as schema validation.
    +    // Developers only need to implement train().
    +    transformSchema(dataset.schema, logging = true)
    +    copyValues(train(dataset).setParent(this))
    +      .setPredictionMetadata(generatePredictionMetadata(dataset.schema))
    --- End diff --
    
    The scenario I'd like to address is the following:
    * Training data has no metadata for label column
    * Classifier.transformSchema should make a best-effort at adding metadata.  In this case, it will note the predictionCol is a Nominal value and set its name.
    * During training, the algorithm identifies the number of classes from the data.
    * The ClassificationModel knows the number of classes, so it should set that in the transform and transformSchema calls.
    This happens with NaiveBayes, for example.
    
    Are you referring to the fact that ClassificationModel.transformSchema calls ClassifierParams.validateAndTransformSchema, and the validateAndTransformSchema method does not take numClasses as an argument?  We can modify validateAndTransformSchema to take an optional numClasses argument.
    
    validateAndTransformSchema is technically a public API (unfortunately), so we could:
    * deprecate the current validateAndTransformSchema
    * make a new copy which takes the numClasses argument.  This copy could be made ```private[classification]```.
    * switch all uses to the new copy
    
    I do think this work is in the scope of this PR; I don't see much benefit to adding metadata if we don't make a best-effort attempt, and I don't think it will be too much extra code.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-216525374
  
    **[Test build #57639 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/57639/consoleFull)** for PR 12066 at commit [`449f824`](https://github.com/apache/spark/commit/449f824fa633ea5b742af8cc8a078cd1561178f5).


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-216536927
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/57639/
    Test PASSed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r61474440
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/classification/Classifier.scala ---
    @@ -62,6 +92,14 @@ abstract class Classifier[
       /** @group setParam */
       def setRawPredictionCol(value: String): E = set(rawPredictionCol, value).asInstanceOf[E]
     
    +  override def fit(dataset: Dataset[_]): M = {
    +    // This handles a few items such as schema validation.
    +    // Developers only need to implement train().
    +    transformSchema(dataset.schema, logging = true)
    +    copyValues(train(dataset).setParent(this))
    +      .setPredictionMetadata(generatePredictionMetadata(dataset.schema))
    --- End diff --
    
    Here, you could pass in numClasses, which is now available from the model.  generatePredictionMetadata could take an optional numClasses argument.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-214847453
  
    Responded above.  It sounds like we're agreed now?


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r61474435
  
    --- 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
    +    // model transformation, so we should not handle label column metadata as well.
    +    if (schema.fieldNames.contains($(labelCol))) {
    +      // determine number of classes either from metadata if provided.
    +      val labelSchema = schema($(labelCol))
    +      MetadataUtils.getNumClasses(labelSchema) match {
    +        case Some(numClasses) =>
    +          // 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($(predictionCol)).withNumValues(numClasses)
    +            case attr: Attribute => attr
    +          }
    +          labelAttribute.toMetadata()
    +        case None =>
    +          Metadata.empty
    --- End diff --
    
    You could do ```NominalAttribute.defaultAttr.withName($(predictionCol))``` instead of Metadata.empty


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r63440571
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/classification/Classifier.scala ---
    @@ -179,7 +230,7 @@ abstract class ClassificationModel[FeaturesType, M <: ClassificationModel[Featur
             }
             predictUDF(col(getFeaturesCol))
           }
    -      outputData = outputData.withColumn(getPredictionCol, predUDF)
    +      outputData = outputData.withColumn(getPredictionCol, predUDF, predictionMetadata)
    --- End diff --
    
    The problem is that the name may be different.  transform can be given a new output column name, so we may need to update the 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 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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-203534421
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/54531/
    Test PASSed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215663983
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/57324/
    Test PASSed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-203512197
  
    Merged build finished. Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-213466446
  
    @jkbradley Thanks for your comments, please see my inline reply to your concerns.
    I have add test case. Because there are no attributes were stored in label column metadata of ```PredictionModel``` currently, I only made changes for ```ClassificationModel``` in this PR. Any thoughts, please let me know.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215379043
  
    **[Test build #57243 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/57243/consoleFull)** for PR 12066 at commit [`d4ffc6a`](https://github.com/apache/spark/commit/d4ffc6a9e400aabf4ab7b1c7b38476b591a65cee).


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r61617878
  
    --- 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 --
    
    Right, thanks


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-214119856
  
    **[Test build #56874 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/56874/consoleFull)** for PR 12066 at commit [`204f4f7`](https://github.com/apache/spark/commit/204f4f7aa1b3730ed8fe8bafb0f999f5a1ce585c).


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r61474427
  
    --- 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
    +    // model transformation, so we should not handle label column metadata as well.
    +    if (schema.fieldNames.contains($(labelCol))) {
    +      // determine number of classes either from metadata if provided.
    --- End diff --
    
    typo: "either"?


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-203511718
  
    **[Test build #54530 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/54530/consoleFull)** for PR 12066 at commit [`7a1139b`](https://github.com/apache/spark/commit/7a1139bb03c19f9d5ad572466a72af7a6cb5ecc2).


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r61579562
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/classification/Classifier.scala ---
    @@ -62,6 +92,14 @@ abstract class Classifier[
       /** @group setParam */
       def setRawPredictionCol(value: String): E = set(rawPredictionCol, value).asInstanceOf[E]
     
    +  override def fit(dataset: Dataset[_]): M = {
    +    // This handles a few items such as schema validation.
    +    // Developers only need to implement train().
    +    transformSchema(dataset.schema, logging = true)
    +    copyValues(train(dataset).setParent(this))
    +      .setPredictionMetadata(generatePredictionMetadata(dataset.schema))
    --- End diff --
    
    It looks like weird to set ```predictionMetadata``` which is a member variable of the model object with another member variable of this object. Think more, ```generatePredictionMetadata``` usually was called by ```validateAndTransformSchema```, looking at the API:
    ```
    override protected def validateAndTransformSchema(
          schema: StructType,
          fitting: Boolean,
          featuresDataType: DataType): StructType = {
       ......
      }
    ```
    It transform the old schema to the new one. It's also strange that we pass in an argument ```numClasses```, or whether we have possibility to add more metadata and also pass in as arguments in future? I think this should be further defined and it has exceed the scope of this PR. Let's do it in a separate one? I'm open to hear your thoughts.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215089870
  
    Yes, we have reached a consensus. Thanks.
    I will update this PR soon.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r61620009
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/classification/Classifier.scala ---
    @@ -179,7 +230,7 @@ abstract class ClassificationModel[FeaturesType, M <: ClassificationModel[Featur
             }
             predictUDF(col(getFeaturesCol))
           }
    -      outputData = outputData.withColumn(getPredictionCol, predUDF)
    +      outputData = outputData.withColumn(getPredictionCol, predUDF, predictionMetadata)
    --- End diff --
    
    Set ```predictionMetadata.withName(getPredictionCol)```


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215389944
  
    Merged build finished. Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-213470096
  
    Merged build finished. Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215448783
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/57251/
    Test PASSed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215663901
  
    **[Test build #57324 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/57324/consoleFull)** for PR 12066 at commit [`94f16e8`](https://github.com/apache/spark/commit/94f16e8f16542026d700d61abd13e428ac27c8d0).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-213453945
  
    **[Test build #56702 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/56702/consoleFull)** for PR 12066 at commit [`5301a96`](https://github.com/apache/spark/commit/5301a96b053614278accfc69103fa88b106cb85b).


---
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


[GitHub] spark issue #12066: [SPARK-7424] [ML] ML ClassificationModel should add meta...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/12066
  
    Build finished. Test PASSed.


---

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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-203512189
  
    **[Test build #54530 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/54530/consoleFull)** for PR 12066 at commit [`7a1139b`](https://github.com/apache/spark/commit/7a1139bb03c19f9d5ad572466a72af7a6cb5ecc2).
     * This patch **fails Scala style tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-213503359
  
    Build finished. Test FAILed.


---
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


[GitHub] spark issue #12066: [SPARK-7424] [ML] ML ClassificationModel should add meta...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on the issue:

    https://github.com/apache/spark/pull/12066
  
    @holdenk Sorry for late response, I'm really busy recently. Sure, I'll close this now. Feel free to take over it. Thanks.


---

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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-220611530
  
    Build finished. Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215448622
  
    **[Test build #57251 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/57251/consoleFull)** for PR 12066 at commit [`486d5ab`](https://github.com/apache/spark/commit/486d5aba1790739c43ef1af6cceb24661b5d918e).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-214775500
  
    Thanks for your comments, please see my inline replies.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215388708
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/57243/
    Test FAILed.


---
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


[GitHub] spark issue #12066: [SPARK-7424] [ML] ML ClassificationModel should add meta...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/12066
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution-unified/1349/
    Test PASSed.


---

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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r60752890
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/classification/Classifier.scala ---
    @@ -115,7 +116,16 @@ abstract class ClassificationModel[FeaturesType, M <: ClassificationModel[Featur
             }
             predictUDF(col(getFeaturesCol))
           }
    -      outputData = outputData.withColumn(getPredictionCol, predUDF)
    +      // 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 {
    --- End diff --
    
    Reply to your concerns:
    1, The ```labelAttribute``` only be prepared when model transform. We can add supporting for model fitting, but I'm not sure someone required this function.
    2, I think the attribute name should ```label```. Its values are the labels set such as ```Yes, No```, although it's one of the attributes in prediction column metadata.
    3, we can not do it in ```PredictorParams.validateAndTransformSchema```, because we did not use the return value of ```validateAndTransformSchema``` as the output DataFrame schema (You can refer the code [here](https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/classification/Classifier.scala#L96)). The output DataFrame and its schema are generated at ```ClassificationModel.transform``` and ```PredictionModel.transform``` by "withColumn" directly.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215388707
  
    Merged build finished. Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by yanboliang <gi...@git.apache.org>.
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215681898
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/57323/
    Test PASSed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-214127204
  
    **[Test build #56874 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/56874/consoleFull)** for PR 12066 at commit [`204f4f7`](https://github.com/apache/spark/commit/204f4f7aa1b3730ed8fe8bafb0f999f5a1ce585c).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-220611311
  
    **[Test build #58982 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/58982/consoleFull)** for PR 12066 at commit [`449f824`](https://github.com/apache/spark/commit/449f824fa633ea5b742af8cc8a078cd1561178f5).
     * This patch **fails Spark unit tests**.
     * This patch **does not merge cleanly**.
     * This patch adds no public classes.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-203514703
  
    **[Test build #54531 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/54531/consoleFull)** for PR 12066 at commit [`f793b08`](https://github.com/apache/spark/commit/f793b0887e9bebdca431d77d2dea34e32356aa3c).


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r61474419
  
    --- 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 --
    
    OneVsRest does not apply here since it does not inherit from Classifier (yet).


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r61474596
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/classification/Classifier.scala ---
    @@ -36,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
    +    // model transformation, so we should not handle label column metadata as well.
    +    if (schema.fieldNames.contains($(labelCol))) {
    +      // determine number of classes either from metadata if provided.
    +      val labelSchema = schema($(labelCol))
    +      MetadataUtils.getNumClasses(labelSchema) match {
    +        case Some(numClasses) =>
    +          // 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($(predictionCol)).withNumValues(numClasses)
    +            case attr: Attribute => attr
    --- End diff --
    
    set ```attr.withName(getPredictionCol)```


---
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


[GitHub] spark issue #12066: [SPARK-7424] [ML] ML ClassificationModel should add meta...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/12066
  
    Build finished. Test PASSed.


---

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


[GitHub] spark issue #12066: [SPARK-7424] [ML] ML ClassificationModel should add meta...

Posted by holdenk <gi...@git.apache.org>.
Github user holdenk commented on the issue:

    https://github.com/apache/spark/pull/12066
  
    Hey @yanboliang I think improved metadata on the pipeline would be great, but if this abonded I get it if so do you want to close this PR and switch the JIRA back to open so someone else can take a crack at it? If you're still working on it that's cool too.


---

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


[GitHub] spark issue #12066: [SPARK-7424] [ML] ML ClassificationModel should add meta...

Posted by holdenk <gi...@git.apache.org>.
Github user holdenk commented on the issue:

    https://github.com/apache/spark/pull/12066
  
    I still this is important, but if you're not working on it @yanboliang would you be OK closing it so someone else can take this over?


---

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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215450008
  
    @jkbradley This is ready for another pass. Thanks!


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215722396
  
    @jkbradley Addressed most comments except two. Please see my inline replies and let me know whether it make sense. Thanks.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215656662
  
    **[Test build #57323 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/57323/consoleFull)** for PR 12066 at commit [`bb3578b`](https://github.com/apache/spark/commit/bb3578bfe8f63ccfe649956008175e94227f97c5).


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215663982
  
    Merged build finished. Test PASSed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215389945
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/57244/
    Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-213209640
  
    One more thing: Can you please add a unit test?  Btw, I know you're working on a lot of issues, so please say if you'd like help with any.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r61664866
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/classification/Classifier.scala ---
    @@ -62,6 +92,14 @@ abstract class Classifier[
       /** @group setParam */
       def setRawPredictionCol(value: String): E = set(rawPredictionCol, value).asInstanceOf[E]
     
    +  override def fit(dataset: Dataset[_]): M = {
    +    // This handles a few items such as schema validation.
    +    // Developers only need to implement train().
    +    transformSchema(dataset.schema, logging = true)
    +    copyValues(train(dataset).setParent(this))
    +      .setPredictionMetadata(generatePredictionMetadata(dataset.schema))
    --- End diff --
    
    Make sense, I will update this PR soon.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r61620014
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/classification/ProbabilisticClassifier.scala ---
    @@ -137,7 +138,7 @@ abstract class ProbabilisticClassificationModel[
             }
             predictUDF(col($(featuresCol)))
           }
    -      outputData = outputData.withColumn($(predictionCol), predUDF)
    +      outputData = outputData.withColumn($(predictionCol), predUDF, predictionMetadata)
    --- End diff --
    
    Set ```predictionMetadata.withName(getPredictionCol)```


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-203534255
  
    **[Test build #54531 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/54531/consoleFull)** for PR 12066 at commit [`f793b08`](https://github.com/apache/spark/commit/f793b0887e9bebdca431d77d2dea34e32356aa3c).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-213502763
  
    **[Test build #56702 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/56702/consoleFull)** for PR 12066 at commit [`5301a96`](https://github.com/apache/spark/commit/5301a96b053614278accfc69103fa88b106cb85b).
     * This patch **fails Spark unit tests**.
     * This patch **does not merge cleanly**.
     * This patch adds no public classes.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215657544
  
    **[Test build #57324 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/57324/consoleFull)** for PR 12066 at commit [`94f16e8`](https://github.com/apache/spark/commit/94f16e8f16542026d700d61abd13e428ac27c8d0).


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215936327
  
    @jkbradley Thanks for your comments. I will update this PR soon.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r60953764
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/classification/Classifier.scala ---
    @@ -115,7 +116,16 @@ abstract class ClassificationModel[FeaturesType, M <: ClassificationModel[Featur
             }
             predictUDF(col(getFeaturesCol))
           }
    -      outputData = outputData.withColumn(getPredictionCol, predUDF)
    +      // 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 {
    --- End diff --
    
    1. Thinking more about this, we should definitely prepare the labelAttribute during model fitting/construction.  During fitting, we know the schema of the output column (since it matches the label column, except for the name).  We should not use the labelCol schema during transformation since that could be a completely different label (thought that's unlikely).
    
    2. The attribute name is supposed to match the column name.  The reason we need this duplicated info is for AttributeGroups, which store attributes for each element in a Vector column.
    
    3. By "compute it in validateAndTransformSchema," I mean that we should make the output schema during schema validation as precise as possible.  In this case, that means we should add metadata to the output column in transformSchema.  I suspect you can create a helper method in ClassifierParams which computes the metadata so that you can use the same code path for both schema validation and the actual transform() method.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-220611532
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/58982/
    Test FAILed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r61474407
  
    --- 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 = {
    --- End diff --
    
    ```private[classification]``` for now


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-213470053
  
    **[Test build #56703 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/56703/consoleFull)** for PR 12066 at commit [`5907c56`](https://github.com/apache/spark/commit/5907c56ed46a64cf57f4f165ceb3ddb1d1b66b27).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215681702
  
    **[Test build #57323 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/57323/consoleFull)** for PR 12066 at commit [`bb3578b`](https://github.com/apache/spark/commit/bb3578bfe8f63ccfe649956008175e94227f97c5).
     * This patch passes all tests.
     * This patch **does not merge cleanly**.
     * This patch adds no public classes.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r60485175
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/classification/Classifier.scala ---
    @@ -115,7 +116,16 @@ abstract class ClassificationModel[FeaturesType, M <: ClassificationModel[Featur
             }
             predictUDF(col(getFeaturesCol))
           }
    -      outputData = outputData.withColumn(getPredictionCol, predUDF)
    +      // 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 {
    --- End diff --
    
    Can this labelAttribute be prepared upon model fitting/construction?  Everything except the name of the output column should be available then.  Btw, the attribute name should be from getPredictionCol, not "label"
    
    Also, can this be computed in validateAndTransformSchema so that transformSchema computes it?


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r61102661
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/classification/Classifier.scala ---
    @@ -115,7 +116,16 @@ abstract class ClassificationModel[FeaturesType, M <: ClassificationModel[Featur
             }
             predictUDF(col(getFeaturesCol))
           }
    -      outputData = outputData.withColumn(getPredictionCol, predUDF)
    +      // 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 {
    --- End diff --
    
    Reply:
    1, I agree that it's better to extract labelAttribute during model fitting, but it need to be transferred to model as an argument of model construction which may take API breaking change. Is this reasonable? Actually [```OneVsRestModel```](https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/classification/OneVsRest.scala#L136) has already done similar work.
    2, I referred that [```OneVsRest```](https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/classification/OneVsRest.scala#L347) and found the attribute was named as ```label```. May be we should rename it as well.
    3, Agree.


---
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


[GitHub] spark issue #12066: [SPARK-7424] [ML] ML ClassificationModel should add meta...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/12066
  
    Build finished. Test PASSed.


---

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


[GitHub] spark issue #12066: [SPARK-7424] [ML] ML ClassificationModel should add meta...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/12066
  
    Build finished. Test PASSed.


---

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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r61474460
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/util/SchemaUtils.scala ---
    @@ -94,6 +94,28 @@ private[spark] object SchemaUtils {
       /**
        * Appends a new column to the input schema. This fails if the given output column already exists.
        * @param schema input schema
    +   * @param colName new column name. If this column name is an empty string "", this method returns
    +   *                the input schema unchanged. This allows users to disable output columns.
    +   * @param dataType new column data type
    +   * @param nullable Indicates if values of this field can be `null` values.
    +   * @param metadata The metadata of this field. The metadata should be preserved during
    +   *                 transformation if the content of the column is not modified.
    +   * @return new schema with the input column appended
    +   */
    +  def appendColumn(
    --- End diff --
    
    How about adding a default arg to the previous appendColumn method?  It's private, so it does not need to be Java-compatible.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-213459391
  
    **[Test build #56703 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/56703/consoleFull)** for PR 12066 at commit [`5907c56`](https://github.com/apache/spark/commit/5907c56ed46a64cf57f4f165ceb3ddb1d1b66b27).


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215388671
  
    **[Test build #57243 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/57243/consoleFull)** for PR 12066 at commit [`d4ffc6a`](https://github.com/apache/spark/commit/d4ffc6a9e400aabf4ab7b1c7b38476b591a65cee).
     * This patch **fails SparkR unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-214127358
  
    Merged build finished. Test PASSed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r61878826
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/classification/Classifier.scala ---
    @@ -179,7 +230,7 @@ abstract class ClassificationModel[FeaturesType, M <: ClassificationModel[Featur
             }
             predictUDF(col(getFeaturesCol))
           }
    -      outputData = outputData.withColumn(getPredictionCol, predUDF)
    +      outputData = outputData.withColumn(getPredictionCol, predUDF, predictionMetadata)
    --- End diff --
    
    The type of ```predictionMetadata``` is ```Metadata``` rather than ```Attribute```, so we can not use ```withName``` method. Actually ```predictionMetadata``` has been set name with ```getPredictionCol``` in ```generatePredictionMetadata```.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12066#discussion_r61879067
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/classification/ProbabilisticClassifier.scala ---
    @@ -137,7 +138,7 @@ abstract class ProbabilisticClassificationModel[
             }
             predictUDF(col($(featuresCol)))
           }
    -      outputData = outputData.withColumn($(predictionCol), predUDF)
    +      outputData = outputData.withColumn($(predictionCol), predUDF, predictionMetadata)
    --- End diff --
    
    Ditto.


---
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


[GitHub] spark issue #12066: [SPARK-7424] [ML] ML ClassificationModel should add meta...

Posted by WeichenXu123 <gi...@git.apache.org>.
Github user WeichenXu123 commented on the issue:

    https://github.com/apache/spark/pull/12066
  
    @yanboliang Are you still working on this ?


---

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


[GitHub] spark pull request #12066: [SPARK-7424] [ML] ML ClassificationModel should a...

Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang closed the pull request at:

    https://github.com/apache/spark/pull/12066


---

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


[GitHub] spark issue #12066: [SPARK-7424] [ML] ML ClassificationModel should add meta...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/12066
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution-unified/2322/
    Test PASSed.


---

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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215830986
  
    Thanks!  I replied above & just noted 2 items which remain.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215434643
  
    **[Test build #57251 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/57251/consoleFull)** for PR 12066 at commit [`486d5ab`](https://github.com/apache/spark/commit/486d5aba1790739c43ef1af6cceb24661b5d918e).


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-215681896
  
    Build finished. Test PASSed.


---
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


[GitHub] spark pull request: [SPARK-7424] [ML] ML ClassificationModel shoul...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on the pull request:

    https://github.com/apache/spark/pull/12066#issuecomment-214451920
  
    Thanks, I just responded above.  I agree only classification, not regression, needs to be handled in this PR.


---
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