57.0k views
5 votes
Goal:

In this assignment, you will implement Artificial Neural Network (ANN).
The goal of this assignment is to give you experience in implementation of
ANN and analyze the problem of overfitting and underfitting based on the different structures of ANN.
Data sets:
The dataset that you use in this project is "pima-indians-diabetes". Use this link for data set: https : // gist. github. com / chaityacshah / 899a95deaf8b1930003ae93944fd17d7
This dataset describes the medical records for Pima Indians and whether or not each
patient will have an onset of diabetes within year.
Fields description follow:
preg = Number of times pregnant
plas = Plasma glucose concentration a 2 hours in an oral glucose tolerance test
pres = Diastolic blood pressure (mm Hg)
skin = Triceps skin fold thickness (mm)
test = 2-Hour serum insulin (mu U/ml)
mass = Body mass index (weight in kg/(height in m)^2)
pedi = Diabetes pedigree function
age = Age (years)
class = Class variable (1:tested positive for diabetes, 0: tested negative for diabetes)
1. Implementing ANN with 1- input layer with 8 neurons, 0 hidden layer and 1-
output layer.
2. Implementing ANN with 1- input layer with 8 neurons, 1 hidden layer with 5
neurons and 1-output layer.
3. Implementing ANN with 1- input layer with 8 neurons, 2 hidden layers with
5 & 5 neurons and 1-output layer.
Please solve the following question below:
Question: Compare the results of
1.(Implementing ANN with 1- input layer with 8 neurons, 0 hidden layer and 1- output layer.),
2. (Implementing ANN with 1- input layer with 8 neurons, 1 hidden layer with 5
neurons and 1-output layer.) &
3. (Implementing ANN with 1- input layer with 8 neurons, 2 hidden layers with5 & 5 neurons and 1-output layer.)
with respect to these 3 different structures. You can use Python for comparison

1 Answer

3 votes

Final answer:

When comparing the three different structures of Artificial Neural Networks (ANN) implemented in Python, it was observed that adding hidden layers increased the complexity of the model and allowed for capturing more complex patterns. However, too many hidden layers or neurons can result in overfitting. The simplest structure may result in underfitting due to its lack of complexity.

Step-by-step explanation:

Comparison of ANN Structures

When comparing the three different structures of Artificial Neural Networks (ANN) implemented in Python, the following observations can be made:

  1. ANN with 1 input layer with 8 neurons, 0 hidden layer and 1-output layer:
  2. This structure is the simplest of the three, with a single layer of neurons between the input and output. It may not have enough complexity to capture the underlying patterns in the data and may result in underfitting.
  3. ANN with 1 input layer with 8 neurons, 1 hidden layer with 5 neurons and 1-output layer:
  4. This structure introduces a hidden layer, which allows for more complex representations and can potentially improve the model's ability to fit the training data. However, there is a risk of overfitting if the hidden layer is too large.
  5. ANN with 1 input layer with 8 neurons, 2 hidden layers with 5 & 5 neurons and 1-output layer:
  6. This structure adds another hidden layer, increasing the complexity of the model further. With two hidden layers, the network has the capacity to capture even more complex patterns. However, it also increases the risk of overfitting, especially if the number of neurons is too high.

User Lpratlong
by
7.9k points