Package org.apache.spark.ml.attribute
Class NominalAttribute
Object
org.apache.spark.ml.attribute.Attribute
org.apache.spark.ml.attribute.NominalAttribute
- All Implemented Interfaces:
Serializable
A nominal attribute.
param: name optional name
param: index optional index
param: isOrdinal whether this attribute is ordinal (optional)
param: numValues optional number of values. At most one of
numValues and values can be
defined.
param: values optional values. At most one of numValues and values can be defined.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionattrType()Attribute type.static final NominalAttributeThe default nominal attribute.booleanstatic AttributefromStructField(StructField field) scala.Option<Object>Get the number of values, either fromnumValuesor fromvalues.getValue(int index) Gets a value given its index.inthashCode()booleanTests whether this attribute contains a specific value.scala.Option<Object>index()Index of the attribute.intIndex of a specific value.booleanTests whether this attribute is nominal, true forNominalAttributeandBinaryAttribute.booleanTests whether this attribute is numeric, true forNumericAttributeandBinaryAttribute.scala.Option<Object>scala.Option<String>name()Name of the attribute.scala.Option<Object>scala.Option<String[]>values()withIndex(int index) Copy with a new index.Copy with a new name.withNumValues(int numValues) Copy with a newnumValuesand emptyvalues.Copy without the index.Copy without the name.Copy without thenumValues.Copy without the values.withValues(String[] values) Copy with new values and emptynumValues.withValues(String first, String... others) Copy with new values and emptynumValues.withValues(String first, scala.collection.immutable.Seq<String> others) Copy with new values and emptynumValues.Methods inherited from class org.apache.spark.ml.attribute.Attribute
toMetadata, toMetadata, toString, toStructField, toStructField
-
Method Details
-
defaultAttr
The default nominal attribute. -
fromStructField
-
withValues
Copy with new values and emptynumValues.- Parameters:
first- (undocumented)others- (undocumented)- Returns:
- (undocumented)
-
name
Description copied from class:AttributeName of the attribute. None if it is not set. -
index
Description copied from class:AttributeIndex of the attribute. None if it is not set. -
isOrdinal
-
numValues
-
values
-
attrType
Description copied from class:AttributeAttribute type. -
isNumeric
public boolean isNumeric()Description copied from class:AttributeTests whether this attribute is numeric, true forNumericAttributeandBinaryAttribute. -
isNominal
public boolean isNominal()Description copied from class:AttributeTests whether this attribute is nominal, true forNominalAttributeandBinaryAttribute. -
indexOf
Index of a specific value. -
hasValue
Tests whether this attribute contains a specific value. -
getValue
Gets a value given its index. -
withName
Description copied from class:AttributeCopy with a new name. -
withoutName
Description copied from class:AttributeCopy without the name.- Specified by:
withoutNamein classAttribute
-
withIndex
Description copied from class:AttributeCopy with a new index. -
withoutIndex
Description copied from class:AttributeCopy without the index.- Specified by:
withoutIndexin classAttribute
-
withValues
Copy with new values and emptynumValues.- Parameters:
values- (undocumented)- Returns:
- (undocumented)
-
withValues
Copy with new values and emptynumValues.- Parameters:
first- (undocumented)others- (undocumented)- Returns:
- (undocumented)
-
withoutValues
Copy without the values. -
withNumValues
Copy with a newnumValuesand emptyvalues.- Parameters:
numValues- (undocumented)- Returns:
- (undocumented)
-
withoutNumValues
Copy without thenumValues.- Returns:
- (undocumented)
-
getNumValues
Get the number of values, either fromnumValuesor fromvalues. Return None if unknown.- Returns:
- (undocumented)
-
equals
-
hashCode
public int hashCode()
-