The Current Level of #ReasonsTo Happiness

This is an example of Azure Machine Learning analysing the sentiment of tweets to the #ReasonsTo hashtag using a pre-built API, which is part of Microsoft's Project Oxford and Azure Machine Learning API’s

This was built as a demo for the Tuesday morning keynote session at Reasons to be Creative. It was delivered live at the conference to show how someone who does not come from a machine learning background can use the publically available (and free) APIs to add aspects of Machine Learning(ML) to their websites and applications on any platform.

This demo is built using the power of the cloud computing platform, Azure. Initially the code makes a call to the Twitter API and searches for tweets containing the specified hashtag (example: #welc2017 and #reasonsto). For each tweet received, an API call is made to the Text Analytics machine learning API to retrieve the sentiment of the tweet. The details from the Twitter API, and the sentiment assigned by the ML API, are combined together and sent to the cloud.

Azure has a great data ingestion service call Event Hubs, which can consume millions of events per second so that you can process and analyse huge amounts of data at a time. In our ever growing data culture this is more important than ever. Each tweet is then passed on to Azure Stream Analytics to be processed and gain real time insights from. The stream analytics query, written using T-SQL, aggregates the tweets sentiment over a 60 second sliding window of time.

Now we have an aggregated sentiment value for all the tweets, to the specified hashtag, over the last 60 seconds, we then then post them back to the event hub and surface them in a web application running on Azure, our glowing orb front-end 

The idea is it provides a visual 'pulse' of what the current sentiment is from people tweeting about the event - this was an idea that we came up with so that if you're speaking at an event and your session has a specific hashtag then you can see the public reaction to your session, live as you're speaking!

In the top right corner is the value that the ML API assigns to the sentiment, you can see this value change from 0 to 100, 0 being very negative and 100 being very positive. The visualiser is a CSS animation that has 10 different visual states so depending on the sentiment value (0-100) is can either be red (0) amber (50) or green (100).

If you want to understand more about this demo and maybe build one yourself, take a look at some of the resources below and start building intelligence into your applications today:

Azure Machine Learning Studio

Project Oxford Machine Learning API’s

Microsoft Virtual Academy online learning platform

Reasons to be Creative sentiment pulse

To see this demo in action, check out this link:




Comments (0)

Skip to main content