Class Normalizer

All Implemented Interfaces:
Serializable, org.apache.spark.internal.Logging, Params, HasInputCol, HasOutputCol, DefaultParamsWritable, Identifiable, MLWritable, scala.Serializable

public class Normalizer extends UnaryTransformer<Vector,Vector,Normalizer> implements DefaultParamsWritable
Normalize a vector to have unit norm using the given p-norm.
See Also:
  • Constructor Details

    • Normalizer

      public Normalizer(String uid)
    • Normalizer

      public Normalizer()
  • Method Details

    • load

      public static Normalizer load(String path)
    • read

      public static MLReader<T> read()
    • uid

      public String uid()
      Description copied from interface: Identifiable
      An immutable unique ID for the object and its derivatives.
      Specified by:
      uid in interface Identifiable
      Returns:
      (undocumented)
    • p

      public DoubleParam p()
      Normalization in L^p^ space. Must be greater than equal to 1. (default: p = 2)
      Returns:
      (undocumented)
    • getP

      public double getP()
    • setP

      public Normalizer setP(double value)
    • transformSchema

      public StructType transformSchema(StructType schema)
      Description copied from class: PipelineStage
      Check transform validity and derive the output schema from the input schema.

      We check validity for interactions between parameters during transformSchema and raise an exception if any parameter value is invalid. Parameter value checks which do not depend on other parameters are handled by Param.validate().

      Typical implementation should first conduct verification on schema change and parameter validity, including complex parameter interaction checks.

      Overrides:
      transformSchema in class UnaryTransformer<Vector,Vector,Normalizer>
      Parameters:
      schema - (undocumented)
      Returns:
      (undocumented)
    • toString

      public String toString()
      Specified by:
      toString in interface Identifiable
      Overrides:
      toString in class Object