Now, let's take a look at how our trained model generalizes, that is, how it performs on unseen review texts from the sentiment labeled sentences dataset. First, we need to restore the trained model from the disk:
System.out.println("Starting the evaluation on sample texts ...");boolean saveUpdater = true;MultiLayerNetwork restoredModel = ModelSerializer.restoreMultiLayerNetwork(modelPath, saveUpdater);SentimentDatasetIterator test = new SentimentDatasetIterator(DATA_PATH, wordvectors, batchSize, truncateReviewsToLength, false);
Now, we can randomly extract two review texts from IMDb, Amazon, and Yelp, where the first one expresses a positive sentiment, and the second one expresses a negative sentiment ...