Normalize

Normalizes vector columns using given p-norm.

This operation is ported from Spark ML.

For a comprehensive introduction, see Spark documentation.

For scala docs details, see org.apache.spark.ml.feature.Normalizer documentation.

Since: Seahorse 1.0.0

Input

Port Type Qualifier Description
0DataFrameThe input DataFrame.

Output

Port Type Qualifier Description
0DataFrameThe output DataFrame.
1TransformerA Transformer that allows to apply the operation on other DataFrames using a Transform.

Parameters

Name Type Description
p Numeric Normalization in L^p space.
operate on InputOutputColumnSelector The input and output columns for the operation.

Example

Parameters

Name Value
p 2.0
operate on one column
input column "features"
output append new column
output column "normalized"

Input

features
[-2.0,2.3,0.0]
[0.0,0.0,0.0]
[0.6,-1.1,-3.0]
[0.0,0.91,3.2]
[5.7,0.72,2.7]
[0.0,0.0,0.0]

Output

features normalized
[-2.0,2.3,0.0] [-0.6561787149247866,0.7546055221635046,0.0]
[0.0,0.0,0.0] [0.0,0.0,0.0]
[0.6,-1.1,-3.0] [0.18454987557625951,-0.3383414385564758,-0.9227493778812975]
[0.0,0.91,3.2] [0.0,0.2735299305180406,0.9618634919315713]
[5.7,0.72,2.7] [0.8979061661970154,0.11341972625646508,0.4253239734617441]
[0.0,0.0,0.0] [0.0,0.0,0.0]