I have often wondered, What if there was a way for us to talk to our systems in our own Natural Language. What if our applications were able to Interpret and Understand our Language and then carry out Predefined tasks in an Intelligent manner by following a strict Prediction Model.
Well no more wondering as Microsoft has introduced “Language Understanding Intelligent Service” – LUIS.
LUIS is a cloud-based service to which you can apply customized machine learning capabilties by passing in Utterances (natural language) to predict overall Intent, and thereby pull out relevant detailed information.
In this article, we are taking a real world scenario where a Support team is trying to implement LUIS on a Common Shared Mailbox so that the Intelligent Service can read the Message Body of each email and based on the Prediction Model understand the correct Microsoft Team Channel where the email needs to be assigned.
To reduce the complexity, we will divide this article in two parts:
- Design and Train our LUIS Application
- Create a Power Automate solution for Implementing Smart Email Management based on LUIS Predictions.
Before you begin, please make sure the following prerequisites are in place:
Step 1 – Building the LUIS Application
- Sign in to LUIS portal .
- Once successfully signed in, on the page that appears select ‘+ New app for conversation’ as shown in the image below.
- A pop up form appears where you need to fill in the basic details for the LUIS application like ‘Name‘, ‘Culture‘ basically the language which the LUIS application should expect and the ‘Description‘.
- Once this information is filled up, Click on ‘Done‘.
Step 2 – Utterances and Intents ??
We now proceed by creating Intents for our LUIS application but wait what exactly is an Intent you ask ???
- An Intent represents an action that the user wants to perform.
- If you remember the image we saw a couple of minutes before, the intent here is to classify emails. That’s it, let’s keep it simple. So when I say classify I need to know the categories for the classification right !! These categories will be our Intents.
- We need to assign emails to one of the three categories which are our Intents, namely –
- OnPremise team
- Online team
- Sales team
Step 2.1 Creating Intents
- Picking up where we left, once your LUIS application has been created you will be navigated to a page where you will see an option called as ‘Intent‘ in the left navigation.
- Select the ‘Intents‘ option and click on ‘+ Create‘ as shown in the image below-
- On the Pop up box that opens up enter the correct ‘Intent name‘ and click on ‘Done‘.
- Do this for ‘Ticket_OnPremise‘, ‘Ticket_Online‘ and ‘Sales‘.
Step 2.2 – Creating Utterances
- Utterances are inputs from the user or a system that your LUIS application will receive.
- The LUIS application needs to understand and interpret these utterances to extract intents and entities from them, and so it is extremely important to capture a variety of different example Utterances for each intent.
- Basically you need to type in the Utterances i.e the expected words that your users will normally be writing in the email messages being received by your shared mailbox.
- Navigate to the ‘Intents’ that we have created in Step 2.1 and start writing Utterances as shown in the image below.
- If you have closely observed the image above, I have written an Utterance
How do I decide the no. of Application, Web Front end and Search servers needed to be configured in my SharePoint 2019 environment
- Once you write an Utterance and press Enter, LUIS starts breaking the Utterance and keeps a track of keywords inside the Utterance.
- The more no. of times a particular word starts appearing in the sample Utterance the more confident the LUIS becomes in predicting the Intent and thus higher the Prediction score for a particular intent.
- Please take a look at the sample Utterances across Intents that I have configured for our LUIS application.
Ticket_OnPremise Utterances –
Ticket_Online Utterances –
Sales Utterances –
- Now that you have seen my sample Utterances, let’s go ahead and Train our LUIS application.
- But WAIT !! Did you notice that in all the images above the ‘TRAIN‘ button at the top is showing a red color.
- That is basically an intimation from the LUIS application for you that you have Untrained utterances registered against Intents in your LUIS application.
Step 3 – Train the LUIS application
- Now that we have built up the basic structure of our LUIS application let us go ahead and train it. We have already been receiving intimations from the LUIS application that it has untrained utterances across intents present with it.
- Just navigate to the top of the page and hit the ‘Train‘ button.
- The LUIS application will start training itself and show you notification stating that it is collection the training data as shown in the image below-
- Sit back and relax, it will take some time for the LUIS application to train itself.
- Once the training is finished, the LUIS application will notify you that the training is completed.
- Now it is time to test our LUIS application before we go ahead and Publish it.
Step 4 – Test the LUIS application
- Click on the ‘Test’ button from the top navigation and it opens up a test environment for us as shown in the image below.
- Here what we can do is type sample utterances once again and see if the LUIS applications (after training) is able to predict the Intents correctly.
- Let’s for example type a sample utterance and hit Enter –
One of the actions in my Power Automate solution keeps failing
- As you can see in the image below, LUIS quickly runs the test utterance and posts a result. It has correctly predicted that the correct intent is ‘Ticket_Online’ which is also the ‘Top-scoring Intent‘ with a score of 0.483 which is the highest still a poor confidence right now because this is just our first test.
- You need to keep training the LUIS app with more and more utterances so that it’s confidence keeps increasing.
- Let’s go ahead and test another utterance and see if this time the confidence i.e ‘Intent Score‘ increases or not.
- There you go !!! If you observe this time the ‘Top-Scoring Intent’ has a score of 0.723 which simply means that the LUIS application is more confident not since the last utterance about the intent.
- So basically the more utterances are passed, the more the LUIS application will become intelligent.
Step 5 – Publish the LUIS application
- That’s it, we are done here.
- If you think about it, now that you know the basics it is so easy to go ahead and configure a LUIS application which at the start may seem like a daunting task.
- Just navigate to the top of your screen and click on the ‘Publish’ button.
- A pop up form opens up asking for the Slot in which the LUIS application needs to be published, just select Production and click on Done.
Next we will be creating a Power Automate solution to grab the ‘Prediction‘ and in turn the ‘CorrectIntent‘ exposed by the ‘LUIS application‘, based on which we will Automate Decision Making.