Skip to main content

Testing a decision strategy

4 Tasks

25 mins

Visible to: All users
Beginner Pega Customer Decision Hub 8.6 English
Verify the version tags to ensure you are consuming the intended content or, complete the latest version.

Scenario

A decision strategy that produces the Next-Best-Label action has been set up. The main purpose of the decision strategy is to select the label with the lowest printing cost. The strategy implements the following requirements:

  • It considers four labels from the Enablement business issue and Labels group.
  • The printing cost of each label is computed based on a formula: PrintingCost = BaseCost + 5 * Lettercount.
  • Only labels with a printing cost lower that the average printing cost can be selected.
  • A decision table is used to apply a few business rules:
    • Black Label is available for anyone over the age of 18.
    • Green Label is for anyone over the age of 27 and with a Customer Lifetime Value (CLV) under 500.
    • Red label is for anyone over the age of 27 and with a CLV over 500.
  • An adaptive model is used to predict the likelihood of accepting a given label. Note that since the adaptive model has not been trained yet, the propensity is 0.5 for all labels.
  • The output of the strategy is the label with the highest priority, where Priority = Propensity / PrintingCost * 100.

Your task as a Strategy Designer is to confirm that the output is the Next best label and if not, to correct the strategy.

Use the following credentials to log in to the exercise system:

Role

Username

Password

Strategy Designer

DataScientist

rules

Your assignment consists of the following tasks:

Task 1: Test the Next-Best-Label strategy using a data transform.

Test the Next-Best-Label strategy using the UseCase1 Data transform

Name

Age

CLV

UseCase1

28

400

Confirm that the Strategy Result is not the expected Next Best label. You can find the printing cost of each label in the table below:

Name

Printing Cost

Blue Label

85

Red Label

70

Black Label

70

Green Label

60

Tip: the strategy is expected to maximize the Priority = Propensity / Printing Cost * 100 expression, therefore the expected result is the Green Label since it has the lowest printing cost and that the propensity to accept is 0.5 for all labels.

Task 2: Identify the cause of the incorrect result and resolve the problem.

Select individual strategy components to identify the cause of the incorrect result and resolve the problem.

Task 3: Test the Next-Best-Label strategy using a second data transform.

Create the UseCase2 Data transform and run the strategy. You should get the Red Label as result. Can you explain why?

Name

Age

CLV

UseCase2

50

600

Tip: In contrast to UseCase1, the CLV value of UseCase2 complies with the Red Label business rule but not with Green Label business rule. The Red Label is selected over the Black Label based on their Rank.

Task 4: Test the strategy in batch, using the UseCases data set.

Test the strategy in batch, using the UseCases data set.

You must initiate your own Pega instance to complete this Challenge.

Initialization may take up to 5 minutes so please be patient.

Challenge Walkthrough

Detailed Tasks

1 Test the Next-Best-Label strategy using a data transform

  1. Login as Strategy Designer.
  2. From the left side menu, select Intelligence > Strategies.
  3. Double-click on the NextBestLabel strategy to open it.
    Strategy
  4. Click Check out.
  5. Open the Test panel on the right.
  6. Double-click on the canvas to adjust the view.
  7. In the Settings section, select UseCase1 as the Data transform.

    Name

    Age

    CLV

    UseCase1

    28

    400

  1. Click Save & Run.
  2. Select the Results component and check if the Strategy Next-Best-Label is correct. It is not, as the both the Black Label and the Green label actions comply with the business rules and the printing cost of the Green Label is lower than that of the Black Label; the propensity to accept is 0.5 for both labels.

 

Black label 1

 

Black label 2

 

 

2 Identify the cause of the incorrect result and resolve the problem

  1. Select the Set Printing Cost component and confirm that the PrintingCost property has been added to the actions.
  2. Select the Average Printing Cost Group by component and confirm that the .AverageCost of the four actions is computed and available. Notice that because the Group by component combines all actions in a single row, the Results contain a single page.
    Blue label
  3. Select the Below Average filter component and confirm that the component contains 3 action. Check which action is missing.
    Below average
  4. In the Below Average filter component, check that the remaining actions have a PrintingCost that is lower than the AverageCost, referenced from the Group by component.
  5. Notice that AverageCost is not propagated by the filter component, only referenced.
  6. Right-click on the Business Rules component and select open the Decision Table and evaluate the result for RedLabel for the current case. What do you expect it to be? Stop or Proceed? The Segment of the Red Label is “Stop” as it is not applicable for UseCase1.

    Name

    Age

    CLV

    Result

    Black Label

    >18

     

    Proceed

    Green Label

    >27

    <=500

    Proceed

    Red Label

    >27

    >500

    Proceed

    Otherwise

    Stop

  1. Select the Business Rules component and note that a Segment output is available and properly computed for all three labels.
    Business rules
  2. Select the Segment Proceed filter component and note that this action is filtered out and that the component contains the remaining two actions.
  3. Select the Propensity to Accept component and confirm that a propensity value has been generated for both actions.
    Note: The Adaptive model has not been trained yet, so the propensity is 0.5 for both actions.
  1. Right-click the Set Priority component and select Properties.
  2. Click on the gear icon next to the Source field to open the Expression builder.
    Expression
  3. Click Test and set the propensity to 0.5 and the printing cost to 70. Click outside the field to see the Result.
    Test expression
  4. Test the formula with other values for the propensity and the printing cost. Notice that a high priority is correlated with a low printing cost and a high propensity to accept.
  5. Click Cancel to close the Expression builder and close the properties panel to return to the strategy canvas.
  6. Select the Set Priority component and notice that the LabelPriority values of the two actions: 0.71 and 0.83 in the Results section.
  7. Select the Best Label component and notice that the component outputs the wrong label, since it outputs the Black label with priority 0.71 instead of the Green label with Priority 0.83.
  8. Open the properties of the Best Label component. Notice that the component currently selects the Top 1 label which is correct, but it incorrectly ranks the labels with a low priority first.
    Correct Prioritize
  9. Correct the ranking order, by selecting Highest first, and click Submit.
  10. Open the test panel and click Save & Run.
  11. Confirm that the Next Best Label is the Green Label, which is the correct result.
    Green Label

3 Test the Next-Best-Label strategy using a second data transform

  1. In the Test panel, click on the icon next the Data transform field.
  2. Click Save as.
  3. Use UseCase2 as the Short description. In case there is a Development branch, ensure No branch is selected.
  4. Click Create and open.
  5. Click Check out.
  6. Change the value of the .Age property to 50 and the .CLV_VALUE property to 600.
  7. Click Save and close the page.
  8. Select UseCase2 as the Data Transform and click Save & Run.
  9. Notice the Next Best Label for UseCase2 and explain the results.
Tip: Both the Black Label and the Red Label are applicable for UseCase2 and both have a printing cost of 70. The strategy selects the Red Label as it has the highest Rank as determined by the very first ranking of the SR results done in the Set Printing Cost component.

4 Test the strategy in batch using the UseCases data set

  1. In the Test Run panel, select Batch.
  2. Click on Settings to open Batch settings.
  3. Click on Performance to test a set of data.
  4. Select UseCases as the Dataset set. This is a preview of the first 10 records:
    Preview UseCases
  5. Click Run.
  6. Use the result panel to examine the speed at which the strategy runs.
    Speed


Available in the following mission:

If you are having problems with your training, please review the Pega Academy Support FAQs.

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 Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice