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

Class TfIdf

    • Constructor Summary

      Constructors 
      Constructor and Description
      TfIdf()
      Creates a new TF-IDF document weighting scheme that uses LOG weighting for term frequency.
      TfIdf(TfIdf.TermFrequencyWeight tfWeighting)
      Creates a new TF-IDF document weighting scheme that uses the specified term frequency weighting
    • 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

      • TfIdf

        public TfIdf()
        Creates a new TF-IDF document weighting scheme that uses LOG weighting for term frequency.
      • TfIdf

        public TfIdf(TfIdf.TermFrequencyWeight tfWeighting)
        Creates a new TF-IDF document weighting scheme that uses the specified term frequency weighting
        Parameters:
        tfWeighting - the weighting method to use for the term frequency (tf) component
    • 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.