As anticipated, the dataset is already available in the Keras library. So we have loaded the appropriate library and then loaded the data:
from keras.datasets import reuters(XTrain, YTrain),(XTest, YTest) = reuters.load_data(num_words=None, test_split=0.3)
The following information is returned:
Downloading data from https://s3.amazonaws.com/text-datasets/reuters.npz2113536/2110848 [==============================] - 2s 1us/step
Now, let's check the contents of the four objects we imported. First, we get the type of the objects. To do this, we'll use the built-in function type(), as follows:
print('XTrain class = ',type(XTrain))print('YTrain class = ',type(YTrain))print('XTest shape = ',type(XTest))print('YTest shape ...