How to use Keras sparse_categorical_crossentropy
As one of the multi-class, single-label classification datasets, the task is to classify grayscale images of handwritten digits (28 pixels by 28 pixels), into their ten categories (0 to 9). Let's build a Keras CNN model to handle it with the last layer applied with "softmax" activation which outputs an array of ten probability scores(summing to 1). Each score will be the probability that the current digit image belongs to one of our 10 digit classes. After that, you can train the model with integer targets, i.e. a one-dimensional array like Note this won't affect the model output shape, it still outputs ten probability scores for each input sample. We'll train a model on the combined works of William Shakespeare, then use it to compose a play in the similar style.
Nov-16-2019, 12:26:51 GMT
- Genre:
- Technology: