Package generic.lsh.vector
Class WeightedLSHCosineVectorFactory
- java.lang.Object
-
- generic.lsh.vector.LSHVectorFactory
-
- generic.lsh.vector.WeightedLSHCosineVectorFactory
-
public class WeightedLSHCosineVectorFactory extends LSHVectorFactory
-
-
Field Summary
-
Fields inherited from class generic.lsh.vector.LSHVectorFactory
idfLookup, settings, weightFactory
-
-
Constructor Summary
Constructors Constructor Description WeightedLSHCosineVectorFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LSHVector
buildVector(int[] feature)
Generate an LSHVector from a feature set, individual features are integer hashes.LSHVector
buildZeroVector()
Generate vector with all coefficients zero.LSHVector
restoreVectorFromSql(java.lang.String sql)
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 knowledgeLSHVector
restoreVectorFromXml(XmlPullParser parser)
Generate an LSHVector based on XML tag seen by pull parser.-
Methods inherited from class generic.lsh.vector.LSHVectorFactory
calculateSignificance, getSelfSignificance, getSettings, getSignificanceAddend, getSignificanceScale, isLoaded, readWeights, set
-
-
-
-
Method Detail
-
buildZeroVector
public LSHVector buildZeroVector()
Description copied from class:LSHVectorFactory
Generate vector with all coefficients zero.- Specified by:
buildZeroVector
in classLSHVectorFactory
- 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 classLSHVectorFactory
- 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 classLSHVectorFactory
- Parameters:
parser
- is the XML parser- Returns:
- the newly minted LSHVector
-
restoreVectorFromSql
public LSHVector restoreVectorFromSql(java.lang.String sql) throws java.io.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 classLSHVectorFactory
- Parameters:
sql
- is the column data string returned by an SQL query- Returns:
- the newly minted LSHVector
- Throws:
java.io.IOException
-
-