Home / Blogs

RealTimeML Email Recommendation Engine Part V: Sentiment Analysis

In our continuing series on RealTime machine learning recommendations for email, we will discuss the importance of Sentiment Analysis in RealTime for Email. The initial feedback we’ve received from the field to develop a Sentiment Analysis model has been extraordinary. We initially want to dissect why we feel this model is essential, determine the components needed to serve real-time machine learning recommendations for higher engagement rates before the campaign send, and tailoring sentiment to the types of emails companies send.

Sentiment Analysis, Predictions, and Recommendations

The Sentiment Analysis Model is currently the 5th model in the Loxz email recommendation portfolio and provides Sentiment Analysis parsed using Beautiful Soup from the previous HTMLs found from a large dataset of the text body of a digital marketing email campaign. Sentiment Analysis can also be extracted from the text module of the content editor on your platform. The model provides RealTime predictive insights and recommendations on the target conversion metric or target variable that you want to optimize for and how that conversion rate could substantially increase by altering the sentiment/tone of the campaign before sending. Most if not all, the models are explained and validated with accuracy scores.

Why Realtime Sentiment Analysis in Email?

Let us say you are creating a webinar-based email campaign, and you just put the finishing touches on the content of the email before sending the campaign. Chances are you do not have RealTime Predictions built into your system yet, and you might want to know how the campaign is going to convert with the current content? Since webinar-based emails must convert well, given that your organization has invested valuable resources and time for Webinar production, your email campaign must cover optimally. Using sentiment analysis gives you a fighting chance that the Webinar will be well-attended. Using the character count model described here on CircleID a few months back, initiating or running the sentiment analysis model simultaneously, you can immediately find higher engagement rates by perhaps striking a more urgent tone. Here is a sneak peek of a proposed output:

RealTime Machine Learning Sentiment Analysis for Email The content and, in particular, the “tone” is critical to each type of email campaign sent. For example, you might want to strike an “urgent” tone with Webinar based email or a more friendly manner with a product announcement type email. When you identify the type of campaign type and hit run, the model will devour historical data from previous campaigns, match them up with your target variable and provide immediate insights on the sentiment your email should have. Here are some of this models’ components:

The Dataset

The dataset we used to train the Sentiment Analysis model originated from UC Irvine, and the model was prepared by Mateo Martinez, a Data Scientist at Loxz Digital Group. The dataset contains 10,000 rows of data, including text and a tone classification. The data was collected using various web scraping techniques to create a balanced dataset representative of the eight sentiment classes this model evaluates for.

The data set used for the Predictive Analytics portion of this model has been curated from the UC Irvine ML Repository. This dataset contains a corpus of six thousand rows of data, containing the text body of randomly selected email campaigns. We used a Google Colab Notebook to develop and run the model.

In the Data Wrangling notebook, we created a few columns of synthetic data for many additional features that would be typical for an email campaign. We chose eight different types of tones that we think might be conducive to penning the content of your email campaign.

Types of Sentiment Tones Selected:

  • Confident
  • Friendly
  • Joyful
  • Respectful
  • Urgent
  • Analytical
  • Casual
  • Optimistic

The Model

The algorithm used for Predictive Analytics is an XGBoost Tree-Based model that creates synthetic alternate versions of your campaign to determine if a different iteration could yield a higher conversion rate. The Sentiment Analysis portion of this model uses a BERT Model (Bidirectional Encoder Representations from Transformers) to perform NLP and analyzes this text with a Tensorflow based Neural Network. The outputs of this BERT model are Sentiment Analysis scores, which I will outline below and recommendations as to which tone your subscribers would engage with most. For increased accuracy, ensemble techniques could be implemented for higher accuracy scores. Given that we are using a finite dataset, we used a model-centric approach in our training.

The Shape of the Model

When determining the model’s shape, we used 150 characters, which analyzes the text bi-directionally. Note: the Tone Scores are on a 0-1 scale, with 1 being the most robust possible sentiment. We felt 150 characters length were large enough, but this could be increased to any number of characters, such as 500, for example. Within every model we create, we evaluate an accuracy score, and the model will produce an accuracy output after the recommendations are served to pick a more accurate tone. The determination to use a more urgent tone on a webinar-based email was merely one example using output parameters generated by this example. Remember that the input parameters used for this example include but are not limited to:

  1. Target Variable: Click-Through-Rate
  2. Type of Email Campaign: Webinar Based
  3. Type of Industry: Software and Technology

The model will provide real-time recommendations based on the input parameters. Remember that your tone will change with each toggle or change in these input parameters, and the requests will change. So, if you are curating an email for the automotive industry, they might want to you prepare an email with a more “friendly or confident” tone. This is just one example of the many types of models in our portfolio. In a future post, and again from the feedback we are receiving from the field, we will share a new model we are building for an ESP that wants us to develop a time optimization model at the individual subscriber level, which is currently being trained. Essentially, using RealTimeML to predict when an email would be opened within a 15-minute time frame. The possibilities and value creation for your campaign builders are endless. I hope you enjoyed this segment of building and creating value for your Email Marketing Campaigns using an in-session RealTimeML Recommendation Engine.

By Fred Tabsharani, Founder and CEO at Loxz Digital Group

Fred Tabsharani is Founder and CEO of Loxz Digital Group, A Machine Learning Collective with an 18 member team. He has spent the last 15 years as a globally recognized digital growth leader. He holds an MBA from John F. Kennedy University and has added five AI/ML certifications, two from the UC Berkeley (SOI) Google, and two from IBM. Fred is a 10 year veteran of M3AAWG and an Armenian General Benevolent Union (AGBU) Olympic Basketball Champion.

Visit Page

Filed Under


Comment Title:

  Notify me of follow-up comments

We encourage you to post comments and engage in discussions that advance this post through relevant opinion, anecdotes, links and data. If you see a comment that you believe is irrelevant or inappropriate, you can report it using the link at the end of each comment. Views expressed in the comments do not represent those of CircleID. For more information on our comment policy, see Codes of Conduct.

CircleID Newsletter The Weekly Wrap

More and more professionals are choosing to publish critical posts on CircleID from all corners of the Internet industry. If you find it hard to keep up daily, consider subscribing to our weekly digest. We will provide you a convenient summary report once a week sent directly to your inbox. It's a quick and easy read.

I make a point of reading CircleID. There is no getting around the utility of knowing what thoughtful people are thinking and saying about our industry.

Co-designer of the TCP/IP Protocols & the Architecture of the Internet



Threat Intelligence

Sponsored byWhoisXML API

IPv4 Markets

Sponsored byIPv4.Global

Brand Protection

Sponsored byCSC

Domain Names

Sponsored byVerisign

New TLDs

Sponsored byRadix


Sponsored byDNIB.com


Sponsored byVerisign