org.apache.spark.ml.attribute
Class AttributeGroup

Object
  extended by org.apache.spark.ml.attribute.AttributeGroup
All Implemented Interfaces:
java.io.Serializable

public class AttributeGroup
extends Object
implements scala.Serializable

:: DeveloperApi :: 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:
Serialized Form

Constructor Summary
AttributeGroup(String name)
          Creates an attribute group without attribute info.
AttributeGroup(String name, Attribute[] attrs)
          Creates an attribute group with attributes.
AttributeGroup(String name, int numAttributes)
          Creates an attribute group knowing only the number of attributes.
 
Method Summary
 Attribute apply(int attrIndex)
          Gets an attribute by its index.
 Attribute apply(String attrName)
          Gets an attribute by its name.
 scala.Option<Attribute[]> attributes()
          Optional array of attributes.
 boolean equals(Object other)
           
static AttributeGroup fromStructField(StructField field)
          Creates an attribute group from a StructField instance.
 Attribute getAttr(int attrIndex)
          Gets an attribute by its index.
 Attribute getAttr(String attrName)
          Gets an attribute by its name.
 boolean hasAttr(String attrName)
          Test whether this attribute group contains a specific attribute.
 int hashCode()
           
 int indexOf(String attrName)
          Index of an attribute specified by name.
 String name()
           
 scala.Option<Object> numAttributes()
           
 int size()
          Size of the attribute group.
 Metadata toMetadata()
          Converts to ML metadata
 Metadata toMetadata(Metadata existingMetadata)
          Converts to ML metadata with some existing metadata.
 StructField toStructField()
          Converts to a StructField.
 StructField toStructField(Metadata existingMetadata)
          Converts to a StructField with some existing metadata.
 
Methods inherited from class Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

fromStructField

public static AttributeGroup fromStructField(StructField field)
Creates an attribute group from a StructField instance.


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