INFERENCE METHODS

This is a reference guide to the types of inference methods available in 
the 'es' module of IRKit, as used in KBTools/Istar.  Each method is known 
by a short identifier of the for esIM_XXX where XXX is its name.  The 
prefix, esIM, means 'es' module Inference Method, and these names are those 
found in the program (e.g. in the es.h include file).

      For each method we give the following information:

1.  esIM_XXX name
2.  Its normal label in a list view gadget - what the knowledge engineer is 
likely to see.
3.  What it does.
4.  What types of antecedents is acts on or requires.
5.  What types of consequents is requires.
6.  Advanced use.
7.  Any stopping rule that makes the result answered before all antecedents 
have been searched by backward chaining.


esIM_ADD            "X = A + B, C, ..."
esIM_SUB            "X = A - B, C, ..."

Action

      With integers and floating point numbers these perform simple
addition and subtraction.  The first antecedent is taken (converted to 
integer or floating point as needed), and then all the others are added to 
or subtracted from it, accumulating a result as we take each antecedent. 
For simple use, ensure that all antecedents are integer or float.

Antecedents

      These act on numeric antecedents.

Consequents

      Integer, Float, Angle/Direction, Enum, Ordinal.  Others in future,
perhaps.

Advanced use

      When B (and C etc.) is a PROPORTION the inference is different: it
adds that proportion of what is already accumulated.  Thus (60 + 50%) gives 
90, not 110.  If C, D, etc. is a PROPORTION, it takes a proportion of what 
is already accumulated, not just of A.  Thus if A is 60, B is 50%, C is 20 
and D is 10% the result is:

      #  take A to give 60
      #  add B=50% of that to give 90
      #  add C=20 to give 110
      #  add D=10% of that to give 121.

At present, probabilities, Bayesians, odds and ratios act as proportions 
do.

esIM_MULT          "X = A * B, C, ..."
esIM_DIV             "X = A / B, C, ...)"

Action

      A is taken and then multiplied or divided by the rest.

Stopping

      With multiplication, if an antecedent makes the result zero then no
further ones are taken.

Antecedents

      These act on numeric antecedents.

Consequents

      Integer, Float or Angle/Direction.

Advanced use

      The stopping rule can be used to control the order in which questions
are asked.


esIM_AND            "X = A & B & C & ..."
esIM_OR              "X = A | B | C | ..."

Action

      The result is the normal boolean AND or OR of all the antecedents.

Stopping

      With AND, if any antecedent in order A, B, C ... is FALSE, no others
are taken.  With OR, if any is TRUE, no others are taken.

Antecedents

      These act on boolean antecedents.  Any other type is converted to
boolean if possible before being accumulated into the result.

Consequents

      Boolean.

Advanced use

      The stopping rule can be used to control the order in which questions
are asked.


esIM_NOT            "X = !(A)"

Action

      Gives the NOT of the antecedent.

Antecedents

      This acts on a single boolean antecedent, and ignores all others.

Consequents

Advanced use


esIM_PROBAND    "p(X) = p(A) & p(B) &..."
esIM_PROBOR               "p(X) = p(A) | p(B) |..."
esIM_PROBNOT    "p(X) = 1 - p(A)"

Action

      They give, respectively, the probabilistic AND, OR and NOT.

Antecedents

      These act on probabilistic antecedents.  Proportions are treated as
probabilities.  Bayesians have their main part treated as a probability. 
Booleans are converted to probability.  Odds are converted to probability 
in the normal manner, viz. P = O / (1 + O).

Consequents

Advanced use


esIM_BAYES        "Bayesian"

Action

      A very useful inference for decision support systems, this performs a
Bayesian accumulation of beliefs of evidence to come to a level of belief 
in a conclusion.

      That is, the consequent and antecedents are all levels of belief in
various propositions.  e.g. (Antecedent belief that) the bird has a red 
breast and (antecedent belief that) the bird is small might be evidence for 
(consequent belief that) the bird is a (British) robin, and (antecedent 
belief that) the bird has a thick bill would be evidence against.  (For 
'belief' you can also say 'probability'.)

      This form of inference is found in artificial intelligence.

Stopping

      Normally there is no stopping rule.  But you can define a Lower or
Upper Cut-Off to ignore any weak evidence once you are sufficiently 
confident in the present result.  Suppose you have six antecedents and a 
Lower Cut-Off of 10% on the consequent, and that three of the antecedents 
have been answered in such a way as to bring the belief in the consequent 
down to 5%.  Then if the other three (unanswered) antecedents have 
sufficiently weak evidence that however they are answered their combined 
effect will not bring the final result over 10%, then the consequent is 
considered answered.  So the three remaining antecedents are not searched 
during the backward chaining process.  Conversely for the Upper Cut-Off.

Antecedents

      This acts on Bayesian antecedents.  Probabilities, proportions and
booleans are converted to Bayesian whose a-priori is 0.5 (50%).

