Structured Matcher
Opening Screen
General Background
User Guide
Downloads
     

Overview of the artificial intelligence task of structure matching

The field of artificial intelligence has many different decision making techniques and tools. The Structured Matcher program implements a technique called hypothesis testing or matching.

Hypothesis testing is a technique to give a confidence level to a hypothesis based upon certain values that are given for relevant parameters [Bylander97]. To put this in simpler terms, each of the pieces will be defined in the following example of an expert system diagnosing a fuel problem in an automobile. In automotive diagnosis, many hypothesis might be considered. One hypothesis could be: 'The problem is related to the fuel from the last fill up'. The parameters of the hypothesis would consist of questions or data relevant to confirming or eliminating the specific hypothesis. For example a parameter could be the following question "Does the engine make a pinging or knocking noise?". Each parameter would have a limited number of answers which are referred to as values of the parameter. In the example question, the values would be limited to the set of {True, False}. Some parameters would have values that would be more of a gradient scale like {Strongly Against, Against, Slightly Against, Neutral, Slightly Match, Match, Strongly Match}.

Hypotheses matching comes into play when rules are applied to the parameters dependent on selected variables. The determination rules used in hypothesis matching are often set up in a truth table, which is also called a simple matcher. Table 1 shows a truth table to resolve the hypothesis that a problem in the fuel system is fill up related. The columns represent parameters or questions relevant to the hypothesis determination. The last column is the confidence level for the hypothesis given the specified values (provided by the user or the system) for the parameters. The cell values in the rows are matching constraints to be compared with the answers or values for the parameters. For example, the first cell in the Higher grade column will match if the value returned is 'True'. A truth table works from left to right comparing acquired values with matching constraints entered in the cells until it finds a row that matches for each of its columns previous to the Results column. The Results column value for the matching row is the level of confidence the table returns for the hypothesis.

Table 1: Truth Table for fill up related problems

Higher grade

Start after fill up

Worse after fill up

Results

True

True

True

Strongly Match

False

True

False

Slightly Against

?

True

?

Neutral

?

?

?

Against

 

 

For example, to resolve Table 1 it will first determine if the value or answer for the Higher grade parameter is equal to True. If it is, then the next column of the same row would be checked to see if its variable matches its cell value. At any point it is found that a parameter value does not match the cell value, the checking of the present row will cease and checking will continue with the next row. A '?' in cell means the value of the particular cell is not relevant for this row, so it is considered to always match.

Due to the sequential nature of the comparisons, complex rules can be constructed by careful row ordering. For example, due to row 2's set up, row 3 would match if the Start after fill up parameter is true, and if either, but not both of the parameters Higher grade or Worse after fill up are true. This is possible because row 2 already took care of the case where both of the parameters, Higher grade and Worse after fill up, were equal to false.

As the number of parameters or the range of parameter values increases, the complexity of the truth table would also increase exponentially. The solution to this complexity is to break the truth table into a collaboration of smaller truth tables. Now a truth table would consist of columns representing parameters, as before, and columns representing other truth table. The included truth tables would resolve a sub-decision of the overall hypothesis being decided. Figure 1 shows an example truth table where the columns Performance Related and Fillup Related are columns that represent sub-decisions. The values that would be compared versus the matching constraints of the cells would be the result cell from each of the sub-decisions matching row. This hierarchy of simple matchers or truth tables is called a structured matcher [Bylander97].

Figure 1. Example of truth table of sub-decisions

 

So to reiterate, a structured matcher is a simple matcher or truth table which contains parameters or questions which can be used to determine a confidence level for a hypothesis. To reduce the level of complexity, some of the parameters could be grouped into sub-decisions, that are simple matchers themselves. These simple matchers would be contained within their parent simple matcher just as a parameter would. When the root simple matcher resolves its truth table and encounters a column that represents a simple matcher, the processing of the current simple matcher would be put on hold while the child simple matcher would be resolved. As Figure 2 illustrates, a structured matcher can be a logical tree of simple matchers.

 

Figure 2. Structured Matcher - simple matcher hierarchy

 

Structured Matcher Software Tool

