Azure Stream & Twitter Sentiment Analytics ML Dashboard on PowerBI
See how we took a machine learning algorithm, used it for twitter sentiment analysis backed by Azure stream to create a dashboard on PowerBI.
Join the DZone community and get the full member experience.Join For Free
Recently, the integration of Azure Stream Analytics & Azure Machine Learning became available as preview update and it’s possible to add AML web service URL and API key as ‘custom functions‘ with ASA input. In this demo, realtime tweets are collected based on keywords like ‘#HappyHolidays2016‘, ‘#MerryChristmas‘, ‘#HappyNewYear2016‘ and they are directly stored on a .csv file and saved on OneDrive. Here goes the solution architecture diagram of the POC.
Now, add the Service Bus event hub endpoint as input to the ASA job, while deploying the ‘Twitter Predictive Sentiment Analytics Model‘ and click on ‘Open in Studio‘ to start deploying the model. Don’t forget to run the solution before deploying.
Once the model is deployed, open the ‘Web Service‘ dashboard page to get the model URL and API key, click on default endpoint -> download the excel 2010 or earlier apps. Collect the URL and API key to apply it to ASA function credentials for AML deployment.
Next, create an ASA job and add the event hub credentials where the real world tweets are getting pushed & click on ‘Functions‘ tab of ASA job to add the AML credentials. Provide model name, URL and API key of the model, and once it’s added, click on Save.
Now, add the following ASA SQL to aggregate the realtime tweets sentiment scores coming out of the predictive twitter sentiment model.
Provide the output as Azure Blob storage, add a container name and serialization type as CSV, and start the ASA job. Also, start importing data into PowerBI desktop from the ASA output Azure blob storage account.
PowerBI desktop contains in-built power queries to start preparing the ASA output data and processing data types. Choose the AML model sentiment score datatype as decimal type and TweetTexts as Text(String) type.
Start building the ‘Twitter Sentiment Analytics‘ dashboard powered by @AzureStreaming & Azure Machine Learning API with realworld tweet streaming. There’re some cool custom visuals available on PowerBI. I’ve used some visuals here like the ‘wordcloud‘ chart which depicts some of the highly scored positive sentiment contained in tweets with specific keywords like ‘happynewyear2016‘, ‘MerryChristmas‘,’HappyHolidays‘ etc.
In the donut chart, the top 10 tweets with the most positive sentiment counts are portrayed with the specific sentiment scores coming from the AML predictive model experiment integrated with ASA jobs.
Published at DZone with permission of Anindita Basak, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.