### Visualize The Model

Output the Model to the Console

- Call the Summary method on the model to display it

**Reference Material**

https://keras.io/models/about-keras-models/

Hint 1

call to retrieve the model:

model.summary()

[collapse]

Full Solution

To output the model to the console:

# summary to console print (model.summary())

[collapse]

[collapse]

### Train The Model

Fit the Model

- Fit the model with the following parameters:
- the inputs (X)
- the outpus (y)
- validation_split=.20
- batch_size=64
- epochs =25

**Reference Material**

https://keras.io/models/sequential/

Hint 1

call:

model.fit(???)

[collapse]

Hint 2

The entire model.fit command:

model.fit(X, y, validation_split = .20, batch_size = 64, epochs = 25)

[collapse]

Full Solution

#Fit the ANN to the training set history = model.fit(X, y, validation_split = .20, batch_size = 64, epochs = 25)

[collapse]

[collapse]

### Visualize The Training

Visual the Training Accuracy

- Visualize the training model accuracy with pyplot from matplotlib using the following parameters:
- the inputs = history.history[‘acc’] and history.history[‘val_acc’]
- the title = model accuracy
- ylabel = accuracy
- xlabel = epoch
- legend containing = train and test

**Reference Material**

https://matplotlib.org/api/pyplot_api.html

Hint 1

Import the library:

import matplotlib.pyplot as plt

[collapse]

Full Solution

Use the following to display the graph:

import matplotlib.pyplot as plt # summarize history for accuracy plt.plot(history.history['acc']) plt.plot(history.history['val_acc']) plt.title('model accuracy') plt.ylabel('accuracy') plt.xlabel('epoch') plt.legend(['train', 'test'], loc='upper left') plt.show()

[collapse]

[collapse]

Visual the Training Model Loss

- Visualize the training model loss with pyplot from matplotlib using the following parameters:
- the inputs = history.history[‘loss’] and history.history[‘val_loss]
- the title = model accuracy
- ylabel = loss
- xlabel = epoch
- legend containing = train and test

**Reference Material**

https://matplotlib.org/api/pyplot_api.html

Full Solution

Use the following to display the graph:

# summarize history for loss plt.plot(history.history['loss']) plt.plot(history.history['val_loss']) plt.title('model loss') plt.ylabel('loss') plt.xlabel('epoch') plt.legend(['train', 'test'], loc='upper left') plt.show()

[collapse]

[collapse]

## Lab Complete!

### Extra Credit – Understand Tensorboard

Interpret the Graphs