# Like peanut butter? This algorithm has a hunch as to what you'll buy next

Recommendation algorithms can make a customer's online shopping experience quicker and more efficient by suggesting complementary products whenever the shopper adds a product to their basket. Did the customer buy peanut butter? The algorithm recommends several brands of jelly to add next.

These algorithms typically work by associating purchased items with items other shoppers have frequently purchased alongside them. If the shopper's habits, tastes, or interests closely resemble those of previous customers, such recommendations might save time, jog the memory, and be a welcome addition to the shopping experience.

But what if the shopper is buying peanut butter to stuff a dog toy or bait a mousetrap? What if the shopper prefers honey or bananas with their peanut butter? The algorithm will offer less useful suggestions, costing the retailer a sale and potentially annoying the .

New research led by Negin Entezari, who recently received a doctoral degree in computer science at UC Riverside, Instacart collaborators, and her doctoral advisor Vagelis Papalexakis, brings a methodology called tensor decomposition—used by scientists to find patterns in massive volumes of data—into the world of commerce to recommend complementary products more carefully tailored to customer preferences.

Tensors can be pictured as multi-dimensional cubes and are used to model and analyze data with many different components, called multi-aspect data. Data closely related to other data can be connected in a cube arrangement and related to other cubes to uncover patterns in the data.

"Tensors can be used to represent customers' shopping behaviors," said Entezari. "Each mode of a 3-mode tensor can capture one aspect of a transaction. Customers form one mode of the tensor and the second and third mode captures product-to-product interactions by considering products co-purchased in a single transaction."

For example, three hypothetical shoppers—A, B, and C— make the following purchases:

• A: Buys hot , hot dog buns, Coke, and mustard in one transaction.
• B: Makes three separate transactions: Basket 1: Hot dogs and hot dog buns; Basket 2: Coke; Basket 3: Mustard
• C: Hot dogs, hot dog buns, and mustard in one transaction.

To a conventional matrix-based algorithm, Customer A is identical to Customer B because they bought the same items. Using tensor decomposition, however, Customer A is more closely related to Customer C because their behavior was similar. Both had similar products co-purchased in a single transaction, even though their purchases differed slightly.

The typical recommendation algorithm makes predictions based on the item the customer just purchased while tensor decomposition can make recommendations based on what is already in the user's whole basket. Thus, if a shopper has dog food and in their basket but no bread, a tensor-based recommendation algorithm might suggest a fillable dog chew toy instead of jelly if other users have also made that purchase.

"Tensors are multidimensional structures that allow modeling of complex, heterogeneous data," said Papalexakis, an associate professor of computer science and engineering. "Instead of simply noticing which products are purchased together, there's a third dimension. These products are purchased by this kind of user and the algorithm tries to determine which kinds of users are creating this match."

To test their method, Entezari, Papalexakis, and co-authors Haixun Wang, Sharath Rao, and Shishir Kumar Prasad, all researchers for Instacart, used an Instacart public dataset to train their . They found that their method outperformed state-of-the-art methods for predicting customer-specific complementary product recommendations. Though more work is needed, the authors conclude that big data tensor decomposition could eventually find a home in big business as well.

"Tensor methods, even though very powerful tools, are still more popular in academic research as far as recommendation systems go," said Papalexakis. "For industry to adopt them we must demonstrate it's worthwhile and relatively painless to substitute for whatever they have that works already."

While previous research has shown the benefits of tensor modeling in recommendation problems, the new publication is the first to do so in the setting of complementary item recommendation, bringing tensor methods closer to industrial adoption and technology transfer in the context of recommendation systems.

"Tensor methods have been adopted successfully by industry before, with chemometrics and being great examples, and every attempt like our work demonstrates the versatility of methods in being able to tackle such a broad range of challenging problems in different domains," said Papalexakis.

The paper, "Tensor-based complementary product recommendation," was presented at IEEE Big Data 2021.

More information: Negin Entezari et al, Tensor-based Complementary Product Recommendation, 2021 IEEE International Conference on Big Data (Big Data) (2022). DOI: 10.1109/BigData52589.2021.9671938

Feedback to editors