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 2020/09/25 03:00:56 UTC

[GitHub] [spark] zhengruifeng commented on pull request #29868: [SPARK-32973][ML][DOC] FeatureHasher does not check categoricalCols in inputCols

zhengruifeng commented on pull request #29868:
URL: https://github.com/apache/spark/pull/29868#issuecomment-698693191


   repl:
   
   ```
   import org.apache.spark.ml.feature._
   import org.apache.spark.ml.linalg.{Vector, Vectors}
   val df = Seq((2.0, 1, "foo"),(3.0, 2, "bar")).toDF("real", "int", "string")
   val n = 100
   val hasher = new FeatureHasher().setInputCols("int", "string").setCategoricalCols(Array("real")).setOutputCol("features").setNumFeatures(n)
   hasher.transform(df).show
   ```
   
   
   ![image](https://user-images.githubusercontent.com/7322292/94221773-5b0e7f80-ff1e-11ea-98d8-e7a2f030c93b.png)
   


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



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