| ★ APPLICATIONS ★ DIVERS ★ EXPERT SYSTEMS ★ |
Expert Systems - Part 1 (The Amstrad User)![]() | Expert Systems - Part 2 (The Amstrad User)![]() |
It's time to forget the theoretical and start to consider the practical, says Paul Gerard. This month we will look at some ways we can actually get the computer to start thinking about concepts that are not numbers. (Bear with me if you still feel computers can't think at all). To get right away from the rather abstract and philosophic approach we have been stuck with so far we will get right down to a concrete example, and imagine an expert system that is concerned with living things (plants and animals). This is a good place to start because the science of biology has, even since the time of Linneus, been highly "structured" (just can't get away from that word!) in the sense that all living things are regarded as belonging to species which belong to families which belong to orders which belong to classes which belong to phylums (phyla?), which belong to kingdoms. For those of you who have either forgotten your biology or (gasp) never studied it, and find that a little confusing, let's take an example. My old puss is a cat, which makes her (from the top down):
Why represent an idea in a code like this rather than as a conventional "word"? Basically the advantage is the same as that produced by the original classification of living things, in that we can talk to the computer about whole classes of creatures, knowing that it can apply this information to all members of the class, and we can talk to it about a specific creature, knowing that the computer will be "aware" that this specific idea is part of a larger more general one. It will "know" for instance that a cat is a mammal - and can apply information generally true of mammals to "cat" (say, the possession of hair rather than scales or feathers, and feeding milk to young ones). This greatly reduces the amount of data it must store (and plough through) to retrieve information about any given animal. This applies in fact to any idea, as we shall see when we start to generalise our expert system a bit. Another advantage of the code is that the idea is universalised, that it is taken away from the domain of a particular word. Because to the computer "cat" is the character string "4587832", and any real "thought" about the idea "cat" is going to be in terms of that string, it can easily be taught to consider "puss" or "mog" as being the same thing - just as our command routine could easily be persuaded to accept several different words as representing the same command. Even more excitingly, it means that our coding, and the bulk of our basic data, can be used unchanged for a version of our expert system designed to work in Arabic or French or Chinese. All that needs to be changed is »hc file holding the data that permits translation between the "natural language" and the code numbers. One drawback is that we need to go to all the bother of compiling a classified list of all concepts - in the case of plants and animals this has already been done for us because that is the way biologists make sense of the multitude of different organisms on the planet, but in the case of other fields of knowledge it Is not so simple (we can still do it, but it is a hassle). Another drawback of our taxionomic "tree" is that it does not give anything like a complete description of the idea of "cat". The cat is a predator, for instance, but so are many animals, including the praying mantis and the crocodile as well as the lion, tiger, leopard and other animals related more closely to old puss. What we need is another set of ideas - let us call them "attributes" that we can apply to "cat" as well as, say "crocodile". These attributes can be coded and stored in the same way as the codes for the animals themselves - in fact we will store them in an independent file rather than putting them in another field in the file for the animals. Some attributes, with their codes that we might want to assign to "cat" might be: CW White (at least my old moggy is) Don't worry too much about the derivations of the codes for the moment - the important thing is that all three attributes need to be linked to "cat". One way to do this would be the method we used in "Structured Data", using "field" entries for (say) "Relationship to man", "Habitat" and "Colour" and keep everything in one file, (or one data array in RAM memory). The trouble is that we may want to make many entries for some headings - for instance, cats can be many colours besides white and feral cats don't live in people's homes. A more flexible way of doing essentially the same thing is to have three data files (or arrays) - one for the animals, one for their attributes and a third that 'links" the other two. Assuming the other two files will be exactly as above, our "linker" file will include these entries for "cat"- (Animal code) (Characteristic code) In addition, wc will want to includc attributes of the wider divisions to which "cat" belongs - say the following: Cat family (458783) : has retractable claws (AK) These things will be true of "cat", of course, and at the same time true of other creatures on different limbs of our "tree". Let's get down to programming and sec if we can get this working! We will cheat a bit and look at our "report" or enquiry module first - this sort of thing is called "bottom-up implementation" and is actually quite respectable from an academic point of view nowadays. The first thing is to get our data files set up - since we have not yet got our input routines working we will do this by setting up ASCII files with the word processor; TASWORD, PROTECT, or WORDSTAR will all do the job nicely. If you haven't got a word processor, then even "ED", the good ole CP/M text editor, is quite adequate for this purpose. If all else fails, you can always cheat by getting this month's cassette and using "CASLOAD" from the CP/M 2.2 disc to load the data files up to disc. Assuming you are using your word processor (remembering to use its ASCII facility so that you haven't got a lot of unwanted control characters), then simply open files (named aft follows) and type in the following data as text. The result is exactly what a BASIC program like Structured Data produces of course. (If you don't believe me then have a look at an SD file)! 1) The following into a file called "animals.exp".
2) Next a rather longer file called "aniclass.cla".
3) Then, yet another called "aniattri.att'
4) And. finally "anilink.lnk".
Oops! That's about all we have room for this month. Clever programmers can probably already work out roughly how we will be using these things • have a go at making sense of it all yourself! For the rest, we will be having a purely "practical" session next month, and getting our first real "intelligent results! TAU |
| ![]() |
|