Package generic.lsh.vector
Class LSHCosineVector
java.lang.Object
generic.lsh.vector.LSHCosineVector
- All Implemented Interfaces:
LSHVector
- Direct Known Subclasses:
LSHCosineVectorAccum
-
Constructor Summary
ConstructorsConstructorDescriptionLSHCosineVector(int[] feature, WeightFactory wfactory, IDFLookup idflookup) Install a set of features as an int[]. -
Method Summary
Modifier and TypeMethodDescriptionlongdoublecompare(LSHVector op2, VectorCompare data) voidcompareCounts(LSHVector op2, VectorCompare data) doublecompareDetail(LSHVector op2, StringBuilder buf) booleanEclipse-generated equals method.getEntry(int i) doubleinthashCode()Uses the existingcalcUniqueHash()method to determine hash value.intvoidrestoreBase64(Reader input, char[] buffer, WeightFactory wfactory, IDFLookup idflookup, int[] decode) voidrestoreSQL(String sql, WeightFactory wfactory, IDFLookup idflookup) voidrestoreXml(XmlPullParser parser, WeightFactory wfactory, IDFLookup idflookup) voidsaveBase64(StringBuilder buffer, char[] encoder) saveSQL()voidvoidsetHashEntries(HashEntry[] entries) Install hashes and weights directly.
-
Constructor Details
-
LSHCosineVector
public LSHCosineVector() -
LSHCosineVector
Install a set of features as an int[]. Each integer is a hash. The integers MUST already be sorted. The same integer can occur more than once in the array (term frequency (TF) > 1). Weights are determined by TF and Inverse Document Frequency (IDF) of individual features- Parameters:
feature- is the sorted array of integer hasheswfactory- is the container of weighting informationidflookup- is the container of IDF information
-
-
Method Details
-
hashCode
public int hashCode()Uses the existingcalcUniqueHash()method to determine hash value. -
equals
Eclipse-generated equals method. Only the hash attribute is necessary. -
setHashEntries
Install hashes and weights directly. Length is automatically calculated. The entries must already be sorted on the hash- Parameters:
entries-
-
numEntries
public int numEntries()- Specified by:
numEntriesin interfaceLSHVector
-
getEntry
-
getEntries
- Specified by:
getEntriesin interfaceLSHVector
-
compare
-
compareCounts
- Specified by:
compareCountsin interfaceLSHVector
-
compareDetail
- Specified by:
compareDetailin interfaceLSHVector
-
getLength
public double getLength() -
restoreXml
- Specified by:
restoreXmlin interfaceLSHVector
-
restoreSQL
- Specified by:
restoreSQLin interfaceLSHVector- Throws:
IOException
-
restoreBase64
public void restoreBase64(Reader input, char[] buffer, WeightFactory wfactory, IDFLookup idflookup, int[] decode) throws IOException - Specified by:
restoreBase64in interfaceLSHVector- Throws:
IOException
-
saveXml
- Specified by:
saveXmlin interfaceLSHVector- Throws:
IOException
-
saveSQL
-
saveBase64
- Specified by:
saveBase64in interfaceLSHVector
-
calcUniqueHash
public long calcUniqueHash()- Specified by:
calcUniqueHashin interfaceLSHVector
-