classifying movie reviewsa binary classification example because you're restricting yourself to the top , most frequent wordsno word index will exceed , max([max(sequencefor sequence in train_data] for kickshere' how you can quickly decode one of these reviews back to english wordsword_index is dictionary mapping words to an integer index word_index imdb get_word_index(reverse_word_index dict[(valuekeyfor (keyvaluein word_index items()]decoded_review join[reverse_word_index get( '?'for in train_data[ ]]reverses itmapping integer indices to words decodes the review note that the indices are offset by because and are reserved indices for padding,start of sequence,and unknown preparing the data you can' feed lists of integers into neural network you have to turn your lists into tensors there are two ways to do thatpad your lists so that they all have the same lengthturn them into an integer tensor of shape (samplesword_indices)and then use as the first layer in your network layer capable of handling such integer tensors (the embedding layerwhich we'll cover in detail later in the bookone-hot encode your lists to turn them into vectors of and this would meanfor instanceturning the sequence [ into , -dimensional vector that would be all except for indices and which would be then you could use as the first layer in your network dense layercapable of handling floating-point vector data let' go with the latter solution to vectorize the datawhich you'll do manually for maximum clarity listing encoding he int eger sequences int binary mat rix import numpy as np creates an all-zero matrix of shape (len(sequences)def vectorize_sequences(sequencesdimension= )dimensionresults np zeros((len(sequences)dimension)for isequence in enumerate(sequences)results[isequence sets specific indices return results of results[ito x_train vectorize_sequences(train_datax_test vectorize_sequences(test_datalicensed to vectorized training data vectorized test data