# Develop a simple set of rules for diagnosing respiratory symptom diseases given patient symptoms,…

Unit 3 A

Thoroughly read chapter 2 in The Essence of Artificial Intelligence. Answer Chapter Exercises 1, 2 and 3 (just the first two a. and b. questions from problem 3) on pages 38 and 39.

Be sure to carefully follow the syntax and semantics of each representational scheme.

For pictorial/graphical representations, you may hand draw them, scan them, and import them into your document. Or, you may use the drawing tools available in your software app.

For quantifiers in predicate logic, feel free to use A and E if you are unable to produce the specialized symbols (" and \$)

For help with logic, review the handout online. There are many other resources available on predicate logic, for example:http://www.cs.odu.edu/~toida/nerzic/content/logic/pred_logic/intr_to_pred_logic.html

Represent the following facts as a set of frames:

"The aorta is a particular kind of artery which has a diameter of 2.5 cm.

An artery is a kind of blood vessel.

An artery always has a muscular wall, and generally has a diameter of 0.4 cm.

A vein is a kind of blood vessel, but has a fibrous wall.

Blood vessels all have tubular form and contain blood."

Represent the following facts in the language of predicate logic:

Every apple is either green or yellow.

No apple is blue.

If an apple is green then it is tasty.

Every man likes a tasty apple.

"Herbert is a small hippopotamus who lives in Edinburgh zoo. Like all hippopotamuses he eats grass and likes swimming."
Represent the above:

as a semantic network;

in predicate logic

For quantifiers, feel free to use A and E if you are unable to produce the specialized symbols (" and\$).

Unit 3 B

Thoroughly read chapter 3 in The Essence of Artificial Intelligence. Answer Chapter Exercises 2 and 3 on page 66ff.

2. Develop a simple set of rules for diagnosing respiratory

[ignore the last part dealing with an expert system shell]

3. What do you think are the main problems and limitations

[20 points]

1. Develop a simple set of rules for diagnosing respiratory symptom diseases given patient symptoms, using the following knowledge of typical symptoms. Describe how a simple backward chaining interpreter could be used to go through the possible diagnoses, asking the user questions about their symptoms. If you have an expert system shell available, try implementing a simple diagnosis system based on the above.

o Influenza: Symptoms include a persistent dry cough and a feeling of general malaise.

o Hayfever: Symptoms include a runny nose and sneezing. The patient will show a positive reaction to allergens, such as dust or pollen.

o Laryngitis: Symptoms include a fever, a dry cough, and a feeling of general malaise. A "laryngoscopy" will reveal that the person has an inflamed larynx.

o Asthma: Symptoms include breathlessness and wheezing. If it is triggered by an allergen, such as dust or pollen, it is likely to be "extrinsic asthma". "Intrinsic asthma" tends to be triggered by exercise, smoke or a respiratory infection.

2. What do you think are the main problems and limitations of the rule-set developed for the question above?

3. What additional knowledge might be useful to deal with more complex or subtle diagnoses?

· Unit 3 D

Prolog programming

Using Amzi Prolog, create and test prolog clauses to perform the following goals (related to the parents.pro database that you will modify).

sister_of : [modified so that it will not return a female as her own sister]

aunt(Aunt, Nephewneice) :- {your mothers or fathers sister}

any_thing :- [make up something interesting relating to families; it should not be similar to any of these rules, eg bother_of]

Use the format of facts and rules as found in the parents.pro file. In other words, you may add data if you wish for you own family, but leave the structure of functions and rules the same (and leave the original facts and rules in the file).

[20 points]

Unit 3 E

Thoroughly read chapter 5 in The Essence of Artificial Intelligence. Answer Chapter Exercises 1 and 2 on page 123.

In exercise 1, create the parse tree for each sentence. Sentences which can be recognized will have a complete parse tree while unrecognized sentences will have incomplete parse trees. Be sure to indicate which sentences are recognized.

In exercise 2, list the full DCG notation for the extended grammar. Test your grammar by using Amzi prolog.

Amzi Prolog allows DCG to be input directly. Therefore, you can enter your grammar exactly as you would create it for problem #2, page 123. For example, you can enter: sentence –> np(N), vp(N). etc.

The only "trick" is how to specify the sentence to check for proper grammar. Here's how:

?- sentence([word1,word2,word3,etc],[]).

note the use of square brackets within the parentheses, each word of the sentence is entered between commas, and the final argument [] (open bracket, close bracket). Thus to check whether "All rabbits eat carrots" is syntactically correct, enter

?- sentence([all,rabbits,eat,carrots],[]).

Examples:

?- sentence([the,rabbit,eats,the,carrot],[]).

yes

?- sentence([rabbit,the,carrot,eats,the],[]).

no

Submit the .pro file as text copied within the document you submit here. Please upload one document with all exercise answers along with your name and CUW ID#

[20 points]

The following is a grammar of a subset of English in DCG notation:

· sentence –> np(N), vp(N).

· np(N) –> det, noun(N).

· vp(N) –> verb(N), np(_).

· noun(s) –> [carrot].

· noun(s) –> [rabbit].

· noun(p) –> [rabbits].

· verb(s) –> [eats].

· det –> [the].

1. Which of the following sentences can be recognized with this Grammar?

o The carrot eats the carrot.

o The rabbits eats the carrot.

o The rabbit eats carrots.

For each sentence which is recognized by the grammar, show its parse tree.

2. Extend the grammar to handle sentences like the following. "All" and "some" should be treated as kinds of determiner (det).

o All rabbits eat carrots.

o Some rabbits eat the carrot.

o The rabbit eats every carrot.

The grammar should NOT allow sentences that are grammatically incorrect because a plural noun (e.g. carrots) is used with a determiner that can only be used with singular nouns (e.g., a, every) or vice versa, e.g.,

o All rabbit eat the carrot.

o A rabbits eat the carrot

o Every rabbits eat the carrots.

Try out your grammar using Prolog.

Unit 4 B

Thoroughly read chapter 6 inThe Essence of Artificial Intelligence. Apply the difference operator mask on page 129 to the image on page 128. Notes: use a threshold of 2; use the absolute value of the difference operation; the resulting matrix will be 7×7 rather than 8×8 (as the original is).

List the resulting matrix and show your work in computing it. This is a difficult assignment; dont panic, but work carefully and deliberately.

Unit 1 D

After you have thoroughly read sections 11.1 – 11.3 in chapter 11 of Computer Science: An Overview. Answer the following questions:

1. Draw the search tree that is generated by a breadth-first search in an attempt to solve the eight-puzzle from the following start state without the assistance of any heuristic information. Continue the tree for 5 levels or until a solution is obtained.

1

3

4

2

5

7

8

6

2. Draw the search tree that is generated by the best-fit algorithm below in an attempt to solve the eight-puzzle from the state shown in the first problem if the number of tiles out of place is used as a heuristic.

o Establish the start node of the state graph as the root of the search tree and record its heuristic value.

o While(the goal note has not been reached)do

§ [Select the leftmost leaf node with the smallest heuristic value of all leaf notes.

§ To this selected node attach as children those nodes that can be reached by a single production.

§ Record the heuristic of each of these new nodes next to the node in the search tree]

o Traverse the search tree from the goal node up to the root, pushing the production associated with each arc traversed onto a stack..

o Solve the original problem by executing the productions as they are popped off the stack.

3. Draw the search tree that is generated by the best-fit algorithm as detailed in the previous question in an attempt to solve the eight-puzzle from the following start state, assuming the heuristic used is as follows:
Measure the distance each tile is from its destination and add these values to obtain a single quantity.

1

2

3

5

7

6

4

8

4. When solving the eight-puzzle, why would the number of tiles out of place not be as good a heuristic as the one described in the question above.