The software tool, refined in this project is an implementation of the structured matcher concept and will be referred to as a Structured Matcher. The Structured Matcher Shell has two types of users. The first type of user is the expert. The expert defines the information ( parameters and constraints ) required to build an accurate hypothesis test. The other type of user, is the non-expert. The non-expert would use a previously defined Structured Matcher to receive advise on a hypothesis. For example, a heart specialist (expert) may construct a Structured Matcher to give the likelihood that a person should be concerned about their heart condition. In this example, the non-expert is a person who is concerned about their health, or a medical person who just does not have the appropriate depth of knowledge in this particular subject. What follows is a walk through of the Structured Matcher from first the expert's point of view and then from a non-expert's point of view.

Expert's walk through - Creating a Structured Matcher. This walk through shows the creation of a Structured Matcher to test a hypothesis that a problem with an automobile is related to bad fuel. When the expert first starts the Structured Matcher program, it will display a screen as shown in Figure 3.

Figure 3. Initial screen

 

This first screen displays a starting simple matcher which is labeled Untitled [SM]. This screen is where the expert would add additional simple matchers to the root simple matcher. Before additions are made to the default setup, the expert may want to start a new set up by selecting File from the menu at the top of the program, and then selecting New from the sub-menu. The expert would then be prompted to enter a name for the Structured Matcher. Notice in Figure 4, how the name has been changed in both the program title bar, and in the viewing area as well. Remember, adding simple matchers to the root simple matcher allows for the hypothesis to be tested to be broken down into sub-decisions.

Figure 4. Adding a simple matcher

 

To add an addition simple matcher to the root simple matcher, the expert can either use the pull down menus at the top of the program or right click (pressing the right mouse button) on the simple matcher to get a pop-up menu as shown in Figure 4. Simple matchers are also referred to as nodes within the program, so for operation related to simple matcher, an expert could also use the Node menu at the top, or as mentioned earlier, right click on the simple matcher itself.

After the expert has added two additional simple matchers to handle sub-decisions of the overall hypothesis, the Structured Matcher screen would look like Figure 5.

Figure 5. Structure Matcher with two simple matchers

 

As noted in Figure 5, the icon appearance changed for the root simple matcher when child simple matcher were added. At this point, the expert has not defined any of the parameters for the simple matchers, but has only set up the organization of the decision tree.

To define the parameters for a simple matcher the expert would double-click (tap the left mouse button twice quickly) on a simple matcher to be changed. If a simple matcher is opened which contains no other sub-decision simple matchers, a blank simple matcher will be presented with one column to represent the Results, or return value for the simple matcher. Figure 6 shows the child simple matcher which, as can be seen, represents the Fill-up Related sub-decision.

Figure 6. Empty simple matcher

 

If the simple matcher in Figure 6 were to be run in its current state, it would return Neutral since no parameters have been defined for this simple matcher. A simple matcher will also return Neutral, if none of the simple matchers rows matched. Figure 7 shows the initial state for the root simple matcher called Bad Fuel Hypothesis. Notice that it contains a column for each of its child simple matchers, that are going to handle sub-decisions in regard to Performance Related, or Fill-up Related. A simple matcher column can be distinguished by the [SM] which the program adds to the end of the column name.

Figure 7. Root simple matcher initial state

 

The values within the columns will be discussed later, but first we will return to the Fill-up Related simple matcher to define the parameters or questions. To add a question, the expert would select the Column menu from the top of the Simple Matcher window and then select Add from the sub menu. This would bring up a screen to allow a question to be defined, as shown in Figure 8.

Figure 8. Question definition screen

 

This screen allows the expert to define a short name for the question, the question itself and what type of question it is. The type of question is selected at the bottom of the screen, and is in reference to how the question is to be answered. The True/False type is self explanatory, but the Likelihood type would be answered with a value from one of the following set {Strongly Against, Against, Slightly Against, Neutral, Slightly Match, Match, Strongly Match}. The area to the left of the screen allows an expert to select an previously defined question to be used again. Figure 9 shows what the screen would look like after being filled out for a second question in the Fill-up Related simple matcher. Notice that the first question is listed on the left. This box on the left will contain all the questions that have been constructed for the whole Structured Matcher, not just the questions for this simple matcher.

Figure 9. Filled out Question definition

 

After three questions have been defined for the Fill-up Related simple matcher, it would look like Figure 10. Notice that a column was created for each question, and each matching constraint or cell value was assigned an initial value of ?- Don't Care. Now the expert must change the constraint values for the cells to reflect the proper decision making process. To change the constraint value of a cell, the expert would double click on the cell to bring up an editor for the cell.

Figure 10. Simple matcher with three questions

 

Figure 11 shows the editing of a cell in the Higher Grade column.

