Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Use case: Training and building the model in an IVA for Web Chatbot

Updated on February 18, 2022

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:

  1. Create the Insurance Quote case type.
    Case type explorer
    The insurance quote menu option in the case type explorer.
  2. 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.
    Associating data objects with case types
    The data objects that you associate with the case types on the edit case type page.

    For more information, see Associating data objects with case types

  3. Enable Web Chatbot channel-specific conversations for a stage of the Insurance Quote case type.
    Stage configuration for the Insurance Quote case type
    Configuring a stage for the Insurance Quote case type to use the IVA for Web Chatbot.

    For more information, see Adding a conversational channel to a case type process.

  4. 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.
    Sample questions for the Insurance Quote case type
    Adding sample questions to a stage process in the insurance quote case type.

    For more information, see Adding questions to a conversation.

  5. 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.
      Sample create case command for a case type
      Adding the create case command to the 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.
      Enabled text analyzers
      The Behavior tab showing enabled text analyzers for the case, both in-context and out-of-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.
      The Response configuration dialog box for case type commands
      Mapped entities in the response configuration dialog box for the case type commands.

      For more information, see Mapping entities in conversation text.

In the preview console, verify that IVA for Web Chatbot does not understand text that you enter to request a car insurance quote.

Sample chat conversation in the preview console
A sample chat conversation in the preview console, in which the IVA for Web Chatbot does not understand a request.

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.

  1. In the navigation pane of App Studio, click Channels.
  2. In the Current channel interfaces section, click the icon that represents your existing Web Chatbot channel that includes the Insurance Quote case type.
  3. In the channel, click the Training data tab, and then click Add records.
  4. In the Create new training record window, in the Topic field, press the Down arrow key and select: insurance
  5. In the next field, enter the following sample user input inquiring about car insurance: I need a car quote.
    Creating a new sample training record
    Entering new sample user input to the training record.
  6. Click Create record.
  7. Add more instances of the same training record by repeating steps 5 through 6 five more times.
  8. 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.
    Creating another sample training record
    Creating another sample training record using specific car model and make details.
  9. Click Create record.
  10. Add more instances of the same data record by repeating steps 8 through 9 five more times.
  11. 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.

Note: From the Training data correction window, you can also create entities to represent the user input.
  1. 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
  2. In the Training data correction window, select and right-click Ford, and then click #Carmakeent.
  3. Select and right-click Mustang GT, and then click #Carmodelent.
    Adding entities to sample training data
    Using the training data correction window to add entities to sample training data
  4. 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.

Note: Instead of using the Training data tab, you can also add sample training data and build the model directly by chatting with the chatbot in the preview console. For more information, see Use case: Building an IVA for Web Chatbot in the preview console.
  1. On the Training data tab, select the check boxes for the six instances of the text: I need a car quote
    Sample training data records in Training data tab
    The Training data tab showing sample training data records.
  2. Click Mark reviewed.
  3. Select the check boxes for the six instances of the text: I need a car insurance quote for my Ford Mustang GT 2017
  4. 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.

  1. 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.

    Updating the model in the Training data tab.
    Updating the model using previously reviewed data in the Training data tab.
    Result: The system successfully updates the model with the six training data records of each type that you created in the previous section.
  2. 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.

  1. On the Behavior tab, in the preview console, enter the following text: I need a car quote.
  2. Display more information about the conversation and the case by turning on the Show analysis switch.
    Sample user input analysis inside a started case
    Viewing extended information in the preview console after clicking the show analysis switch.
    Result: The chatbot correctly responds, associating the text that you entered for the insurance topic with a confidence of 100 percent. The system also starts case I-122 and asks the first question about the make of the car.
  3. Click Reset.
  4. Enter the following text: I need a car insurance quote for my Ford Mustang GT 2017
    Sample user input analysis with mapped entities and skipped questions
    Analysis of sample user input showing mapped entities and skipped questions.
    Result: The IVA correctly responds by associating the text that you entered with the insurance topic with a confidence of 100 percent. The system also starts case I-123. In addition, the car make and model that you entered, Ford and Mustang GT, are extracted and automatically mapped to the car make and model properties for the case. As a result, the IVA also skips the questions about the car make and model.

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).

What to do next: After you have trained the model and used the preview console to test whether the chatbot responds correctly to user requests for car insurance, move the system to a production environment.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us