zhengruifeng commented on a change in pull request #25383: [SPARK-13677][ML] 
Implement Tree-Based Feature Transformation for ML
URL: https://github.com/apache/spark/pull/25383#discussion_r315977440
 
 

 ##########
 File path: 
mllib/src/main/scala/org/apache/spark/ml/classification/DecisionTreeClassifier.scala
 ##########
 @@ -210,6 +214,22 @@ class DecisionTreeClassificationModel private[ml] (
     rootNode.predictImpl(features).prediction
   }
 
+  /** @group setParam */
+  @Since("3.0.0")
+  def setLeafCol(value: String): this.type = set(leafCol, value)
+
+  override def transform(dataset: Dataset[_]): DataFrame = {
+    transformSchema(dataset.schema, logging = true)
+
+    if ($(leafCol).nonEmpty) {
+      val leafUDF = udf { features: Vector => predictLeaf(features) }
 
 Review comment:
   It is very stranger that IDEA will warn if I write `udf { predictLeaf }` or 
`udf(predictLeaf)`:
   
   
![图片](https://user-images.githubusercontent.com/7322292/63398142-341e7980-c3ff-11e9-8fe3-22b645504aa9.png)
   
   So I leave it alone for now 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to