Consequents

      Bayesian.

Advanced use

      Using the Lower and Upper Cut-Offs you can make the knowledge base
appear more 'intelligent' and less pedantic.

      To understand Bayesian accumulation of evidence, read the following.

      The consequent belief is an accumulation of the antecedent beliefs,
for and against.  Each antecedent can have a different weight, so that 
having a red breast is of greater weight (more conclusive) as evidence for 
the bird being a robin than that the bird is small.  Evidence against (such 
as thick bill) is also indicated by the weights, and in this case the 
weight would be inverted.

      The weights are held as parameters of the relationship that joins the
antecedent to the consequent.  All antecedent relationships must have a UOp 
of either 'Normal' or 'Negate', and are expected to hold a Bayesian Weight, 
which is two odds multipliers - four small positive integers in all.  One 
pair should give a ratio >= 1 and the other pair should give a ratio <= 1. 
The distance these ratios are from 1 the 'stronger' the weight for this 
antecedent.

      If belief in the antecedent is total (e.g. 100%) then the full weight
found in the relationship is taken and accumulated into the consequent 
belief.  But if the belief is partial then only part of the weight is 
taken.  By "total" we mean either that the antecedent is definitely known 
to be true (100%) or definitely known to be false (0%).

      The consequent and each antecedent has an a-priori belief, which is
the belief which would be taken if there were no evidence.  (The a-priori 
is often found from the statistical probability of the proposition being 
true.)  The a-priori belief of the consequent is the starting point for 
accumulation.  e.g. The a-priori belief that the bird is a robin might be 
10%, and as evidence is accumulated for or against the belief varies from 
this level.  When the proposition is an antecedent of a Bayesian inference 
then the a-priori is also used to calculate partial weights.  If the belief 
is precisely that of the a-priori then the antecedent has zero weight, no 
effect.  As the belief moves away from the a-priori of the antecedent the 
amount of the weight taken increases until the whole is taken for a total 
belief.

      For details, see the section on Bayesian accumulation.


esIM_EQ              "Whether A = all"
esIM_NE              "Whether A <> all"

Action

      These can take most types of antecedent, and yields a boolean result.
All antecedents after the first, viz. B, C, D, ..., are converted to the 
type of the first before the comparison.

      The result is TRUE is A equals all the rest, is unequal to all the
rest, respectively.

Stopping

      Answered as soon as it is known the result is false, so no further
antecedents will be searched during backward chaining.

Antecedents

      A:  Any.
      Others:  Any convertible to type of A.

Consequents

      Boolean.

Advanced use

      Owing to the stopping rule, this can be used to control the order in
which questions are asked of the user.


esIM_GT              "Whether A > all"
esIM_LT               "Whether A < all"
esIM_GE              "Whether A >= all"
esIM_LE               "Whether A <= all"

Action

      These all perform comparisons in a similar manner to the above.  The
difference is that the antecedents must by numeric or string.

Antecedents

      A: Any numeric or ordinal.
      Others:  Any convertible to type of A.

Consequents

      Boolean.

Advanced use


esIM_PEQ            "% A ="
esIM_PGT            "% A >"
esIM_PLT             "% A <"
esIM_PNE            "% A <>"
esIM_PGE            "% A >="
esIM_PLE             "% A <="

Action

      These perform comparisons similar to the above, but they find the
proportion for which the comparison is true, rather than whether all are 
true.

Antecedents

      A: Any numeric or ordinal.
      Others:  Any convertible to type of A.

Consequents

      The result is a Proportion (or Probability or Bayesian).

Advanced use

esIM_CEQ            "Count A ="
esIM_CGT            "Count A >"
esIM_CLT             "Count A <"
esIM_CNE            "Count A <>"
esIM_CGE            "Count A >="
esIM_CLE             "Count A <="

Action

      These perform comparisons similar to the above, but count the number
for which the comparison is true.

Antecedents

      A: Any numeric or ordinal.
      Others:  Any convertible to type of A.

Consequents

      Integer.

Advanced use


esIM_ISIN            "A is found in all B, C, ..."
esIM_CISIN          "How many A is in"
esIM_PISIN           "% A is in"

Action

      These look to see if A 'is in' all the other antecedents, and return
either a truth value, a number or a proportion (as in the comparisons 
above).

      By 'is in' we mean one of two things.  If all antecedents are
strings, then is looks to see if A is a substring of all other antecedents. 
If all antecedents are integers, it looks to see if A is a factor of all 
the others.

Antecedents

      A:  String or integer.
      Others:  Must be like A or convertible to A's type.

Consequents

      esIM_HAS:  Boolean.
      esIM_CHAS:  Integer.
      esIM_PHAS:  Proportion, Probability or Bayesian.

Advanced use


esIM_HAS            "A contains all B, C, ..."
esIM_CHAS          "How many are in A"
esIM_PHAS          "% in A"

Action

      These operate inversely to the above.  They count or find the
