Package smile.data
Class NumericAttribute
- java.lang.Object
-
- smile.data.Attribute
-
- smile.data.NumericAttribute
-
- All Implemented Interfaces:
java.io.Serializable
public class NumericAttribute extends Attribute
Numeric attribute. Numeric attributes can be real or integer numbers.- Author:
- Haifeng Li
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class smile.data.Attribute
Attribute.Type
-
-
Constructor Summary
Constructors Constructor Description NumericAttribute(java.lang.String name)Constructor.NumericAttribute(java.lang.String name, double weight)Constructor.NumericAttribute(java.lang.String name, java.lang.String description)Constructor.NumericAttribute(java.lang.String name, java.lang.String description, double weight)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
Constructor Detail
-
NumericAttribute
public NumericAttribute(java.lang.String name)
Constructor.
-
NumericAttribute
public NumericAttribute(java.lang.String name, double weight)Constructor.
-
NumericAttribute
public NumericAttribute(java.lang.String name, java.lang.String description)Constructor.
-
NumericAttribute
public NumericAttribute(java.lang.String name, java.lang.String description, double weight)Constructor.
-
-
Method Detail
-
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.
-
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.
-
-