Class Array2FeatureVector

  • All Implemented Interfaces:
    AlphabetCarrying, java.io.Serializable

    public class Array2FeatureVector
    extends Pipe
    Converts a Java array of numerical types to a FeatureVector, where the Alphabet is the data array index wrapped in an Integer object.
    Author:
    Jerod Weinman weinman@cs.umass.edu
    See Also:
    Serialized Form
    • Constructor Detail

      • Array2FeatureVector

        public Array2FeatureVector​(int capacity)
      • Array2FeatureVector

        public Array2FeatureVector()
      • Array2FeatureVector

        public Array2FeatureVector​(Alphabet dataAlphabet,
                                   Alphabet targetAlphabet)
        Construct a pipe based on the dimensions of the data and target.
    • Method Detail

      • pipe

        public Instance pipe​(Instance carrier)
                      throws java.lang.IllegalStateException
        Convert the data in an Instance from an array to a FeatureVector leaving other fields unchanged. Instance.getData() must return a numeric array, and it is cast to double[]
        Overrides:
        pipe in class Pipe
        Throws:
        java.lang.IllegalStateException - If Instance.getTarget() is not a Labeling
      • size

        public int size()
        Current size of the Vocabulary