Adding Rules Manually in the Rule Manager

The Rule Manager allows you not only to inspect, manipulate and optimize a set of rules created with the LLM tasks, but also to manually add heuristic rules, by simply linking it to a Data Manager.

Prerequisites

Additional tabs

The following additional tabs are provided:

  • Documentation tab where you can document your task,

  • Parametric options tab where you can configure process variables instead of fixed values. In this task the parametric options are available for alert options only.

  • History tab, which tracks all  the operations that have been performed in the Rules Manager task, and behaves in the same way as the Data Manager History tab, with icons for the main operations:

    • Minus, for the deletion of rules or conditions

    • Plus, for the creation of new rules or conditions

    • Question mark, for query operations.

Procedure

  1. After having selected the output attribute in a Data Manager task, drag the Rule Manager task onto the stage.

  2. Link it to a Data Manager.

  3. Double click the Rule Manager task.

  4. Click the plus button located under the Rules tab.

  5. Choose the output value and define its conditions by right-clicking onto the Output value and selecting Append Condition.

  6. Choose the condition and click Ok to add it.

  7. Choose the attribute value(s) to add and click Ok.

  8. Save and compute the task.

  9. Repeat the operation to add other conditions.

Results

Rules spreadsheet

The Rule spreadsheet, with the generated ruleset, contains the following columns:

  • #Cond: the number of conditions in the rule.

  • Output: the output if that rule is matched.

  • Cond n: the n-th condition.

In this spreadsheet you can modify rules and conditions:

  • To delete a rule, select its row in the table and either click the minus icon above the spreadsheet or right-click and select Delete selected rules.

  • To add new rules either click the plus icon above the spreadsheets or by right-click within the spreadsheet and select Create rule. Once you have specified the output value for your rule, a blank rule will be added to the table to which you will then need to add/append conditions.  

  • To delete a condition select it in the spreadsheet, right-click and select Delete selected condition or simply press Delete. The conditions to be removed can belong to different rules. 

  • To edit a condition either select it in the spreadsheet, right-click and select Edit condition or simply double-click it. The changes you can make depend on whether the condition is an ordered or nominal condition.

Covering spreadsheet

The Covering spreadsheet, with additional information related to the covering of each rule in the following columns:

  • #Patt.: the number of patterns in the training set with the same output class of the rule.

  • Covering: the percentage of patterns (with the output class of the rule) matched by this rule in relation to the total number of patterns of that class.

  • w\o Cond n: the covering gain that would be obtained by removing the n-th condition.

Error spreadsheet

The Error spreadsheet, with additional information about the error scored by each rule in the following columns:

  • #Patt.: the number of patterns in the training set with the output class different from the output class of the rule.

  • Error: the percentage of patterns (with the output class different from that of the rule) matched by this rule in relation to the total number of patterns where the output class is different from the class of the rule.

  • w\o Cond n: the error increase that would be obtained by removing the n-th condition. 

Example

The following example uses the Go to work business rules dataset, provided below.

Go to work business rules.xlsx

Description

Screenshot

Import the dataset through an Import from Excel File task, then drag a Data Manager and define the Transport attribute as Output in the Attributes tab.

After having imported the dataset, drag a Rule Manager task onto the stage and link it to the Data Manager task (if you have added it) or directly to the Import from Excel File task.

Double click the Rule Manager task to open it. As you can see, no rules have been created for this dataset.

Click the plus button to add a new rule.

In this example we want to add three rules, stating that:

  1. IF Weather = Sunny AND IF Smart Working = No, THEN Transport = Bicycle

  2. IF Weather = Rain AND IF Smart Working = No, THEN Transport = Bus

  3. IF Smart Working = Yes, THEN Transport = None

Let’s start by adding the first rule, so select Bicycle as the output value and click OK. The rule has been added onto the Rules tab.

Right-click on the Output value and select Append condition.

In this example, we will need to append two conditions: starting with the first one, choose the Weather attribute and click OK, then choose the condition, which will be in Sunny.

Repeat the same step mentioned above and add the second condition, which will be Smart Working and the value will be in No.

The first rule has been created.

Add a new rule by clicking on the plus button, choosing the output and appending the conditions needed.

This is the final result after we have added all the rules mentioned in the first step of this example, so we can analyze the Covering spreadsheet and the Error spreadsheet using the directories provided in the Results table at the beginning of this page.