Package org.apache.spark.ml.attribute
Class Attribute
Object
org.apache.spark.ml.attribute.Attribute
- All Implemented Interfaces:
Serializable
,scala.Serializable
- Direct Known Subclasses:
BinaryAttribute
,NominalAttribute
,NumericAttribute
Abstract class for ML attributes.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract AttributeType
attrType()
Attribute type.static Attribute
fromStructField
(StructField field) abstract scala.Option<Object>
index()
Index of the attribute.abstract boolean
Tests whether this attribute is nominal, true forNominalAttribute
andBinaryAttribute
.abstract boolean
Tests whether this attribute is numeric, true forNumericAttribute
andBinaryAttribute
.abstract scala.Option<String>
name()
Name of the attribute.Converts to ML metadatatoMetadata
(Metadata existingMetadata) Converts to ML metadata with some existing metadata.toString()
Converts to aStructField
.toStructField
(Metadata existingMetadata) Converts to aStructField
with some existing metadata.abstract Attribute
withIndex
(int index) Copy with a new index.abstract Attribute
Copy with a new name.abstract Attribute
Copy without the index.abstract Attribute
Copy without the name.
-
Constructor Details
-
Attribute
public Attribute()
-
-
Method Details
-
fromStructField
-
attrType
Attribute type. -
name
Name of the attribute. None if it is not set. -
withName
Copy with a new name. -
withoutName
Copy without the name. -
index
Index of the attribute. None if it is not set. -
withIndex
Copy with a new index. -
withoutIndex
Copy without the index. -
isNumeric
public abstract boolean isNumeric()Tests whether this attribute is numeric, true forNumericAttribute
andBinaryAttribute
.- Returns:
- (undocumented)
-
isNominal
public abstract boolean isNominal()Tests whether this attribute is nominal, true forNominalAttribute
andBinaryAttribute
.- Returns:
- (undocumented)
-
toMetadata
Converts to ML metadata with some existing metadata. -
toMetadata
Converts to ML metadata -
toStructField
Converts to aStructField
with some existing metadata.- Parameters:
existingMetadata
- existing metadata to carry over- Returns:
- (undocumented)
-
toStructField
Converts to aStructField
.- Returns:
- (undocumented)
-
toString
-