Training a topic model to improve email routing
4 Tasks
20 mins
Beginner
Pega Customer Decision Hub 8.8
English
Scenario
U+ Bank plans to use Pega Customer Service™ to route incoming emails to the appropriate department based on the topic of the email. For several use cases (for example an address change), emails can be routed based on keywords detected in the message. To implement email routing, create an email channel interface, and train the text prediction with a data set that contains classified messages.
Use the following credentials to log in to the exercise system:
Role | User name | Password |
---|---|---|
Data scientist | DataScientist | rules |
Application Developer | ApplicationDeveloper | rules |
Customer service representative | cacsr | password123! |
Customer1 | customer1 | citadel |
Your assignment consists of the following tasks:
Task 1: Create a channel interface
As an application developer, create and configure U+ Bank customer support email channel interface to respond to requests from customers.
Task 2: Test the text prediction
As a data scientist, test the U+ Bank customer support text prediction with the two messages below and inspect the sentiment and topic classifications. Answer the following questions:
- How would you estimate the sentiment of these two messages?
- Why is complaint detected as a topic in a message concerning an address change?
Complaint
I am a very unhappy customer of yours. For the third time, I have noticed an invalid transaction. The amount is small, but could you please check? It is unfortunate because, in general, I like your services.
Address change
I have noticed, in my last account statement, you have used a wrong address. Please change my mailing address to read: 222 West Las Colinas Blvd., Irving, TX 75039, USA, effective immediately. And I'm happy to have a fresh email address: [email protected]
Task 3: Train the text prediction
Train the U+ Bank customer support text prediction with the CSTrainingData data set and answer the following question:
- On how many topics will this CSV file train?
Task 4: Test the trained prediction
Test the U+ Bank customer support text prediction after it is trained with the message concerning an address change from task 1.
Confirm your work
As a customer1, use the enablement email client to send an email to U+ Bank customer support.
Subject: Incorrect address
Message:
Hi U+ Bank,
I have noticed, in my last account statement, you have used a wrong address. Please change my mailing address to read: 222 West Las Colinas Blvd., Irving, TX 75039, USA, effective immediately. And I'm happy to have a fresh email address: [email protected].
Cheers, Sara Connors
As a U+ Bank customer service representative, confirm that the incoming email is correctly routed.
Challenge Walkthrough
Detailed Tasks
1 Create a channel interface
- On the exercise system landing page, click Pega CRM suite to log in to App Studio.
- Log in to App Studio as an application developer:
- In the User name field, enter ApplicationDeveloper.
- In the Password field, enter rules.
- In the navigation pane of App Studio landing page, click Channels.
- In the Create new channel interface section, click Email to create a new channel interface.
- In the Details section, in the Email channel name text box, enter U+ Bank customer support.
- In the Email handling section, click Add email account.
- In the drop-down list, select ubanksupport.
- Click Verify to verify the address and check if the email server is responsive.
- In the Additional settings section, in the Reference operator list, select DataScientist.
- Click the Behavior tab.
- In the Text Analytics section, click Edit topics:
- Delete unnecessary topics, as shown in the following figure:
- In the Edit topics window, click Add item to add a row.
- In the new row, in the Topic column, enter Complaint.
- In the Approximate match column, enter wrong,invalid,service,transaction,unhappy,protest,customer,services.
- Click Submit to save the topic list.
- Delete unnecessary topics, as shown in the following figure:
- In the Intelligent routing section, edit the existing condition:
- In the Action list, select Route to work queue.
- In the Value field, enter or select TransactionDisputes.
- In the When row, in the value field, enter or select Complaint, as shown in the following figure:
- Click Add condition to add a second condition.
- In the Action list, select Route to work queue.
- In the Value field, enter or select AccountMaintenance.
- In the When list, select NLP > Topic.
- In the comparator list, select is equal.
- In the value field, enter or select Account Address Change.
- In the upper right, click Save.
- In the lower-left corner, click the operator icon, and then select Log off to end the application developer session.
2 Test the text prediction
- On the exercise system landing page, click Pega CRM suite to log in to Prediction Studio.
- Log in to Prediction Studio as a data scientist:
- In the User name field, enter DataScientist.
- In the Password field, enter rules.
- On the Predictions landing page, click the U+ Bank customer support tile.
- In the upper-right corner, click Test to open the Test prediction dialog box.
- In the Test prediction dialog box, in the Text field, enter the following message concerning a complaint:
I am a very unhappy customer of yours. For the third time, I have noticed an invalid transaction. The amount is small, but could you please check? It is unfortunate because, in general, I like your services. - Click Test.
- Observe that a complaint is detected as the topic of the message with a confidence score of 1.
- Click the Sentiment tab.
- In the Sentiment section, notice that the complaint has a negative overall sentiment score.
Tip: Check if your estimation of the sentiment of the message matches the sentiment score.
- Click Highlight in input text to identify the sentences with positive and negative sentiments.
Note: Although the email has a mixed positive and negative sentences, the overall sentiment is negative.
- In the Text field, enter the following message that concerns an address change.
I have noticed, in my last account statement, you have used a wrong address. Please change my mailing address to read: 222 West Las Colinas Blvd., Irving, TX 75039, USA, effective immediately. And I'm happy to have a fresh email address: [email protected] - Click Test.
- Click the Topic tab.
- In the Topic section, observe that both a complaint and an address change are detected as topics with a confidence score of one.
Tip: Check if your estimation of the sentiment of the message matches the sentiment score.
- Close the test panel to return to the prediction.
- Question – Why is complaint detected as a topic in a message concerning an address change?
- To the right of the complaint topic, click the Gear icon to view the keywords for this topic.
- On the Keywords tab, notice that wrong is one of Should words.
Tip: Because the word 'wrong' is present in the message, the complaint topic is detected.
- To the right of the complaint topic, click the Gear icon to view the keywords for this topic.
- Click Cancel.
3 Train the text prediction
- Download CSTrainingData and extract the CSV file.
- Question - How many topics does this CSV file contain?
- Open the CSV file in an editor, and then inspect the result column and check the possible values.
Tip: This file has training data for two topics: Account Address Change and Complaint.
- Open the CSV file in an editor, and then inspect the result column and check the possible values.
- Switch back to the U+ Bank customer support text prediction.
- On the right, click Import.
- Click Choose file, and then select the CSTrainingData.csv file.
- Click Upload.
Tip: Note that the two topics have over a hundred records pending training each.
- In the upper-right corner, click Build.
- Select the U+ Bank customer support topic model.
- Click Build to begin training the text prediction.
- After the build is triggered, note that there is a training job in a pending state.
- In the upper-right corner, click Actions > Refresh.
Tip: It may take up to a minute to build the model. Click Refresh until the build is complete.
- Once the prediction build is complete, click View report to see the result of the model building process.
- Close the Model training report.
Note: The training data consists of 70 percent of the records. The remaining 30 percent has been used for validation of the model.
4 Test the trained prediction
- In the upper-right corner, click Test.
- In the Text field, enter the following message concerning an address change that you have tested in the first task.
I have noticed, in my last account statement, you have used a wrong address. Please change my mailing address to read: 222 West Las Colinas Blvd., Irving, TX 75039, USA, effective immediately. And I'm happy to have a fresh email address: [email protected] - Click Test.
- Observe that after training the model, only an address change is detected as a topic with a high confidence score.
Note: The observed confidence score values may vary, as 30 percent of the training data is randomly used for validation.
- In the Entity section, confirm that the ZIP code, state, city, address, country, and email address mentioned in the message are detected by the entity extraction model.
- Close the Test prediction window.
- In the upper-right corner, click Save.
- In the lower-left corner, click the user icon, and then select Log off to log out of Prediction Studio.
Confirm your work
- On the exercise system landing page, click Email.
- Log in to Citadel Server as a customer1:
- In the User name field, enter customer1.
- In the Password field, enter citadel.
- In the navigation pane on the left, click Mail.
- In the top menu, click Write mail.
- Compose an email concerning an address change:
To: [email protected]
Subject: Incorrect address
Message: Hi U+ Bank,
I have noticed, in my last account statement, you have used a wrong address. Please change my mailing address to read: 222 West Las Colinas Blvd., Irving, TX 75039, USA, effective immediately. And I'm happy to have a fresh email address: [email protected].
Cheers, Sara Connors - Click Send message.
- On the exercise system landing page, click Pega CRM suite to log in Customer Service Portal.
- Log in to Customer Service Portal as a customer service representative:
- In the User name field, enter cacsr.
- In the Password field, enter password123!.
- On the My workbaskets tab, select the Account Maintenance workbasket.
- If there is no incoming email, click the Refresh button until the email is processed.
Note: Depending on the environment, it might take up to two minutes until the email is sent and processed in Customer Service.
- Click the ID number of the incoming email.
- Notice the neutral sentiment and the entities that are detected.
This Challenge is to practice what you learned in the following Module:
Available in the following mission:
If you are having problems with your training, please review the Pega Academy Support FAQs.
Want to help us improve this content?