Skip to main content

Trending Items Ranking

Shaped can be used for non-personalized ranking of trending items. Trending items means more than just the most popular items because it also takes into account recency of the items and the rate-of-change of their popularity over a short period. This is a common use-case of Shaped, and can supplement the personalized recommendation options. For example, you might want to have a carousel or feed that shows trending items, but also have a personalized 'For You' feed that shows the most relevant items just to that user.

This guide will show you how easy it is to retrieve these trending item rankings after you've created your Shaped model.

Model Creation

You can use trending items ranking with any of Shaped's models. The popularity of the items is determined by the counts of interactions and the recency of this popularity is determined by the interactions created_at timestamps. We automatically determine the recency period for your trending items and can detect real-time micro-trends if you attach a real-time event connector.

All you need to do to fetch trending items is make a rank request without specifying the user_id argument. This will return the global top trending items. Here's an example with our rank CLI:

shaped rank --model-name video_recommendations --limit 5

And with our REST endpoint:

curl https://api.prod.shaped.ai/v1/models/{model_name}/rank \
-H "x-api-key: <API_KEY>" \
-H "Content-Type: application/json"
-d '{
"limit": 10,
}'

Conclusion

Now that you've seen how to use the Rank API to retrieve trending items, you can use it to build real-time popular item feeds and carousels for your users.