# Re: Prolog examples please?? HELP?

From: ELB (elb@btinternet.com)
Date: Wed Jan 02 2002 - 23:31:38 MET

• Next message: Imre Rudas: "ITHET2002"

The problem I have is as follows:

To create an expert shell to read in the following

The predicate 'disease' has 4 arguments: a reference number for the disease,
followed by its name, its prior probability in the absence of any other
information and a symptom list.

The symptom list comprises a series of numbers in groups of three, one
group
for each symptom associated with the disease, in the following order:

(a) The reference number of the symptom
(b) The probability of the symptom being present in patients who have
the disease
(c) The probability of the symptom being present in patients who do not
have the disease

e.g)

disease(1,'Common
cold',0.02,[1,0.9,0.05,2,0.8,0.02,3,0.8,0.02,5,0.6,0.01,6,0.99,0.01,7,0.2,0.
01,8,0.5,0.01,15,0.8,0.01,34,0.01,0.01]).

The 'symptom' predicate has two arguments: a reference number for the
symptom,
followed by a question that can be used to ask the user whether or not
the
symptom is present

e.g)

symptom(1,'Are you sneezing a lot?').

I have used the following coding below before to calculate the probability
using bayes theroem, but I am stuck as to how to modify the following code
to calculate the probability to a symptom relating to a disease and how once
such calculations have been performed how to select an apporriate disease
and display it to the user. All I'm looking for is the basics to get my
past this stage as I've been stuck for about a week and am a maths student
not a programmer (I need all the help I can get)

find_prob(Disease,Prob):-
start_prob(Disease,Prior),calcprob(Disease,Prior,Prob),!.

calcprob(Disease,Prior,Post):-
findall([PEH,PEnotH],symptom(Disease,_,PEH,PEnotH),Problist),
calcprob2(Prior,Problist,Post).

calcprob2(Prior,[],Prior):-!.

calcprob2(Prior,[[PEH,PEnotH]|Rest],Post):-
Newval is (PEH*Prior)/((PEH*Prior)+(PEnotH)*(1-Prior)),
calcprob2(Newval,Rest,Post),!.

start_prob(brain_tumour,0.00002).
symptom(brain_tumour,depression,0.4,0.25).

Please can you offer any help

ELB
"Martin Sondergaard" <nobody@nowhere.com> wrote in message
news:1009643727.18768.0@eurus.uk.clara.net...
> I think it needs a long answer.
> We can't really post the source code for an
> expert system shell, it would take too long to type.
>
> Would you like to ask a question that has a short answer?
>
>
> --
> Martin Sondergaard,
> London.
>
>
>

############################################################################
This message was posted through the fuzzy mailing list.
(1) To subscribe to this mailing list, send a message body of
"SUB FUZZY-MAIL myFirstName mySurname" to listproc@dbai.tuwien.ac.at
(2) To unsubscribe from this mailing list, send a message body of
"UNSUB FUZZY-MAIL" or "UNSUB FUZZY-MAIL yoursubscription@email.address.com"
to listproc@dbai.tuwien.ac.at
(3) To reach the human who maintains the list, send mail to
fuzzy-owner@dbai.tuwien.ac.at
(4) WWW access and other information on Fuzzy Sets and Logic see
http://www.dbai.tuwien.ac.at/ftp/mlowner/fuzzy-mail.info
(5) WWW archive: http://www.dbai.tuwien.ac.at/marchives/fuzzy-mail/index.html

This archive was generated by hypermail 2b30 : Wed Jan 02 2002 - 23:35:21 MET