public interface RescorerProvider
Implementations of this interface provide, optionally, objects that can be used to
modify and influence the results of endpoints like Recommend
, Similarity
,
etc. It is a means to inject business logic into the results of the ALS application
endpoints.
Implementations of this class are factories. An implementation creates and configures
a Rescorer
rescoring object and returns it for use in the context of one
of the endpoints' operation. For example, the result of
getRecommendRescorer(List, List)
is used with Recommend
.
The Rescorer
filters the candidates recommendations by item ID
(Rescorer.isFiltered(String)
) or modifies the scores of item candidates that
are not filtered (Rescorer.rescore(String, double)
) based on the item ID and
original score.
The factory methods take several optional String
arguments. These are passed
from the REST API, as several String
s, from URL parameter rescorerParams
.
The implementation may need this information to initialize its rescoring logic for the request.
For example, the argument may be the user's current location, used to filter
results by location.
For example, a request containing ...?rescorerParams=xxx,yyy,zzz
will result in an
args
parameter with one elements, xxx,yyy,zzz
. A request containing
...?rescorerParams=xxx&...rescorerParams=yyy&...rescorerParams=zzz...
will result in an
args
parameter with 3 elements, xxx
, yyy
, zzz
.
Modifier and Type | Method and Description |
---|---|
Rescorer |
getMostActiveUsersRescorer(List<String> args) |
Rescorer |
getMostPopularItemsRescorer(List<String> args) |
Rescorer |
getMostSimilarItemsRescorer(List<String> args) |
Rescorer |
getRecommendRescorer(List<String> userIDs,
List<String> args) |
Rescorer |
getRecommendToAnonymousRescorer(List<String> itemIDs,
List<String> args) |
Rescorer getRecommendRescorer(List<String> userIDs, List<String> args)
userIDs
- user(s) for which recommendations are being made, which may be needed
in the rescoring logic.args
- arguments, if any, that should be used when making the Rescorer
.
This is additional information from the request that may be necessary to its logic,
like current location. What it means is up to the implementation.Rescorer
to use or null
if none should be used.
The resulting Rescorer
will be passed each candidate item ID to
Rescorer.isFiltered(String)
, and each non-filtered candidate with its original score
to Rescorer.rescore(String, double)
Rescorer getRecommendToAnonymousRescorer(List<String> itemIDs, List<String> args)
itemIDs
- items that the anonymous user is associated toargs
- arguments, if any, that should be used when making the Rescorer
.
This is additional information from the request that may be necessary to its logic,
like current location. What it means is up to the implementation.Rescorer
to use or null
if none should be used.
The resulting Rescorer
will be passed each candidate item ID to
Rescorer.isFiltered(String)
, and each non-filtered candidate with its original score
to Rescorer.rescore(String, double)
Rescorer getMostPopularItemsRescorer(List<String> args)
args
- arguments, if any, that should be used when making the Rescorer
.
This is additional information from the request that may be necessary to its logic,
like current location. What it means is up to the implementation.Rescorer
to use or null
if none should be used. Note that
only its Rescorer.isFiltered(String)
method has effect.Rescorer getMostActiveUsersRescorer(List<String> args)
args
- arguments, if any, that should be used when making the Rescorer
.
This is additional information from the request that may be necessary to its logic,
like current location. What it means is up to the implementation.Rescorer
to use or null
if none should be used. Note that
only its Rescorer.isFiltered(String)
method has effect.Rescorer getMostSimilarItemsRescorer(List<String> args)
args
- arguments, if any, that should be used when making the Rescorer
.
This is additional information from the request that may be necessary to its logic,
like current location. What it means is up to the implementation.Rescorer
to use or null
if none should be used.
The Rescorer
will be passed, to its Rescorer.isFiltered(String)
method, the candidate item ID passed in the user query as its second element.
Each non-filtered pair is passed with its original score to
Rescorer.rescore(String, double)
Copyright © 2014–2018. All rights reserved.