Class WeightedLSHCosineVectorFactory

java.lang.Object
generic.lsh.vector.LSHVectorFactory
generic.lsh.vector.WeightedLSHCosineVectorFactory

public class WeightedLSHCosineVectorFactory extends LSHVectorFactory
  • Constructor Details

    • WeightedLSHCosineVectorFactory

      public WeightedLSHCosineVectorFactory()
  • Method Details

    • buildZeroVector

      public LSHVector buildZeroVector()
      Description copied from class: LSHVectorFactory
      Generate vector with all coefficients zero.
      Specified by:
      buildZeroVector in class LSHVectorFactory
      Returns:
      the zero vector
    • buildVector

      public LSHVector buildVector(int[] feature)
      Description copied from class: LSHVectorFactory
      Generate an LSHVector from a feature set, individual features are integer hashes. The integers MUST already be sorted. The same integer can occur more than once in the array (term frequency (TF) > 1). The factory decides internally how to create weights based on term frequency and any knowledge of Inverse Document Frequency (IDF)
      Specified by:
      buildVector in class LSHVectorFactory
      Parameters:
      feature - is the sorted array of integer features
      Returns:
      the newly minted LSHVector
    • restoreVectorFromXml

      public LSHVector restoreVectorFromXml(XmlPullParser parser)
      Description copied from class: LSHVectorFactory
      Generate an LSHVector based on XML tag seen by pull parser. Factory generates weights based on term frequency info in the XML tag and its internal IDF knowledge
      Specified by:
      restoreVectorFromXml in class LSHVectorFactory
      Parameters:
      parser - is the XML parser
      Returns:
      the newly minted LSHVector
    • restoreVectorFromSql

      public LSHVector restoreVectorFromSql(String sql) throws IOException
      Description copied from class: LSHVectorFactory
      Generate an LSHVector based on string returned from SQL query Factory generates weights based on term frequency info in the string and its internal IDF knowledge
      Specified by:
      restoreVectorFromSql in class LSHVectorFactory
      Parameters:
      sql - is the column data string returned by an SQL query
      Returns:
      the newly minted LSHVector
      Throws:
      IOException