Get startedGet started for free

Fitting a neural network model to clothing data

In this exercise, you will fit the fully connected neural network that you constructed in the previous exercise to image data. The training data is provided as two variables: train_data that contains the pixel data for 50 images of the three clothing classes and train_labels, which contains one-hot encoded representations of the labels for each one of these 50 images. Transform the data into the network's expected input and then fit the model on training data and training labels.

The model you compiled in the previous exercise, and train_data and train_labels are available in your workspace.

This exercise is part of the course

Image Modeling with Keras

View Course

Exercise instructions

  • Prepare the data for fitting by reshaping it.
  • Fit the model by passing the input training data and training labels to the model's .fit() method.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Reshape the data to two-dimensional array
train_data = train_data.reshape(____, ____)

# Fit the model
model.fit(____, ____, validation_split=0.2, epochs=3)
Edit and Run Code