You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/10/22 10:15:09 UTC

[GitHub] [spark] zhengruifeng commented on a change in pull request #25983: [SPARK-29327][MLLIB]Support specifying features via multiple columns

zhengruifeng commented on a change in pull request #25983: [SPARK-29327][MLLIB]Support specifying features via multiple columns
URL: https://github.com/apache/spark/pull/25983#discussion_r337431082
 
 

 ##########
 File path: mllib/src/main/scala/org/apache/spark/ml/Predictor.scala
 ##########
 @@ -127,6 +136,27 @@ abstract class Predictor[
   /** @group setParam */
   def setPredictionCol(value: String): Learner = set(predictionCol, value).asInstanceOf[Learner]
 
+  /**
+   * @group setParam
+   * An overloaded version to support multiple columns for features.
+   *
+   * Please note it will save the features columns names to a new parameter "featuresCols" as
+   * an Array[String].
+   */
+  def setFeaturesCol(value: Array[String]): Learner = {
+    require(isSupportMultiColumnsForFeatures,
+      s"Multiple columns for features is not supported by ${getClass.getSimpleName}")
+    set(featuresCols, value).asInstanceOf[Learner]
+  }
+
+  /**
+   * Children classes should override this to tell whether supporting multiple columns
+   * for features, meaning to fetch features columns names from parameter 'featuresCols'.
+   *
+   * @return Whether this predictor support multiple columns for features
+   */
+  protected def isSupportMultiColumnsForFeatures: Boolean = false
 
 Review comment:
   I do not see the impl that support fit/transform in Predictor/PredictionModel, it seems that in this PR all algs in ML do not impl this new fit/transform with more features cols?

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


With regards,
Apache Git Services

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