Package generic.lsh.vector
Class LSHCosineVector
java.lang.Object
generic.lsh.vector.LSHCosineVector
- All Implemented Interfaces:
LSHVector
- Direct Known Subclasses:
LSHCosineVectorAccum
-
Constructor Summary
ConstructorDescriptionLSHCosineVector
(int[] feature, WeightFactory wfactory, IDFLookup idflookup) Install a set of features as an int[]. -
Method Summary
Modifier and TypeMethodDescriptionlong
double
compare
(LSHVector op2, VectorCompare data) void
compareCounts
(LSHVector op2, VectorCompare data) double
compareDetail
(LSHVector op2, StringBuilder buf) boolean
Eclipse-generated equals method.getEntry
(int i) double
int
hashCode()
Uses the existingcalcUniqueHash()
method to determine hash value.int
void
restoreBase64
(Reader input, char[] buffer, WeightFactory wfactory, IDFLookup idflookup, int[] decode) void
restoreSQL
(String sql, WeightFactory wfactory, IDFLookup idflookup) void
restoreXml
(XmlPullParser parser, WeightFactory wfactory, IDFLookup idflookup) void
saveBase64
(StringBuilder buffer, char[] encoder) saveSQL()
void
void
setHashEntries
(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:
numEntries
in interfaceLSHVector
-
getEntry
-
getEntries
- Specified by:
getEntries
in interfaceLSHVector
-
compare
-
compareCounts
- Specified by:
compareCounts
in interfaceLSHVector
-
compareDetail
- Specified by:
compareDetail
in interfaceLSHVector
-
getLength
public double getLength() -
restoreXml
- Specified by:
restoreXml
in interfaceLSHVector
-
restoreSQL
- Specified by:
restoreSQL
in interfaceLSHVector
- Throws:
IOException
-
restoreBase64
public void restoreBase64(Reader input, char[] buffer, WeightFactory wfactory, IDFLookup idflookup, int[] decode) throws IOException - Specified by:
restoreBase64
in interfaceLSHVector
- Throws:
IOException
-
saveXml
- Specified by:
saveXml
in interfaceLSHVector
- Throws:
IOException
-
saveSQL
-
saveBase64
- Specified by:
saveBase64
in interfaceLSHVector
-
calcUniqueHash
public long calcUniqueHash()- Specified by:
calcUniqueHash
in interfaceLSHVector
-