Conversational Understanding Model with MS Azure
7K views
Oct 30, 2023
Conversational Understanding Model with MS Azure
View Video Transcript
0:00
Okay, so a little bit of introduction about myself
0:04
Yeah, Kuljod Desai. I am a first year undergrad at IIT Bombay at the Department of Environmental Science and Engineering
0:15
Okay, so what is the tutorial going to be about? The tutorial is going to be about creating a conversational language understanding model with Microsoft Azure platform
0:30
Okay, so a bit of introduction about what we are going to do in this tutorial
0:36
So to start with, a conversational language understanding model uses concepts such as
0:41
natural language processing and deep learning to make the bot behave like a human
0:46
So through this tutorial, what we are going to do is we are going to train the computer
0:52
or the model to behave just like a human and then when we give it a query it's
1:02
gonna recognize the intention behind it and then act accordingly for instance if
1:08
I give a command to print the time then it's gonna identify the intention behind
1:16
it and then act accordingly to print the current time okay so this slide is not
1:28
important but to keep the tutorial on a comical side or just to have a small
1:39
comical aspect of the tutorial I have kept this light just for the sake of
1:44
file so okay moving on to the next slide some important terminologies so before starting with
1:54
the model we are going we will need to learn some some term some important keywords and so the first
2:05
keyword is intent so intent represents a task that the user wants the computer to perform so
2:12
So intent can be as simple as telling the computer to print the time or, or, or as simple
2:19
as telling the computer to print what they, it is, for instance, what time is it
2:25
Tell me the time. What's the time now? So all these three examples are nothing but different, different utterances of the same
2:34
intent that is telling the computer to print the time. So the second word, the second important keyword is entities
2:43
Entities as the name suggests, refer to some object. For instance, I tell the computer to tell me what time is it in Pune
2:54
So the intent in this specific sentence would be telling the computer to print the time
3:00
That is the intent of my query would be that I want to know what time is it in Pune
3:06
and Pune the word that is highlighted or that is written in bold letters would be the entity here
3:14
and the type of this entity would be location similarly the second example is what day is it
3:22
in London so in this sentence the intent or the intention behind me inputting this query would be
3:34
that I need to know what day is it in London and the word London that is written in bold letters
3:42
would be the entity here and the type of this entity would be that of a location
3:47
okay so now moving on to different types of entities so the first entity the first type
3:57
entity is something known as list entities list entities have a very
4:04
limited usage and the model identifies these entities with only a specific set
4:11
of values so the crux of this whole tool Linus is that suppose I want the
4:21
computer to identify Monday as an entity of the type we did okay so if and only if in my query I
4:35
enter the word m o n or Monday as a whole then and only then when the computer identified that
4:47
word as an entity of the type and similarly for Tuesday we have used TUE or TUEs that means if in
4:59
my query I write the word TQSJ as a whole or use TUE or use TUEs then and only then will the computer
5:08
identify that word as an entity of the type we take okay so now the second type of entity is
5:18
learned entities now these entities are one of the most important types of entities and will be the
5:25
most commonly used entities so these entities work on a very simple principle the more you provide
5:33
the utterances of phrases for these entities the better the model gets trained to identify these
5:37
entities. That means to make your model more accurate in identifying these entities, you have
5:47
to feed the model with huge chunks of data. And the more you feed the model with data, the more
5:56
precise the model gets. Okay. So moving on to the last type of entity, these are something, these are
6:06
called as pre-built entities. So, as the name suggests, you can compare or relate this concept
6:15
with that of keywords in a language which are already defined in DSDK
6:21
For example, the number 6 will be identified as an integer or a numeric entity
6:26
and the word Microsoft will be identified as an organization entity. So these pre-built entities are already offered or are already offered by Microsoft as your platform. So you need not worry about these entities. You need not worry about, you know, already defining with defining these entities as learned entities and then going through the whole process of feeding data into the model and then training that model on that amount of
7:00
on that huge amount of data to identify these entities. I know this these terminologies are a bit difficult to grasp at once but believe me as we move forward with our tutorial as we move forward with our practical once you do the practical hands once you do the
7:22
hands-on lab you will get quite familiar or quite comfortable with these concepts so have patience
7:30
and please please do not ignore the lab or the practical that we will that they
7:39
will perform later in this video okay so that's just a slide to which
7:49
differentiates utterances based on their intent and entities so pause the video
7:54
for maybe five or ten minutes have a good look at it and dive deep into this slide have a good look
8:02
at it and I guess we'll be good to go for the hands-on tutorial okay so I guess the theory part
8:12
of this tutorial is completed now moving now we'll be moving on to the hands-on lab
8:21
so uh okay so the first step would be to open portal.azio.com
8:34
wait for some time yeah so the first step here would be to create a language resource
8:41
that we will use be using to create a model to create a conversation
8:48
understanding model yeah here you go click on create continue to create a resource so this is the subscription here which will
9:07
obviously differ on your counterparts resource group I have already created a
9:13
resource group or if you want to create a new one just click on the new one
9:16
create new resource loop and then move forward so I'll be choosing the
9:22
already created resource group that that that that RG region I guess each US
9:30
would be fine name I will keep it as new language resource pricing tier this
9:43
click on review plus create validation required okay something okay yeah click
9:51
on this checkbox review plus create So click on Kuljot, new language resource
10:32
Okay. So our language service has been created. So I guess 20 or 30% of the tutorial has been completed
10:44
So yeah, just make a note that go to resource management tab and under the resource management
10:50
it click on keys and endpoint and it's always a good habit to just copy the key
10:58
and the endpoint URL and save it in a notepad file or some text editor file
11:05
yeah so I am also going to save location for being the endpoint URL yeah
11:21
so now so now we are going to begin the major part of the tutorial so after this you have to go on
11:32
language.cognitive.azure.com which is the language studio or the place where we are
11:41
going to create, train and deploy our language, conversational language understanding model
11:50
Yeah. So here we are. Click on sign in. So now what we need to do is we need to connect our language to the language resource that
12:07
we have already created. So click on your Azure subscription resource type, sorry, language and the resource that
12:20
we just created here. the content now what we need to do is create a project click on create new and then
12:35
conversational language understanding our project name would be let's keep it dashboard looks like of the language studio so what we need to do next is
13:15
create some intents and entities and then move on to deploying a model
13:24
training a model and then deploying the model so to add an intent click on add
13:34
intent name would be get time click on it and we'll be adding some attrances here so forget time some three to four attrances
13:55
would be something like what time so what time is it
14:08
what the time they need the time and what is the time click on save changes
14:32
so let me have a look at my code what all intents do I have to create get day
14:39
get date okay click on create a new intent get date
14:53
what day is it what's the day then the page what is the day
15:08
click on save changes now the next intent would be get time also oh yeah
15:18
get date sorry click on add so I'm sick click on gate date select the date so
15:47
What's the date? What date is here? There will be the date
15:59
Click on Save Changes. So now we'll be creating some entities
16:12
So the first entity would be location type. Click on learned entity
16:22
Click on add entity. So now to train the model on these entities, follow these steps
16:36
Get date. Click on get date. and let's say what is the Paris and now click on Paris and if sorry click on
16:58
that is and the whole and define it as a location entity some another example
17:04
would be 10 May the day in London and another would be what's the day in Leo
17:34
save changes now we are gonna add another entity which we are gonna name as weekday
17:46
and this is gonna be a list type entity and new list Monday
19:08
on pre-built add entity and now click on add new pre-built click on select pre-built and from this
19:21
click on date time so to just have a look we have a choice entity date time entity email
19:31
general event general organization location ip address person name phone number and and stuff
19:39
like that so you have a lot of pre-built entities already defined in ms as your language studio
19:47
offering so you need not worry about uh you know defining first for example defining percentage
19:55
as a learned entity and then feeding data to train the model on identifying
20:01
percentage as an entity click on save so click on intent okay so big derived we have to define big day
21:28
what the day of 23 9 and identify this as a date identity okay I guess we are
21:55
done for that's pretty much it for training our data for training our model on this specific
22:01
dataset click on save changes click on training jobs now we are going to train our model so what
22:15
we have done till now is provided the data and now that now all that is left is training a model
22:24
Deploying a model and testing are deployed model. So to train a model click on training jobs
22:31
Start a training job into model name would be a new model
22:38
Standard yeah train And this might take some while so have patience
22:52
Okay, so our model has been trained now we have to deploy a model. So to deploy deploy a model click on deploying model and deployment
23:05
The name would be it's a new deploy men New model deploy
23:22
okay so hard deployment has been completed now let's test a more selected upon that new
23:32
deployment let's say what is the time he's run the test so so the intent then the model has
23:51
identified is get time with a confidence percentage of 99.99 and no entities
23:59
predicted as such and this is the graphical interface to view the JSON
24:05
interface click on JSON okay so this output is an adjacent format with
24:12
confidence scores of all categories so for example for the category get time
24:18
or for the intent get time the confidence score was 99.99 percent for the intent get date the
24:25
confidence score was 88.78 percent for the intent get day the confidence score was 87.56 percent
24:33
and for the intent none the confidence score was zero and the entities predicted here are none no
24:41
entity was predicted so let's run one more example
24:57
run the test okay so the intent that has been rated is get time with a
25:06
confidence score of 82.98% location is India with the confidence of 100% and
25:13
with all these examples I think our model is working just fine okay now so
25:19
coming to the final part of the tutorial in this part we'll be using the command
25:28
prompt to call our model and input the query and let's see and and and then see
25:36
what result we get so the first step would be to open the command prompt
25:44
Okay, so now in this deploying a model tab select your current deployment and then click
26:00
on get prediction URL then this is a post command a curl post comma copy this
26:11
then copy it in a notepad and now we I think we will have to make some changes in this yeah
26:27
so yeah there is the participant ID here this one takes your query here let's see up let's put it
26:40
what is the time in London that's or I think we should select a new day in India
27:23
window paste and then hit enter yeah so this is the final output that we have
27:38
got from the model so query was what is the time in India top intent is get time
27:53
confidence score of get time intent was 84.47 percent of get day was 75.3 percent of get date
28:03
was 64.96 percent and of none was zero so that means the intent detected is correct which was
28:13
which should have been get time and it is get time here with the most confidence score of 84.47
28:23
and the entities detected is India which is of the location type of which is of the
28:31
type location length is 5 confidence score is 1 so I guess that's pretty
28:39
much it about this tutorial and I hope you enjoyed the tutorial
28:44
yeah thank you
#Engineering & Technology
#Intelligent Personal Assistants
#Programming
#Software