public class OrdRecRatingPredictor extends AbstractRatingPredictor
OrdRec implementation of rating prediction.
The model views user feedback as ordinal. The framework is based on a pointwise (rather than pairwise) ordinal approach, it can wrap existing CF methods, and upgrade them into being able to tackle ordinal feedback. The implementation is based on Koren’s paper:
Modifier and Type | Class and Description |
---|---|
static class |
OrdRecRatingPredictor.FullResult
The result type of OrdRec rating predictions.
|
Constructor and Description |
---|
OrdRecRatingPredictor(ItemScorer scorer,
DataAccessObject dao,
Quantizer quantizer,
double rate,
double reg,
int niters)
Construct a new OrdRec rating predictor.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.Long,java.lang.Double> |
predict(long user,
java.util.Collection<java.lang.Long> items)
Predict the user’s preference for a collection of items.
|
ResultMap |
predictWithDetails(long user,
java.util.Collection<java.lang.Long> items)
Compute detailed predictions for the user.
|
predict
@Inject public OrdRecRatingPredictor(ItemScorer scorer, DataAccessObject dao, Quantizer quantizer, @LearningRate double rate, @RegularizationTerm double reg, @IterationCount int niters)
Construct a new OrdRec rating predictor.
scorer
- The ItemScorer to produce the underlyign scores.dao
- The DAO to access user events.quantizer
- The quantizer to which ratings should be constrained.rate
- The learning rate for user profile training.reg
- Regularization term for user profile training.@Nonnull public java.util.Map<java.lang.Long,java.lang.Double> predict(long user, @Nonnull java.util.Collection<java.lang.Long> items)
AbstractRatingPredictor
Predict the user’s preference for a collection of items.
This implementation delegates to RatingPredictor.predictWithDetails(long, Collection)
.
predict
in interface RatingPredictor
predict
in class AbstractRatingPredictor
user
- The user ID for whom to generate predicts.items
- The items to predict for.@Nonnull public ResultMap predictWithDetails(long user, @Nonnull java.util.Collection<java.lang.Long> items)
Compute detailed predictions for the user.
user
- The user ID for whom to generate predictions.items
- The items to predict for.OrdRecRatingPredictor.FullResult
.