Figure 11. Cell editing

 

The expert will also need to add additional rows to facilitate other options in the decision making process. To do this the expert would select Row from the menu at the top of the program and then select Add from the sub-menu. The expert would then proceed to change the constraints for each of the new rows as appropriate. Figure 12 shows the completely edited simple matcher for the Fill-up Related sub-decision.

Figure 12. Edited simple matcher

 

After defining all the sub-decisions the expert would also need to define the cell constraints for the root simple matcher. So far, the cell editor for true and false has been shown, but when dealing with a range of values to be chosen from, a different type of cell editor must be used. Figure 13 shows an example of a different cell editor. Due to the range of values that can be selected as an answer, comparison operators are added to the constraint, so for example, a parameter can be said to be true or match if its value is greater than Neutral.

Figure 13. Relationship editor for simple matcher cells

 

The relationship editor would be used to edit cells for questions that have a parameter type of likelihood, or for columns that represent sub-decision simple matchers, since simple matchers return a likelihood representing the confidence level of their sub-decision. The completed root simple matcher would look like the screen shown in Figure 14.

Figure 14. Root simple matcher

 

Each simple matcher has a run button which would allow the expert to test each simple matcher on its own. If the run button is pressed for the root simple matcher (Bad Fuel Hypothesis) as shown in Figure 14, instead of running one of the sub-decision simple matchers, this would run the whole Structured Matcher, because to resolve this simple matcher, it would need to resolve its sub-decision matchers (Performance Related, and Fillup Related).

After verifying that the Structured Matcher is complete, the expert would save it by selecting File from the menu at the top of the program and then they would select the Save sub-menu. At that point, the Structured Matcher would be defined and the expert would be finished with this specific Structured Matcher.

Non-expert's walk through - Running a Structured Matcher. The non-expert user of Structured Matcher has a much less complicated time of using the Structured Matcher program. The user would load a previously defined and saved Structured Matcher. To do this, first the user would start the Structured Matcher program, and then they would select the File menu item at the top of the program, and then select the Open from the sub-menu. At this point, the user would select a file that contains the hypothesis to be tested. After the program has loaded the information, the user would see the same information that was available to the expert who built the system. Figure 15 shows the freshly loaded Structured Matcher for the testing the Bad Fuel Hypothesis.

Figure 15. Structured Matcher loaded from disk

 

From this point the user would press the run button at the Structured Matcher screen, and the program would pop up small dialog windows with questions from the simple matchers, as shown in Figure 16.

Figure 16. Question dialog

 

The question order is dependent on how the constraints were entered within the columns of the simple matchers. The Structured Matcher will finish asking questions when the answers match the constraints for a complete row. Structured Matcher will keep asking questions until a row matches or until all rows have been compared.

Figure 17. Structured Matcher resolution dialog

 

When the above criteria has been met, the program will present a dialog that gives the level of confidence for the hypothesis, as shown in Figure 17. As the user is answering the questions pertaining to the parameters, the program will save the answers in a collection of answers for this particular user's case. This collection of answers is called a case, and can be saved, reloaded, or reset. This manipulation of the case can be done through the Case menu at the top of the program. A benefit of saving the case is that it can be used to go back to any of the simple matchers to determine which row matched by running the individual simple matcher. After a simple matcher has resolved, it will present a dialog, as shown in Figure 18, showing the result of the simple matcher and the row where it matched the constraints.

Figure 18. Simple Matcher resolution dialog

This ability to save and load cases provides a powerful tool for the expert to test the parts of the Structure Matcher during construction, or to gain more specific information about an individual user.

 

Overview of Program Design

The Structured Matcher program is set up along the lines of the Model-View-Control guidelines [Larman97], where the data of the program (model) was separated away from the user interface (UI) (view). This makes the code easier to maintain, because either piece of the program, the model or the view, can be altered without major changes to the other.

Figure 19. Basic program design

At its core the Structured Matcher program consist of two different types of models. A tree model that is the structured matching hierarchy, where each node of the tree represents a simple matcher. The second model is a table model which represents the information that is stored within each simple matcher. Corresponding to each model is the view that represents visually the data stored in the model and allows the users to interact or issue commands to the model for its manipulation. Figure 21 shows this parallel hierarchy with the models of the system being on the right, and the views being on the left side of the diagram. There are of course many supporting objects that are not shown in this diagram, but these are the core objects of the Structured Matcher program. Class diagrams of the whole system are given in Appendix B.