org.apache.spark.mllib.feature
Class Normalizer

Object
  extended by org.apache.spark.mllib.feature.Normalizer
All Implemented Interfaces:
java.io.Serializable, VectorTransformer

public class Normalizer
extends Object
implements VectorTransformer

:: Experimental :: Normalizes samples individually to unit L^p^ norm

For any 1 <= p < Double.PositiveInfinity, normalizes samples using sum(abs(vector).^p^)^(1/p)^ as norm.

For p = Double.PositiveInfinity, max(abs(vector)) will be used as norm for normalization.

param: p Normalization in L^p^ space, p = 2 by default.

See Also:
Serialized Form

Constructor Summary
Normalizer()
           
Normalizer(double p)
           
 
Method Summary
 Vector transform(Vector vector)
          Applies unit length normalization on a vector.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.spark.mllib.feature.VectorTransformer
transform, transform
 

Constructor Detail

Normalizer

public Normalizer(double p)

Normalizer

public Normalizer()
Method Detail

transform

public Vector transform(Vector vector)
Applies unit length normalization on a vector.

Specified by:
transform in interface VectorTransformer
Parameters:
vector - vector to be normalized.
Returns:
normalized vector. If the norm of the input is zero, it will return the input vector.