cs0401009/rr.tex
1: \chapter[Recognition and Retrieval]{Pattern Recognition and Information Retrieval}\label{rr_chapter}
2: 
3: \index{perception!recognition|(}\index{information!retrieval|(}
4: 
5: \section{Introduction}
6: 
7: From at least as far back as the 1970s, it has been recognised that pattern recognition may be understood as information compression \citep{watanabe_article_1972}. At first sight, pattern recognition and information compression may seem unrelated but a little reflection shows the connection. In order to recognise something, incoming sensory data must be matched with a stored `engram' or record of the thing to be recognised. It is possible, of course, that the incoming data is stored independently of the record with which it has been matched. However, it seems much more likely that we merge or unify the sensory data with the stored record and encode it in terms of that record. This achieves information compression as described in Section \ref{ic_repetition_of_patterns}.
8: 
9: This chapter includes a (shortish) section on information retrieval because there are many similarities between pattern recognition and information retrieval. When we recognise something, we necessarily retrieve stored information about the thing that we have recognised. Any kind of `query' must make a connection with stored information in much the same way that a pattern to be recognised must connect with stored records of things that may be recognised. This can be seen most clearly in the case of `query-by-example' in which the query has the same general form as the stored records but with gaps where information is needed.
10: 
11: As we shall see in this chapter and the one that follows, recognition and retrieval are intimately related to (probabilistic) reasoning. This three-way connection may be referred to as `recognition-retrieval-and-reasoning'.
12: 
13: The chapter presents a selection of examples of the ways in which pattern recognition and information retrieval may be modelled in the SP system, including simple `fuzzy' pattern recognition, best-match information retrieval, and indirection in information retrieval, recognition with class-inclusion relations and part-whole relations, polythetic (family resemblance) concepts, and medical diagnosis.
14: 
15: \section{Scene analysis, fuzzy pattern recognition, best-match information retrieval and multiple alignment}\label{scene_analysis_recognition_retrieval}
16: 
17: \index{scene analysis|(}
18: 
19: A prominent feature of human perception is our ability to recognise things despite distortions or `noise' of various kinds. Consider, for example, how we perceive a typical scene. We may see a tree, behind which is parked a car which is itself in front of a house. With no conscious effort we immediately recognise the car as a car and the house as a house despite the fact that part of the car is obscured by the tree and part of the house is obscured by the tree and the car.
20: 
21: Not only can we recognise a whole object or pattern from a sub-set of its parts but, within 
22: wide limits, it normally does not matter very much which parts we see and which are obscured. We can also cope with other kinds of distortion in things that we recognise. Even if the car had an extra wheel at the front or back, we would probably still recognise it as a car provided it retained a reasonable number of car-like features. And we would still recognise a tree as a tree even if some of the branches had been replaced by balloons. In short, we have a robust ability to recognise things in a `fuzzy' manner that can cope with errors of omission, commission or substitution.
23: 
24: This process of recognising objects in a scene using information that is incomplete or distorted---so familiar and so apparently effortless---may be interpreted in terms of multiple alignment. Figure \ref{house_tree_car_figure} shows a multiple alignment which represents, schematically, how the scene described above is recognised.
25: 
26: \begin{figure}[!hbt]
27: \centering
28: \begin{BVerbatim}
29: 0 h h x h h c c c t t t c c c c h x h h   h 0
30:   | |   | | | | | | | | | | | | |   | |   |
31: 1 | |   | | | | | t t t | | | | |   | |   | 1
32:   | |   | | | | |       | | | | |   | |   |
33: 2 | |   | | c c c c c c c c c c |   | |   | 2
34:   | |   | |                     |   | |   |
35: 3 h h   h h h h h h h h h h h h h h h h h h 3
36: \end{BVerbatim}
37: \caption{A multiple alignment illustrating schematically the recognition of a house, car and tree. The top row represents the scene as it is projected onto the retina of one eye. Row 1 (`t') represents a record in memory for the appearance of a tree. Rows 2 and 3 represent similar records for a car (`c') and a house (`h'). The two instances of `x' in the figure represent errors of addition and substitution.}
38: \label{house_tree_car_figure}
39: \end{figure}
40: 
41: The symbols `t', `c' and `h' represent elements of the tree, car and house, respectively. 
42: The top row represents an image of the scene as it appears on the retina of one eye. The three rows below represent three stored patterns corresponding to the three types of object. The two instances of `x' represent errors of addition and substitution. There is also an error of omission on the right.
43: 
44: There is, of course, much more to the recognition process than is conveyed by the figure. 
45: But, for recognition to occur, there must be a mapping between elements of the image and elements of the stored patterns. The multiple alignment shown in Figure \ref{house_tree_car_figure} captures the overall structure of that mapping.
46: 
47: Current computer models of the SP system are restricted to one-dimensional patterns. For applications like scene analysis, the SP concepts would need to be generalised to patterns in two dimensions with corresponding developments in the computer models. This is something for the future (see Chapter \ref{future_chapter}).%
48: \index{scene analysis|)}
49: 
50: \subsection{Fuzzy recognition of words}\label{fuzzy_pattern_recognition}
51: 
52: Given a dictionary of correctly-spelled words, SP61 is able to recognise incorrectly-spelled words in fuzzy manner much like a system for spelling checking and correction. However, by contrast with most spelling checkers, the model can bridge arbitrarily large sequences of unmatched letters. 
53: 
54: In the example shown here, words are treated as simple flat patterns without any internal structure. This is not strictly correct (many words may be seen to contain more or less discrete `morphemes' and there are always smaller structures such as `phonemes') but for a preliminary illustration of fuzzy pattern recognition in the SP system, it is convenient to treat words as simple patterns. There are many examples throughout this book (starting with the examples in Section \ref{framework_examples_section}) that demonstrate how the system can accommodate patterns with rich internal structure.
55: 
56: SP61 has been run using the thoroughly mis-spelled `word', `e p e r i m a n t a t x p i u n' as New and, as Old, a small dictionary of words that vary in their similarity with that pattern. Each word in Old was assigned a notional frequency of occurrence so that relative values corresponded roughly with their subjective rate of use in ordinary English.
57: 
58: Figure \ref{fuzzy_recognition_figure} shows a selection of the multiple alignments formed by SP61 in order of their compression scores (calculated as described in Section \ref{ma_evaluation}). Notice that the system is able to find good matches between patterns despite the omission, addition or substitution of symbols. 
59: 
60: \begin{figure}[!hbt]
61: % \fontsize{10.00pt}{12.00pt}
62: \centering
63: \begin{BVerbatim}
64: 0      e   p e r i m a n t a t x p i u n   0
65:        |   | | | | |   | | | |     |   |  
66: 1 < E3 e x p e r i m e n t a t     i o n > 1
67: 
68: (a) CD = 926.18
69: 
70: 0            e p e r i m       a n t a t x p i u n   0
71:              |     | | |       |       |     |   |  
72: 1 < E3 e x p e     r i m e n t a       t     i o n > 1
73: 
74: (b) CD = 573.08
75: 
76: 0 e          p e r i m a n t a t x p i u n   0
77:              |             | | |     |   |  
78: 1 < C1 c o m p u           t a t     i o n > 1
79: 
80: (c) CD = 467.21
81: 
82: 0 e p e        r i m a n t a t x p i u n   0
83:                |   |       | |     |   |  
84: 1 < I3 i n f o r   m       a t     i o n > 1
85: 
86: (d) CD = 434.59
87: 
88: 0 e p e r i m a n t a t x p i u n                 0
89:                               | |                
90: 1 < U1                        u n t a n g l e s > 1
91: 
92: (e) CD = 182.38
93: \end{BVerbatim}
94: \caption{The best four multiple alignments formed by SP61 between `e p e r i m a n t a t x p i u n' and words in a small dictionary. The $CD$ for each multiple alignment is shown below the multiple alignment.}
95: \label{fuzzy_recognition_figure}
96: \end{figure}
97: 
98: It is pertinent to point out that, in the small dictionary of words which was used as Old, the 
99: words `e x p e r i m e n t a t i o n' and `c o m p u t a t i o n' were assigned the same notional frequency of occurrence (10,000). Thus the relatively high $CD$ of multiple alignment (a) compared with multiple alignment (c) is not due to differences in frequency between the two words from Old. It is due to the fact that the best multiple alignment encodes more symbols from New than the other multiple alignment.
100: 
101: In general, these results accord with our intuition that the `correct' form of `e p e r i m a n t a t x p i u n' is `e x p e r i m e n t a t i o n', that `c o m p u t a t i o n' and `i n f o r   m a t i o n' are similar in some respects, and that `u n t a n g l e s' is much less similar.
102: 
103: \section{Best-match information retrieval}
104: 
105: SP61 can also be used for the retrieval of information from a `database' in the manner of query-by-example. Figure \ref{best_match_ir_figure} shows the best three multiple alignments found with a `query' pattern in New (`Name John Jones \#Name Address New \#Address') and patterns in Old that are analogous to records in a database.
106: 
107: \begin{figure}[!hbt]
108: \fontsize{08.00pt}{09.60pt}
109: \centering
110: \begin{BVerbatim}
111: 0          1               0          1              0          1         
112: 
113: Name ----- Name            Name ----- Name           Name ----- Name      
114: John ----- John            John ----- John           John       Mary      
115: Jones ---- Jones           Jones      Smith          Jones ---- Jones     
116: #Name ---- #Name           #Name ---- #Name          #Name ---- #Name     
117: Address -- Address         Address -- Address        Address -- Address   
118:            54                         6              New        20        
119: New ------ New             New ------ New                       Old       
120:            Road                       Street                    Street    
121: #Address - #Address        #Address - #Address       #Address - #Address  
122:            Town                       Town                      Town      
123:            Anytown                    Oldsville                 Countytown
124:            #Town                      #Town                     #Town     
125:            County                     County                    County    
126:            Coastshire                 Ruralshire                Urbanshire
127:            #County                    #County                   #County   
128:            Telephone                  Telephone                 Telephone 
129:            05718                      01234                     09876     
130:            638945                     567890                    543210    
131:            #Telephone                 #Telephone                #Telephone
132: 
133: 0          1               0          1              0          1         
134: 
135: (a) CD = 558.41           (b) CD = 470.11            (c) CD = 381.81
136: \end{BVerbatim}
137: \caption{The three best multiple alignments found by SP61 between the New pattern `Name John Jones \#Name Address New \#Address' in column 0 (the `query' pattern) and three different Old patterns in column 1 (`records' in a `database'). The $CD$ for each multiple alignment is shown at the bottom.}
138: \label{best_match_ir_figure}
139: \end{figure}
140: 
141: As in a conventional database, retrieval of a complete record from an incomplete query enables one to read off information that was not in the query. From the first multiple alignment in the figure, we can obtain the full street address for John Jones, his home town and county, and his telephone number.
142: 
143: \subsection{Indirection in information retrieval}\label{indirection_in_ir}
144: 
145: A common problem with the simpler kinds of system for information retrieval is that relevant material will not be found if, in the query which is used to initiate the search, the query term (or terms) does not appear in the index, title or body of that relevant material. For example, the focus of interest may be `parallel processing', but this term will not retrieve relevant material if that material is indexed by or uses the term `concurrency' instead of `parallel processing'.
146: 
147: Figure \ref{thesaurus_knowledge_base} shows a small knowledge base in which the first four patterns represent bodies of information about `sleep', `theory of knowledge', `luggage' and `concurrency'. At the bottom is shown four patterns from a thesaurus where each pattern contains one of the four terms just mentioned, together with one or more synonyms for that term. 
148: 
149: \begin{figure}[!hbt]
150: \centering
151: \begin{BVerbatim}
152: sleep ... information_about_sleep ... #sl (500)
153: theory of knowledge ... information_about_TOK ... #tk (800)
154: luggage ... information_about_luggage ... #lg (200)
155: concurrency ... information_about_concurrency ... #cy (400)
156: ...
157: sleep #sl nap #np kip #kp (1)
158: epistemology #ey theory of knowledge #tk (1)
159: luggage #lg baggage #bg (1)
160: concurrency #cy parallel processing #pp (1)
161: \end{BVerbatim}
162: \caption{A small knowledge base, including patterns representing entries in a thesaurus.}
163: \label{thesaurus_knowledge_base}
164: \end{figure}
165: 
166: The best multiple alignment formed with this knowledge base in Old and the pattern `parallel 
167: processing' in New is shown at the top of Figure \ref{indirect_retrieval_alignments}. Below it is the one other multiple alignment in the reference set of multiple alignments for the best multiple alignment. The relative probabilities of the two multiple alignments are 0.9878 and 0.0122 respectively.
168: 
169: \begin{figure}[!hbt]
170: \fontsize{09.00pt}{10.80pt}
171: \centering
172: \begin{BVerbatim}
173: 0                 parallel processing 0
174:                      |         |     
175: 1 concurrency #cy parallel processing 1
176: 
177: (a)
178: 
179: 0                                                parallel processing 0
180:                                                     |         |     
181: 1 concurrency                                #cy parallel processing 1
182:        |                                      |                     
183: 2 concurrency ... info_about_concurrency ... #cy                     2
184: 
185: (b)
186: \end{BVerbatim}
187: \caption{The best multiple alignment and the one other multiple alignment in its reference set formed by SP61 with the patterns from Figure \ref{thesaurus_knowledge_base} in Old and the pattern `parallel processing' in New.}
188: \label{indirect_retrieval_alignments}
189: \end{figure}
190: 
191: The best multiple alignment shows that `concurrency' is associated with `parallel 
192: processing'. This is not entirely without interest or usefulness but it does not tell us anything about the technical or other aspects of parallel processing. However, the second multiple alignment in 
193: Figure \ref{indirect_retrieval_alignments} contains a pattern with `information\_about\_concurrency' which, we may suppose is much closer to what we are looking for.
194: 
195: Although the relative probability of the second multiple alignment is only 0.0122 (and likewise for 
196: the the pattern `concurrency ... information\_about\_concurrency ... \#cy' and the symbol 
197: `information\_about\_concurrency'), this is the best of the `sub-optimal' inferences made by the 
198: system.
199: 
200: \section{Class-inclusion relations, part-whole relations and inheritance of attributes}\label{class_part_inheritance}
201: 
202: \index{class!hierarchy|(}\index{part-whole hierarchy|(}\index{inheritance of attributes|(}\index{object|(}
203: 
204: Figure \ref{animal_classes_figure} shows some patterns representing a hierarchy of classes from `animal' at the top level through the classes `mammal' and `bird' to relatively low-level classes such as `cat' and `robin'. At the lowest level are the individual animals `Tibs' and `Tweety'.
205: 
206: As in object-oriented computer languages, each class in the figure is linked to its parent 
207: class (if any) by including the relevant symbol or symbols for the parent class in the definition of the child class. The pattern for `mammal' contains the symbols `A' and `\#A'. These match the ID-symbols for the pattern that describes the class `animal' and they express the fact that a mammal is an animal. Likewise, the pattern for `cat' contains the symbols `M' and `\#M' showing that a cat is a mammal. And the pattern for `Tibs' contains the symbols `C' and `\#C' showing that it is a cat. 
208: 
209: Apart from symbols of that kind, each pattern contains symbols representing attributes of the corresponding class. An animal (in this simplified scheme) has a head, body and legs and it eats, breathes and has senses. Apart from being an animal, a mammal is furry and warm-blooded and, apart from being a mammal, a cat has such attributes as carnassial teeth and retractile claws. Three dots in each pattern (`...') show that there are other attributes that have been omitted to avoid cluttering the example unnecessarily. 
210: 
211: \begin{figure}[!hbt]
212: % \fontsize{10.00pt}{12.00pt}
213: \centering
214: \begin{BVerbatim}
215: !A animal head #head body #body legs #legs eats
216:      breathes has-senses ... !#A
217: !M mammal A #A furry warm-blooded ... !#M
218: !C cat M !head carnassial-teeth !#head !legs
219:      retractile-claws !#legs #M purrs ... !#C
220: !T Tibs C !body white-bib !#body #C tabby ... !#T
221: !R reptile A #A cold-blooded scaly-skin ... !#R
222: !B bird A body wings feathers #body #A  can-fly ... !#B
223: !Rb robin B #B red-breast ... !#Rb
224: !Tw Tweety R #R ... !#Tw
225: \end{BVerbatim}
226: \caption{Patterns representing the class `animal' with some of its sub-classes, including individual animals `Tibs' and `Tweety'.}
227: \label{animal_classes_figure}
228: \end{figure}
229: 
230: \subsection{Class-inclusion relations, part-whole relations and multiple alignment}\label{class_inclusion_part_whole}
231: 
232: Figure \ref{class_part_whole_alignment} shows the best multiple alignment found by SP61 between the pattern `white-bib eats furry purrs' in New with the patterns from Figure \ref{animal_classes_figure} in Old.
233: 
234: \begin{figure}[!hbt]
235: \fontsize{07.00pt}{08.40pt}
236: \centering
237: \begin{BVerbatim}
238: 0           1            2              3                  4        
239: 
240:                                                            T        
241:                                                            Tibs     
242:                                         C ---------------- C        
243:                                         cat                         
244:                          M ------------ M                           
245:                          mammal                                     
246:             A ---------- A                                          
247:             animal                                                  
248:             head ---------------------- head                        
249:                                         carnassial-teeth            
250:             #head --------------------- #head                       
251:             body ----------------------------------------- body     
252: white-bib ------------------------------------------------ white-bib
253:             #body ---------------------------------------- #body    
254:             legs ---------------------- legs                        
255:                                         retractile-claws            
256:             #legs --------------------- #legs                       
257: eats ------ eats                                                    
258:             breathes                                                
259:             has-senses                                              
260:             ...                                                     
261:             #A --------- #A                                         
262: furry ------------------ furry                                      
263:                          warm-blooded                               
264:                          ...                                        
265:                          #M ----------- #M                          
266: purrs --------------------------------- purrs                       
267:                                         ...                         
268:                                         #C --------------- #C       
269:                                                            tabby    
270:                                                            ...      
271:                                                            #T       
272: 
273: 0           1            2              3                  4        
274: \end{BVerbatim}
275: \caption{The best multiple alignment found by SP61, between the pattern `white-bib eats furry purrs' in New and the patterns shown in Figure \ref{animal_classes_figure} in Old.}
276: \label{class_part_whole_alignment}
277: \end{figure}
278: 
279: A multiple alignment like this may be interpreted as the result of a process of recognition. An unknown entity with the attributes `white-bib eats furry purrs' has been recognised as `Tibs' (column 4). At the same time, it is recognised as a cat (column 3), as a mammal (column 2), and as an animal (column 1).
280: 
281: \subsubsection{Inheritance of attributes}
282: 
283: From a multiple alignment like the one shown in Figure \ref{class_part_whole_alignment}, it is possible to infer that the entity that has been recognised has a tabby colouration (from the pattern for `Tibs') and retractile claws (from the pattern for `cat'), that it is warm-blooded (from the pattern for `mammal') and that it breathes and has senses (from the pattern for `animal'). In short, the process of recognition achieves the effect of {\em inheritance of attributes} in the manner of object-oriented design.
284: 
285: This kind of inheritance of attributes in a class hierarchy is a simple but important form of inference or reasoning---part of the recognition-retrieval-and-reasoning constellation mentioned at the beginning of this chapter. In Chapter \ref{pr_chapter}, we shall see how several other kinds of probabilistic reasoning may be modelled in the SP framework. And Chapter \ref{maths_logic_chapter} discusses how similar principles may provide an interpretation for the `exact' forms of reasoning associated with mathematics and logic. 
286: 
287: \subsubsection{Integration of class-inclusion relations and part-whole relations}\label{integration_class_part_whole}
288: 
289: The multiple alignment in Figure \ref{class_part_whole_alignment} not only shows a hierarchy of classes with `animal' at the highest level and `Tibs' at the bottom but it also shows the division of the recognised entity into parts and sub-parts. At the level of `animal', it has a `head', a `body' and some `legs'. Additional information about the structure of those parts is provided at lower levels in the class hierarchy. At the level of `cat', the head contains `carnassial-teeth' and associated with the legs are the `retractile-claws'. At the level of `Tibs' the body has a white bib. It should be clear that the breakdown of an entity into its parts and sub-parts may be elaborated in much more detail than is shown in this simple example.
290: 
291: Notice that there is no artificial distinction between `class' and `object' or between the `attribute' of a class and a `part' of an object, as described in Section \ref{making_haste_slowly}. The multiple alignment scheme allows the {\em integration} of class-inclusion relations with part-whole relations as envisaged at the outset of this project (see also Section \ref{objects_classes_metaclasses}, below).
292: 
293: \subsection{Cross classification and multiple inheritance}\label{cross_classification_multiple_inheritance}
294: 
295: \index{class!cross-classification|(}
296: 
297: `Natural' objects and classes that we recognise in everyday speaking and thinking often 
298: have more than one parent class: one person may be both a `woman' and a `doctor', another person 
299: may be both a `man' and a `footballer', and so on. In this kind of `cross classification' or `multiple inheritance', the parent classes overlap each other without one being a sub-class of the other.
300: 
301: The SP system can accommodate this kind of relationship between classes quite simply. If an entity or class belongs in two or more parent classes, it is merely necessary for the corresponding pattern to include references to those parent classes. This can be seen in Figure \ref{cross_classification_alignment} where someone called `John' is recognised as being a member of the class `doctor' and also a member of the class `male'. 
302: 
303: \begin{figure}[!hbt]
304: \fontsize{06.00pt}{07.20pt}
305: \centering
306: \begin{BVerbatim}
307: 0             1         2             3             4           5          6        7        8         9   
308: 
309:               john1                                                                                        
310:               person -- person                                                                             
311:               name ---- name                                                                               
312: John -------- John ----------------------------------------------------------------------------------- John
313:               Smith                                                                                        
314:               #name --- #name                                                                              
315:                         gender ------------------------------------------------------------- gender        
316:                                                                                              male ---- male
317:                                                                                              ...           
318:                         #gender ------------------------------------------------------------ #gender       
319:                         profession -- profession                                                           
320:                                       doctor                                                               
321: stethoscope ------------------------- stethoscope                                                          
322: black-bag                             ...                                                                  
323:                         #profession - #profession                                                          
324:                         head ------------------------------------------------------ head                   
325:                                                                 hair -------------- hair                   
326:                                                     hcolour --- hcolour                                    
327: fair-hair ----------------------------------------- fair-hair                                              
328:                                                     #hcolour -- #hcolour                                   
329:                                                                 length                                     
330:                                                                 #length                                    
331:                                                                 #hair ------------- #hair                  
332:                                                                            eyes --- eyes                   
333:                                                                            pupil                           
334: iris --------------------------------------------------------------------- iris                            
335:                                                                            whites                          
336:                                                                            #eyes -- #eyes                  
337:                                                                                     nose                   
338:                                                                                     #nose                  
339:                                                                                     mouth                  
340:                                                                                     #mouth                 
341:                                                                                     chin --- chin          
342:                                                                                              beard         
343:                                                                                     #chin -- #chin         
344:                                                                                     ...                    
345:                         #head ----------------------------------------------------- #head                  
346:                         body                                                                               
347:                         #body                                                                              
348:                         legs                                                                               
349:                         #legs                                                                              
350:                         voice -------------------------------------------------------------- voice         
351:                                                                                              deep          
352:                         #voice ------------------------------------------------------------- #voice        
353:               town ---- town                                                                               
354: Dorking ----- Dorking                                                                                      
355:               #town --- #town                                                                              
356:                         ...                                                                                
357:               #person - #person                                                                            
358:               #john1                                                                                       
359: 
360: 0             1         2             3             4           5          6        7        8         9   
361: \end{BVerbatim}
362: \caption{\small The best multiple alignment found by SP61 with patterns representing classes related to `person' in Old and the pattern `John stethoscope black-bag fair-hair iris Dorking' in New.}
363: \label{cross_classification_alignment}
364: \end{figure}
365: 
366: As with our previous example, various attributes can be inferred from the multiple alignment that were not directly observed as `New'. We can infer that John has the qualifications and other attributes of his profession (represented only by `...' in this multiple alignment) and that he has male attributes such as a beard and a deep voice (no attempt has been made here to model the possibility that John might be a child).
367: 
368: Notice how the attribute `beard' has been tied in to the `chin' part of `head' (column 2), while the attribute `deep' is linked to `voice' in the pattern for `person' (column 4). Notice also how John's male gender (column 5) has, in effect, been inferred from the association between the name `John' and the attribute `male' (column 6).%
369: \index{class!cross-classification|)}
370: 
371: \subsection{Polythetic or `family resemblance' classes}\label{polythetic_categories}
372: 
373: \index{class!polythetic|(}
374: 
375: It is widely recognised that many of the `natural' categories that we use in everyday thinking are `polythetic' meaning that, for each such category, no single attribute is necessarily present in every member of the given category and there need be no single attribute that is exclusive to that category \citep{sokal_sneath_1973}. In Wittgenstein's phrase, members of this type of category have a `family resemblance' to each other.
376: 
377: The SP system can accommodate this type of category in two different ways that may operate individually or together:
378: 
379: \begin{itemize}
380: 
381: \item As we saw in Section \ref{fuzzy_pattern_recognition}, the dynamic programming that is built into the system (Appendix \ref{matching_appendix}) enables it to recognise patterns despite errors of omission, commission or substitution. This means that recognition does not depend on the presence (or absence) of any one feature. Because the system looks for the best overall match between patterns, recognition does not require that any one category should have any feature that is exclusive to that category.
382: 
383: \item As we saw in Section \ref{framework_examples_section}, SP patterns can function in a manner that is equivalent to a context-free phrase-structure grammar. Any system with that capability (or more) can be used to define categories in which no single attribute need be found in all members of the category and no attribute need be exclusive to that category. 
384: 
385: \end{itemize}
386: 
387: To illustrate this last point, consider the following simple grammar:
388: 
389: \begin{center}
390: \begin{tabular}{l}
391: S $\rightarrow$ 1 2 \\
392: 1 $\rightarrow$ A \\
393: 1 $\rightarrow$ B \\
394: 2 $\rightarrow$ C \\
395: 2 $\rightarrow$ D \\
396: \end{tabular}
397: \end{center}
398: 
399: This defines the set of two-letter strings \{AC, AD, BC, BD\}. Notice that no single attribute (letter) is found in all the members of this category. And none of the letters need be exclusive to this category. Since the SP system can model this type of grammar, it can model polythetic categories.
400: 
401: In this connection, it is pertinent to say that, while the system can accommodate categories of that kind, it is not constrained to operate only in that way. It is easy enough within the SP system to create categories in which one or more features (or combination of features) are necessary for the recognition of a category or sufficient for that recognition or both these things.
402: 
403: \subsubsection{Objects, classes and metaclasses}\label{objects_classes_metaclasses}
404: 
405: \index{metaclass|(}
406: 
407: By contrast with most object-oriented systems, the SP system makes no formal distinction between `class' and `object'. This accords with the observation that what we perceive to be an individual object, such as `Tibs', can itself be seen to represent a variety of possibilities: `Tibs playing with a ball', `Tibs catching a mouse', `Tibs when he is sleeping', and so on. A pattern like the one shown in column 4 of Figure \ref{class_part_whole_alignment} could easily function as a class with vacant slots to be filled at a more specific level by details of the activity that Tibs is engaged in, whether he is well-fed or hungry, happy or sad, and so on. This flexibility is lost in systems that do make a formal distinction between classes and objects.
408: 
409: Making a formal distinction between objects and classes points to the need for the concept of a `metaclass':
410: 
411: \begin{quotation}
412: 
413: ``If each object is an instance of a class, and a class is an object, the [object-oriented] model should provide the notion of {\em metaclass}. A metaclass is the class of a class.'' \cite[p. 43]{bertino_etal_2001}.
414: 
415: \end{quotation}
416: 
417: \noindent This construct has been introduced in some AI systems so that classes can be derived from metaclasses in the same way that objects are derived from classes. Of course, this logic points to the need for `metametaclasses', `metametametaclasses', and so on without limit. Because the SP system makes no distinction between `object' and `class', there is no need for the concept of `metaclass' or anything beyond it. All these constructs are represented by patterns.%
418: \index{metaclass|)}\index{class!hierarchy|)}\index{part-whole hierarchy|)}%
419: \index{inheritance of attributes|)}\index{class!polythetic|)}\index{object|)}
420: 
421: \section{Medical diagnosis}\label{medical_diagnosis_section}
422: 
423: \index{diagnosis!medical|(}
424: 
425: The problem of providing computational support for medical diagnosis has been approached from many directions including logical reasoning, set theory, rough set theory, if-then rules, Bayesian networks, artificial neural networks, case-based reasoning, possibility theory, and others. This section describes how medical diagnosis, viewed as a problem of pattern recognition, may be modelled in the SP system.
426: 
427: In the SP scheme, knowledge about diseases may be stored as patterns in Old and the signs and symptoms for an individual patient (abbreviated hereinafter as `symptoms') may be represented as a New pattern. A pattern in Old may represent one disease and its associated symptoms or it may represent a cluster of symptoms that tend to occur together in two or more different diseases (see Section \ref{clusters_of_symptoms}, below). In addition, Old may include patterns that play supporting r{\^o}les (see Section \ref{uncertainties_in_diagnosis}, below).
428: 
429: Associated with each pattern in Old is an integer value reflecting the frequency with which a given disease or cluster of symptoms is found in a given population. These figures may be derived from population surveys or they may be estimated by medical experts.
430: 
431: The process of diagnosis may be modelled by the building of one or more multiple alignments. Figure \ref{medical_diagnosis_alignment} shows the best multiple alignment created by SP61 with a New pattern describing a fictional `John Smith' and his symptoms and a set of patterns in Old, provided by the user, that represent diseases or aspects of diseases.
432: 
433: \begin{figure}[!hbt]
434: \fontsize{05.00pt}{06.00pt}
435: \centering
436: \begin{BVerbatim}
437: 0                    1                     2                  3              4                 5       
438: 
439:                                            disease                                                     
440:                      D ------------------- D                                                           
441:                      flu                                                                               
442:                      : ------------------- :                                                           
443: patient ---------------------------------- patient                                                     
444: john_smith                                                                                             
445: #patient --------------------------------- #patient                                                    
446:                      diagnosis ----------- diagnosis                                                   
447: poor_appetite        influenza                                                                         
448:                      #diagnosis ---------- #diagnosis                                                  
449:                      R1 ------------------ R1                                                          
450:                      flu_symptoms --------------------------- flu_symptoms                             
451:                      #R1 ----------------- #R1                                                         
452:                                            R2 --------------- R2                                       
453:                                                               fever -------- fever                     
454:                                            #R2 -------------- #R2                                      
455:                      ap ------------------ ap                                                          
456:                      normal_appetite                                                                   
457:                      #ap ----------------- #ap                                                         
458:                                            br ------------------------------ br                        
459: rapid_breathing ------------------------------------------------------------ rapid_breathing           
460:                                            #br ----------------------------- #br                       
461:                      chst ---------------- chst                                                        
462:                      normal_chest                                                                      
463:                      #chst --------------- #chst                                                       
464:                                            chl -------------- chl                                      
465: has_chills -------------------------------------------------- has_chills                               
466:                                            #chl ------------- #chl                                     
467:                                            cgh -------------- cgh                                      
468:                                                               has_cough                                
469:                                            #cgh ------------- #cgh                                     
470:                      dh ------------------ dh                                                          
471:                      no_diarrhoea                                                                      
472:                      #dh ----------------- #dh                                                         
473:                                            fc ------------------------------ fc                        
474: flushed_face --------------------------------------------------------------- flushed_face              
475:                                            #fc ----------------------------- #fc                       
476:                      ftg ----------------- ftg                                                         
477: tired                no_fatigue                                                                        
478:                      #ftg ---------------- #ftg                                                        
479:                                            hd --------------- hd                                       
480:                                                               has_headache                             
481:                                            #hd -------------- #hd                                      
482:                      ln ------------------ ln                                                          
483: normal_lymph_nodes - normal_lymph_nodes                                                                
484:                      #ln ----------------- #ln                                                         
485:                      mls ----------------- mls                                                         
486: no_malaise --------- no_malaise                                                                        
487:                      #mls ---------------- #mls                                                        
488:                                            msl -------------- msl                                      
489: muscle_aches ------------------------------------------------ muscle_aches                             
490:                                            #msl ------------- #msl                                     
491:                                            ns --------------- ns                                       
492: runny_nose -------------------------------------------------- runny_nose                               
493:                                            #ns -------------- #ns                                      
494:                      skn ----------------- skn                                                         
495:                      normal_skin                                                                       
496:                      #skn ---------------- #skn                                                        
497:                                            tmp ----------------------------- tmp                       
498:                                                                              tclass1 --------- tclass1 
499: t37-39 --------------------------------------------------------------------------------------- t37-39  
500:                                                                              #tclass1 -------- #tclass1
501:                                            #tmp ---------------------------- #tmp                      
502:                                            thr -------------- thr                                      
503: sore_throat ------------------------------------------------- sore_throat                              
504:                                            #thr ------------- #thr                                     
505:                      wt ------------------ wt                                                          
506:                      no_weight_change                                                                  
507:                      #wt ----------------- #wt                                                         
508:                      causative_agent ----- causative_agent                                             
509:                      influenza_virus                                                                   
510:                      #causative_agent ---- #causative_agent                                            
511:                      treatment ----------- treatment                                                   
512:                      influenza_treatment                                                               
513:                      #treatment ---------- #treatment                                                  
514:                      #D ------------------ #D                                                          
515:                                            #disease                                                    
516: 
517: 0                    1                     2                  3              4                 5       
518: \end{BVerbatim}
519: \caption{The best multiple alignment found by SP61 with a pattern describing a patient's symptoms in New and a set of patterns in Old describing a range of different diseases and named clusters of symptoms, together with the `framework' pattern shown in column 2.}
520: \label{medical_diagnosis_alignment}
521: \end{figure}
522: 
523: A multiple alignment like this may be interpreted as the result of a process of recognition. In this case, the symptoms that have been recognised are those of influenza, as shown in column 1. The following subsections discuss aspects of the multiple alignment and of this interpretation.  
524: 
525: \subsection{Ordering of symptoms}\label{ordering_of_symptoms}
526: 
527: As noted in Section \ref{ordering_of_symbols_and_patterns}, there are some applications where one might wish to treat New information as an unordered set of patterns or as an unordered or partially-ordered set of symbols. Medical diagnosis seems to be one such application because it is not obvious that there is any intrinsic order to the symptoms of a disease: `high temperature' may precede `runny nose' but, equally well, it might come after.
528: 
529: Given that a patient's symptoms are specified in a single pattern in New, and given that that pattern represents a sequence of symbols, one can achieve the effect of unordered symptoms by using a `framework' pattern (mentioned in Section \ref{ordering_of_symbols_and_patterns}) that defines an arbitrary order for disjunctive classes of symptom that may be found across the range of diseases described by the patterns in Old. An example of such a framework pattern is shown in Figure \ref{medical_diagnosis_alignment}, column 2. Within that pattern, a pair of symbols such as `ap \#ap' provides a slot for alternative states of a patient's appetite. Likewise, the pair of symbols `br \#br' provides a slot for different kinds of breathing---`rapid', `laboured', `normal' and so on. Provided that corresponding pairs of symbols are used in other patterns in Old, and provided that classes of symptoms are always specified in the defined order, appropriate multiple alignments can be built.
530: 
531: \subsection{Clusters of symptoms}\label{clusters_of_symptoms}
532: 
533: It is quite usual in medicine for a cluster of two or more symptoms that occur in two or more different diseases to be given a name. For example, the name `fever' provides a conveniently brief shorthand for the symptoms `high temperature', `flushed face' and `rapid breathing' that feature in several different diseases.
534: 
535: Two such clusters are shown in Figure \ref{medical_diagnosis_alignment}. The symptoms of fever are shown in column 4 while column 3 shows a cluster of symptoms associated with influenza and other diseases such as smallpox (see below). Notice that fever is itself part of the influenza cluster.
536: 
537: Notice also how the provision of a named cluster saves the need to specify the corresponding symptoms redundantly in each of the diseases where that cluster appears.
538: 
539: \subsection{Uncertainties in diagnosis}\label{uncertainties_in_diagnosis}
540: 
541: Diagnosis is not an exact process. Although some symptoms may be necessary or sufficient for the diagnosis of a given disease, the majority are merely `characteristic' in the sense that they are associated with the disease but any one such symptom need not be present in every case and any of them may be associated with other diseases. There may also be errors in the observation or recording of symptoms.
542: 
543: In broad terms, SP61 can accommodate this kind of uncertainty in diagnosis. This is because it looks for a global best match amongst patterns and does not depend on the presence or absence of any particular symptom. At the same time, particular symptoms can have a major impact on diagnosis, as described in Section \ref{explaining_away}, below.
544: 
545: Within the SP system, it is not necessary for every symptom of a disease to be recorded as a specific value. In column 4 of the multiple alignment in Figure \ref{medical_diagnosis_alignment}, the pair of symbols `tclass1 \#tclass1' represents a set of alternative values for the temperature associated with fever. In this case, there are just two values, represented in Old by the patterns `tclass1 t37-39 \#tclass1' (high temperature) and `tclass1 t39+ \#tclass1' (very high temperature). The first of these patterns is shown in column 5 of the multiple alignment, matched to the temperature of the patient shown in column 0.
546: 
547: \subsection{Weighing alternative hypotheses}\label{medical_alternative_hypotheses}
548: 
549: In medical diagnosis, it is quite usual for the physician to consider alternative hypotheses about what disease or diseases the patient may be suffering from. The SP system provides a model for this process in the way the system builds alternative multiple alignments for any given pattern in New, each with a compression score calculated as described in Section \ref{ma_evaluation}. Notice that the compression score  depends in part on the frequency values for patterns mentioned at the beginning of Section \ref{medical_diagnosis_section}.
550: 
551: As described in Section \ref{probabilities_section}, each multiple alignment has an absolute probability. And for each multiple alignment in a set of alternative multiple alignments that encode the same symbols from New, a relative probability ($p_{REL}$) may also be calculated.
552: 
553: Where alternative multiple alignments encode different subsets of the symbols in New, $CD$ seems to be the most appropriate measure for the purpose of comparison. Where two or more multiple alignments encode exactly the same symbols from New, they may be compared using relative probabilities.
554: 
555: When SP61 formed the multiple alignment shown in Figure \ref{medical_diagnosis_alignment}, it also formed a similar multiple alignment, matching exactly the same symbols in New, in which column 2 contained a pattern representing the symptoms of smallpox, instead of the pattern for influenza. The $p_{REL}$ values calculated in this case were 0.99950 for influenza and 0.00049 for smallpox, reflecting the relative frequencies of those two diseases in the world today.
556: 
557: \subsubsection{`Explaining away'}\label{medical_explaining_away}
558: 
559: \index{reasoning!explaining away|(}
560: 
561: The symptoms of influenza and smallpox are quite similar, except for the very distinctive rash and blisters that occur in smallpox. The example shown in Figure \ref{medical_diagnosis_alignment} is silent about whether John Smith had a rash and blisters or not.\footnote{If a rash and blisters had been seen to be absent, this would be represented as `normal\_skin'.} Given this lack of information about those symptoms, the probabilities shown above are reasonable.
562: 
563: If `rash\_with\_blisters' is added to the symptoms recorded in New, and SP61 is run again, the best multiple alignment found by the system is similar to that shown in Figure \ref{medical_diagnosis_alignment} but with the pattern for smallpox in column 2 and with a match shown for the two instances of `rash\_with\_blisters'. However, in this case there is no other multiple alignment that matches the same symbols in New. So the value of $p_{REL}$ for the best multiple alignment is 1.0.
564: 
565: From this result, we may conclude that the patient certainly has smallpox and that his aching muscles and runny nose are due to smallpox, not influenza. This is the phenomenon of `explaining away' discussed in Section \ref{bayesian_network}.%
566: \index{reasoning!explaining away|)}
567: 
568: \subsubsection{A patient may suffer from two or more diseases at the same time}
569: 
570: It is entirely possible, of course, for a patient to suffer from two or more diseases at the same time. In the SP system, a combination of diseases may be treated as a single disease, represented as a pattern in Old. The pattern may be constructed economically as references to the component diseases, as described in Section \ref{clusters_of_symptoms}.
571: 
572: As with single diseases, frequency values for a combinations of diseases may be obtained from population surveys or by the judgement of experts. Where diseases are statistically independent, these values will of course be very low. But they can be used for the calculation of $CD$ values and probabilities in exactly the same way as for single diseases.
573: 
574: \subsection{Inference and diagnosis}
575: 
576: Hypotheses formed in the course of diagnosis often lead to inferences about the condition of the patient. These inferences may suggest the need to gather more information from blood tests, X rays or the like. Or they may provide the basis for prescription, treatment or advice to the patient.
577: 
578: In a multiple alignment like the one shown in Figure \ref{medical_diagnosis_alignment}, any symbol within an Old pattern that is {\em not} matched to a symbol in New represents an inference that may be drawn from the multiple alignment. In this example, we may infer from the multiple alignment {\em inter alia} that the patient is likely to have a cough and a headache and that the standard treatment for influenza is required. Probabilities of these inferences can be calculated as described in Section \ref{probabilities_section}.
579: 
580: \subsubsection{Causal reasoning}\label{medical_causal_reasoning}
581: 
582: Apart from the kinds of inference just described, medical diagnosis often seems to involve a `deeper' kind of reasoning about the causes of symptoms and diseases, using knowledge of anatomy and physiology.
583: 
584: No attempt has yet been made with the SP system to model this kind of medical reasoning. However, as we shall see in Section \ref{causal_diagnosis_section}, the SP system can be used to model causal diagnosis in other contexts and there seems no reason in principle why it should not also be applied to reasoning about the causes of medical conditions.%
585: \index{diagnosis!medical|)}
586: 
587: \section{Conclusion}
588: 
589: As we have seen, the SP system allows the recognition or retrieval of patterns despite errors of omission, commission or substitution. It also allows recognition or retrieval with class-inclusion relations (and cross-classification) and their integration with part-whole relations. The system can model polythetic categories and it supports indirection in information retrieval. An example has been presented showing how the system may provide computational support for medical diagnosis, viewed as a problem of pattern recognition.
590: 
591: We have noted the close recognition-retrieval-and-reasoning connection between recognition, retrieval and reasoning and we have touched briefly on the last of these three in Sections \ref{medical_alternative_hypotheses}, \ref{medical_explaining_away} and \ref{medical_causal_reasoning}. In the next chapter, we look in more detail at the ways in which the SP system supports probabilistic reasoning.%
592: \index{perception!recognition|)}\index{information!retrieval|)}
593: 
594: 
595: