protected static class MetaObjectProfiSCT.DatabaseSupport.KeywordWeightProvider extends java.lang.Object implements ObjectIntMultiVector.WeightProvider, java.io.Serializable
Modifier | Constructor and Description |
---|---|
protected |
MetaObjectProfiSCT.DatabaseSupport.KeywordWeightProvider(java.util.Map<java.lang.Integer,java.lang.Float> keywordWeights,
float[] weights)
Creates a new weight provider with the given map of keyword weights.
|
Modifier and Type | Method and Description |
---|---|
float |
getWeight(ObjectIntMultiVector.SortedDataIterator iterator)
Returns the weight for the item that the
iterator points to. |
double |
getWeightNorm(ObjectIntMultiVector obj)
Returns the square root of the sum of all weight squares for the given object.
|
float |
getWeightSum(ObjectIntMultiVector obj)
Returns the sum of all weights for the given object.
|
protected MetaObjectProfiSCT.DatabaseSupport.KeywordWeightProvider(java.util.Map<java.lang.Integer,java.lang.Float> keywordWeights, float[] weights)
keywordWeights
- the weights for the respective keyword IDs - key is the keyword id and value is its idf weightweights
- the weights for different layers of keywords (title, etc.)public float getWeight(ObjectIntMultiVector.SortedDataIterator iterator)
ObjectIntMultiVector.WeightProvider
iterator
points to.getWeight
in interface ObjectIntMultiVector.WeightProvider
iterator
- this iterator's current object weight is to be retrievedpublic float getWeightSum(ObjectIntMultiVector obj)
ObjectIntMultiVector.WeightProvider
ObjectIntMultiVector.WeightProvider.getWeight(messif.objects.impl.ObjectIntMultiVector.SortedDataIterator)
,
i.e. the returned sum is the sum of the weight retrieved by iterating over
all items from the obj.getSortedIterator()
.getWeightSum
in interface ObjectIntMultiVector.WeightProvider
obj
- the object for which the weights are givenpublic double getWeightNorm(ObjectIntMultiVector obj)
ObjectIntMultiVector.WeightProvider
ObjectIntMultiVector.WeightProvider.getWeight(messif.objects.impl.ObjectIntMultiVector.SortedDataIterator)
,
i.e. the returned number is the square root of the sum of all weight squares retrieved by iterating over
all items from the obj.getSortedIterator()
.getWeightNorm
in interface ObjectIntMultiVector.WeightProvider
obj
- the object for which the weights are given