proportion of antecedents after the first (A), that are 'in' A in the sense 
defined above.  That is, if strings, whether each is a substring of A, and 
if integers, if each is a factor of A.

Antecedents

      A:  String or integer.
      Others:  Must be like A or convertible to A's type.

Consequents

      esIM_HAS:  Boolean.
      esIM_CHAS:  Integer.
      esIM_PHAS:  Proportion, Probability or Bayesian.

Advanced use


esIM_FIRSTKNOWN       "First Known"

Action

      This finds the first antecedent that has a known value.  It is useful
for instance in allowing the user to answer 'Unknown' and then inferring 
the value by other means.  It can take any type of antecedent that is 
convertible to the type of the consequent.

Antecedents

      Any that can be converted to type of consequent.

Consequents

      Any.

Advanced use

      With this you can provide sophisticated strategies of questioning the
user or otherwise finding out information.


esIM_FIRSTOK      "Present Each to User"

** This is current not available

Action

      This takes the value of the first antecedent and presents it to the
user for acceptance.  The user can accept or reject it.  If s/he rejects 
it, then the second is presented, and so on until one is accepted.  If none 
is accepted then result is Unknown.  It can take any type of antecedent 
that is convertible to the type of consequent.

Antecedents

      Any, converted to consequent type.

Consequents

      Any.

Advanced use

      You can use this to build 'critiquing' systems, which ask a few
questions, come to a conclusion and then ask the user "Is this the answer 
you want?" and if not then probe the user with more questions.


esIM_CHOICE                "Chooser"

Action

      This acts like an array or small database.  It chooses one
antecedent.  If A is integer, it chooses the Ath among the rest.  That is, 
if A is 1 it chooses B, if 2, it chooses C, etc.  If 0, it returns Unknown. 
If A is boolean, it chooses B if A is false, and C if A is true.

Antecedents

      A:  Anything that can be converted to integer.
      Others:  Converted to type of consequent.

Consequents

      Any.

Advanced use

      Note that in backward chaining, it first gets A answered and once its
value is found will only backward chain up the appropriate chosen 
antecedent.  In this way you can cut out whole sections of questioning if 
you wish.


esIM_ALLANS               "All Answered"

Action

      This returns TRUE or FALSE, depending on whether all antecedents are
in an answered state.  They can be of any type.

Antecedents

      Any.

Consequents

      Boolean.

Advanced use


esIM_COUNTANS "How many Answered"

Action

      This counts the number of antecedents that are answered.  They can be
of any type.

Antecedents

      Any.

Consequents

      Integer.

Advanced use

Beware: The consequent is always known and answered.

esIM_COUNTKNOWN     "How many Known"

Action

      This counts the number of antecedents that have known values.  They
can be of any type.

Antecedents

      Any.

Consequents

      Integer.

Advanced use


esIM_COUNT                "No of Antes"

Action

      This is simply a count of the antecedents.  Like a constant, but you
don't have to set it manually if you add another.

Antecedents

      Any.

Consequents

      Integer.

Advanced use


esIM_IRAND         "X = A + (Rand * (B - A))"

Action

      This produces a random number.  At present, the antecedents are
irrelevant.  It uses the FastRand algorithm.

Antecedents

      Any.

Consequents

      Integer.

Advanced use


esIM_MAX           "Max"
esIM_MIN            "Min"

Action

These act on numeric or string antecedents.  They find which one is maximum 
or minimum.

Antecedents

      Anything that can be converted to type of consequent.

Consequents

      Numeric or string.  The antecedents are converted to type of
consequent.

Advanced use

      These act on numeric or string antecedents.  They return the maximum
or minimum value.


esIM_WHICHMAX "Which Max"
esIM_WHICHMIN  "Which Min"

Action

These act on numeric or string antecedents.  They find which one is maximum 
or minimum.

Antecedents

      Most numerics and string.

Consequents

      Integer, ENUM or ORDINAL (in which case the answer is 1 if A is
max/min, 2 if B, and so on).
      Or BLOCK, in which case the result is the DSAP of the antecedent
block.

Advanced use

      The use of BLOCK consequent is expected to become more versatile in
future, but at present you can find for instance the name of the block by 
conversion to string at the next stage.


esIM_AVG            "Mean"

Action

      This acts on certain numeric antecedents, and returns the mean
(average) of them.

Antecedents

      Numeric.

Consequents

      Numeric.

Advanced use


esIM_CONCAT              "Concat"

Action

This concatenates string antecedents.  e.g. "cat" and "dog" antecedents 
gives consequent "catdog" (note: no spaces; an option for spacing might be 
added in future).

In future CONCAT is likely to be used for any data that is essentially a 
linear sequence, such as sound samples, songs, animations, lists, arrays.

Antecedents

      If the antecedents are not string type then they are converted to
string if possible.

Consequents

      String.

Advanced use


Copyright (c) Andrew Basden, 1996
