@Shareable public class DefaultItemVectorNormalizer extends Object implements ItemVectorNormalizer, Serializable
VectorNormalizer
.Modifier and Type | Field and Description |
---|---|
protected VectorNormalizer |
delegate |
Constructor and Description |
---|
DefaultItemVectorNormalizer()
Construct a new item vector normalizer that uses the identity normalization.
|
DefaultItemVectorNormalizer(VectorNormalizer norm)
Construct a new item vector normalizer wrapping a generic vector normalizer.
|
Modifier and Type | Method and Description |
---|---|
VectorTransformation |
makeTransformation(long user,
SparseVector vector)
Make a vector transformation for an item.
|
MutableSparseVector |
normalize(long user,
SparseVector vector,
MutableSparseVector target)
Normalize a vector with respect to an item vector.
|
protected final VectorNormalizer delegate
public DefaultItemVectorNormalizer()
@Inject public DefaultItemVectorNormalizer(VectorNormalizer norm)
norm
- The generic normalizer to use.public MutableSparseVector normalize(long user, @Nonnull SparseVector vector, @Nullable MutableSparseVector target)
ItemVectorNormalizer
normalize
in interface ItemVectorNormalizer
user
- The item id to normalize a vector for.vector
- The item's vector for reference.target
- The vector to normalize. If null
, the item vector is normalized.target
vector, if specified. Otherwise, a fresh mutable vector
containing a normalized copy of the item vector is returned.public VectorTransformation makeTransformation(long user, SparseVector vector)
ItemVectorNormalizer
makeTransformation
in interface ItemVectorNormalizer
user
- The item id to normalize for.vector
- The item's vector to use as the reference vector.