public class AttributeGroup
extends Object
implements scala.Serializable
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.
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
String |
toString() |
StructField |
toStructField()
Converts to a StructField.
|
StructField |
toStructField(Metadata existingMetadata)
Converts to a StructField with some existing metadata.
|
public AttributeGroup(String name)
name
- name of the attribute grouppublic AttributeGroup(String name, int numAttributes)
name
- name of the attribute groupnumAttributes
- number of attributespublic AttributeGroup(String name, Attribute[] attrs)
name
- name of the attribute groupattrs
- array of attributes. Attributes will be copied with their corresponding indices in
the array.public static AttributeGroup fromStructField(StructField field)
StructField
instance.public String name()
public scala.Option<Object> numAttributes()
public scala.Option<Attribute[]> attributes()
numAttributes
and attributes
can be defined.public int size()
public boolean hasAttr(String attrName)
public int indexOf(String attrName)
public Attribute apply(String attrName)
public Attribute getAttr(String attrName)
public Attribute apply(int attrIndex)
public Attribute getAttr(int attrIndex)
public Metadata toMetadata(Metadata existingMetadata)
public Metadata toMetadata()
public StructField toStructField(Metadata existingMetadata)
public StructField toStructField()
public boolean equals(Object other)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object