Class Attribute

Object
org.apache.spark.ml.attribute.Attribute
All Implemented Interfaces:
Serializable, scala.Serializable
Direct Known Subclasses:
BinaryAttribute, NominalAttribute, NumericAttribute

public abstract class Attribute extends Object implements scala.Serializable
Abstract class for ML attributes.
See Also:
  • Constructor Details

    • Attribute

      public Attribute()
  • Method Details

    • fromStructField

      public static Attribute fromStructField(StructField field)
    • attrType

      public abstract AttributeType attrType()
      Attribute type.
    • name

      public abstract scala.Option<String> name()
      Name of the attribute. None if it is not set.
    • withName

      public abstract Attribute withName(String name)
      Copy with a new name.
    • withoutName

      public abstract Attribute withoutName()
      Copy without the name.
    • index

      public abstract scala.Option<Object> index()
      Index of the attribute. None if it is not set.
    • withIndex

      public abstract Attribute withIndex(int index)
      Copy with a new index.
    • withoutIndex

      public abstract Attribute withoutIndex()
      Copy without the index.
    • isNumeric

      public abstract boolean isNumeric()
      Tests whether this attribute is numeric, true for NumericAttribute and BinaryAttribute.
      Returns:
      (undocumented)
    • isNominal

      public abstract boolean isNominal()
      Tests whether this attribute is nominal, true for NominalAttribute and BinaryAttribute.
      Returns:
      (undocumented)
    • 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.
      Parameters:
      existingMetadata - existing metadata to carry over
      Returns:
      (undocumented)
    • toStructField

      public StructField toStructField()
      Converts to a StructField.
      Returns:
      (undocumented)
    • toString

      public String toString()
      Overrides:
      toString in class Object