FirstBatch SDK
Search
K
Comment on page

Signals

User actions generate signals, which in turn update User Embeddings via the FirstBatch SDK. Essentially, these signals allow users to self-shape their experience within the application without requiring external data. In simpler terms, signals are specific actions performed by users that serve as a link between them and their embeddings.

Social App: An example

For example, consider a social app with various types of content. When a user likes a particular piece, say "content_2," the app can send this information to our backend through the "api/add_signal" API endpoint, along with parameters like user ID, action type, and content ID. On the backend, we add:
personalized.add_signal(session, UserAction(Signal.LIKE), "content_2")
This line will update the User Embeddings for that particular session. This action will influence the type of content recommended to the user, tailoring it based on the context of the liked content.
How LIKE action updates user embeddings
Different types of signals are defined by the Signal class.
personalized.add_signal(session, UserAction(Signal.LIKE), content_id)
personalized.add_signal(session, UserAction(Signal.AUTO_PLAY), content_id)

Why are weights important?

The weight of each signal influences its impact on the calculation of the embeddings. Contributions are computed using weighted averages. In some cases, signals with similar embeddings may be combined into a single signal.
FirstBatch SDK provides built-in signal types and their weights which can be used directly through Signalclass. Custom algorithms also allow custom signals, see Algorithm Design for more.
# Built-in Signal Types
DEFAULT = SignalType(label="default", weight=1.0)
ADD_TO_CART = SignalType("ADD_TO_CART", 16)
ITEM_VIEW = SignalType("ITEM_VIEW", 10)
APPLY = SignalType("APPLY", 18)
PURCHASE = SignalType("PURCHASE", 20)
HIGHLIGHT = SignalType("HIGHLIGHT", 8)
GLANCE_VIEW = SignalType("GLANCE_VIEW", 14)
CAMPAIGN_CLICK = SignalType("CAMPAIGN_CLICK", 6)
CATEGORY_VISIT = SignalType("CATEGORY_VISIT", 10)
SHARE = SignalType("SHARE", 10)
MERCHANT_VIEW = SignalType("MERCHANT_VIEW", 10)
REIMBURSED = SignalType("REIMBURSED", 20)
APPROVED = SignalType("APPROVED", 18)
REJECTED = SignalType("REJECTED", 18)
SHARE_ARTICLE = SignalType("SHARE_ARTICLE", 10)
COMMENT = SignalType("COMMENT", 12)
PERSPECTIVES_SWITCH = SignalType("PERSPECTIVES_SWITCH", 8)
REPOST = SignalType("REPOST", 20)
SUBSCRIBE = SignalType("SUBSCRIBE", 18)
SHARE_PROFILE = SignalType("SHARE_PROFILE", 10)
PAID_SUBSCRIBE = SignalType("PAID_SUBSCRIBE", 20)
SAVE = SignalType("SAVE", 8)
FOLLOW_TOPIC = SignalType("FOLLOW_TOPIC", 10)
WATCH = SignalType("WATCH", 20)
CLICK_LINK = SignalType("CLICK_LINK", 6)
RECOMMEND = SignalType("RECOMMEND", 12)
FOLLOW = SignalType("FOLLOW", 10)
VISIT_PROFILE = SignalType("VISIT_PROFILE", 12)
AUTO_PLAY = SignalType("AUTO_PLAY", 4)
SAVE_ARTICLE = SignalType("SAVE_ARTICLE", 8)
REPLAY = SignalType("REPLAY", 20)
READ = SignalType("READ", 14)
LIKE = SignalType("LIKE", 8)
CLICK_EMAIL_LINK = SignalType("CLICK_EMAIL_LINK", 6)
ADD_TO_LIST = SignalType("ADD_TO_LIST", 12)
FOLLOW_AUTHOR = SignalType("FOLLOW_AUTHOR", 10)
SEARCH = SignalType("SEARCH", 15)
CLICK_AD = SignalType("CLICK_AD", 6.0)