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
# Image processing function | |
# Usage: In the Terminal, run: bash images.sh | |
# Get user input and resize images | |
function process () { | |
# rename | |
a=1 | |
for i in *.${ext} | |
do |
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
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 |
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() |
""" | |
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. |
# 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) |
Generating image embeddings for Hub |
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
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', | |
} |
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): |