Skip to content

Instantly share code, notes, and snippets.

@mynameisvinn
Created April 11, 2024 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mynameisvinn/b199a0b0cb1cb849e25749ce337d3afb to your computer and use it in GitHub Desktop.
Save mynameisvinn/b199a0b0cb1cb849e25749ce337d3afb to your computer and use it in GitHub Desktop.

Updates Ranker

Overview

The Updates Ranker ranks notification types (eg thank you coupons).

Surface

The Updates Ranker will be used in the Deal tab.

Runbook

Generate User and Global Notification Features

Notification features (eg user click rate for various notification types, triggers, and sources) are generated via a Sparkly job. These features are moved to FBv2 via the recs_ranking_updates_features_fbv2 DAG

A notification consists of three features:

  • notification_source:

    • Possible values include: 'cart_listing', 'collection', 'favorite_listing', 'favorite_shop', 'purchased_shop', 'saved_for_later_listing'
  • notification_trigger:

    • Possible triggers are: 'coupon', 'in_stock', 'new_listings', 'on_sale', 'only_1_left', 'recommendations'
  • notification_type:

    • Types include: 'aco', 'asfl', 'cr', 'fbis', 'nfyfs', 'ofl', 'psfcl', 'psffl', 'psffs', 'pssfl', 'rfc', 'tyc'

Implicit Feedback

Notification events (denoted by notification_feed_id) are scanned and collected in the reranking feedback DAG. It can be found here.

Attributed Data

Implicit feedback is joined with user and candidate features via a Time Machine DAG to produce training data (which can be found in gs://etldata-prod-recsys-data-hkwv8r/data/shared/recsys/updates_ranker/updates_ranker_features/)

Preprocessing

Inputs to be preprocessed is specified in this spec and processed via a Beam job.

Training

Evaluation

Barista

Komodo

Expected input:

{
    "name": "updates-ranker-v1",
    "version": "v1",
    "inputNames": [
      "candidate",		// listing id
      "notification_source",
      "notification_trigger",
      "notification_type",
      "target",		// listing id
      "user"			// user id
    ],

Client Request

// MMX REQUEST PATH
/apiv2/notification/rec_set/ranking-v1/recs

// MMX REQUEST BODY
[03-Apr-2024 16:31:47 UTC] Array
(
    [coreParams] => Array
        (
            [limit] => 45
            [modulePlacement] => boe_notifications_feed
            [featureLoggingEnabled] =>
        )

    [recSetParams] => Array
        (
            [userId] => 31887901
            [feedLastSeenOn] => 1709653875
            [candidates] => Array
                (
                    [0] => Array
                        (
                            [notificationId] => 0
                            [notificationType] => nfyfs
                            [source] => favorite_shop
                            [trigger] => new_listings
                            [createdOn] => 1712159763
                            [isSeen] =>
                            [hasCta] =>
                            [listingIds] => Array
                                (
                                    [0] => 1707908963
                                )

                            [shopIds] => Array
                                (
                                    [0] => 5613760
                                )

                        )
                )
        )
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment