Interface Vectors


  • public interface Vectors
    Utilities for mapping bags-of-words to real-valued vectors.
    See Also:
    Dot products
    • Method Summary

      Static Methods 
      Modifier and Type Method Description
      static <V> org.apache.commons.math3.linear.RealVector transform​(Map<V,​Number> bag)
      Transform the bag-of-words into a real-valued vector.
      static <V> org.apache.commons.math3.linear.RealVector transform​(Map<V,​Number> bag, Collection<V> domain)
      Transform the bag-of-words into a real-valued vector.
    • Method Detail

      • transform

        static <V> org.apache.commons.math3.linear.RealVector transform​(Map<V,​Number> bag)
        Transform the bag-of-words into a real-valued vector.

        The number of elements in the vector is equal to the size of the key set of the given bag.

        Type Parameters:
        V - the type of bag elements
        Parameters:
        bag - the bag-of-words
        Returns:
        a real-valued vector
      • transform

        static <V> org.apache.commons.math3.linear.RealVector transform​(Map<V,​Number> bag,
                                                                        Collection<V> domain)
        Transform the bag-of-words into a real-valued vector.

        The number of elements in the vector is equal to the size of the domain set.

        Please make sure that all elements in domain are unique.

        Type Parameters:
        V - the type of bag elements
        Parameters:
        bag - the bag-of-words
        domain - the collection of allowed elements of bag
        Returns:
        a real-valued vector