public class AttributeGroup
extends java.lang.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(java.lang.String name)
Creates an attribute group without attribute info.
|
AttributeGroup(java.lang.String name,
Attribute[] attrs)
Creates an attribute group with attributes.
|
AttributeGroup(java.lang.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(java.lang.String attrName)
Gets an attribute by its name.
|
scala.Option<Attribute[]> |
attributes()
Optional array of attributes.
|
boolean |
equals(java.lang.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(java.lang.String attrName)
Gets an attribute by its name.
|
boolean |
hasAttr(java.lang.String attrName)
Test whether this attribute group contains a specific attribute.
|
int |
hashCode() |
int |
indexOf(java.lang.String attrName)
Index of an attribute specified by name.
|
java.lang.String |
name() |
scala.Option<java.lang.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.
|
java.lang.String |
toString() |
StructField |
toStructField()
Converts to a StructField.
|
StructField |
toStructField(Metadata existingMetadata)
Converts to a StructField with some existing metadata.
|
public AttributeGroup(java.lang.String name)
name
- name of the attribute grouppublic AttributeGroup(java.lang.String name, int numAttributes)
name
- name of the attribute groupnumAttributes
- number of attributespublic AttributeGroup(java.lang.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 java.lang.String name()
public scala.Option<java.lang.Object> numAttributes()
public scala.Option<Attribute[]> attributes()
numAttributes
and attributes
can be defined.public int size()
public boolean hasAttr(java.lang.String attrName)
public int indexOf(java.lang.String attrName)
public Attribute apply(java.lang.String attrName)
public Attribute getAttr(java.lang.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(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object