public class SimpleRatingPredictor extends java.lang.Object implements RatingPredictor
Basic rating predictor that uses scores, clamped to valid rating values if appropriate. It returns results of type RescoredResult.
The default item scorer used by the rating predictor is provided by FallbackItemScorer.DynamicProvider, so it will default to falling back to the baseline scorer if one is present.
| Constructor and Description |
|---|
SimpleRatingPredictor(ItemScorer s,
PreferenceDomain dom)
Create a new simple rating predictor.
|
| Modifier and Type | Method and Description |
|---|---|
ItemScorer |
getItemScorer() |
PreferenceDomain |
getPreferenceDomain() |
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.
|
RescoredResult |
predict(long user,
long item)
Predict a user’s rating for a single item.
|
ResultMap |
predictWithDetails(long user,
java.util.Collection<java.lang.Long> items)
Predict the user’s preference for a collection of items, potentially with additional details.
|
@Inject public SimpleRatingPredictor(@Nonnull @PredictionScorer ItemScorer s, @Nullable PreferenceDomain dom)
Create a new simple rating predictor.
s - The scorer.dom - The preference domain.@Nonnull public ItemScorer getItemScorer()
@Nullable public PreferenceDomain getPreferenceDomain()
public RescoredResult predict(long user, long item)
RatingPredictorPredict a user’s rating for a single item.
predict in interface RatingPredictoruser - The user ID for whom to generate a prediction.item - The item ID whose rating is to be predicted.Double.NaN if no preference can be predicted.@Nonnull
public java.util.Map<java.lang.Long,java.lang.Double> predict(long user,
@Nonnull
java.util.Collection<java.lang.Long> items)
RatingPredictorPredict the user’s preference for a collection of items.
predict in interface RatingPredictoruser - 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)
RatingPredictorPredict the user’s preference for a collection of items, potentially with additional details.
predictWithDetails in interface RatingPredictoruser - The user ID for whom to generate predicts.items - The items to predict for.