Use case: Training and building the model in an IVA for Web Chatbot
Improve how Pega Intelligent Virtual Assistant™ (IVA) for Web Chatbot responds to requests by training the text analytics model. In this tutorial, you will learn how to create a sample training data and map entities, add the training data to the model, and when ready, rebuild the model. As a result, the chatbot improves how it responds to inquiries about a car insurance quote.
Although this content demonstrates how to train and build the model for the IVA for Web Chatbot, you can perform similar steps to improve the model for the IVA for Alexa, Unified Messaging, and Pega Email Bot™.
Before you begin
To follow the steps in this tutorial, set up a sample Pega Platform application with the Insurance Quote case type and a Web Chatbot channel.
Set up the Insurance Quote case type for car insurance quotes:
- Create the Insurance Quote case type.
- Add the following data types to the Insurance Quote case type for the car color,
car make, model, car registration date, vehicle identification number (VIN), and
car production year: carColor,
carMake, carRegistrationDate,
carModel, carVIN, and
carYear.
For more information, see Associating data objects with case types
- Enable Web Chatbot channel-specific conversations for a stage of the Insurance
Quote case type.
For more information, see Adding a conversational channel to a case type process.
- Configure conversation questions for a stage process of the Insurance Quote case
type by adding three simple questions for the make, model, and VIN data types.
For more information, see Adding questions to a conversation.
Configure a Web Chatbot channel with the following settings:
- In the Content section on the
Configuration tab, add the
insurance create case command for the Insurance
Quote case type.
For more information, see Adding case commands for a conversational channel.
- On the Behavior tab, enable advanced text
analyzer configuration and add the iNLP text analyzer. Ensure that the
IVA can interpret text in both the context of the case and outside the
case context.
For more information, see Adding a text analyzer for an IVA.
- Map the following entities to the Insurance Quote case data properties:
.carMake, .carModel, and
.carVIN.
For more information, see Mapping entities in conversation text.
- In the Content section on the
Configuration tab, add the
insurance create case command for the Insurance
Quote case type.
In the preview console, verify that IVA for Web Chatbot does not understand text that you enter to request a car insurance quote.
For more information, see Verifying chatbot responses.
Creating training records
Create training data records that contain sample user input for inquiries about a car insurance quote, so that you can later add this sample data to the model for the IVA. After you add enough instances of the same training data and build the model, the chatbot will improve its responses to user input about a car insurance quote. In addition, create five more instances of the same training data records in which you ask about an insurance quote for a Ford Mustang GT. This car make and model will later be mapped to entities, so that the system learns how to extract car make and model information and add it automatically to the Insurance Quote case type properties.
It is not sufficient to add only a few instances of the same training data. For each topic, create at least 20 records in the training sample so that the system learns how to correctly respond to the entered text. Distribute records evenly across topics, otherwise the model will be biased toward the overrepresented topic. For more information, see Best practices for creating categorization models.
- In the navigation pane of App Studio, click Channels.
- In the Current channel interfaces section, click the icon that represents your existing Web Chatbot channel that includes the Insurance Quote case type.
- In the channel, click the Training data tab, and then click Add records.
- In the Create new training record window, in the Topic field, press the Down arrow key and select: insurance
- In the next field, enter the following sample user input inquiring about car insurance: I need a car quote.
- Click Create record.
- Add more instances of the same training record by repeating steps 5 through 6 five more times.
- In the next field, enter the following sample user input inquiring about insurance for a specific car make and model insurance: I need a car insurance quote for my Ford Mustang GT 2017.
- Click Create record.
- Add more instances of the same data record by repeating steps 8 through 9 five more times.
- Click Close.
Mapping entities in the training data
Map training data to entities so that the car make and model information is later automatically extracted from the text that you enter to the Insurance Quote case properties. After adding the training data and building the model, you will verify in the preview console that the car make and model from the user input is automatically copied to the Insurance Quote case properties.
In this example, you will associate the #Carmakeent and #Carmodelent entities with the car make and model in the user input. These entities are already mapped to the .carMake and .carModel properties that are defined for the Insurance Quote case.
- On the Training data tab, select the training data record with the text: I need a car insurance quote for my Ford Mustang GT 2017
- In the Training data correction window, select and right-click Ford, and then click #Carmakeent.
- Select and right-click Mustang GT, and then click #Carmodelent.
- Map more instances of the training data with the same text by repeating steps 1 through 3 five more times.
Adding training data to the model
Add sample training data to the model so that the IVA improves future responses to user inquiries about a car insurance quote. Update the model with sample data and associate it with the insurance topic. You can also help the system learn to recognize entities from user input such as the car make or model, so that this information is automatically mapped to the Insurance Quote case properties.
- On the Training data tab, select the check boxes for the six instances of the text: I need a car quote
- Click Mark reviewed.
- Select the check boxes for the six instances of the text: I need a car insurance quote for my Ford Mustang GT 2017
- Click Mark reviewed.
Building the model
Build the model with sufficient sample training data so that the IVA can recognize a user request for a car insurance quote. The system can then start the Insurance Quote case automatically, and ask for more information about the car make, model, and VIN.
- On the Training data tab, click the
More icon and then Build
model.
You build the model by using only training data that was marked as reviewed.
- Click Save.
Testing model changes in the chatbot
Verify the changes to the model for the IVA from the preview console. Enter the same training data that was used to train the model so that you can check that the system responds correctly to a request for a car insurance quote.
- On the Behavior tab, in the preview console, enter the following text: I need a car quote.
- Display more information about the conversation and the case by turning on the Show analysis switch.
- Click Reset.
- Enter the following text: I need a car insurance quote for my Ford Mustang GT 2017
Conclusion
You have successfully added new training data to the model and rebuilt the model. As a result, you have trained and improved how the IVA responds to user requests about car insurance by using artificial intelligence and natural language processing (NLP).
Previous topic Use case: Building an IVA for Web Chatbot in the preview console Next topic Creating an Alexa channel