Documentation of 'jsat.text.wordweighting.BinaryWordPresent' Java class
BinaryWordPresent
jsat.text.wordweighting

Class BinaryWordPresent

  • All Implemented Interfaces:
    java.io.Serializable, Function, IndexFunction, WordWeighting


    public class BinaryWordPresent
    extends java.lang.Object
    implements WordWeighting
    Provides a simple binary representation of bag-of-word vectors by simply marking a value 1.0 if the token is present, and 0.0 if the token is not present. Nothing else is taken into account.

    This class does not require any state or configuration, so it can be used without calling setWeight(java.util.List, java.util.List).
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void applyTo(Vec vec)
      The implementation may want to pre compute come values based on the vector it is about to be applied to.
      double indexFunc(double value, int index)
      An index function, meant to be applied to vectors where the value to be computed may vary based on the position in the vector of the value.
      void setWeight(java.util.List<? extends Vec> allDocuments, java.util.List<java.lang.Integer> df)
      Prepares the word weighting to be performed on a data set.
      • Methods inherited from class java.lang.Object

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

      • BinaryWordPresent

        public BinaryWordPresent()
    • Method Detail

      • setWeight

        public void setWeight(java.util.List<? extends Vec> allDocuments,
                              java.util.List<java.lang.Integer> df)
        Description copied from interface: WordWeighting
        Prepares the word weighting to be performed on a data set. This should be called once before being applied to any vectors. Different WordWeightings may require different amounts of computation to set up.
        Specified by:
        setWeight in interface WordWeighting
        Parameters:
        allDocuments - the list of all vectors that make up the set of documents. The word vectors should be unmodified, containing the value of how many times a word appeared in the document for each index.
        df - a list mapping each integer index of a word to how many times that word occurred in total
      • indexFunc

        public double indexFunc(double value,
                                int index)
        Description copied from interface: IndexFunction
        An index function, meant to be applied to vectors where the value to be computed may vary based on the position in the vector of the value.
        Specified by:
        indexFunc in interface IndexFunction
        Parameters:
        value - the value at the specified index
        index - the index the value is from
        Returns:
        the computed result. If a negative index was given, the function should return 0.0 if indexFunc(0,indx) would return zero for all valid indices. If this is not the case, any non zero value should be returned.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.