public final class SimpleRatingPredictor extends AbstractRatingPredictor
RatingPredictor
backed by an
ItemScorer
. The scores are clamped to the preference domain
but otherwise unmodified.
If a baseline predictor is provided, then it is used to supply predictions that the item scorer could not.
This class has a provider SimpleRatingPredictor.Provider
that is the default provider
for RatingPredictor
.
Modifier and Type | Class and Description |
---|---|
static class |
SimpleRatingPredictor.Provider
An intelligent provider for simple rating predictors.
|
dao
Constructor and Description |
---|
SimpleRatingPredictor(DataAccessObject dao,
ItemScorer scorer,
BaselinePredictor baseline,
PreferenceDomain domain) |
Modifier and Type | Method and Description |
---|---|
BaselinePredictor |
getBaselinePredictor()
Get the baseline predictor.
|
PreferenceDomain |
getPreferenceDomain()
Get the preference domain.
|
ItemScorer |
getScorer()
Get the backing scorer.
|
void |
predict(long user,
MutableSparseVector scores)
Predict for items in a vector.
|
void |
predict(UserHistory<? extends Event> profile,
MutableSparseVector predictions)
Predict for items in a vector.
|
canUseHistory, getUserHistory, predict, predict, predict, predict, score, score, score, score, score, score
@Inject public SimpleRatingPredictor(DataAccessObject dao, ItemScorer scorer, @Nullable BaselinePredictor baseline, @Nullable PreferenceDomain domain)
public ItemScorer getScorer()
@Nullable public PreferenceDomain getPreferenceDomain()
@Nullable public BaselinePredictor getBaselinePredictor()
null
if no baseline is configured.public void predict(long user, @Nonnull MutableSparseVector scores)
AbstractRatingPredictor
Delegates to RatingPredictor.predict(org.grouplens.lenskit.data.UserHistory, MutableSparseVector)
, with a
history retrieved from the DAO.
predict
in interface RatingPredictor
predict
in class AbstractRatingPredictor
user
- The user ID.scores
- The score vector.AbstractRatingPredictor.getUserHistory(long)
public void predict(@Nonnull UserHistory<? extends Event> profile, @Nonnull MutableSparseVector predictions)
RatingPredictor
If the user has rated any items to be predicted, the algorithm should not just use their rating as the predict — it should compute a predict in the normal fashion. If client code wants to substitute ratings, it is easy to do so as a separate step or wrapper interface.
profile
- The user history.predictions
- The prediction output vector.Copyright © 2013 GroupLens Research. All Rights Reserved.