Created
November 5, 2018 19:57
-
-
Save ajayborra/243c7e17679c12e7df946875a1a2f9f1 to your computer and use it in GitHub Desktop.
Creating Features and Lables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create features | |
val featureCols = Array("medianIncome", "housingMedianAge", "totalRooms", "totalBedrooms", | |
"population", "households", "latitude", "longitude") | |
val vectorAssembler = new VectorAssembler().setInputCols(featureCols).setOutputCol("features") | |
//create Label and Features | |
val featuresDf = vectorAssembler.transform(castedDF).select("medianHouseValue", "features") | |
//print label/feature | |
featuresDf.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment