e2gDroid Lite Online Documentation
Index:

Introduction

Index

Rule-based expert systems

e2gDroid delivers mobile, interactive decision making tools in the form of rule-based expert systems that run on Android™ devices that implement at least the version 1.6 "Donut" Android operating system. A rule-based expert system consists of an expert system shell (like e2gDroid) and one or more knowledge bases (abbreviated "KBs") that define both the decision logic and the user interface for controlling the expert system.

Here is an example of expert system rules used in a demonstration KB (AutoFix.kb) that diagnoses why a car won't start:

Rule 1:
If the result of trying the starter is the car cranks normally and
a gas smell is not present when trying the starter
Then the gas tank is empty with 90% certainty

Rule 2:
If the result of trying the starter is the car cranks normally and
a gas smell is present when trying the starter
Then the recommended action is wait 10 minutes, then restart flooded car

The user of this expert system will be asked questions (called prompts in e2gDroid) while interacting with the system (which we'll call a consultation) to provide data that helps the expert system make its recommendations. If a user is asked what happens when they try the starter, and their answer is other than "it cranks normally" the reasoning mechanism in e2gDroid (the inference engine) won't continue looking for verification that the gas tank is empty or the car is flooded, perhaps turning to questions that diagnose an electrical subsystem problem. A rule-based expert system's knowledge base may contain lots of rules and prompts, but use only a small percentage of these in diagnosing a specific problem. This is one of the advantages of interactive rule-based systems: complex problems might be solved with only limited data input.

This online documentation does not provide a comprehensive description of expert systems or the expert system development (knowledge engineering) process. More complete treatment of these topics is available in a series of mini-course training modules best viewed on higher resolution computer screens:

http://expertise2go.com/e2g3g/e2g3gdoc/

Index

What is e2gDroid?

e2gDroid is an expert system shell designed to support delivery, but not development, of expert systems applications on mobile Internet-connected Android devices.

e2gDroid is a port to Android of the e2gRuleEngine Java applet that allows expert systems to be embedded in Web pages. e2gDroid and e2gRuleEngine operate on identical knowledge bases. It is intended that development and testing of these knowledge bases be accomplished with e2gRuleEngine because it incorporates analysis and debugging tools that would be impractical to implement with the limited resolution displays of many Android devices.

Much of the recent interest in interactive rule-based expert systems is in countries where English is not the primary language. Although the development environment is English-based, provision is made for translation of the knowledge base content and user interface to facilitate expert systems delivery to end users when English is not the preferred language.

e2gDroid will typically access knowledge bases from the Internet. Once downloaded, a KB may be stored in the Android device's internal memory or on an SD card (if one is supported by the device) for later offline use. Knowledge bases optionally access Internet resources. When this is the case, the Android device running e2gDroid will need access to the Internet via a celluar or Wi-Fi connection.

Index

Disclaimers and terms of use

Starting a consultation

Index

Selecting a knowledge base

Once it has been installed from the Android Market available on Android smartphones or the AppsLib application marketplace for Android installed on (or available for) selected Android tablets, start e2gDroid by selecting the e2gDroid icon from the Android device's Applications Screen. Additional options for downloading from the Android Market are available from app indexers including AndroidZoom, DroidMill and AppBrain: search for e2gDroid or e2gDroid Lite (two words).

After a few seconds, the startup screen will be displayed with the current e2gDroid version and locale setting for the Android device shown in the title bar. This screen allows selection and loading of a KB from the Web or a local (internal Memory or SD card) source. It also allows KBs loaded from the Web to be stored on the Android device for offline use:

The button to the right of the spinner toggles among as many of the three potential KB sources as are available on the device and hold knowledge bases. The three sources are: Web, Mem and SD. When e2gDroid is first installed there are no KBs stored in the Mem or SD sources, so clicking the button has no effect.

The Web source will always be available, and will always provide Web access to at least this online documentation. The Web KB spinner list includes the last 10 KB files accessed from the Web (plus this documentation) with the most recently accessed KB listed first.

When e2gDroid is run for the first time the Web addresses of several demonstration knowledge bases are preloaded into the Web list.

When the source displayed on the source button is Mem or SD, clicking the spinner opens a list of all knowledge bases available on the selected storage device. If the displayed source is Web you may either select one of the KBs listed in the spinner or tap the text box, then type the Web address of a KB you wish to load:

Clicking the KB Delete button removes the Web address of the selected KB from the list if it is a Web KB, or deletes the KB file from internal memory or the SD card if that is its location. A confirmation is requested before the delete is accomplished:

The e2gDroid Online Documentation Web address (expertise2go.com/Android/Help.html) cannot be deleted. If you delete all but this Web address, then try to delete it, the Web addresses of the demonstration KBs will be restored to the list.

Click KB Load to request that the KB be loaded and error checked. If Help.html is selected, the file will be loaded into the Android browser so it is possible to move between the documentation and a running expert system application. To return to e2gDroid without losing access to the documentation, click the device's Home key, select the app screen, then click the e2gDroid icon. Move back and forth between the browser and e2gDroid by using the Home key and the browser icon on the home screen or e2gDroid icon on the Applications Screen. A long press on the Home key will usually bring up a small window showing icons for the most recent activities, providing a convenient way to switch back and forth between the documentation and consultation.

While the knowledge base is loading, a progress dialog is displayed that incorporates the Web address of the KB if it is loaded from the Web or just the name if loaded from memory or an SD card. When loading from the Web, e2gDroid will attempt to make a connection for approximately 20 seconds:

Index

Knowledge base load success/failure

If the knowledge base is successfully loaded, an additional row of buttons will be added to the display:

When a KB is loaded from the Web, Start and Save Mem buttons will always be shown and Save SD will be displayed if an SD card is available. Only the Start button is displayed when the KB is loaded from memory or an SD card.

The Save... buttons save a copy of the KB in the indicated storage device so it doesn't have to be reloaded from the Web. When the first KB is saved on the SD card a subdirectory named /sdcard/e2gkb will be created. KBs stored in internal memory reside in the files subdirectory associated with e2gDroid Lite: /data/data/com.expertise2go.e2gdroidlite/files. Although knowledge bases stored on a SD card will usually have been originally loaded from the Web, they could be downloaded directly to the /sdcard/e2gkb/ subdirectory from a PC using the USB cable available for most Android devices.

Successful completion of the subdirectory/file creation operations is acknowledged by a popup (Android "toast") message.

If there is a problem loading the knowledge base, an error message is displayed. Clicking OK returns operation to the startup screen to allow selection of a different KB or trying the KB Load action again. The error message in the example below indicates the Android device is not connected to the Internet or the KB does not exist at the requested Web address:

Index

Knowledge base disclaimer

When the Start button is clicked, the first prompt (request for user input) is displayed.

The knowledge base developer has the option to include a disclaimer statement in the knowledge base that causes an output like the one below to overlay the first prompt. You are not allowed to interact with the knowledge base unless the disclaimer is accepted. Clicking "Exit" cancels the consultation and returns to the knowledge base selection screen:

User input: prompts

Index

Multiple choice prompt

The KB developer defines the prompts that allow users to input facts or choices. Multiple choice, allowing a single selection, is the most common input format (example from BankLoan.kb):

Clicking Submit inputs the value selected with a radio button to the inference engine.

Index

InfoLink output

The KB developer has the option to provide explanatory information about the prompt using an InfoLink that is accessed by clicking the ? button before selecting and submitting a response. Here is the result of clicking the InfoLink button for the above prompt:

Clicking Return redisplays the prompt with the default response selected.

Index

Why was this question asked?

Before selecting and submitting a value, you may want to know why the input has been requested. The Why? button provides an explanation for the value solicited by the current prompt:

While this screen is displayed, selecting any of the already determined values from the spinner, then clicking Explain, provides an explanation of how the value was determined. The Return button redisplays the prompt with the default response selected.

Index

Go Back: restart at earlier prompt

After the first prompt input has been submitted, you may restart the consultation at any of the earlier prompts by clicking the Go Back button that is added to the prompt screen. The prompt questions are displayed in a spinner in the order they were issued:

Select a prompt from the spinner, click Go Back and the consultation will be restarted with that prompt. Values already input after this prompt are deleted because they could lead to inconsistent final results. To restart the entire consultation, click Go Back for the first prompt listed in the spinner. To cancel the Go Back action and return to the current prompt, click Return.

Index

Exit e2gDroid

Clicking the Exit button displayed on some screens leads to a confirmation dialog that allows the consultation to be terminated with a return to the knowledge base selection screen:

Index

Certainty Factor (CF) input

A Certainty Factor value between 50% and 100% (in 10% increments) may be entered for a response if the KB developer has specified this input as a prompt option. In the AutoFix.kb example below the "nothing happens" response will be entered with 90% certainty when Submit is clicked:

Index

Additional prompt types

In addition to the multiple choice prompt already illustrated, a "forced choice" prompt is available to KB developers that omits the "I don't know/would rather not answer" response.

Another developer option allows the user to select multiple responses, using check boxes instead of radio buttons as illustrated here with a GradAdmit.kb prompt:

Although e2gDroid (but not e2gRuleEngine) multiple choice prompts may be scrolled if there are too many options to display on one screen, selection from a spinner is sometimes preferred for long lists of options as shown in the following WineAdvisor.kb prompt:

The prompt for numeric data allows range checking of the input value. If the number submitted is outside the range specified by the KB developer, the prompt is redisplayed with an error message included in the data input field as a hint (AutoFix.kb example):

Text data, typically requested for identifying purposes, is entered in the following format:

Consultation results

Index

Once the inference engine has determined the values of as many of the goals established by the KB developer as can be determined, the final results screen is displayed:

Any of the results might incorporate a hyperlink declared by the KB developer. Clicking on a hyperlink loads a developer specified Web page. The Return button reloads the results page:

Button options to explain how any known attribute values were determined or to go back to one of the prompts are provided. Selecting the explanation of "all conclusions" leads to the following display. The vertical bars on the left side of the output tie together all of the rules and prompt inputs that were used to resolve the value of the attribute shown at the top of that bar:

Internationalized knowledge bases

Index

Knowledge bases optionally incorporate commands that translate button labels and other e2gDroid text output from English to other languages.

Because the KB has not been loaded when the application is started, opening screen text is displayed in English unless text for the specific locale selected for the Android device has been implemented in the e2gDroid software. For example, running e2gDroid with the French locale selected on the Android device:

Support for multiple locales will be added to e2gDroid over time. Button icons have been provided on the opening screen to help users interpret buttons for locales not yet translated. Here is an example of a prompt screen from a translated KB (AutoFixFr.kb):

Errors

Index

Run time errors

Run time errors occur when the knowledge base loads successfully, but e2gDroid encounters an error during the consultation. Examples include detection of logical loops in the rules or computational errors such as an attempt to divide by zero in evaluating a numeric expression. These errors result in program termination after the user acknowledges the error:

Run Time Error Description
Error Meaning Comment
205 Goal loop Circular logic in rules caused inferencing process to loop
610 Not a legitimate numeric value Illegal characters or out of range
615 Out of range CF value Confidence factors are limited to the range -100 to +100
760 Unrecognized data type
930 Bad operator in numeric expression Unrecognized mathematical operator evaluating rule consequent numeric expression (+, -, etc.)
940 Bad factor in numeric expression
950 Non-numeric factor in numeric expression
960 No numeric value found with CF >= MINCF See Note 1 below.
970 Unbalanced parentheses in expression
980 Attempted division by zero in evaluating numeric expression
Notes
  1. It is the knowledge base developer's responsibility to make sure all numeric attributes to be used in a calculation in a rule's consequent have values before the rule fires. This is best accomplished by using all of the attributes in the rule's premise. The "?" (has been determined) relational operator can be employed when there is no other reason for a numeric attribute to appear in the premise.

Index

Knowledge base errors

Most knowledge base errors are identified as the knowledge base is loaded. If the KB has been developed and tested with e2gRuleEngine as recommended, these errors should not be encountered in e2gDroid. KB errors usually display the KB statement that caused the error and result in a return to the knowledge base selection screen after the user acknowledges the error.

Knowledge Base Error Description
Error Meaning Comment
210 Too many GOAL statements Program capacity exceeded: can also result from circular logic leading to goal stack overflow
220 No GOAL statements At least one goal is required
230 Too many attributes Program capacity exceeded
240 Too many unknown attributes Program capacity exceeded (600)
250 Too many RULEs Program capacity exceeded (approximately 500 depending on complexity)
260 Too many RULE premise clauses Program capacity exceeded
270 Too many RULE consequent clauses Program capacity exceeded
280 Space for RULE data exceeded Program capacity exceeded
290 Too many PROMPTS Program capacity exceeded
300 Space for PROMPT data exceeded Program capacity exceeded
310 Too many HYPERLINK, JSHYPERLINK and INFOLINK commands (v7.0+) Program capacity exceeded (100)
400 Expected a delimited attribute name or value at this location
405 Expected a delimited parameter name at this location
410 Unexpected end of knowledge base Encountered end of KB file while processing a KB component
420 Expected an IF statement at this location Next non-blank line after RULE must begin with IF
430 Expected an attribute name at this location
440 Expected a value at this location
450 Expected a THEN statement at this location The premise clause on the previous line did not end with And or Or
460 Expected a relational operator (=,<,<=,>,>=,!,!=,<>,:,!:) at this location
470 Expected a logical operator (and/or) at this location Using the "=" instead of ":" relational operator with multiple values is one source of this error
480 Expected an assignment operator (=) at this location
490 Expected AND at this location
500 Expected numeric confidence factor between 1 and 100 at this location
510 Expected numeric MAXVALS value at this location
520 Expected PROMPT type (YesNo, MultChoice,...) at this location
540 An attribute with this name does not exist (must appear in rule first) Usually caused by defining a PROMPT with an attribute name never used in a RULE
600 Attempt to change attribute type Use in an earlier RULE defined this attribute as a different data type
610 Not a legitimate numeric value Illegal characters or out of range
615 Out of range CF value Confidence factors are limited to the range -100 to +100
620 Bad numeric value in MAXVALS statement
630 Logical operator not recognized Probably mixed and/or logical operators in same rule premise
700 PROMPT type not recognized
750 Knowledge base command not recognized
760 Unrecognized data type
800 Missing or empty knowledge base This error will also appear if the Web server will not allow files with the .kb extension to be read. Changing the knowledge base extension to .txt should resolve the problem.

Index


e2gDroid Online Documentation Copyright © 2010-2011 by eXpertise2Go.com. All rights reserved.
webmaster@expertise2go.com