smile.data
Class StringAttribute
- java.lang.Object
-
- smile.data.Attribute
-
- smile.data.StringAttribute
-
- All Implemented Interfaces:
- java.io.Serializable
public class StringAttribute extends Attribute
String attribute. String attributes may contain arbitrary textual values. Value 0 is reserved for unknown word.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class smile.data.Attribute
Attribute.Type
-
-
Constructor Summary
Constructors Constructor and Description StringAttribute(java.lang.String name)Constructor.StringAttribute(java.lang.String name, double weight)Constructor.StringAttribute(java.lang.String name, java.lang.String description, double weight)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanisOpen()Returns true if the string values of the nominal attribute is a open set.voidsetOpen(boolean open)Sets if the string values of the nominal attribute is a open set.java.lang.StringtoString(double x)Returns the string representation of a double value of this attribute.doublevalueOf(java.lang.String s)Returns the double value of a string of this attribute.java.util.List<java.lang.String>values()Returns the list of string values of this attribute.
-
-
-
Constructor Detail
-
StringAttribute
public StringAttribute(java.lang.String name)
Constructor.- Parameters:
name- the name of attribute.
-
StringAttribute
public StringAttribute(java.lang.String name, double weight)Constructor.- Parameters:
name- the name of attribute.
-
StringAttribute
public StringAttribute(java.lang.String name, java.lang.String description, double weight)Constructor.- Parameters:
name- the name of attribute.description- the detailed description of attribute.
-
-
Method Detail
-
values
public java.util.List<java.lang.String> values()
Returns the list of string values of this attribute.- Returns:
- the list of string values of this attribute
-
isOpen
public boolean isOpen()
Returns true if the string values of the nominal attribute is a open set. The new string values will be added into the attribute when calling the method valueOf(String).- Returns:
- true if the string values of the nominal attribute is a open set.
-
setOpen
public void setOpen(boolean open)
Sets if the string values of the nominal attribute is a open set.- Parameters:
open- true if the string values of the nominal attribute is a open set.
-
valueOf
public double valueOf(java.lang.String s) throws java.text.ParseExceptionDescription copied from class:AttributeReturns the double value of a string of this attribute.
-
toString
public java.lang.String toString(double x)
Description copied from class:AttributeReturns the string representation of a double value of this attribute.- Specified by:
toStringin classAttribute- Parameters:
x- a double value of this attribute. NaN means missing value.- Returns:
- the string representation of x. For nominal, date and string attributes, null will be returned for missing values. For numeric attributes, "NaN" will be returned for missing values.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG