Class WeightFactory

java.lang.Object
generic.lsh.vector.WeightFactory

public class WeightFactory extends Object
  • Constructor Details

    • WeightFactory

      public WeightFactory()
  • Method Details

    • getIDFSize

      public final int getIDFSize()
      Returns:
      number of weights in the IDF portion of the table
    • getTFSize

      public final int getTFSize()
      Returns:
      number of weights in the TF portion of the table
    • getSize

      public final int getSize()
      Returns:
      number of floating-point entries needed to serialize the factory
    • getIDFWeight

      public final double getIDFWeight(short val)
      Parameters:
      val -
      Returns:
      the IDF weight at the given position
    • getTFWeight

      public final double getTFWeight(short val)
      Parameters:
      val - is the term count (-1)
      Returns:
      the TF weight for the given count
    • getCoeff

      public final double getCoeff(short i, short t)
      Given an IDF position and a TF count, build the feature coefficient
      Parameters:
      i - is the IDF position
      t - is the TF count
      Returns:
      the feature coefficient
    • getWeightNorm

      public final double getWeightNorm()
      Returns:
      the weight normalization factor
    • getFlipNorm0

      public final double getFlipNorm0()
      Returns:
      the first feature flip penalty parameter
    • getDiffNorm0

      public final double getDiffNorm0()
      Returns:
      the first feature drop penalty parameter
    • getFlipNorm1

      public final double getFlipNorm1()
      Returns:
      the second feature flip penalty parameter
    • getDiffNorm1

      public final double getDiffNorm1()
      Returns:
      the second feature drop penalty parameter
    • getScale

      public final double getScale()
      Returns:
      the final score scaling factor
    • getAddend

      public final double getAddend()
      Returns:
      the final score addend
    • setLogarithmicTFWeights

      public void setLogarithmicTFWeights()
    • saveXml

      public void saveXml(Writer fwrite) throws IOException
      Serialize this object as XML to a Writer
      Parameters:
      fwrite - is the Writer
      Throws:
      IOException
    • toArray

      public double[] toArray()
      Condense weight table down to array of doubles
      Returns:
      array of doubles
    • set

      public void set(double[] weightArray)
      Initialize the WeightTable from an array of doubles
      Parameters:
      weightArray -
    • restoreXml

      public void restoreXml(XmlPullParser parser)
      Build (deserialize) this object from an XML stream
      Parameters:
      parser - is the XML parser