public final class LiveUserItemBiasModel extends Object implements BiasModel
Bias model that provides global, user, and item biases. The global and item biases are precomputed and are not refreshed based on user data added since the model build, but the user bias (mean rating from the rating DAO) is recomputed live based on a RatingVectorPDAO.
| Constructor and Description |
|---|
LiveUserItemBiasModel(ItemBiasModel base,
RatingVectorPDAO dao)
Construct a new 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.
|
@Inject public LiveUserItemBiasModel(ItemBiasModel base, RatingVectorPDAO dao)
Construct a new bias model.
base - An item bias model to use as the base model.dao - The rating vector DAO to fetch user data.public double getIntercept()
BiasModelGet the global bias (intercept).
getIntercept in interface BiasModelpublic double getUserBias(long user)
BiasModelGet the user bias.
getUserBias in interface BiasModeluser - The user ID.public double getItemBias(long item)
BiasModelGet the item bias.
getItemBias in interface BiasModelitem - The item ID.public Long2DoubleMap getUserBiases(LongSet users)
BiasModelGet a set of user biases.
getUserBiases in interface BiasModelusers - The users whose biases are to be returned.Long2DoubleFunction.defaultReturnValue() will be 0.public Long2DoubleMap getItemBiases(LongSet items)
BiasModelGet a set of item biases.
getItemBiases in interface BiasModelitems - The items whose biases are to be returned.Long2DoubleFunction.defaultReturnValue() will be 0.