@Shareable public class DefaultUserVectorNormalizer extends Object implements UserVectorNormalizer, Serializable
VectorNormalizer
.Modifier and Type | Field and Description |
---|---|
protected VectorNormalizer |
delegate |
Constructor and Description |
---|
DefaultUserVectorNormalizer()
Construct a new user vector normalizer that uses the identity normalization.
|
DefaultUserVectorNormalizer(VectorNormalizer norm)
Construct a new user vector normalizer wrapping a generic vector normalizer.
|
Modifier and Type | Method and Description |
---|---|
VectorNormalizer |
getVectorNormalizer()
Get the delegate vector normalizer.
|
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.
|
protected final VectorNormalizer delegate
public DefaultUserVectorNormalizer()
@Inject public DefaultUserVectorNormalizer(VectorNormalizer norm)
norm
- The generic normalizer to use.public VectorNormalizer getVectorNormalizer()
public MutableSparseVector normalize(long user, @Nonnull SparseVector vector, @Nullable MutableSparseVector target)
UserVectorNormalizer
normalize
in interface UserVectorNormalizer
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.public VectorTransformation makeTransformation(long user, SparseVector vector)
UserVectorNormalizer
makeTransformation
in interface UserVectorNormalizer
user
- The user ID to normalize for.vector
- The user's vector to use as the reference vector.