Package generic.lsh.vector
Class LSHCosineVector
- java.lang.Object
- 
- generic.lsh.vector.LSHCosineVector
 
- 
- All Implemented Interfaces:
- LSHVector
 - Direct Known Subclasses:
- LSHCosineVectorAccum
 
 public class LSHCosineVector extends java.lang.Object implements LSHVector 
- 
- 
Constructor SummaryConstructors Constructor Description LSHCosineVector()LSHCosineVector(int[] feature, WeightFactory wfactory, IDFLookup idflookup)Install a set of features as an int[].
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description longcalcUniqueHash()doublecompare(LSHVector op2, VectorCompare data)voidcompareCounts(LSHVector op2, VectorCompare data)doublecompareDetail(LSHVector op2, java.lang.StringBuilder buf)booleanequals(java.lang.Object obj)Eclipse-generated equals method.HashEntry[]getEntries()HashEntrygetEntry(int i)doublegetLength()inthashCode()Uses the existingcalcUniqueHash()method to determine hash value.intnumEntries()voidrestoreBase64(java.io.Reader input, char[] buffer, WeightFactory wfactory, IDFLookup idflookup, int[] decode)voidrestoreSQL(java.lang.String sql, WeightFactory wfactory, IDFLookup idflookup)voidrestoreXml(XmlPullParser parser, WeightFactory wfactory, IDFLookup idflookup)voidsaveBase64(java.lang.StringBuilder buffer, char[] encoder)java.lang.StringsaveSQL()voidsaveXml(java.io.Writer fwrite)voidsetHashEntries(HashEntry[] entries)Install hashes and weights directly.
 
- 
- 
- 
Constructor Detail- 
LSHCosineVectorpublic LSHCosineVector() 
 - 
LSHCosineVectorpublic LSHCosineVector(int[] feature, WeightFactory wfactory, IDFLookup idflookup)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 hashes
- wfactory- is the container of weighting information
- idflookup- is the container of IDF information
 
 
- 
 - 
Method Detail- 
hashCodepublic int hashCode() Uses the existingcalcUniqueHash()method to determine hash value.- Overrides:
- hashCodein class- java.lang.Object
- Returns:
 
 - 
equalspublic boolean equals(java.lang.Object obj) Eclipse-generated equals method. Only the hash attribute is necessary.- Overrides:
- equalsin class- java.lang.Object
- Parameters:
- obj-
- Returns:
 
 - 
setHashEntriespublic void setHashEntries(HashEntry[] entries) Install hashes and weights directly. Length is automatically calculated. The entries must already be sorted on the hash- Parameters:
- entries-
 
 - 
numEntriespublic int numEntries() - Specified by:
- numEntriesin interface- LSHVector
 
 - 
getEntriespublic HashEntry[] getEntries() - Specified by:
- getEntriesin interface- LSHVector
 
 - 
comparepublic double compare(LSHVector op2, VectorCompare data) 
 - 
compareCountspublic void compareCounts(LSHVector op2, VectorCompare data) - Specified by:
- compareCountsin interface- LSHVector
 
 - 
compareDetailpublic double compareDetail(LSHVector op2, java.lang.StringBuilder buf) - Specified by:
- compareDetailin interface- LSHVector
 
 - 
restoreXmlpublic void restoreXml(XmlPullParser parser, WeightFactory wfactory, IDFLookup idflookup) - Specified by:
- restoreXmlin interface- LSHVector
 
 - 
restoreSQLpublic void restoreSQL(java.lang.String sql, WeightFactory wfactory, IDFLookup idflookup) throws java.io.IOException- Specified by:
- restoreSQLin interface- LSHVector
- Throws:
- java.io.IOException
 
 - 
restoreBase64public void restoreBase64(java.io.Reader input, char[] buffer, WeightFactory wfactory, IDFLookup idflookup, int[] decode) throws java.io.IOException- Specified by:
- restoreBase64in interface- LSHVector
- Throws:
- java.io.IOException
 
 - 
saveXmlpublic void saveXml(java.io.Writer fwrite) throws java.io.IOException
 - 
saveBase64public void saveBase64(java.lang.StringBuilder buffer, char[] encoder)- Specified by:
- saveBase64in interface- LSHVector
 
 - 
calcUniqueHashpublic long calcUniqueHash() - Specified by:
- calcUniqueHashin interface- LSHVector
 
 
- 
 
-