## Uncertainty Jess

Uncertainty Jess is an extension to the Jess language for dealing with uncertainty in the style of MYCIN [1]. Buchanan and Shortlife realised that in Expert Systems (aka Knowledge Based Systems, Intelligent Systems), uncertainty is associated with both the data (facts) as well as with the rules (the knowledge of the system). As such they assigned Certainty Factors (CFs) to the data and rules within the MYCIN system. A CF is simple a numeric indication, between -1 and 1, of how certain the data/rule provider (typically a domain expert) is about the knowledge they are putting into the system.

Buchanan and Shortlife devised an approach for working out CFs of the conclusions that are generated by rules, along with a technique for calculating an overall CF when there are multiple identical conclusions generated. Roughly there approach is as follows:

1. Have the domain expert assign CFs to all the data (facts) and rules they provide.
2. The CF of a conclusion (generated by a rule) is the CF of the rule * the minimum CF of the individual pieces of data that was used to derive that conclusion.
3. If there are two identical conclusions present (cf1 and cf2), then calculate their combined CF based on the following:
If cf1 > 0 and cf2 > 0 then combined CF = cf1 + cf2 – cf1 * cf2
Else If cf1 < 0 and cf2 < 0 then combined CF = cf1 + cf2 + cf1 * cf2
Else combined CF = (cf1 + cf2) / (1 – min(abs(cf1), abs(cf2) ) )

Uncertainty Jess is a system and technique for including the same type of uncertainty reasoning in Jess programs. Initially we provide a set of examples below that show how to go from a standard Jess system, which does not use uncertainty, to a system that does by using Uncertainty Jess. To convert an existing program, there are essentially four steps:

1. Add a slot to relevant deftemplates (typically these will be the ones that model the basic data of your system), which will store the CF associated with a fact of that deftemplate.
2. Update the facts of those deftemplates to include associated CF value.
3. Add the following to your Jess code: `(load-function uk.ac.abdn.csd.uncertaintyjess.UncertaintyJess)`
4. Copy and paste the detect-and-calculate-multiple-conclusions rule from the `UncertainEnteroClassificationDetectingMultipleConclusion.clp` file into your Jess code. Then modify it to use the deftemplates that you are using for storing conclusions (in this example it is the `classification` deftemplate).

That should be it! You will then need to include the `uncertaintyjess.jar` file on the classpath when you run your program. How this is done can vary, but if you are running Jess from the command line and using the application Jess provides for this, then the following should do:

`java -classpath uncertaintyjess.jar;jess.jar;. jess.Main`

## Examples

We provide an example which shows how Uncertainty Jess is added to a simple system which deals with organism classification.

1. BasicEnteroClassification.clp – is the basic system
2. UncertainEnteroClassification.clp – is the basic system extended with CFs for the data and the rules
3. UncertainEnteroClassificationDetectingMultipleConclusions.clp – is the system which has uncertainty associated with data and rules, extended to support deriving CFs when there are multiple identical conclusions.

Hopefully, by looking at these examples (there is plenty of comments to explain what is going on) it should be clear how to extend a system with uncertain reasoning using Uncertainty Jess. If you have any other questions/are having any difficulties, please feel free to email me (see the about me page) with any questions.