In this project , we are trying to improve the quality of product recommendations by using the A* search algorithm to navigate a grid of products based on their attributes. Currently, recommendation systems often struggle with providing highly relevant suggestions due to limitations in how they calculate similarity and handle diverse product attributes. We address these challenges by integrating advanced text embeddings, like Word2Vec and BERT, with traditional feature engineering, such as ratings and categories. By arranging products on a grid where rows and columns are determined by these combined features, we create a structured space for recommendations. The A* search algorithm, known for efficiently finding the shortest path, is then used to explore this grid, balancing product similarity and distance to find the best recommendation path. This approach not only improves the accuracy of recommendations but also provides a clear visual representation of the recommendation process, making it easier to understand and trust the system's suggestions.
This project focuses on building a recommendation system that uses the A* search algorithm to find the best path between products, aiming to improve the quality of recommendations by arranging products on a grid. Initially, the e-commerce dataset is cleaned and processed: missing values are handled, ratings are normalized, and product categories are converted into numerical form using one-hot encoding. Product descriptions are transformed into numerical vectors using Word2Vec and BERT embeddings, which capture the meaning of the text. Products are then placed on a 2D grid, where the rows represent hybrid filtering-based indices and columns represent embedding-based indices, ensuring a balanced spread of products across the grid.
To calculate how similar two products are, the project combines cosine similarity of their BERT embeddings with feature-based similarities like ratings and rating counts. The A* search algorithm, known for finding the shortest path in a graph, is used to navigate this grid. A* uses a heuristic, which in this context combines the physical distance on the grid (Manhattan distance) and the calculated product similarity. This heuristic helps A* efficiently explore the most promising paths from a start product to a destination product. The resulting path represents a sequence of recommended products. The A* search algorithm not only navigates within the same category but also transitions across different product categories as it traverses the grid. This capability provides significant insights and benefits. By transitioning between categories, the algorithm uncovers hidden relationships and similarities between products, improving the diversity and relevance of recommendations. This cross-category movement enables the identification of potential cross-selling opportunities, such as recommending accessories for electronics, thereby increasing the chances of multiple sales. Additionally, analyzing the paths taken by A* reveals user preferences and behavior patterns, helping to refine future recommendations and marketing strategies. This approach also improves the user experience by exposing them to a broader range of products, which can be especially beneficial for users who are open to exploring different options.
Many systems provide static recommendations that do not adapt well to changing user preferences or new product additions. Our grid-based approach and the dynamic nature of the A* algorithm allow for flexible and adaptive recommendations. New products with few ratings or interactions often get sidelined in traditional systems. By leveraging text embeddings and category information, our method can provide reasonable recommendations even for products with limited user interaction data. Searching through large datasets to find relevant products can be computationally intensive. The A* search algorithm, with its heuristic-driven approach, reduces the search space and improves efficiency, making it scalable to larger datasets.