Class AttributeGroup

Object
org.apache.spark.ml.attribute.AttributeGroup
All Implemented Interfaces:
Serializable, scala.Serializable

public class AttributeGroup extends Object implements scala.Serializable
Attributes that describe a vector ML column.

param: name name of the attribute group (the ML column name) param: numAttributes optional number of attributes. At most one of numAttributes and attrs can be defined. param: attrs optional array of attributes. Attribute will be copied with their corresponding indices in the array.

See Also:
  • Constructor Details

    • AttributeGroup

      public AttributeGroup(String name)
      Creates an attribute group without attribute info.
      Parameters:
      name - name of the attribute group
    • AttributeGroup

      public AttributeGroup(String name, int numAttributes)
      Creates an attribute group knowing only the number of attributes.
      Parameters:
      name - name of the attribute group
      numAttributes - number of attributes
    • AttributeGroup

      public AttributeGroup(String name, Attribute[] attrs)
      Creates an attribute group with attributes.
      Parameters:
      name - name of the attribute group
      attrs - array of attributes. Attributes will be copied with their corresponding indices in the array.
  • Method Details

    • fromStructField

      public static AttributeGroup fromStructField(StructField field)
      Creates an attribute group from a StructField instance.
      Parameters:
      field - (undocumented)
      Returns:
      (undocumented)
    • name

      public String name()
    • numAttributes

      public scala.Option<Object> numAttributes()
    • attributes

      public scala.Option<Attribute[]> attributes()
      Optional array of attributes. At most one of numAttributes and attributes can be defined.
      Returns:
      (undocumented)
    • size

      public int size()
      Size of the attribute group. Returns -1 if the size is unknown.
    • hasAttr

      public boolean hasAttr(String attrName)
      Test whether this attribute group contains a specific attribute.
    • indexOf

      public int indexOf(String attrName)
      Index of an attribute specified by name.
    • apply

      public Attribute apply(String attrName)
      Gets an attribute by its name.
    • getAttr

      public Attribute getAttr(String attrName)
      Gets an attribute by its name.
    • apply

      public Attribute apply(int attrIndex)
      Gets an attribute by its index.
    • getAttr

      public Attribute getAttr(int attrIndex)
      Gets an attribute by its index.
    • toMetadata

      public Metadata toMetadata(Metadata existingMetadata)
      Converts to ML metadata with some existing metadata.
    • toMetadata

      public Metadata toMetadata()
      Converts to ML metadata
    • toStructField

      public StructField toStructField(Metadata existingMetadata)
      Converts to a StructField with some existing metadata.
    • toStructField

      public StructField toStructField()
      Converts to a StructField.
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object