@Singleton @Path(value="/recommend") public final class Recommend extends AbstractOryxResource
Responds to a GET request to
/recommend/[userID](?howMany=n)(&offset=o)(&considerKnownItems=c)(&rescorerParams=...)
Results are recommended items for the user, along with a score. Outputs contain item and score pairs, where the score is an opaque value where higher values mean a better recommendation.
offset
is an offset into the entire list of results; howMany
is the desired
number of results to return from there. For example, offset=30
and howMany=5
will cause the implementation to retrieve 35 results internally and output the last 5.
If howMany
is not specified, defaults to 10. offset
defaults to 0.
considerKnownItems
causes items that the user has interacted with to be
eligible to be returned as recommendations. It defaults to false
, meaning that these
previously interacted-with items are not returned in recommendations.
If the user is not known to the model, a Response.Status.NOT_FOUND
response is generated.
Default output is CSV format, containing id,value
per line.
JSON format can also be selected by an appropriate Accept
header. It returns
an array of recommendations, each of which has an "id" and "value" entry, like
[{"id":"I2","value":0.141348009071816},...]
INPUT_PRODUCER_KEY, MODEL_MANAGER_KEY
Constructor and Description |
---|
Recommend() |
Modifier and Type | Method and Description |
---|---|
List<IDValue> |
get(String userID,
int howMany,
int offset,
boolean considerKnownItems,
List<String> rescorerParams) |
check, check, checkExists, checkNotReadOnly, getServingModel, isReadOnly, maybeBuffer, maybeBuffer, maybeDecompress, parseMultipart, sendInput
getInputProducer, getServingModelManager, init
@GET @Path(value="{userID}") @Produces(value={"text/plain","text/csv","application/json"}) public List<IDValue> get(@PathParam(value="userID") String userID, @DefaultValue(value="10") @QueryParam(value="howMany") int howMany, @DefaultValue(value="0") @QueryParam(value="offset") int offset, @DefaultValue(value="false") @QueryParam(value="considerKnownItems") boolean considerKnownItems, @QueryParam(value="rescorerParams") List<String> rescorerParams) throws OryxServingException
OryxServingException
Copyright © 2014–2018. All rights reserved.