Microsoft Power BI team has introduced an AI Insights in Power BI in November 2019 update, which is collection of pre trained machine learning models and AI functions from Azure Cognitive Services that you can use to transform your data and helps you to get useful data insights using AI capabilities with very less efforts.
AI Insights can be accessed in Power Query Editor. You can see the below screenshot.
It consists of three functions as given below:
Text Analytics: It is a pre trained ML models for text analysis, which helps you to extract the meaningful information from unstructured text. List of available text analytics functions in Power BI:
-
- Detect Language: The language detection function evaluates text input and for each field, It returns the language name and ISO identifier.
- Extract Key Phrases: The Key Phrase Extraction function evaluates unstructured text, and for each text field, It returns the most relevant words and expressions from text.
- Score Sentiment: The Score Sentiment function evaluates text input and returns a sentiment score for each text, ranging from 0 (negative) to 1 (positive). It is commonly used to analyze customer feedback, survey responses, and product reviews.
Vision: It is a Pre-built model for extracting information from images. List of available vision functions in Power BI:
-
- Tag Image: Tag image functions detects the objects in images and returns tags based on more than two thousand recognizable objects, living beings, scenery, and actions.
Azure Machine learning: It allows the use of Azure ML models.
To use the Text Analytics or Vision features requires Power BI Premium capacity.
In this article we are going to cover Text Analytics and Vision functions in Power BI.
Lets take a look on AI Insights features in Power BI.
As you can see here we have a sample data csv file named ProductReview. Which is a review given by customers about the product.
Now we will load this data into Power BI and use the Text Analytics functions on this data.
Lets load the data, Click on Get Data then select Text/CSV.
Now you can see data is loaded.
Lets open the Power Query Editor, click on Transforms data under Home tab.
Now you can see, power query editor window opens. Here you can see the data preview.
Lets use the text analytics functions on data, first we will see the language of the text. For that we will use the detect language function.
Detect Language function
Lets detect the language of text ReviewBody, just select the field ReviewBody then go to ribbon bar and click on Text Analytics under AI Insights tab as shown below.
If you have already logged in then it will display the available functions otherwise you will be prompted to sign in.
Now you can see a Text Analytics pop window opens there you can see all the available text analytics functions.
Now select the Detect Language function, and from drop down you can also change the field that you want to detect language.
For the premium capacity used for AI Insights option, leave the default, then click OK button.
Once you click on OK button, next it asks you information about privacy level. You must agree with the privacy levels.
Just click on Continue button, then check the option and click on Save button as shown below.
Now you can see, it adds two columns in data that is Language name and Language ISO code. Which tells the language of reviews in ReviewBody field.
Score Sentiment function
Lets get the sentiment score for reviews given by customers about the product.
First select the field ReviewBody then click on Text Analytics under AI Insights tab as shown below.
Now you can see a Text Analytics pop window opens, just select the Score Sentiment function and click on OK button.
Language ISO code option is optional, you can leave it as blank.
Now you can see, it returns the sentiment score for each reviews in ReviewBody field ranging from 0 (negative) to 1 (positive).
Lets add one custom column and based on this sentiment score divide the review in three categories Positive, Neutral and Negative.
You can see, a custom column pop up window opens.
Now we will write a condition, if sentiment score is less then 0.25 the consider them as Negative, if it is greater than and equal to 0.75 then consider them as Positive otherwise consider them as Neutral.
Now you can quickly see the number of Positive, Negative and Neutral reviews given by customers.
Extract Key Phrases
Lets extract the key phrases using Extract Key Phrases function, for this click on Text Analytics, then then select Extract Key Phrases after that click on OK button as shown below.
The key phrase extraction, the results can return multiple values. Each individual result is returned on a duplicate of the original row as new row will be added for each key phrase.
You can see two columns are added into data, Extract Key Phrases and Extract Key Phrases.KeyPhrase.
If you want to remove the duplicate rows, follow the below steps.
First remove the Extract Key Phrases.KeyPhrase column. Just right click on column header then select Remove.
Now after removing the Extract key phrases.KeyPhrase, right click on the Extract key phrases column header then select Remove Duplicates.
Now we have a single row for each record.
Now you can click on Close&Apply button to save the changes.
Image Tagging
Lets explore the Image Tagging functions, as you can see here we have table which contains an image URLs.
Make sure, you have defined the data category for these URL as ImageURL.
If you do not know how to define the data category then select the ImageURL field in field pane after that select the Data Category as ImageURL under Column tools tab.
After that, lets display the images on visual. Here we have used custom visual Image Grid.
Now we will use the Image Tagging function which will detect the objects in image and returns the tags what they contains.
Also note that image tagging can return multiple values. Each individual result is returned on a duplicate of the original row.
Lets go to Power Query Editor window then select the ImageURL field then click on Vision under AI Insights tab.
Now you will see a Vision pop up window opens, just select tag image function.
In ImageURL option we have provided Images URL.
After that click on OK button.
You can see, it returns the tags based on what image contains. Each single image can have multiple tags that why there could be multiple rows.
Other than the tags information it also tells the confidence score about the tag that how accurate the tag result is.
Lets click on Close&Apply button to save the changes the see the output on report.
Now take the table visual and drag the ImageURL, Tag images.Tag, Tag images.tags.
You can see, it gives the information about the image what they contain.
Lets select the dog image and see the tags for this image.
You can see for dog image, generated tags are animal, black, brown, dog, distance and staring. Which is based on what image contains.
To read more on AI Insights, you can refer the post AI Insights in Power BI
Also Read..