Introduction to Artificial Inteligence

Assignment 4

Programming assignment - disgnostic reasoning with Bayes networks


Getting a feel for probabilistic reasoning. Using Bayes networks for diagnostic reasoning.


Your program should be able to read a Bayes network specified as a file, and then allow the user to preform one of the following, repeatedly:

  • Print out the network (mainly for debugging).
  • Add evidence.
  • Reset the evidence to null.
  • Set a query node, upon which the program computes and prints out the posterior distribution of the query node given the current evidence.
  • Quit.

    The inference algorithm for computing the posterior distribution is your choice: enumeration, sampling, or any other algorithm studied in class.

    Details of the requirements

    The type of network your program should be able to support is defined below. You will define and reason on a network for medical diagnosis. In the system, there are four types of variables:

    1. Background data - these variables are knowledge about patient data that requires no testing of the patient, such as age, sex, race, and hereditary diseases in relatives.
    2. Pathogens - these variables are dependent on the primal causes, and cause the diseases. Examples are: weak immune system, increased deposits in arteries, exposure to infection.
    3. Pathology - possible diseases, such as cancer, influenza, pneumonia, common cold, and angina pectoris (heart disease).
    4. Symptoms - these are observable variables in a patient, or results of tests, such as: high temperature, tachycardia (fast pulse), headache, cough, sore throught, blood or urine test results (high cholesterol, low blood count, HIV, blood in urine).

    Pathogens depend on background data - e.g. people of a certain heredity have a tendency for increased deposits in arteries. Pathology is caused by the pathogens - e.g. angina pectoris may result from blocked arteries. The symptoms are modeled by noisy-or nodes, each potentially caused by one or more diseases. You are to create a Bayes network modeling at least 2 primal causes, 2 pathogens, 6 diseases, and 3 symptoms. Explain the choices made in your design (especially the network topology). Make up probabilities such that you will be able to demonstrate all behaviours required below. One of the primal causes, age, is multi-valued, its values being: Child, Adult, Middle-aged, Elderly.

    Now that your model is ready, write it in the requisite format as a text file (manually using a text editor, or in any other way). Now, perform reasoning on the network using your program. Establish values for primal cause nodes and some symptoms, and perform observations - i.e. find the probability of all diseases given the evidence, and state the most likely disease.

    Perform the resoning over at least 2 different patients of different background. For each patient, compute the probability of all diseases given:

    Show in the data (by using at least 1 pair of different evidence sets each), behaviours of the following types:


    You need to turn in:

    Deadline: January 13, 2013.

    Additional material

    Format of the file specifying the Bayes network is your choice. Suggest the following format (characters following ; on a line are comments):

    Nodes  n                  ;  How many nodes/random variables
    NODE node_name1 standard (parents_list)    ; Define a node called node_name1 of type standard
    LABELS value1 value2 ...                   ; Define values possible for the node
    DISTRIBUTION distribution_table            ; Distribution table given as a complete array
    NODE node_name2 noisyOR (parents_list)     ; Define another node called node_name2 of type noisy-or
    DISTRIBUTION list_of_causal_weights        ; Weights defining the conditional distribution

    Note that for a noisy or we can assume that the values are TRUE/FALSE and that the parents are also TRUE/FALSE.