from keras.src.utils import to_categorical
y_binary = to_categorical(y_int)
Alternatively, you can use the loss function `sparse_categorical_crossentropy` instead, which does expect integer targets.
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
[enter image description here](https://i.sstatic.net/H34aUVgO.png),
Here is my code
New contributor
Goodluck Adanlawo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.