### CS4341 Introduction to Artificial Intelligence  HOMEWORK 4 - C 2000

#### PROF. CAROLINA RUIZ

DUE DATE: Friday, Feb. 25 at 5 pm.

• Instructions for Homework 4:
• This is an INDIVIDUAL homework.
• The homework is due Friday, February 25, 2000 at 5 pm.
• Parts of the homework are in PDF format, as well as in DVI and PS formats. If you are unable to handle those formats, send email to cs4341_ta@cs.wpi.edu, and we'll make paper copies of the HW assignment available to you.

• Homework Problems: This homework consists of three parts:

### Part 1: Practice Problems for the Final Exam (60 points)

Solve all 5 problems. This set of problems is available in the following formats:

### Part 2: Training Neural Nets (20 points)

This problem is available in the following formats:

## Hint:

Here is a partially completed table to guide your calculations. Below the table there are some sample computations. The table was generated using Janet Burge's error back propagation code.
```+-----------+-----------+---------+---------+---------+---------+----------+
| Variables | Initial W |  ex. 1  |  ex. 2  |  ex. 3  |  ex. 4  | Final W  |
+-----------+-----------+---------+---------+---------+---------+----------+
|  A        |           |   0.000 |   0.000 |   1.000 |   1.000 |          |
|  B        |           |   0.000 |   1.000 |   0.000 |   1.000 |          |
| Des. Out  |           |   0.000 |   1.000 |   1.000 |   0.000 |          |
+-----------+-----------+---------+---------+---------+---------+----------+
| W a->c    |    0.100  |   0.100 |   0.100 |   0.100 |   0.100 |          |
| W a->d    |    0.200  |   0.200 |   0.200 |   0.200 |   0.200 |          |
| W b->c    |   -0.100  |  -0.100 |  -0.100 |  -0.100 |  -0.100 |          |
| W b->d    |    0.050  |   0.050 |   0.050 |   0.050 |   0.050 |          |
| W c->e    |   -0.200  |  -0.200 |  -0.200 |  -0.200 |  -0.200 |          |
| W d->e    |    0.300  |   0.300 |   0.300 |   0.300 |   0.300 |    0.295 |
+-----------+-----------+---------+---------+---------+---------+----------+
| C Output  |           |  0.3775 |  0.3543 |         |         |          |
| D Output  |           |  0.3775 |  0.3894 |         |         |          |
| E Output  |           |  0.5094 |  0.5115 |         |         |          |
+-----------+-----------+---------+---------+---------+---------+----------+
| Beta C    |           |  0.0255 | -0.0244 |         |         |          |
| Beta D    |           | -0.0382 |  0.0366 |         |         |          |
| Beta E    |           | -0.5094 |  0.4885 |         |         |          |
+-----------+-----------+---------+---------+---------+---------+----------+
| D W a->c  |           |  0.0000 | -0.0000 |         |         |          |
| D W a->d  |           | -0.0000 |  0.0000 |         |         |          |
| D W b->c  |           |  0.0000 | -0.0056 |         |         |          |
| D W b->d  |           | -0.0000 |  0.0087 |         |         |          |
| D W c->e  |           | -0.0481 |  0.0433 |         |         |          |
| D W d->e  |           | -0.0481 |  0.0475 |  0.0519 | -0.0562 |          |
+-----------+-----------+---------+---------+---------+---------+----------+

Sample Computations for example 1, i.e. A = 0, B = 0:
(here e^y means e to the power y)

Oc = 1/[1 + e^{y}] where  y = A*Wac + B*Wbc + (-1)*1/2
= 0.377541               = 0*0.1 + 0*(-0.1) - 0.5 = -0.5

Od = 1/[1 + e^{y}] where  y = A*Wad + B*Wbd + (-1)*1/2
= 0.377541               = 0*0.1 + 0*(0.05) - 0.5 = -0.5

Oe = 1/[1 + e^{y}] where  y = Oc*Wcd + Od*Wde
= 0.509437               = 0.377541*(-0.2) + 0.377541*(0.3)

New Wde (after processing all 4 examples):

New Wde :=  0.300 -0.0481 + 0.0475 + 0.0519 -0.0562 = 0.295
```

### Part 3: Genetic Algorithms (20 points)

Solve Exercise 25.2 (page 680) from your textbook.