@DefaultImplementation(value=DefaultUserVectorNormalizer.class) public interface UserVectorNormalizer
This interface is essentially a user-aware version of VectorNormalizer
. The
default implementation, DefaultUserVectorNormalizer
, delegates to a
VectorNormalizer
. Implement this interface directly to create a normalizer
that is aware of the fact that it is normalizing a user and e.g. uses user properties
outside the vector to aid in the normalization. Otherwise, use a context-sensitive
binding of VectorNormalizer
to configure the user vector normalizer:
factory.in(UserVectorNormalizer.class)
.bind(VectorNormalizer.class)
.to(MeanVarianceNormalizer.class);
VectorNormalizer
Modifier and Type | Method and Description |
---|---|
VectorTransformation |
makeTransformation(long user,
SparseVector vector)
Make a vector transformation for a user.
|
MutableSparseVector |
normalize(long user,
SparseVector vector,
MutableSparseVector target)
Normalize a vector with respect to a user vector.
|
MutableSparseVector normalize(long user, @Nonnull SparseVector vector, @Nullable MutableSparseVector target)
user
- The user to normalize a vector for.vector
- The user's vector for reference.target
- The vector to normalize. If null
, the user vector is normalized.target
vector, if specified. Otherwise, a fresh mutable vector
containing a normalized copy of the user vector is returned.VectorTransformation makeTransformation(long user, SparseVector vector)
user
- The user ID to normalize for.vector
- The user's vector to use as the reference vector.