"For You" Feeds
You've seen them everywhere – TikTok, Instagram Reels, Netflix, news apps. The "For You" feed (or Discover, Recommended, etc.) has become the cornerstone of modern digital experiences. It's a dynamic, seemingly magical stream of content – videos, products, articles, music – curated specifically for each individual user. Done right, it's incredibly engaging, keeps users coming back, increases time spent, and drives conversions. Done poorly, it's irrelevant, repetitive, and frustrating. The magic isn't actually magic; it's a complex symphony of data engineering, machine learning, and robust infrastructure.
Building a "For You" Feed with Shaped
Let's illustrate how much simpler it is using Shaped, adapting the concepts from a typical recommendation tutorial. (Imagine you've already connected your data sources using one of Shaped's connectors).
Goal: Create a personalized feed recommending relevant items (products, articles, videos, etc.) to users.
1. Ensure Data is Connected: Assume you have connected two primary data sources via Shaped connectors:
user_interactions
: A dataset containing events like views, clicks, likes, purchases (withuser_id
,item_id
,timestamp
,event_type
).content_metadata
(Optional but Recommended): A dataset with details about your items (e.g.,item_id
,title
,category
,description
, etc.).
2. Define Your Model (YAML): Create a simple YAML file to tell Shaped how to use your data.
model:
name: my_for_you_feed # Choose a name for your feed model
# Optional: How far back to look at interactions
# interaction_expiration_days: 180
connectors:
- type: Dataset
id: interactions_source # Alias used in the SQL below
name: user_interactions # Name of your interaction dataset in Shaped
- type: Dataset
id: content_source # Alias used in the SQL below
name: content_metadata # Name of your item metadata dataset
fetch:
# Define how to select interaction events
events: |
SELECT
user_id, -- User identifier
item_id, -- Content/Item identifier
timestamp, -- Interaction time (use the correct column name)
event_type -- e.g., 'view', 'like', 'purchase'
-- Optional: Create a 'label' for explicit signal training
-- CASE
-- WHEN event_type = 'purchase' THEN 1.0
-- WHEN event_type = 'like' THEN 0.8
-- ELSE 0.1 -- e.g., treat views as weaker positive signal
-- END as label
FROM interactions_source
-- Optional: WHERE clause to filter events
-- WHERE event_type IN ('view', 'like', 'purchase')
# Define how to select item metadata (optional but improves relevance)
items: |
SELECT
item_id,
title,
category,
description
-- Include other relevant item attributes
FROM contentsource
3. Create the Model via Shaped CLI:
shaped create-model --file my_for_you_feed_model.yaml
4. Monitor Model Training: Shaped handles the complex training process automatically. You can monitor the status:
shaped list-models
# Or: shaped view-model --model-name my_for_you_feed
The status progresses: SCHEDULING
-> FETCHING
-> TRAINING
-> TUNING
-> DEPLOYING
-> ACTIVE
. This can take minutes to hours depending on data size.
5. Fetch Personalized Feed Rankings: Once ACTIVE
, use the Rank API to get a personalized list of item IDs for any user. This is the core of your "For You" feed.
- Python
- JavaScript
- CLI
- Curl
from shaped import Shaped
shaped_client = Shaped() # Assumes SHAPED_API_KEY environment variable is set
response = shaped_client.rank(
model_name='my_for_you_feed',
user_id='USER_123', # Optional: for personalization
limit=5,
return_metadata=True,
)
print(f"Retrieved {len(response.metadata)} feed items.")
const { ShapedClient } = require('@shapedai/shaped');
const apiKey = process.env.SHAPED_API_KEY; // Assumes this is set in environment
const shapedClient = new ShapedClient({ apiKey: apiKey });
const response = await shapedClient.rank({
modelName: 'my_for_you_feed',
userId: 'USER_123',
limit: 5,
returnMetadata: true,
});
console.log(`Successfully retrieved ${response.metadata.length} feed items.`);
shaped rank --model-name my_for_you_feed --user-id 'USER_123' --limit 20
curl https://api.shaped.ai/v1/models/my_for_you_feed/rank \
-H "x-api-key: <YOUR_SHAPED_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"user_id": "USER_123",
"limit": 20,
"return_metadata": true # Optionally get item metadata back too
}'
Response Structure:
{
"ids": ["item_abc", "item_xyz", "item_123", ...], // Ranked item IDs
"scores": [0.95, 0.92, 0.88, ...], // Relevance scores
"metadata": [ // Optional: if return_metadata=true and item data connected
{"title": "Article Title A", "category": "Tech", ...},
{"title": "Product Name B", "category": "Apparel", ...},
...
]
}
Your application backend takes this list of ids
and fetches the full content/product details to render the feed UI.
That's it! Shaped handles the underlying data pipelines, model training, scaling, real-time serving, and optimization, allowing you to deploy a sophisticated "For You" feed dramatically faster and with significantly less internal resources than the standard approach.
Conclusion: Stop Building Infrastructure, Start Building Experiences
Building a truly personalized "For You" feed is a powerful way to engage users, but the standard path is paved with immense technical challenges requiring significant investment in specialized teams, infrastructure, and ongoing maintenance.
Shaped provides the managed AI platform to bypass this complexity. By connecting your data sources and defining your goals, you can leverage state-of-the-art machine learning to power world-class personalized feeds, allowing your team to focus on creating great user experiences, not wrestling with infrastructure.
Ready to build your killer "For You" feed the smarter way?
Request a demo of Shaped today to see it in action with your specific use case. Or, start exploring immediately with our free trial sandbox.