[GitHub] [spark] zhengruifeng commented on a change in pull request #24793: [SPARK-27944][ML] Unify the behavior of checking empty output column names

2019-07-15 Thread GitBox
zhengruifeng commented on a change in pull request #24793: [SPARK-27944][ML] 
Unify the behavior of checking empty output column names
URL: https://github.com/apache/spark/pull/24793#discussion_r303695757
 
 

 ##
 File path: 
mllib/src/main/scala/org/apache/spark/ml/clustering/GaussianMixture.scala
 ##
 @@ -33,7 +33,7 @@ import org.apache.spark.ml.util.Instrumentation.instrumented
 import org.apache.spark.mllib.linalg.{Matrices => OldMatrices, Matrix => 
OldMatrix,
   Vector => OldVector, Vectors => OldVectors}
 import org.apache.spark.rdd.RDD
-import org.apache.spark.sql.{DataFrame, Dataset, Row, SparkSession}
+import org.apache.spark.sql._
 
 Review comment:
   ok, I will revert these place.


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:
us...@infra.apache.org


With regards,
Apache Git Services

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



[GitHub] [spark] zhengruifeng commented on a change in pull request #24793: [SPARK-27944][ML] Unify the behavior of checking empty output column names

2019-07-11 Thread GitBox
zhengruifeng commented on a change in pull request #24793: [SPARK-27944][ML] 
Unify the behavior of checking empty output column names
URL: https://github.com/apache/spark/pull/24793#discussion_r302814838
 
 

 ##
 File path: 
mllib/src/main/scala/org/apache/spark/ml/clustering/BisectingKMeans.scala
 ##
 @@ -107,9 +107,15 @@ class BisectingKMeansModel private[ml] (
   @Since("2.0.0")
   override def transform(dataset: Dataset[_]): DataFrame = {
 transformSchema(dataset.schema, logging = true)
-val predictUDF = udf((vector: Vector) => predict(vector))
-dataset.withColumn($(predictionCol),
-  predictUDF(DatasetUtils.columnToVector(dataset, getFeaturesCol)))
+if ($(predictionCol).nonEmpty) {
 
 Review comment:
   I changed here to keep in line with other algs like  
[LDA.transform](https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/clustering/LDA.scala#L461)
   Or leave alone algs with only one output column, and remove the check in 
algs like LDA?


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:
us...@infra.apache.org


With regards,
Apache Git Services

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