Example – MLP for classification
We will review basic NN concepts by looking at the MLP, which is conceptually one of the most straightforward types of NNs. The example we will use is the classification of movie reviews into reviews with positive and negative sentiments. Since there are only two possible categories, this is a binary classification problem. We will use the Sentiment Labelled Sentences Data Set (From Group to Individual Labels using Deep Features, Kotzias et al., KDD 2015 https://archive.ics.uci.edu/ml/datasets/Sentiment+Labelled+Sentences), available from the University of California, Irvine. Start by downloading the data and unzipping it into a directory in the same directory as your Python script. You will see a directory called sentiment labeled sentences
that contains the actual data in a file called imdb_labeled.txt
. You can install the data into another directory of your choosing, but if you do, be sure to modify the filepath_dict
variable accordingly.