In this final module, we'll use a hypothetical graduate school admission
process as a case study to illustrate some ideas about knowledge base
design, construction and debugging. A listing of the complete
e2gLite graduate admissions knowledge base is included
in the module for reference.
If you haven't already done so, taking a look at
Module 6: Introduction to
Knowledge Engineering is recommended because it
provides supporting material for this discussion. We'll also assume
that you have worked the examples in
Module 4: Creating your first knowledge base
so that you know how to enter a knowledge base and create a Web page
that loads the e2gLite applet to access your rules.
Admissions recommendation logic: The logic for the example
expert system is represented by the following flow chart:
| Graduate Admissions Recommendation Logic |
|
Framework: An expert system is developed in a conceptual framework
that represents the problem domain. This structure supports the knowledge
decomposition that leads to the definition of attributes and creation of
rules as described in Module 6.
Procedural examples like this admissions process are often documented in a
flowchart or decision tree format when knowledge engineering
begins. It is tempting to develop a rule to represent each path through the
flow chart, but additional analysis that identifies and names
subconcepts could produce a knowledge base that
more clearly supports two of the justifications for using an expert system:
the ability to explain why a
recommendation was made and the ability to make a recommendation using
a minimum amount of factual input.
Expert system outputs: A list of the possible admissions
recommendations can be extracted from the flow chart:
- Admit with full status
- Admit with full status (special decision)
- Admit provisionally
- Admit provisionally with recommended remedial English coursework
- Refer to academic department for decision
- Admit conditionally (special decision)
- Wait for transcript before making decision
- Deny normal admission (could be reviewed)
Recommendations 1-5 are possible for students who have provided a
final undergraduate transcript. Recommendations 6-7 are possible for
students who have not provided a final undergraduate transcript.
Recommendation 8 is possible whether or not the undergraduate degree
has been completed.
Expert system inputs: Here is a grouped list of the
attributes, identified from the flow chart, for which input PROMPTs
will be written:
- Completion of undergraduate program
- Final undergraduate transcript availability
- English language requirement
- Bachelor's degree from US institution
- Test of English as a Foreign Language (TOEFL)
- Performance as an undergraduate
- Grade Point Ratio (GPR) last 60 Undergraduate (UG) hours
- Honor student
- Honor graduate
- Valedictorian
- Salutatorian
- Performance in prior graduate work (if any taken)
- Grade Point Ratio (GPR) for completed graduate work
- Performance on graduate admissions tests
- Graduate Record Exam (GRE) overall score
- Graduate Record Exam (GRE) verbal score
Certainty factors: Because these inputs are factual rather than
opinions, certainty factor input will not be requested for any of the PROMPTs
in this knowledge base: the optional CF parameter is not used
in the PROMPTs.
Multi-valued attributes: There are four parameters representing
special honors, and an applicant could possess any combination of these.
The parameters are used in several rules, and the fact that an
applicant possesses none of the attributes is also
used in several rules. This set of circumstances is efficiently
represented in an e2gLite knowledge base through the combined use of
the AllChoice PROMPT along with the MAXVALS and DEFAULT statements:
PROMPT [the applicant] AllChoice
"This applicant is (check all that apply):"
"an honor student"
"an honor graduate"
"a class valedictorian"
"a class salutatorian"
MAXVALS [the applicant] 4
DEFAULT [the applicant] = "not the recipient of special honors"
The AllChoice PROMPT allows the knowledge base user to check any or
all of the parameters describing the applicant's special honors. A MAXVALS
statement allowing four values of the applicant must be included
or values beyond the first one entered will be discarded.
It is often useful for a rule to detect the fact that no value can
be found for an attribute. This is accomplished in e2gLite by employing
the DEFAULT statement. The PROMPT for the applicant is the only
source of values for this attribute. If none of the values are checked when
the PROMPT is issued, the inference engine determines that the value cannot
be resolved and the DEFAULT value "not the recipient of special honors" is
assigned. Here is an example rule that will only fire for an applicant
who has received no special honors:
RULE [Conditional eval, low GRE]
If [the evaluation] = "for a conditional decision" and
[the applicant] = "not the recipient of special honors" and
[the applicant's GRE score] < 1100
Then [the recommendation] = "wait for transcript" and
[the action] = "based on established policy"
Interim constructs: Knowledge bases are sometimes simplified and
recommendation justifications clarified by using interim constructs to capture
a common theme. The next pair of rules captures the logic in the
flow chart that determines the need to examine the applicant's undergraduate
GPR:
RULE [Consider undergraduate GPR (no grad credits)]
If [the applicant's graduate status] = "no prior graduate work completed"
Then [the undergraduate GPR should be considered] = true
RULE [Consider undergraduate GPR (grad credits)]
If [the applicant's graduate status] = "prior graduate work completed" and
[the applicant's GPR on prior graduate work] > 2.99
Then [the undergraduate GPR should be considered] = true
The contrived attribute the undergraduate GPR should be considered
may then be used in rules like the following:
RULE [Deny because of undergraduate GPR]
If [the undergraduate GPR should be considered] = true and
[the applicant's GPR on last 60 undergraduate hours] < 2.5
Then [the recommendation] = "deny normal admission" and
[the action] = "based on established policy"
Without this device, the following rules would be required to capture
the same logic (and there are several similar rules that must determine
whether to evaluate the undergraduate GPR):
RULE [Deny because of undergraduate GPR (no grad credits)]
If [the applicant's graduate status] = "no prior graduate work completed" and
[the applicant's GPR on last 60 undergraduate hours] < 2.5
Then [the recommendation] = "deny normal admission" and
[the action] = "based on established policy"
RULE [Deny because of undergraduate GPR (grad credits)]
If [the applicant's graduate status] = "prior graduate work completed" and
[the applicant's GPR on prior graduate work] > 2.99 and
[the applicant's GPR on last 60 undergraduate hours] < 2.5
Then [the recommendation] = "deny normal admission" and
[the action] = "based on established policy"
The knowledge base: the complete knowledge base is provided in
the following table as a reference.
| Graduate Admissions Knowledge Base |
REM Graduate admissions demonstration expert system
REM Decide how to proceed
RULE [Language requirement]
If [the applicant's UG status] = "receiving a bachelor's degree from a US institution" or
[the applicant's TOEFL score] > 499
Then [the language requirement] = "met"
RULE [Conditional consideration]
If [the language requirement] = "met" and
[the applicant's final undergraduate transcript] = "not available"
Then [the evaluation] = "for a conditional decision"
RULE [Full consideration]
If [the language requirement] = "met" and
[the applicant's final undergraduate transcript] = "available"
Then [the evaluation] = "for a full decision"
REM Conditional evaluation
RULE [Wait for transcript]
If [the evaluation] = "for a conditional decision" and
[the applicant's GPR on last 60 undergraduate hours] < 3.3
Then [the recommendation] = "wait for transcript" and
[the action] = "based on established policy"
RULE [Honor student]
If [the evaluation] = "for a conditional decision" and
[the applicant's GPR on last 60 undergraduate hours] > 3.29 and
[the applicant] = "an honor student"
Then [the recommendation] = "admit conditionally" and
[the action] = "based on special decision"
RULE [Conditional eval, high GRE]
If [the evaluation] = "for a conditional decision" and
[the applicant] = "not the recipient of special honors" and
[the applicant's GRE score] > 1099
Then [the recommendation] = "admit conditionally" and
[the action] = "based on special decision"
RULE [Conditional eval, low GRE]
If [the evaluation] = "for a conditional decision" and
[the applicant] = "not the recipient of special honors" and
[the applicant's GRE score] < 1100
Then [the recommendation] = "wait for transcript" and
[the action] = "based on established policy"
REM Full evaluation
REM Deny
RULE [Deny because language requirement not met]
If [the applicant's UG status] = "not receiving a bachelor's degree from a US institution" and
[the applicant's TOEFL score] < 500
Then [the recommendation] = "deny normal admission" and
[the action] = "based on established policy"
RULE [Deny because of graduate GPR]
If [the applicant's graduate status] = "prior graduate work completed" and
[the applicant's GPR on prior graduate work] < 3.0
Then [the recommendation] = "deny normal admission" and
[the action] = "based on established policy"
RULE [Consider undergraduate GPR (no grad credits)]
If [the applicant's graduate status] = "no prior graduate work completed"
Then [the undergraduate GPR should be considered] = true
RULE [Consider undergraduate GPR (grad credits)]
If [the applicant's graduate status] = "prior graduate work completed" and
[the applicant's GPR on prior graduate work] > 2.99
Then [the undergraduate GPR should be considered] = true
RULE [Deny because of undergraduate GPR]
If [the undergraduate GPR should be considered] = true and
[the applicant's GPR on last 60 undergraduate hours] < 2.5
Then [the recommendation] = "deny normal admission" and
[the action] = "based on established policy"
RULE [Deny because of undergraduate GPR and GRE]
If [the undergraduate GPR should be considered] = true and
[the applicant's GPR on last 60 undergraduate hours] > 2.49 and
[the applicant's GRE score] < 900
Then [the recommendation] = "deny normal admission" and
[the action] = "based on established policy"
RULE [Deny because of GRE]
If [the undergraduate GPR should be considered] = true and
[the applicant's GPR on last 60 undergraduate hours] > 2.49 and
[the applicant] = "not the recipient of special honors" and
[the applicant's GRE score] < 900
Then [the recommendation] = "deny normal admission" and
[the action] = "based on established policy"
REM Provisional acceptance
RULE [Provisional acceptance: low GRE, verbal GRE]
If [the undergraduate GPR should be considered] = true and
[the applicant's GPR on last 60 undergraduate hours] > 2.49 and
[the applicant] = "not the recipient of special honors" and
[the applicant's GRE score] > 899 and
[the applicant's GRE score] < 1100 and
[the applicant's GRE verbal score] < 400
Then [the recommendation] = "admit provisionally - recommend English remediation" and
[the action] = "based on established policy"
RULE [Provisional acceptance: low GPR, verbal GRE]
If [the undergraduate GPR should be considered] = true and
[the applicant's GPR on last 60 undergraduate hours] > 2.49 and
[the applicant's GPR on last 60 undergraduate hours] < 3.0 and
[the applicant's GRE score] > 899 and
[the applicant's GRE verbal score] < 400
Then [the recommendation] = "admit provisionally - recommend English remediation" and
[the action] = "based on established policy"
RULE [Provisional acceptance: low GRE]
If [the undergraduate GPR should be considered] = true and
[the applicant's GPR on last 60 undergraduate hours] > 2.99 and
[the applicant] = "not the recipient of special honors" and
[the applicant's GRE score] > 899 and
[the applicant's GRE score] < 1100 and
[the applicant's GRE verbal score] > 399
Then [the recommendation] = "admit provisionally" and
[the action] = "based on established policy"
RULE [Provisional acceptance: low GPR]
If [the undergraduate GPR should be considered] = true and
[the applicant's GPR on last 60 undergraduate hours] > 2.49 and
[the applicant's GPR on last 60 undergraduate hours] < 3.0 and
[the applicant's GRE score] > 899
Then [the recommendation] = "admit provisionally" and
[the action] = "based on established policy"
REM Accept
RULE [Acceptance: honors]
If [the undergraduate GPR should be considered] = true and
[the applicant's GPR on last 60 undergraduate hours] > 2.99 and
[the applicant] : "an honor graduate" "a class valedictorian" "a class salutatorian"
Then [the recommendation] = "admit with full status" and
[the action] = "based on special decision"
RULE [Acceptance at departmental discretion]
If [the undergraduate GPR should be considered] = true and
[the applicant's GPR on last 60 undergraduate hours] > 2.99 and
[the applicant] = "not the recipient of special honors" and
[the applicant's GRE score] > 1099 and
[the applicant's GRE verbal score] < 400
Then [the recommendation] = "admission decision is at department's discretion" and
[the action] = "based on established policy"
RULE [Acceptance]
If [the undergraduate GPR should be considered] = true and
[the applicant's GPR on last 60 undergraduate hours] > 2.99 and
[the applicant] = "not the recipient of special honors" and
[the applicant's GRE score] > 1099 and
[the applicant's GRE verbal score] > 399
Then [the recommendation] = "admit with full status" and
[the action] = "based on established policy"
REM Prompts
PROMPT [the applicant's UG status] MultChoice
"This applicant is:"
"receiving a bachelor's degree from a US institution"
"not receiving a bachelor's degree from a US institution"
PROMPT [the applicant's TOEFL score] Numeric
"What is the applicant's TOEFL (Test of English as a Foreign Language) score?"
"0"
"800"
PROMPT [the applicant's GPR on prior graduate work] Numeric
"What is the applicant's GPR (Grade point ratio) for prior graduate work?"
"0"
"4.0"
PROMPT [the applicant's final undergraduate transcript] MultChoice
"The applicant's final undergraduate transcript is:"
"available"
"not available"
PROMPT [the applicant's GPR on last 60 undergraduate hours] Numeric
"What is the applicant's GPR (Grade point ratio) for the last 60 UG hours?"
"0"
"4.0"
PROMPT [the applicant's graduate status] MultChoice
"This applicant's graduate status is:"
"prior graduate work completed"
"no prior graduate work completed"
PROMPT [the applicant's GPR on prior graduate work] Numeric
"What is the applicant's GPR (Grade point ratio) on prior graduate work?"
"0"
"4.0"
PROMPT [the applicant] AllChoice
"This applicant is (check all that apply):"
"an honor student"
"an honor graduate"
"a class valedictorian"
"a class salutatorian"
PROMPT [the applicant's GRE score] Numeric
"What is the applicant's total GRE (Graduate Record Exam) score?"
"0"
"1600"
PROMPT [the applicant's GRE verbal score] Numeric
"What is the applicant's GRE verbal score?"
GOAL [the recommendation]
GOAL [the action]
MAXVALS [the applicant] 4
DEFAULT [the applicant] = "not the recipient of special honors"
|
Delivering a knowledge base in languages other than English (requires e2gLite v2.0 or later: e2gSwing is recommended)
A typical approach to delivering applications in multiple languages is to
first produce a version in a base language, then localize this version of the application
for each target language. Once a base language (English is currently the
only base language for e2gLite) version of a
knowledge base has been developed and debugged, the following steps
may be used to deliver it in another language:
- Translate the Knowledge base (a text editor with a search and replace capability is almost a necessity for this process):
- Make a copy of the English language knowledge base (*.kb file) giving it a new name for the target language.
- Create the TRANSLATE commands that convert text messages generated internally by e2gLite into the target language.
The complete set of TRANSLATE commands for a specific target language will be included in
every knowledge base you translate to this language, so you will only have to build the TRANSLATE commands once
for a given language no matter how many knowledge bases you wish to translate.
The easiest way to accomplish this process is to cut and paste the
complete list of TRANSLATE statements from the table titled
Text Customizeable with TRANSLATE Commands
in the Reference document into a text editor, then translate each of the
English words or phrases that is shown in the list into the target language.
- Starting at the beginning of the knowledge base, translate each rule and
attribute name (values enclosed by the delimiters [...]), then search and replace each usage of the
attribute name in the knowledge base with the translated value. It is best to
use the entire string (including the delimiters) in the search and replace
operation to avoid accidentally including extra characters.
- Starting at the beginning of the knowledge base, translate each
text string (values enclosed by the delimiters "..." or '...'), then search and replace each usage of the
text string in the knowledge base with the translated value.
- IMPORTANT! Translate only attribute names and values enclosed by delimiters, not any part of e2gLite commands.
As an example, the rule fragment:
[the headlights dim when trying the starter] = true and
Translates to:
[les phares obscurcissent en essayant le démarreur] = true and
because true and and are elements of the e2gLite RULE command.
When a rule is displayed by e2gLite, English text is translated for output only
by the appropriate TRANSLATE commands.
- Test the translated knowledge base carefully to see if you need to increase the
displayed width of the applet (defined by the width= value in the Applet tag).
When English words and phrases are translated into another language the length in characters typically
increases, and e2gLite truncates long text strings when they are displayed. Truncated text is
easily identified because e2gLite terminates truncated strings with ellipses (...).
- Evaluate your knowledge base logic to see if it makes sense in the target language. For example, in the
auto diagnosis knowledge base there is a PROMPT that asks the user how much he is
willing to spend on repairs. The numeric answer is assumed the represent dollars.
If the numeric value interpreted as French francs, Italian lira or
whatever currency is relevant to your target language does not
make sense, alteration of the PROMPT and/or the RULE that evaluates the input would be required.
- There is no provision in e2gLite to translate error messages or
debug mode output. It is assumed that you will debug the knowledge base
before it is translated.
- Create a new HTML file to start the knowledge base for each language
by copying the English version. The following Applet parameters will be
modified or added:
- KBURL with the name of the translated knowledge base (*.kb) file.
- APPTITLE with the title of the application in the target language.
- APPSUBTITLE with the subtitle for the application in the target language.
- STARTBUTTON text to replace the English default "Start the consultation".
- LOADMSG text to replace the English default "Loading knowledge base...".
- Consider implementing the application with e2gSwing rather than e2gLite. See the e2gSwing Reference
for more information on this software that represents a re-architecting of e2gLite with a user interface better suited to displaying
non-English output.
Here's an example of the auto diagnosis knowledge base translated into French.
This is the autofr.kb file referenced in the KBURL applet parameter in the HTML that loads the knowledge base.
This is a machine translation and is therefore less polished than would be expected from an expert human translator.
The English version of this knowledge base is available as the
Example e2gLite Knowledge Base
in the reference documentation.
REM Test knowledge base
RULE [La batterie est-elle morte?]
If [le résultat d'alimenter les phares] = "rien ne se produit" or
[le résultat d'essayer le démarreur] = "rien ne se produit"
Then [recommandée l'action] = "rechargez ou substituez la batterie"
RULE [La voiture est-elle hors d'essence?]
If [le réservoir d'essence] = "vide"
Then [recommandée l'action] = "réapprovisionnez en combustible la voiture"
RULE [La batterie est-elle faible?]
If [le résultat d'essayer le démarreur] : "les manivelles de voiture lentement" "les manivelles de voiture normalement" and
[les phares obscurcissent en essayant le démarreur] = true and
[la quantité vous êtes disposé à dépenser sur des réparations] > 24.99
Then [recommandée l'action] = "rechargez ou substituez la batterie"
RULE [La voiture est-elle inondée?]
If [le résultat d'essayer le démarreur] = "les manivelles de voiture normalement" and
[une odeur d'essence] = "présentez en essayant le démarreur"
Then [recommandée l'action] = "l'attente 10 minutes, relancent alors inondée la voiture"
RULE [Le réservoir d'essence est-il vide?]
If [le résultat d'essayer le démarreur] = "les manivelles de voiture normalement" and
[une odeur d'essence] = "pas présentez en essayant le démarreur"
Then [le réservoir d'essence] = "vide" @ 90
PROMPT [le résultat d'essayer le démarreur] Choice CF
"Que se produit quand vous tournez la clé pour essayer de mettre en marche la voiture?"
"les manivelles de voiture normalement"
"les manivelles de voiture lentement"
"rien ne se produit"
PROMPT [une odeur d'essence] MultChoice CF
"Une odeur d'essence et:"
"présentez en essayant le démarreur"
"pas présentez en essayant le démarreur"
PROMPT [le résultat d'alimenter les phares] MultChoice CF
"Le résultat d'alimenter les phares et:"
"ils s'allument"
"rien ne se produit"
PROMPT [les phares obscurcissent en essayant le démarreur] YesNo CF
"Les phares obscurcissent-ils quand vous essayez le démarreur avec les lumières?"
PROMPT [le réservoir d'essence] MultChoice CF
"Selon la mesure de carburant, le réservoir d'essence est:"
"vide"
"non vide"
PROMPT [la quantité vous êtes disposé à dépenser sur des réparations] Numeric CF
"Combien coûtez-vous disposé à dépenser sur des réparations? (0->500)"
"0"
"500.0"
GOAL [recommandée l'action]
MINCF 80
REM French translation
REM Button text
TRANSLATE B_SUBMIT = "Soumettez votre réponse"
TRANSLATE B_EXPLAIN = "Expliquent"
TRANSLATE B_WHYASK = "Pourquoi demandez?"
TRANSLATE B_RESTART = "Relancement"
TRANSLATE B_RETURN = "Retournent"
REM Message text
TRANSLATE TR_KB = "Base de connaissance:"
TRANSLATE TR_NORESP = "Je ne connais pas/ne répondrait plutôt pas"
TRANSLATE TR_HOWCONF = "Que confiant pensez-vous de votre réponse?"
TRANSLATE TR_LOWCONF = "Très incertain (50%)" "
TRANSLATE TR_HICONF = "Très certain (100%)"
TRANSLATE TR_YES = "Oui"
TRANSLATE TR_NO = "Non"
TRANSLATE TR_FALSE = "faux"
TRANSLATE TR_RESULTS = "FINALS RÉSULTATS:"
TRANSLATE TR_MINCF = "Facteur minimum de confiance pour recevoir une valeur comme fait:"
TRANSLATE TR_NOTDETERMINED = "n'a pas pu être déterminé"
TRANSLATE TR_ISRESULT = "est:"
TRANSLATE TR_WITH = "avec"
TRANSLATE TR_CONF = "% de confiance"
TRANSLATE TR_ALLGOALS = "toutes les conclusions"
TRANSLATE TR_VALUE = "Valeur"
TRANSLATE TR_OF = "de"
TRANSLATE TR_THISRULE = "Règle au-dessous de réussi à CF="
TRANSLATE TR_RULEASGN = "et assigné la valeur"
TRANSLATE TR_TOFIND = "Pour trouver"
TRANSLATE TR_AVALUE = "une valeur pour"
TRANSLATE TR_ISNEEDED = "est nécessaire pour essayer cette règle:"
TRANSLATE TR_RULE = "RÈGLE:"
TRANSLATE TR_IF = "SI:"
TRANSLATE TR_THEN = "ALORS:"
TRANSLATE TR_AND = "et"
TRANSLATE TR_OR = "ou"
TRANSLATE TR_IS = "est"
TRANSLATE TR_EQUAL = "est"
TRANSLATE TR_LESSTHAN = "est moins qu'"
TRANSLATE TR_NOTEQUAL = "n'est past"
TRANSLATE TR_GREATER = "est plus grand qu'"
TRANSLATE TR_VALUEFOR = "Une valeur pour:"
TRANSLATE TR_FOUND = "a été déterminé"
TRANSLATE TR_NOTFOUND = "n'a pas été encore déterminé"
TRANSLATE TR_WASINPUT = "a été entré avec"
TRANSLATE TR_DETERMINED = "Déterminé"
TRANSLATE TR_FROM = "de:"
TRANSLATE TR_DEFAULTED = "a été placé par défaut avec"
REM following added in v3.03
TRANSLATE TR_ONE = "une des valeurs du"
TRANSLATE TR_HOWCF1 = "Calcul de confiance de multi-source pour"
|