Skip to content

Instantly share code, notes, and snippets.

@kaysush
Created May 16, 2018 15:21
Show Gist options
  • Save kaysush/fed0a1eb20e9e7d857633912b13928b0 to your computer and use it in GitHub Desktop.
Save kaysush/fed0a1eb20e9e7d857633912b13928b0 to your computer and use it in GitHub Desktop.
One-Hot-Encoding Categorical Variables
val genderIndexer = new StringIndexer().setInputCol("Gender").setOutputCol("GenderIndex")
val genderOneHotEncoder = new OneHotEncoder().setInputCol("GenderIndex").setOutputCol("GenderOHE")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment