public interface Recommender
extends java.lang.AutoCloseable
Main entry point for accessing recommender components. A recommender object is effectively a recommender session: it is a per-thread or per-request object, likely connected to a database connection or persistence session, that needs to be closed when the client code is finished with it.
The various methods in this class return null
if the corresponding operation is not supported by the underlying recommender configuration. This ensures that, if you can actually get an object implementing a particular interface, you are guaranteed to be able to use it.
RecommenderEngine
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the recommender.
|
ItemBasedItemRecommender |
getItemBasedItemRecommender()
Get the recommender’s item-based item recommender.
|
ItemBasedItemScorer |
getItemBasedItemScorer()
Get the recommender’s item-based item scorer.
|
ItemRecommender |
getItemRecommender()
Get the recommender’s item recommender.
|
ItemScorer |
getItemScorer()
Get the recommender’s item scorer.
|
RatingPredictor |
getRatingPredictor()
Get the recommender’s rating scorer.
|
@Nullable RatingPredictor getRatingPredictor()
Get the recommender’s rating scorer.
null
if rating prediction is not supported.@Nullable ItemRecommender getItemRecommender()
Get the recommender’s item recommender.
null
if item recommendation is not supported.@Nullable ItemScorer getItemScorer()
Get the recommender’s item scorer.
null
if item scoring is not supported.@Nullable ItemBasedItemScorer getItemBasedItemScorer()
Get the recommender’s item-based item scorer.
null
if basket-based scoring is not supported.@Nullable ItemBasedItemRecommender getItemBasedItemRecommender()
Get the recommender’s item-based item recommender.
null
if basket-based scoring is not supported.void close()
Close the recommender. This closes underlying resources such as database collections. Components retrieved from the recommender must be used once the recommender is closed. Components capable of explicitly detecting use-after-close will indicate such invalid use by throwing IllegalStateException
, although they may fail with other exceptions. The results of using a component after its recommender has been closed are formally undefined.
close
in interface java.lang.AutoCloseable