Package smile.data

Class 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
    • 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: Attribute
        Returns the string representation of a double value of this attribute.
        Specified by:
        toString in class Attribute
        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.ParseException
        Description copied from class: Attribute
        Returns the double value of a string of this attribute.
        Specified by:
        valueOf in class Attribute
        Parameters:
        s - a string value of this attribute.
        Throws:
        java.text.ParseException