Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      CodeSOD: A Highly Paid Field

      June 30, 2025

      Never Stop Exploring (July 2025 Wallpapers Edition)

      June 30, 2025

      How AI further empowers value stream management

      June 27, 2025

      12 Top ReactJS Development Companies in 2025

      June 27, 2025

      I never thought I’d praise a kickstand power bank – until I tried this one

      June 30, 2025

      I replaced my work PC with this Alienware laptop – now I’m wondering why I hadn’t done this sooner

      June 30, 2025

      How to set up Alexa to receive notifications on Prime Day deals you want

      June 30, 2025

      How proxy servers actually work, and why they’re so valuable

      June 30, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      What’s the difference between named functions and arrow functions in JavaScript?

      June 30, 2025
      Recent

      What’s the difference between named functions and arrow functions in JavaScript?

      June 30, 2025

      Spring Boot + Swagger: A Complete Guide to API Documentation

      June 30, 2025

      Wire Room Math: AI + SME = (Less Compensation Paid) X (Headline Risk + Payment Errors)^2

      June 30, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Orange Pi R2S Single Board Computer Running Linux: Introduction

      June 30, 2025
      Recent

      Orange Pi R2S Single Board Computer Running Linux: Introduction

      June 30, 2025

      vmstat – reports virtual memory statistics

      June 30, 2025

      cgames – collection of three ncurses games

      June 30, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Using AI to Compare Retail Product Performance

    Using AI to Compare Retail Product Performance

    June 30, 2025

    AI this, AI that. It seems like everyone is trying to shoehorn AI into everything even if it doesn’t make sense. Many of the use cases I come across online are either not a fit for AI or could be easily done without it. However, below I explore a use case that is not only a good fit, but also very much accelerated by the use of AI.

     

    The Use Case

    In the retail world, sometimes you have products that don’t seem to sell well even though they might be very similar to another product that does. Being able to group these products and analyze them as a cohort is the first useful step in understanding why.

     

    The Data and Toolset

    For this particular exercise I will be using a retail sales dataset from Zara that I got from Kaggle. It contains information about sales as well as the description of the items.

    The tools I will be using are:

      • Ollama (to run LLMs locally)
      • Gemma3 LLM
      • Python
          • Pandas
          • Langchain
      • Power BI
     

    High-level actions

    I spend a lot of my time design solutions and one thing I’ve learned is that creating a high-level workflow is crucial in the early stages of solutioning. It allows for quick critique, communication, and change, if needed. This particular solution is not very complex, nevertheless, below are the high-level actions we will be performing.

    1. Load the csv data onto memory using Pandas
    2. Create a Vector Store to store our embeddings.
      1. Embed the description of the products
    3. Modify the Pandas dataframe to accommodate the results we want to get.
    4. Create a template that will be sent to the LLM for analysis
    5. Process each product on its own
      1. Get a list of comparable products based on the description. (This is where we leverage the LLM)
      2. Capture comparable products
      3. Rank the comparable products based on sales volume
    6. Output the data onto a new CSV
    7. Load the CSV onto PowerBI for visualization
      1. Add thresholding and filters.

    The Code

    All of the code for this exercise can be found here

     

    The Template

    Creating a template to send to the LLM is crucial. You can play around with it to see what works best and modify it to fit your scenario. What I used was this:

     
    template = """<br>    You are an expert business analyst that specializes in retail sales analysis.<br>    The data you need is provided below. It is in dictionary format including:<br>    "Product Position": Where the product is positioned within the store,<br>    "Sales Volume": How many units of a given product were sold,<br>    "Product Category": The category for the product,<br>    "Promotion": Whether or not the product was sold during a promotion.<br>    There is additional information such as the name of the product, price, description, and more.<br>    Here is all the data you need to answer questions: {data}<br>    Here is the question to answer: {question}<br>    When referencing products, add a list of the Product IDs at the end of your response in the following format: 'product_ids = [<id1>, <id2>, ... ]'.<br>"""

    When we iterate, we will use the following as the question:

     
    question = f"Look for 5 products that loosely match this description: {product['description']}?"

     

    The output

    Once python does its thing and iterates over all the products we get something like this:

    Product ID Product Name Product Description Sales Volume Comparable Product 1 Comparable Product 2 … Group Ranking
    185102 BASIC PUFFER JACKET Puffer jacket made of tear-resistant… 2823 133100 128179 … 1
    187234 STRETCH POCKET OVERSHIRT Overshirt made of stretchy fabric…. 2575 134104 182306 … 0.75
    … … … … … … … …

     

    Power BI

    We then load the data onto Power BI to visualize it better. This will allow us to not only analyze the data using filtering and conditional formatting, but we can also explore the data even further with Copilot.

    Look at the screenshot below. I’ve initially setup conditional formatting so that all the products that rank low within their group are highlighted.

    I then used Copilot to ask how all of these relate to each other. It was quick to point out that all of them were jackets.

    Pbi Copilot

    This arms us with enough information to go down a narrower search to figure out why the products are not performing. Some other questions we could ask are:

    1. Is this data seasonal and only includes summer sales?
    2. How long have these jackets been on sale?
    3. Are they all sold within a specific region or along all the stores?
    4. etc.

    Conclusion

    Yes, there are many, many use cases that don’t make sense for AI, however there are many that do! I hope that what you just read sparks some creativity in how you can use AI to further analyze data. The one thing to remember is that in order for AI to work as it should, it needs contextual information about the data. That can be accomplished via semantic layers. To know more, got to my post on semantic layers. 

    Do you have a business problem and need to talk to an expert about how to go about it? Are you unsure how AI can help? Reach out and we can talk about it!

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleLaravel Virtual Wallet
    Next Article Wire Room Math: AI + SME = (Less Compensation Paid) X (Headline Risk + Payment Errors)^2

    Related Posts

    Artificial Intelligence

    Introducing Gemma 3

    June 30, 2025
    Artificial Intelligence

    Experiment with Gemini 2.0 Flash native image generation

    June 30, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    the bridal beauty team

    Web Development

    KDE Plasma 6.3.5 Update Available to Kubuntu Users

    Linux

    AI for the board game Diplomacy

    Artificial Intelligence

    SPD: Sync-Point Drop for Efficient Tensor Parallelism of Large Language Models

    Machine Learning

    Highlights

    June 2025 Patch Tuesday: One Zero-Day and Nine Critical Vulnerabilities Among 66 CVEs

    June 11, 2025

    June 2025 Patch Tuesday: One Zero-Day and Nine Critical Vulnerabilities Among 66 CVEs

    Microsoft has addressed 66 vulnerabilities in its June 2025 security update release. This month’s patches include fixes for one actively exploited zero-day vulnerability and nine Critical vulnerabilit …
    Read more

    Published Date:
    Jun 11, 2025 (1 hour, 21 minutes ago)

    Vulnerabilities has been mentioned in this article.

    CVE-2025-47953

    CVE-2025-47172

    CVE-2025-47167

    CVE-2025-47164

    CVE-2025-47162

    CVE-2025-33073

    CVE-2025-33071

    CVE-2025-33070

    CVE-2025-33053

    CVE-2025-32710

    CVE-2025-29828

    CVE-2025-6295 – Code-projects Hostel Management System SQL Injection

    June 19, 2025

    CVE-2025-6340 – School Fees Payment System Cross-Site Scripting Vulnerability

    June 20, 2025

    CVE-2025-5714 – SoluçõesCoop iSoluçõesWEB Profile Information Update Path Traversal Vulnerability

    June 6, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.