getting started with neural networks as you can seethe training loss decreases with every epochand the training accuracy increases with every epoch that' what you would expect when running gradientdescent optimization--the quantity you're trying to minimize should be less with every iteration but that isn' the case for the validation loss and accuracythey seem to peak at the fourth epoch this is an example of what we warned against earliera model that performs better on the training data isn' necessarily model that will do better on data it has never seen before in precise termswhat you're seeing is overfitting after the second epochyou're overoptimizing on the training dataand you end up learning representations that are specific to the training data and don' generalize to data outside of the training set in this caseto prevent overfittingyou could stop training after three epochs in generalyou can use range of techniques to mitigate overfittingwhich we'll cover in let' train new network from scratch for four epochs and then evaluate it on the test data listing ret raining model from scrat ch model models sequential(model add(layers dense( activation='relu'input_shape=( ,))model add(layers dense( activation='relu')model add(layers dense( activation='sigmoid')model compile(optimizer='rmsprop'loss='binary_crossentropy'metrics=['accuracy']model fit(x_trainy_trainepochs= batch_size= results model evaluate(x_testy_testthe final results are as followsresults [ this fairly naive approach achieves an accuracy of with state-of-the-art approachesyou should be able to get close to using trained network to generate predictions on new data after having trained networkyou'll want to use it in practical setting you can generate the likelihood of reviews being positive by using the predict methodmodel predict(x_testarray([ ]]dtype=float licensed to