we' need only binary parameters for each of the , digits but such model would be useless for classifying new digit samples always keep this in minddeeplearning models tend to be good at fitting to the training databut the real challenge is generalizationnot fitting on the other handif the network has limited memorization resourcesit won' be able to learn this mapping as easilythusin order to minimize its lossit will have to resort to learning compressed representations that have predictive power regarding the targets--precisely the type of representations we're interested in at the same timekeep in mind that you should use models that have enough parameters that they don' underfityour model shouldn' be starved for memorization resources there is compromise to be found between too much capacity and not enough capacity unfortunatelythere is no magical formula to determine the right number of layers or the right size for each layer you must evaluate an array of different architectures (on your validation setnot on your test setof coursein order to find the correct model size for your data the general workflow to find an appropriate model size is to start with relatively few layers and parametersand increase the size of the layers or add new layers until you see diminishing returns with regard to validation loss let' try this on the movie-review classification network the original network is shown next listing original model from keras import models from keras import layers model models sequential(model add(layers dense( activation='relu'input_shape=( ,))model add(layers dense( activation='relu')model add(layers dense( activation='sigmoid')now let' try to replace it with this smaller network listing version of he model with lower capacit model models sequential(model add(layers dense( activation='relu'input_shape=( ,))model add(layers dense( activation='relu')model add(layers dense( activation='sigmoid')figure shows comparison of the validation losses of the original network and the smaller network the dots are the validation loss values of the smaller networkand the crosses are the initial network (remembera lower validation loss signals better modellicensed to