diff options
author | Yuhao Yang <hhbyyh@gmail.com> | 2016-03-11 09:31:35 +0200 |
---|---|---|
committer | Nick Pentreath <nick.pentreath@gmail.com> | 2016-03-11 09:31:35 +0200 |
commit | 0b713e0455d01999d5a027ddc2ea8527eb085b34 (patch) | |
tree | f4a4f05620e8ee3787136ba72f158bbd7e761523 /docs | |
parent | 6ca990fb366cf68cd9d5afb433725d28f07e51a0 (diff) | |
download | spark-0b713e0455d01999d5a027ddc2ea8527eb085b34.tar.gz spark-0b713e0455d01999d5a027ddc2ea8527eb085b34.tar.bz2 spark-0b713e0455d01999d5a027ddc2ea8527eb085b34.zip |
[SPARK-13512][ML] add example and doc for MaxAbsScaler
## What changes were proposed in this pull request?
jira: https://issues.apache.org/jira/browse/SPARK-13512
Add example and doc for ml.feature.MaxAbsScaler.
## How was this patch tested?
unit tests
Author: Yuhao Yang <hhbyyh@gmail.com>
Closes #11392 from hhbyyh/maxabsdoc.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/ml-features.md | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/docs/ml-features.md b/docs/ml-features.md index 68d3ea2971..4fe8eefc26 100644 --- a/docs/ml-features.md +++ b/docs/ml-features.md @@ -773,6 +773,38 @@ for more details on the API. </div> </div> + +## MaxAbsScaler + +`MaxAbsScaler` transforms a dataset of `Vector` rows, rescaling each feature to range [-1, 1] +by dividing through the maximum absolute value in each feature. It does not shift/center the +data, and thus does not destroy any sparsity. + +`MaxAbsScaler` computes summary statistics on a data set and produces a `MaxAbsScalerModel`. The +model can then transform each feature individually to range [-1, 1]. + +The following example demonstrates how to load a dataset in libsvm format and then rescale each feature to [-1, 1]. + +<div class="codetabs"> +<div data-lang="scala" markdown="1"> + +Refer to the [MaxAbsScaler Scala docs](api/scala/index.html#org.apache.spark.ml.feature.MaxAbsScaler) +and the [MaxAbsScalerModel Scala docs](api/scala/index.html#org.apache.spark.ml.feature.MaxAbsScalerModel) +for more details on the API. + +{% include_example scala/org/apache/spark/examples/ml/MaxAbsScalerExample.scala %} +</div> + +<div data-lang="java" markdown="1"> + +Refer to the [MaxAbsScaler Java docs](api/java/org/apache/spark/ml/feature/MaxAbsScaler.html) +and the [MaxAbsScalerModel Java docs](api/java/org/apache/spark/ml/feature/MaxAbsScalerModel.html) +for more details on the API. + +{% include_example java/org/apache/spark/examples/ml/JavaMaxAbsScalerExample.java %} +</div> +</div> + ## Bucketizer `Bucketizer` transforms a column of continuous features to a column of feature buckets, where the buckets are specified by users. It takes a parameter: |