Class WeightFactory

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

public class WeightFactory extends Object
  • Constructor Details Link icon

    • WeightFactory Link icon

      public WeightFactory()
  • Method Details Link icon

    • getIDFSize Link icon

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

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

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

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

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

      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 Link icon

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

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

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

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

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

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

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

      public void setLogarithmicTFWeights()
    • saveXml Link icon

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

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

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

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