WITH
-- userId, candidateId, attribution (eg click, purchase)
-- candidateid is listingId https://etsy.slack.com/archives/C01T5STE7DH/p1726850552184059?thread_ts=1726850305.245089&cid=C01T5STE7DH
attribution_tab AS (
SELECT
CAST(userId AS int) AS userId,
candidateId AS listingId
FROM
`etsy-sr-etl-prod.etl_data.search_attribution_hourly`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from glob import glob | |
import json | |
from tqdm import tqdm | |
# raw treatment -> gs://etsy-recsys-ml-dev-data-nxsn/user/vtang/updates-ranker-v1/metrics/prod_updates_2 | |
prod_fp = glob("./prod_updates_2/*") | |
prod_updates = {} # key = notification_feed_id, value = notification_type of candidate position 0 | |
for fp in tqdm(prod_fp): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import numpy as np | |
url = 'http://mmx-recsys-ingress.flop.search-infra.etsy-searchinfra-gke-prod-2.etsycloud.com/apiv2/general/rec_set/dynamic/recs' | |
headers = { | |
'accept': 'application/json', | |
'Content-Type': 'application/json', | |
} |
The Updates Ranker ranks notification types (eg thank you coupons).
The Updates Ranker will be used in the Deal tab.
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Generating image embeddings for Hub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# we know the following graph is nilpontent | |
m = np.array([[0, 1, 0, 0, 0, 0], | |
[0, 0, 1, 1, 0, 0], | |
[0, 0, 0, 0, 0, 0], | |
[0, 0, 0, 0, 1, 1], | |
[0, 0, 0, 0, 0, 1], | |
[0, 0, 1, 0, 0, 0]]) | |
for k in range(len(m)): | |
print(m) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
graph examples collected from https://www.cs.hmc.edu/~keller/courses/cs60/s98/examples/acyclic/ | |
in the first example, we have an acylic graph. there exists k such its adjacency | |
matrix m^k == 0. because we cant produce a path of arbitrarily high length (eg | |
greater than k), the graph does not have a cycle. | |
in the second example, we have a cyclic graph. there is no k where its adjacency | |
matrix m^k == 0. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_tokens(source): | |
"""convert source to tokens. | |
convert a string "(first (list 1 (+ 2 3) 9))" into a python list | |
['(', 'first', '(', 'list', '1', '(', '+', '2', '3', ')', '9', ')', ')']. | |
this conversion allows us to recursively inspect each element in the list. | |
""" | |
return source.replace('(',' ( ').replace(')',' ) ').split() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Vertex(object): | |
"""represent vertices in a tree/graph.""" | |
def __init__(self, name): | |
self.name = name | |
self.children = {} | |
self.status = None | |
def add_child(self, child): | |
key = child.name | |
self.children[key] = child |
git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
NewerOlder