Skip to main content

User and Item Embeddings

Embeddings lie at the heart of modern recommendation systems, capturing the complex relationships between users and items in a multi-dimensional space. Shaped allows you to access and leverage these powerful representations through dedicated endpoints for generating user and item embeddings.

Accessing the Building Blocks: create-item-embedding and create-user-embedding

Shaped provides two dedicated endpoints to generate embeddings:

1. Item Embeddings:

shaped create-item-embedding \
--model-name your-model-name \
--item-ids ["your-item-id1", "your-item-id1"]

2. User Embeddings:

shaped create-user-embedding \
--model-name your-model-name \
--user-ids ["your-user-id1", "your-user-id1"]

Simply provide the desired model name and a list of item IDs or user IDs to retrieve their corresponding embeddings.

Understanding Embeddings

Embeddings are dense vector representations of users and items, capturing their essential characteristics and relationships. Items with similar embeddings share underlying features or appeal to similar user groups. Likewise, users with similar embeddings exhibit similar preferences or behaviors.

Use Cases for Generated Embeddings

Accessing these raw embeddings unlocks a world of possibilities:

  • Build Custom Recommendation Systems: Integrate Shaped's embeddings into your own algorithms or machine learning models to create highly customized recommendation systems tailored to your specific needs.
  • Power Similarity Search: Efficiently find similar users or items based on their embedding vectors. This can power features like "Users who liked this also liked..." or recommend related products.
  • Visualize User and Item Relationships: Project embeddings into lower-dimensional spaces using techniques like t-SNE or UMAP to visualize clusters and patterns in your data, gaining insights into user preferences and item relationships.
  • Enhance Cold-Start Recommendations: Use item embeddings to recommend new or less popular items that are similar to those a user has previously interacted with, even if those items have limited interaction history.

Example: Building a Simple Item Similarity Engine

Let's say you want to recommend similar items using Shaped's embeddings:

  1. Retrieve Embeddings: Use create-item-embedding to generate embeddings for your items.
  2. Calculate Similarity: Employ a similarity metric like cosine similarity to compare the embeddings of different items.
  3. Rank and Recommend: For a given item, rank other items based on their similarity scores and recommend the top-ranking items.

Conclusion

Shaped's create-item-embedding and create-user-embedding endpoints provide valuable building blocks for advanced recommendation tasks and data exploration. By accessing these underlying representations, you gain deeper insights into your data and unlock the flexibility to build highly customized recommendation systems tailored to your unique requirements.