@Shareable @Immutable @DefaultProvider(value=UserItemAverageRatingBiasModelProvider.class) public class UserItemBiasModel extends Object implements BiasModel, Serializable
Bias model that provides global, user, and item biases. The user and item biases are precomputed and are not refreshed based on user data added since the model build.
Constructor and Description |
---|
UserItemBiasModel(double global,
Long2DoubleMap users,
Long2DoubleMap items)
Construct a new user bias model.
|
Modifier and Type | Method and Description |
---|---|
double |
getIntercept()
Get the global bias (intercept).
|
double |
getItemBias(long item)
Get the item bias.
|
Long2DoubleMap |
getItemBiases(LongSet items)
Get a set of item biases.
|
double |
getUserBias(long user)
Get the user bias.
|
Long2DoubleMap |
getUserBiases(LongSet users)
Get a set of user biases.
|
public UserItemBiasModel(double global, Long2DoubleMap users, Long2DoubleMap items)
Construct a new user bias model.
global
- The global bias.users
- The user biases.items
- The item biases.public double getIntercept()
BiasModel
Get the global bias (intercept).
getIntercept
in interface BiasModel
public double getUserBias(long user)
BiasModel
Get the user bias.
getUserBias
in interface BiasModel
user
- The user ID.public Long2DoubleMap getUserBiases(LongSet users)
BiasModel
Get a set of user biases.
getUserBiases
in interface BiasModel
users
- The users whose biases are to be returned.Long2DoubleFunction.defaultReturnValue()
will be 0.public double getItemBias(long item)
BiasModel
Get the item bias.
getItemBias
in interface BiasModel
item
- The item ID.public Long2DoubleMap getItemBiases(LongSet items)
BiasModel
Get a set of item biases.
getItemBiases
in interface BiasModel
items
- The items whose biases are to be returned.Long2DoubleFunction.defaultReturnValue()
will be 0.