Documentation of 'smile.feature.OneHotEncoder' Java class
OneHotEncoder
smile.feature

Class OneHotEncoder

  • All Implemented Interfaces:
    FeatureGenerator<double[]>


    public class OneHotEncoder
    extends java.lang.Object
    implements FeatureGenerator<double[]>
    Encode categorical integer features using a one-hot aka one-of-K scheme. Although some method such as decision trees can handle nominal variable directly, other methods generally require nominal variables converted to multiple binary dummy variables to indicate the presence or absence of a characteristic.
    • Constructor Summary

      Constructors 
      Constructor and Description
      OneHotEncoder(Attribute[] attributes)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      Attribute[] attributes()
      Returns the variable attributes of generated features.
      double[] feature(double[] x)
      Generates a feature for given object.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OneHotEncoder

        public OneHotEncoder(Attribute[] attributes)
        Constructor.
        Parameters:
        attributes - the variable attributes. Of which, nominal variables will be converted to binary dummy variables.
    • Method Detail

      • attributes

        public Attribute[] attributes()
        Description copied from interface: FeatureGenerator
        Returns the variable attributes of generated features. Note that these are NOT the original variable attributes of objects.
        Specified by:
        attributes in interface FeatureGenerator<double[]>
        Returns:
        the variable attributes of generated features
      • feature

        public double[] feature(double[] x)
        Description copied from interface: FeatureGenerator
        Generates a feature for given object.
        Specified by:
        feature in interface FeatureGenerator<double[]>
        Parameters:
        x - an object of interest.
        Returns:
        a feature vector.

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.