Package org.apache.spark.ml.attribute
Class AttributeGroup
Object
org.apache.spark.ml.attribute.AttributeGroup
- All Implemented Interfaces:
 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 Summary
ConstructorsConstructorDescriptionAttributeGroup(String name) Creates an attribute group without attribute info.AttributeGroup(String name, int numAttributes) Creates an attribute group knowing only the number of attributes.AttributeGroup(String name, Attribute[] attrs) Creates an attribute group with attributes. - 
Method Summary
Modifier and TypeMethodDescriptionapply(int attrIndex) Gets an attribute by its index.Gets an attribute by its name.scala.Option<Attribute[]>Optional array of attributes.booleanstatic AttributeGroupfromStructField(StructField field) Creates an attribute group from aStructFieldinstance.getAttr(int attrIndex) Gets an attribute by its index.Gets an attribute by its name.booleanTest whether this attribute group contains a specific attribute.inthashCode()intIndex of an attribute specified by name.name()scala.Option<Object>intsize()Size of the attribute group.Converts to ML metadatatoMetadata(Metadata existingMetadata) Converts to ML metadata with some existing metadata.toString()Converts to a StructField.toStructField(Metadata existingMetadata) Converts to a StructField with some existing metadata. 
- 
Constructor Details
- 
AttributeGroup
Creates an attribute group without attribute info.- Parameters:
 name- name of the attribute group
 - 
AttributeGroup
Creates an attribute group knowing only the number of attributes.- Parameters:
 name- name of the attribute groupnumAttributes- number of attributes
 - 
AttributeGroup
Creates an attribute group with attributes.- Parameters:
 name- name of the attribute groupattrs- array of attributes. Attributes will be copied with their corresponding indices in the array.
 
 - 
 - 
Method Details
- 
fromStructField
Creates an attribute group from aStructFieldinstance.- Parameters:
 field- (undocumented)- Returns:
 - (undocumented)
 
 - 
name
 - 
numAttributes
 - 
attributes
Optional array of attributes. At most one ofnumAttributesandattributescan be defined.- Returns:
 - (undocumented)
 
 - 
size
public int size()Size of the attribute group. Returns -1 if the size is unknown. - 
hasAttr
Test whether this attribute group contains a specific attribute. - 
indexOf
Index of an attribute specified by name. - 
apply
Gets an attribute by its name. - 
getAttr
Gets an attribute by its name. - 
apply
Gets an attribute by its index. - 
getAttr
Gets an attribute by its index. - 
toMetadata
Converts to ML metadata with some existing metadata. - 
toMetadata
Converts to ML metadata - 
toStructField
Converts to a StructField with some existing metadata. - 
toStructField
Converts to a StructField. - 
equals
 - 
hashCode
public int hashCode() - 
toString
 
 -