APPLICATIONSDIVERS ★ EXPERT SYSTEMS ★

Expert Systems - Part 1 (The Amstrad User)Expert Systems - Part 2 (The Amstrad User)
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

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):

  1. An animal (a member of the animal kingdom).
  2. A vertebrate (of the phylum chordata)
  3. A mammal (class mammalia)
  4. A carnivore (order carnivora)
  5. A member of the cat family (family felidae)
  6. A member of a particular species (felix felix).
Now let us imagine that we want to represent this stepwise definition of a particular creature symbolically - one way, invented by the great librarian Dewey over a hundred years ago, is to use symbols (probably numbers) applied as if they were decimal fractions. Thus additional definition is carried from left to right. Unfortunately Dewey's own scheme is designed for arranging library books and doesn't work consistently enough for the computer, but pinching his basic idea rather than his application of it we might arrive at the following as our definition of the concept "cat". Let us take a one place decimal fraction (say .4) and assign to it the meaning "all living things and their environment." The other decimal fractions (.1..2 and so on) we can save for other classes of idea; if you like the "fraction" metaphor then think of them as divisions of a central unity (1) of thought. Then we can further divide .4 as follows:
  • 4 living things
  • 45 animals
  • 458 vertebrates
  • 4587 mammals
  • 45878 carnivora
  • 458783 felidae (cat family)
  • 45878355 domesticated cat
Note that in practice we have left off the decimal point - if you look at the backs of a few library books you will notice that Dewey moved his decimal point three places to the right to make his numbers easier to read. Since our user will never have the read the "number", and the computer will be treating it as a character string, we don't have to bother with the point at all - but it will help to understand what we are doing if you imagine it there - and each longer "number" as actually representing an increasingly smaller fraction of the totality of possible ideas. Note that when we are likely to have more than nine divisions of an idea it makes sense to add two or throe digits rather than one -as "55" to define the domestic pussy. Also note that Dewey's scheme uses quite different numbers - his "4's" are concerned with language rather than biology, for instance.

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)
HA Domesticated
HAA Living in human dwellings

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)
4587832 CW
4587832 HA
4587832 HAA

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)
Carnivore (45878) : is i predator (DD)
Mammal (4587) : has für or hair (AH)
: feeds its young milk (RF)
Vertebrate (458) : has an internal skeleton (AAT)

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

★ PUBLISHER: THE AMSTRAD USER
★ YEAR: 1989
★ CONFIG: 64K + AMSDOS
★ LANGUAGE:
★ LiCENCE: LISTING
★ AUTHOR: Paul GERARD
 



★ AMSTRAD CPC ★ DOWNLOAD ★

Type-in/Listing:
» Expert  Systems    LISTINGDATE: 2013-07-20
DL: 394
TYPE: PDF
SiZE: 611Ko
NOTE: 6 pages/PDFlib v1.6

★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
» Applications » Morse Tutor
» Applications » Creacion de Listas
» Applications » Bildschirmspiegelung (Computer Partner)
» Applications » Accelerateur (CPC Revue)
» Applications » Biorythme
» Applications » Wortketten v2 (CPC Amstrad International)
Je participe au site:
» Pour ce titre nous ne disposons de fichier executable sur CPC (Dump, Saisie du listing) , alors si vous avez ça dans vos cartons ou vous désirez usé vos petit doigts boudinés sur votre clavier faites le nous savoir.
» Vous avez des infos personnel ?
» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.

CPCrulez[Content Management System] v8.732-desktop/c
Page créée en 177 millisecondes et consultée 3314 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.