Jonathan Gu

    Machine learning at Coframe

    Work

    Coframe uses AI to improve and personalize online stores. My part is the machine learning that decides what each shopper sees: which products appear beside the one they are looking at, the order of a category page, what search returns and what to suggest to someone hesitating over a cart.

    Search on One Kings Lane

    This is a search engine I built that runs in your browser, and you can type anything into it. Plain search only matches the exact words you typed, and my search forgives typos and looks for meaning when no word matches. Pick a kind of shopper and my search reorders its results for what that shopper has looked at.

    • Object
    • Art
    • Place
    • Person
    • Idea
    Grokipedia

    Shoppers

    Plain search

    No results

    My search

    1. Luxley Brass Crystal Chandelier Small$649E
    2. Yunlan Carved Wood Silk Chandelier$699E
    3. Adelmere Brass Six-Light Chandelier$449E
    4. Duskmere Brass Lantern Chandelier$349E
    5. Adelmere Brass Pleated Shade Chandelier$649E

    1. 1Instant answer

      Every keystroke gets an answer right away from a table built ahead of time. The personalized answer replaces it as soon as it is ready. An empty box shows what the shopper looked at last.

      Table
      CacheResults are cached per shopper and query. The products a query finds are cached once for every shopper, so a new shopper only reruns ranking. When a shopper looks at a product, their cached results are dropped. Word vectors are split into files by a word’s first two letters, and a file is fetched the first time a search needs a word in it.
      LatencyEach bar is one stage of this search, timed in your browser. Each stage is run many times and averaged, because one run is too fast for the browser’s clock. If the answer is not ready by the deadline, the page shows the table’s answer, or the best sellers among the products found.
    2. 2Finding products

      Words are matched against each product’s title and terms and scored with BM25, a standard text score. One wrong letter is forgiven in a word of four to seven letters, and two in a longer word. Embeddings run only when no word matches. There is no synonym table. Words like “she” or “why” are searched when they are the whole query.

      EmbeddingsAn embedding is a list of numbers that stands for a word’s meaning. Each strip is one vector of 100 numbers: the query on top, then the top products with their cosine similarity to the query. The star beside each strip is drawn from the same numbers.
      ESCIEach query and product pair gets a grade: Exact, Substitute, Complement or Irrelevant (ESCI). The scheme is from Amazon’s public Shopping Queries dataset, where people assigned the grades. Here a rule assigns them, and the grade is one of the ranker’s features.
    3. 3Ranking

      Boosted decision trees (LightGBM) predict expected revenue: what a product earns when it is shown and then bought within a day. That is blended with a best-seller score from 28 days of orders.

      Feature storeThe ranker reads its features from three shelves: one row per shopper, one per product, and one per query and product pair. Age is how long ago a row was written in this tab.
      Training rowsThe trees were trained on simulated shoppers. A row is one product shown in one search. The label is its revenue: the price if it was bought within a day, zero if not. A row lower on the page gets more weight, because fewer shoppers look that far down.
      TreesEach bar is what one feature added to or took from the picked product’s expected revenue. Model is each feature’s share of the gain in the trees.
    4. 4Rules

      Only products that are in stock and have a price are shown, one per product family, inside the category the query names.

      Rules

    This is a working copy on a made-up catalog: 202 products drawn from Poly Haven’s models, and 895 entries from outside the shop (art, objects, people, places and ideas), each listed as a print, a book, a cast or another form it could be sold in. Their pictures come from open museum collections, NASA, Wellcome Collection and Wikimedia Commons. Prices and sales are made up. The shoppers are simulated. Word vectors are GloVe. Plain search matches the words exactly as typed and lists every variant. None of the store’s data is here. Nothing you type leaves this page.

    Personalization on Demand

    Cooking newsletter

    1. Hearthby Brass Cooking Pot with Lid
    2. Hearthby Brass Pan with Wood Handle
    1. Hearthby Brass Pan with Wood HandleHearthby Brass Pan with Wood Handle
    2. Hearthby Brass Pot with Wood HandlesHearthby Brass Pot with Wood Handles
    3. Hearthby Brass Cooking Pot with LidHearthby Brass Cooking Pot with Lid
    4. Duskmere Brass Lantern ChandelierDuskmere Brass Lantern Chandelier
    5. Hawkmoor Brass Hurricane Lantern, LargeHawkmoor Brass Hurricane Lantern
    6. Rosewick Brass and Porcelain Oil LampRosewick Brass and Porcelain Oil Lamp
    7. Saltwick Brass Nautical CompassSaltwick Brass Nautical Compass
    8. Aldwick Tall Engraved Brass VaseAldwick Tall Engraved Brass Vase

    Best sellers

    Brass · 8

    1. Hawkmoor Brass Hurricane Lantern, Large
    2. Saltwick Brass Nautical Compass
    3. Duskmere Brass Lantern Chandelier
    4. Aldwick Tall Engraved Brass Vase
    5. Hearthby Brass Pan with Wood Handle
    6. Hearthby Brass Pot with Wood Handles
    7. Hearthby Brass Cooking Pot with Lid
    8. Rosewick Brass and Porcelain Oil Lamp

    Lighting ad

    1. Rosewick Brass and Porcelain Oil Lamp
    2. Duskmere Brass Lantern Chandelier
    1. Duskmere Brass Lantern ChandelierDuskmere Brass Lantern Chandelier
    2. Rosewick Brass and Porcelain Oil LampRosewick Brass and Porcelain Oil Lamp
    3. Hawkmoor Brass Hurricane Lantern, LargeHawkmoor Brass Hurricane Lantern
    4. Aldwick Tall Engraved Brass VaseAldwick Tall Engraved Brass Vase
    5. Saltwick Brass Nautical CompassSaltwick Brass Nautical Compass
    6. Hearthby Brass Pot with Wood HandlesHearthby Brass Pot with Wood Handles
    7. Hearthby Brass Pan with Wood HandleHearthby Brass Pan with Wood Handle
    8. Hearthby Brass Cooking Pot with LidHearthby Brass Cooking Pot with Lid
    • Lighting
    • Decor
    • Kitchen & Dining

    Hearthby Brass Pan with Wood Handle$69

    1. Cooking newsletter1
    2. Best sellers5
    3. Lighting ad7
    Average
    $0.56
    Views
    +$3.37
    Title
    +$0.25
    Price
    −$0.34
    Text
    −$0.21
    Hist.
    +$1.40
    Grade
    +$0.41
    Expected
    $5.43

    Made-up catalog. Same model as the search demo above. No store’s data is used.

    Read the essay

    Family

    Jonathan with his wife and their two kids on vacation, all four smiling
    The four of us.
    Everest and Maggie riding together in a green grocery cart in front of a wall of fruit
    Saturday groceries.
    Everest in a tie-dye shirt, standing in the late afternoon sun
    Everest in the afternoon sun.
    Maggie with two little pigtails, sitting by a bright window with flowers behind her
    Maggie by the window.
    Jonathan’s son and daughter laughing together at the kitchen table
    A birthday.
    Jonathan on a shaded walkway with Maggie in a baby carrier, Tina and Everest on a bench behind them
    Out for a walk.
    Everest at the table, gluing green paper triangles onto pink paper
    Everest applying glue.
    Maggie grinning on the rug in a green-trimmed bib
    Maggie.
    Everest outside in a blue fleece, holding a long branch in one hand and a toy truck in the other
    Everest with a stick and a truck.
    Maggie sitting on the rug in a knitted sweater, holding a blue stacking ring
    Maggie with stacking rings.

    Bikes

    On the balance bike, “help me” turned into “I do it.”

    Boats

    On the walk home along the water, every boat is named after someone in our family. The little boat is Maggie and the fat boat is Daddy.

    Trucks

    We look at monster trucks, fire trucks, trains and cranes up close and for a long time.

    Bedtime books

    We read five books every night at bedtime.

    Languages

    We speak Mandarin and English at home. The kids sing us the songs we sang to them.

    Pancakes

    On Saturdays we make pancakes. Everest mixes the batter and Maggie handles the cheese.