Skip to content

Instantly share code, notes, and snippets.

@ajayborra
Created November 5, 2018 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajayborra/109ed33528560cff8d01a5b36d0b13f9 to your computer and use it in GitHub Desktop.
Save ajayborra/109ed33528560cff8d01a5b36d0b13f9 to your computer and use it in GitHub Desktop.
Feature Scaling
//Using Standard scaler to scale the feature set
val standardScaler = new StandardScaler()
.setInputCol("features")
.setOutputCol("scaledFeatures")
.setWithStd(true)
.setWithMean(true)
val scaler = standardScaler.fit(featuresDf)
val scaledFeatures = scaler.transform(featuresDf)
//print the output
scaledFeatures.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment