if a and b then c exceptThis is interpreted as "if a and b are true then we conclude c unless d is true. In that case we conclude e. Here are the outputs of the RDR under different conditions:
if d then e
else if f and g then h
a and b => cNotice that an RDR can always be rewritten as an ordinary if-then-else statement. The rule above would be:
a and b and d => e
a and f and g => h
if a and b thenWe use the exception conditions instead of the normal if-then-else form because this will make it easier for us to update rules.
if d then e
else c
else if f and g then h
if true then normal rule 0This simply says that no matter what, the expert system will always draw the conclusion normal.If this were a problem in medical diagnosis, this rule would work most of the time because most people are normal!
Now suppose that a person comes to the doctor with symptoms a and b and the doctor concludes that the patient has disease c. The RDR would conclude that this person is normal. To correct this, we add an exception rule:
if true then normal except rule 1This rule now works for this patient since the RDR would conclude that the person is normal except when the symptoms a and b are present.
if a and b then c
Now suppose another patient with disease h comes along. He as symptoms f and g. Because there is no rule to cover these conditions, we still get a diagnosis of normal. This is because true is always true, so in the absence of any other rules, normal is the conclusion. How do we fix this? We add a new else part:
if true then normal except rule 2This RDR now works for the new patient. Now suppose another patient comes to the doctor. This patient has symptoms a, b and d. The doctor concludes that the patient has disease e, but the RDR concludes c because of a and b. To fix this problem, we add another exception rule:
if a and b then c
else if f and g then h
if true then normal except rule 3This process is repeated for each case that is seen.
if a and b then c except
if d then e
else if f and g then h
How do we know where to add a new rule? Here is the algorithm:
For example, rule 0, above fires, but produces the wrong
conclusion so an except branch is added. Similarly, in rule 2,
the a and b condition succeeds when given the example a and b
and d. It should not so we add the exception condition.
For example, in rule 1 above, the true condition succeeds
and then we test a and b. This fails so we add an else branch
to handle the new case.
An RDR system keeps track of which cases caused a rule to be created. Here is rule 2 above, rewritten with the associated cases:
if true then normal because [] exceptNow let's see what happens when we get case [a, b, d]. Initially it is classified as d, which is incorrect. Now what is the difference between the original case [a, b] and [a, b, d]? The new case has the additional condition d. So if we want to distinguish the two cases, we just look to see if d is present. Thus the new rule is:
if a and b then c because [a, b]
else if f and g then h because [f, g]
if true then normal because [] exceptSuppose that instead of the case [f, g] we had [a, f, g]. The RDR above would still produce the correct diagnosis, but the cases would be a little different.
if a and b then c because [a, b]
if d then e because [a, b, d]
else if f and g then h because [f, g]
if true then normal because [] exceptAccording to this rule, the case [f, g] would be diagnosed as h. Suppose it should be diagnosed as i. What is the difference between the cases? The original case has an additional a. Thus the new rule could be:
if a and b then c because [a, b]
if d then e because [a, b, d]
else if f and g then h because [a, f, g]
if true then normal because [] exceptThus, we can make a difference list of conditions from the old and new case like this:
if a and b then c because [a, b]
if d then e because [a, b, d]
else if f and g then h because [a, f, g] except
if not a then i because [f, g].
Note: when attributes are numeric, we may have to do something else. For example, if case 1 has age 20 and case 2 has age 40, we might pick the mid point and build a condition age > 30.