Open Your Business Rules!                     
Rules-based Operational Decision Services

OpenRules Classic: Rule Compressor

Motivation for Rule Compression

y

 Business Rules have a tendency to grow quickly.  Let's consider simple classification rules:
 
Min 
Age
Max
Age
 Card
 Type
Discount
Code
18
30
Standard
0
18
30
Gold
2
18
30
Platinum
3
31
40
Standard
1
31
40
Gold
1
31
40
Platinum
1
41
50
Standard
1
41
50
Gold
2
41
50
Platinum
3
51
60
Standard
1
51
60
Gold
2
51
60
Platinum
3
61
70
Standard
1
61
70
Gold
2
61
70
Platinum
3
71
120
Standard
1
71
120
Gold
2
71
120
Platinum
3

This decision table classifies customer's discount based on customer's age and credit card type. It already includes 18 rules and 72 total entries without considering other attributes. If you carefully analyze this simple table you would be able to compress 18 rules into just 6 (with overrides):

 Card
Type
Min
Age
Max
Age
Discount Code
Standard
 
 
1
Standard
18
30
0
Gold
 
 
2
Gold
31
40
1
Platinum
 
 
3
Platinum
31
40
1


However, when you have tens or hundreds of attributes (columns) such an analysis becomes difficult or impossible without an automatic Rule Compressor!


ML-based Rule Compressor

A generic integration schema for Machine Learning (ML) and Business Rules (BR) techniques is described in the section "Rule Learner".  The Rule Compressor is a special add-on that uses the integrated ML+BR approach to automatically compress complex classification rules.

How does Rule Compressor work?

Input:

  1. An initial set of manually created classification rules (like the first decision table above) that is based on different combinations of an object's attributes and specifies the object's class
  2. Test data to which the rules can be applied

In the example above the object is Customer.  Based on the customer's age and credit card type the rules specify the customer's discount code.

Output:

  1. A new compressed set of classification rules (like the second decision table above) that does the same work as the initial set with a certain degree of accuracy
  2. Accuracy measurements

Rule Compression Steps

1. Execute "manual" rules against test data and save the results as a set of instances with classification results saved in the class attribute.  There are two options for "manual" rules execution:

- Using an original rule engine

- Using OpenRules Rule Engine with a preliminary conversion of the "manual" rules into an Excel table in OpenRules format

2. Use OpenRules Trainer to convert these results into a training set for a selected Rule Learner implementation

3. Execute Rule Learner by experimenting with different ML algorithms and data tuning options. The resulting rules are presented in a human-readable format specific to the selected Rule Learner

4. Execute an OpenRules Converter that will parse the Rule Learner output and convert the learned rules into an OpenRules (or other rule engine) format

5. Execute OpenRules Rule Engine by running the learned rules against the initial test data where the class attribute is unknown

6. Compare the results produced during steps 2 and 5 to generate accuracy measurements of the "compressed" rules

 

All described steps except that of the initial test data reading are automated. The OpenRules® Trainer includes a Data Reader that can be tuned to different data sources and input formats including relational databases and Excel tables. Thus, OpenRules® includes all the necessary components for automatic rule compression.

 

Automatic Rule Compression Example

The rules table below was manually created in Excel as part of a real-world application.  The described relationships between "type", "adjustment", and "amount" were discovered manually by using multiple database queries over 2396 data records.  Rule Compressor has managed to compress this table to one simple rule!

Rules void classifyInstance(TestInstance instance)
IF
type is
AND
adjustment
 > $$$
AND
adjustment
< $$$
AND
amount
< $$$
AND
amount
>= $$$
THEN
Classify
Instance as
          NONE
31 $200   -$150   TOP
31   $200   -$189 BOTTOM
32 $500   -$1,000   TOP
32   $500   -$99 BOTTOM
33 $500   -$1,000   TOP
33   $500   -$100 BOTTOM
34 $500   -$1,000   TOP
34   $500   -$100 BOTTOM
35 $500   -$800   TOP
35   $500   -$100 BOTTOM
36 $500   -$800   TOP
36   $500   -$100 BOTTOM
37 $500   -$2,000   TOP
37   $500   $0.0 BOTTOM
 

 

 

8

 

Automatically discovered rules:

 IF amount <= -159
 THEN
     
classifiedAs=TOP
 ELSE
     
classifiedAs=BOTTOM

 
 

14 rules compressed to 1!
 

Correctly Classified Instances:     
2395 out of 2396

Rule Compressor has found that only one attribute ("amount") out of 3 is essential for this classification and efficiently found the threshold (-159) for this attribute.

 

Rule Discovery, Compression, and Optimization Services

OpenRules, Inc. provides professional services using an integrated ML+BR approach. You may send examples of your most complicated business rules to OpenRules at rulecompressor@openrules.com.  After an initial analysis our specialists will inform you how they (or yourself) may apply Rule Compressor to compress and optimize your rules.  The results may vary based on the availability of your data, your current rules implementation, or the very nature of your business rules.  However, you have nothing to lose - the initial analysis and consultation are always free.  If OpenRules, Inc. is able to compress your rules you then pay based on a mutually agreed saving estimate or based on actual time & material.  You also have an option to acquire Rule Compressorand apply rules compression yourself to your other rules.

Successful rules compression cannot be guaranteed.  In cases when we are not able to effectively compress your rules using Machine Learning techniques, OpenRules, Inc. specialists may apply other rules optimization techniques.  Here are two practical examples:

1. Instead of presenting all possible combinations of your business object attributes in rules, OpenRules, Inc. may apply Rule Solver to allow a constraint-based engine to find a solution for a constraint satisfaction problem that may be automatically generated by the rule engine.

2. Sometimes the business rules being implemented in a selected rules engine become too complex and enormously large in number.  Usually, rules represent the results of a data analysis and rules discovery that was conducted by business analysts.  However, frequently it could be much more productive to represent in rules not the results but the actual logic that guided business analysts during data analysis. In the past OpenRules, Inc. experts have been able to change the rules representation from an unmanageably large set of rules into a manageable, small set of decision tables.  This experience may work in your case as well. 

If your might be interested in compression and optimization of your business rules, please contact us at rulecompressor@openrules.com.

 

Top