meaningful stories

Using AI For Sentiment Analysis and Predictive Analytics

Apoorv Nandan
CTO & Co-founder
July 10, 2023

With DALL-E 2 and ChatGPT, OpenAI helped break AI out of the tech bubble and into the broader public's consciousness.

It’s clear to see why-generating any image you can dream of and talking to a bot that can pretend to be an expert in just about anything-it’s just outright magical stuff.

The thing is though, GPT3 didn’t come out in December-it was released 3 years ago.

The reason ChatGPT gained so much traction is really quite simple-the base tech was productized for consumer.

Soon, the same is going to happen for how we work.

The fundamental tech (which already exists) will be built into new product experiences that entirely change how data analysts go about their day.

Today, we’ll focus on business analysts, and why they ought to look forward to, and not be afraid of AI.


This advanced understanding of language context and nuance opens up a host of applications for business analytics.

With the proliferation of transformer models like GPT-3.5, sentiment analysis can be undertaken with greater sophistication than ever before, in a manner that is economically feasible. Traditional sentiment analysis techniques typically rely on lexical approaches (i.e., the presence of particular 'positive' or 'negative' words) and often struggle to grasp the subtleties of human language such as sarcasm, idioms, and cultural nuances. Models like GPT-4, by contrast, can better understand the context of language and can thus provide an even more nuanced analysis; in some cases, definitely better than even most people could do over a large volume of data.

How Does It Work?

Consider the mechanics of transformers: self-attention mechanisms allow them to weight the importance of words in context. They don’t merely look at individual words but also consider the position of words in relation to each other within the sentence.

They weigh the importance of words in context, considering both individual words and their positions, resulting in their impressive ability to understand and generate meaningful text.

In practice, this capability is achieved by feeding the transformer model a sequence of token embeddings, which are vector representations of words. The model then uses a combination of self-attention and feed-forward neural networks to convert these tokens into a new sequence of vectors. This sequence can then be fed into a classification layer (such as a softmax layer) to generate a sentiment score.

Real World Applications Of Sentiment Analysis

Using customer reviews as our use case, a transformer model's capability to analyze and understand text shines especially brightly in handling intricate language structures, cultural nuances, and contextual semantics.

1. Unpacking Complex Language Constructs

Consider a review like this: "I wouldn't say the product isn't useful." To a traditional sentiment analysis tool, the presence of negative terms might lead it to interpret this as a negative sentiment. However, a transformer model, with its attention mechanism, can understand the double negative ("wouldn't" and "isn't") and accurately interpret the review as expressing positive sentiment.

Similarly, a phrase like "It's not the best product I've used, but it gets the job done." includes both positive and negative sentiments. A transformer model could identify this nuanced sentiment better by understanding the context. It could assign a neutral or mildly positive sentiment score, reflecting the mixed sentiment in the review.

2. Grasping Idiomatic Expressions & Sarcasm

Idioms, sarcasm, and other nuanced language constructs pose another challenge for traditional sentiment analysis tools. A phrase like "This software is the bomb!" might be classified as negative by a keyword-based sentiment analysis tool due to the word "bomb." However, a transformer model would understand the idiomatic use of "bomb" as a positive sentiment.

Sarcasm, such as "Oh great, another software update," poses similar challenges. The word "great" might lead a traditional sentiment analysis tool to classify this as positive. In contrast, a transformer model can understand the sarcastic context from the sequence of the sentence, correctly identifying the sentiment as negative.

3. Cultural References & Contextual Semantics

Finally, cultural references or region-specific slang that could be critical in understanding the sentiment of a review are handled adeptly by transformer models.

For instance, a review like "This app is the bee's knees!" uses a slang phrase that means "excellent" in certain English-speaking cultures. A transformer model, if trained on a diverse enough dataset, could pick up on this and correctly interpret the sentiment as positive.

4. Enhanced Analytics & Actionable Insights

By accurately understanding the sentiment in customer reviews, businesses can gain deeper, more nuanced insights into their customers' experiences that they might have otherwise not been able to with currently prevalent analytics tools. This information can guide everything from product development to customer service strategies.

