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

      Sentry launches MCP monitoring tool

      August 14, 2025

      10 Benefits of Hiring a React.js Development Company (2025–2026 Edition)

      August 13, 2025

      From Line To Layout: How Past Experiences Shape Your Design Career

      August 13, 2025

      Hire React.js Developers in the US: How to Choose the Right Team for Your Needs

      August 13, 2025

      I’ve tested every Samsung Galaxy phone in 2025 – here’s the model I’d recommend on sale

      August 14, 2025

      Google Photos just put all its best editing tools a tap away – here’s the shortcut

      August 14, 2025

      Claude can teach you how to code now, and more – how to try it

      August 14, 2025

      One of the best work laptops I’ve tested has MacBook written all over it (but it’s even better)

      August 14, 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

      Controlling Execution Flow with Laravel’s Sleep Helper

      August 14, 2025
      Recent

      Controlling Execution Flow with Laravel’s Sleep Helper

      August 14, 2025

      Generate Secure Temporary Share Links for Files in Laravel

      August 14, 2025

      This Week in Laravel: Filament 4, Laravel Boost, and Junie Review

      August 14, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      KDE Plasma 6 on Wayland: the Payoff for Years of Plumbing

      August 14, 2025
      Recent

      KDE Plasma 6 on Wayland: the Payoff for Years of Plumbing

      August 14, 2025

      FOSS Weekly #25.33: Debian 13 Released, Torvalds vs RISC-V, Arch’s New Tool, GNOME Perfection and More Linux Stuff

      August 14, 2025

      Ultimate ChatGPT-5 Prompt Guide: 52 Ideas for Any Task

      August 14, 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 IDProduct NameProduct DescriptionSales VolumeComparable Product 1Comparable Product 2…Group Ranking
    185102BASIC PUFFER JACKETPuffer jacket made of tear-resistant…2823133100128179…1
    187234STRETCH POCKET OVERSHIRTOvershirt made of stretchy fabric….2575134104182306…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

    Development

    Controlling Execution Flow with Laravel’s Sleep Helper

    August 14, 2025
    Development

    Generate Secure Temporary Share Links for Files in Laravel

    August 14, 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

    7 accessibility features in Windows 11 that make life easier for everyone

    News & Updates

    Wyze wants to keep prying eyes away from your cameras with this new feature

    News & Updates

    Everything coming to Call of Duty: Black Ops 6 multiplayer with Season 3

    News & Updates

    CVE-2025-41646 – Apache Software Type Confusion Authentication Bypass

    Common Vulnerabilities and Exposures (CVEs)

    Highlights

    CVE-2025-23172 – “Versa Networks Director Webhook Command Execution”

    June 18, 2025

    CVE ID : CVE-2025-23172

    Published : June 19, 2025, 12:15 a.m. | 1 hour, 47 minutes ago

    Description : The Versa Director SD-WAN orchestration platform includes a Webhook feature for sending notifications to external HTTP endpoints. However, the “Add Webhook” and “Test Webhook” functionalities can be abused by an authenticated user to send crafted HTTP requests to localhost. This can be leveraged to execute commands on behalf of the versa user, who has sudo privileges, potentially leading to privilege escalation or remote code execution.

    Exploitation Status:

    Versa Networks is not aware of any reported instance where this vulnerability was exploited. Proof of concept for this vulnerability has been disclosed by third party security researchers.

    Workarounds or Mitigation:

    There are no workarounds to disable the GUI option. Versa recommends that Director be upgraded to one of the remediated software versions.

    Severity: 7.2 | HIGH

    Visit the link for more details, such as CVSS details, affected products, timeline, and more…

    CVE-2025-4140 – Netgear EX6120 Remote Buffer Overflow Vulnerability

    April 30, 2025

    Using Manim For Making UI Animations

    April 11, 2025

    DuckDuckGo browser expands Scam Blocker to catch more fake sites and scareware

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

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