Skip to content
Browse files

[SPARK-23127][DOC] Update FeatureHasher guide for categoricalCols par…


Update user guide entry for `FeatureHasher` to match the Scala / Python doc, to describe the `categoricalCols` parameter.

## How was this patch tested?

Doc only

Author: Nick Pentreath <>

Closes #20293 from MLnick/SPARK-23127-catCol-userguide.

(cherry picked from commit 60203fc)
Signed-off-by: Nick Pentreath <>
  • Loading branch information...
MLnick committed Jan 19, 2018
1 parent 54c1fae commit e58223171ecae6450482aadf4e7994c3b8d8a58d
Showing with 3 additions and 3 deletions.
  1. +3 −3 docs/
@@ -222,9 +222,9 @@ The `FeatureHasher` transformer operates on multiple columns. Each column may co
numeric or categorical features. Behavior and handling of column data types is as follows:

- Numeric columns: For numeric features, the hash value of the column name is used to map the
feature value to its index in the feature vector. Numeric features are never treated as
categorical, even when they are integers. You must explicitly convert numeric columns containing
categorical features to strings first.
feature value to its index in the feature vector. By default, numeric features are not treated
as categorical (even when they are integers). To treat them as categorical, specify the relevant
columns using the `categoricalCols` parameter.
- String columns: For categorical features, the hash value of the string "column_name=value"
is used to map to the vector index, with an indicator value of `1.0`. Thus, categorical features
are "one-hot" encoded (similarly to using [OneHotEncoder](ml-features.html#onehotencoder) with

0 comments on commit e582231

Please sign in to comment.
You can’t perform that action at this time.