Feature Analysis

A transformer model could be used to highlight the aspects of a product or service that are mentioned most frequently in reviews, both positively and negatively.This would allow businesses to prioritize areas for improvement or capitalize on strengths more effectively.

Real Time Analysis

Furthermore, such tools can process large volumes of reviews quickly, providing near-real-time sentiment analysis. This rapid processing allows businesses to react more swiftly to emerging trends or issues in customer sentiment, offering a potential competitive advantage.

In essence, today's LLMs offer a powerful, sophisticated tool for sentiment analysis that can handle the complexities of human language with remarkable accuracy. By leveraging these models, businesses can gain deeper insights into customer sentiment, drive product improvements, and deliver a better customer experience.


To understand how these models can help predictive analytics, let’s consider their use in managing churn, an obviously crucial metric.

Understanding user interactions with different product features can provide crucial insights into churn prediction. In the context of product analytics, transformer models can analyze detailed usage data and learn complex patterns that may indicate a user is at risk of churning.

How Does It Work?

Instead of relying on shallow metrics such as frequency or recency of use, transformer models can process sequences of user interactions in a granular fashion. For instance, they can learn from the order of actions, time spent on each feature, navigation paths through the product, feature combinations used, and more.

The model is trained on sequences of these user interactions represented as token embeddings. For example, different features or buttons within the product could be represented as different tokens, and the sequence in which a user interacts with these features becomes the input sequence for the model.

The model uses its self-attention mechanism to understand the temporal and contextual dependencies between these interactions. For example, a user who frequently encounters errors or spends less time on a key feature may be more likely to churn.

Real World Applications Of Predictive Analysis

Consider a SaaS product. Each user interaction, whether it's clicking a button, using a feature, or even hovering over a certain part of the interface, generates a sequence of tokens. This sequence is the narrative of the user's journey through the product.

The transformer model can be trained on these sequences to identify patterns that precede churn. It could find that users who rarely use a core feature, or who frequently use a feature that's not central to the product's value proposition, are more likely to churn. Or it might recognize that users who start to use the product less frequently, or whose sessions become shorter and shorter, are also at risk.

The model's ability to understand these sequences in a holistic, context-aware manner allows it to pick up on subtleties that simpler models might miss. It might learn, for example, that a user who abandons a certain feature midway through using it is more likely to churn, indicating that the feature might be too complex or not valuable enough.

Moreover, the model can consider multiple factors simultaneously. It could identify a group of users who use certain features less frequently but are not at risk of churn, and another group where decreased usage does indicate churn risk. This nuanced understanding can help pinpoint specific areas of the product that need improvement.

With these insights, product teams can not only identify at-risk users before they churn but also glean insights into which aspects of the product may be contributing to churn. This allows them to make targeted improvements to enhance user satisfaction and retention.

In conclusion, transformer models offer a powerful, nuanced tool for predicting customer churn based on user interactions. By leveraging these models, product teams can make more informed, proactive decisions and significantly improve their user retention strategies. AI shouldn't be seen as a threat to product analytics but rather an invaluable tool that can drive deeper insights and more effective strategies.

Modern LLMs' capacity to decipher complex language constructs, grasp cultural nuances, and recognize intricate patterns makes them invaluable in business analytics.

From mining nuanced sentiments out of customer reviews to predicting customer churn with remarkable detail, these models enhance the ability to extract actionable insights. They not only bolster the understanding of user behavior but also illuminate areas that need improvement, enabling businesses to make informed and proactive decisions.

For business analysts, these AI models should not be seen as a threat, but as an extraordinary tool that amplifies their analytical capabilities. AI is not here to replace us but to augment our skills, and the magic of transformer models lies in their potential to equip us with deeper understanding and predictive abilities.

This is exactly what Crunch brings to the table.

Your co-pilot for analytics.

Sign up for our waitlist here!

Tell meaningful stories

Read similar blogs


The ultimate intelligent data layer for every business

Get Started With Crunch