1 Answer
- Newest
- Most votes
- Most comments
0
I was able to print out the scores for GetPersonalizedRanking with AWS SDK JavaScript version 2.1404.0 and Node version 20.3.1, I ran the code below in my local environment:
const AWS = require('aws-sdk')
AWS.config.update({
accessKeyId: 'INSERT-ACCESS-KEY',
secretAccessKey: 'INSERT-SECRET-KEY',
region: "us-east-1"
})
const personalize = new AWS.PersonalizeRuntime();
var params = {
campaignArn: "arn:aws:personalize:us-east-1:account:campaign/example-campaign-name",
inputList: ['257', '201', '495', '399', '184', '919', '222', '227', '450', '151', '373', '380'],
userId: '2',
context: {}
};
personalize.getPersonalizedRanking(params, (err,data) => {
if(err){
console.log(err);
}else{
console.log(JSON.stringify(data.personalizedRanking));
const rankedItems = data.personalizedRanking.map ((item) => item.itemId);
console.log("OUTPUT " + rankedItems);
}
});
I then received an output with the scores, below is an example:
{
"itemId": "495",
"score": 0.988938,
"promotionName": null
}
I suggest checking the SDK and Node versions that you are using and try the versions I have used here to see if the scores will appear in the output. But should you still face an issue of scores being excluded in the response, then I would suggest raising a case with AWS Premium Support [1] for further troubleshooting to understand why the scores are not being passed.
I hope this helps.
Reference:
answered 10 months ago
Relevant content
- asked a year ago
- asked 4 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 2 years ago
Thank you. It was indeed the sdk version.