xxxxxxxxxx
from tensorflow.keras.utils import to_categorical
to_categorical()
xxxxxxxxxx
Newer versions of keras==2.4.0 and tensorflow==2.3.0 would work as follows.
Import:
from keras.utils import np_utils
or
from keras import utils as np_utils
and then replace keras.utils.to_categorical with
keras.utils.np_utils.to_categorical