Psychology 149
Midterm 2023

Midterm is due by midnight Friday May 19th.   The name of your program should be your first and last name (for example, "MarySmith.m") and email just the program (not the data) to me at saberi@uci.edu     

Write a program that estimates a person's risk factor for developing dementia (or Alzheimer's) resulting in significant memory deficits. You can use the data file called dementiaData to train the network (click here to download).  The data variable dementiaData has 7 rows and 800 columns.  Each column is data from one individual so the data is from 800 hypothetical individuals.   The first 6 rows of the data are attributes used for training.  These attributes are:

1) Exercise (number of hours per week).
2) APOE gene, known to be involved in causing dementia (1 for yes, the person has this gene, 0 for no)
3) Healthy diet (0 is unhealthy and 10 is very healthy)
4) Stress levels (0 is no stress and 10 is a highly stressed person).
5) Exposure to environmental pollutants (measured in parts per million PPM- This will go from 0 to 200 PPM)
6) Number of hours of intellectual activity per day (chess, reading, etc.). 

The 7th row of the data shows whether or not this individual has dementia (1 means they have dementia, 0 means no dementia).

You must use Matlab neural network functions (e.g., feedforwardnet, train, etc.)  to create and train the network.

Your network should:
1) have 4 hidden layers with 10 nodes in the first hidden layer, 8 nodes in second hidden layer, and 5 nodes in the 3rd and 4th hidden layers.
2) The network should be trained using a gradient descent with momentum learning rule.
3) have a cross-entropy cost function
4) It should have a linear activation function for the first hidden layer, logistic activation function for the second hidden layer, and hyperbolic tangent activation functions for the remaining layers.
5) After training, the program should get information from the user in the form of questions (6 questions corresponding to the 6 risk factors).  The same program should be used for training and getting new input data (send me only one program).
6) The program should then calculate (using the trained network) and display to the user (in the command window) a binary risk level for development of dementia (either 0 for low of 1 for high)
. Make sure the final program output is one of these two values, but you can tell the user using words whether they are high or low risk.  You may have to rescale or round off the network's final output value to get either a 0 or 1.  Good luck!