In this section, we are going to use TensorFlow (Python) to do DL sentiment analysis using the same Large Movie Review Dataset as for the first example in the previous section. Prerequisites for this example are Python 2.7.x, the PIP package manager, and Tensorflow. The Importing Python Models in the JVM with DL4J section in Chapter 10, Deploying on a Distributed System, covers the details of setting up the required tools. We are also going to use the TensorFlow hub library (https://www.tensorflow.org/hub/), which has been created for reusable ML modules. It needs to be installed through pip, as follows:
pip install tensorflow-hub
The example also requires the pandas (https://pandas.pydata.org/) data analysis library, as follows:
pip install pandas
Import the necessary modules:
import tensorflow as tf
import tensorflow_hub as hub
import os
import...