Classifying text
In this recipe, we will use the RottenTomatoes
dataset and classify the review texts for sentiment. We will classify the test split of the dataset and evaluate the results of the classifier against the true labels in the test split of the dataset.
Getting ready
As part of this recipe, we will use the pipeline module from the transformers package. You can use the 8.3_Classification_And_Evaluation.ipynb
notebook from the code site if you need to work from an existing notebook.
How to do it...
In this recipe, you will continue from the previous example using the RottenTomatoes
dataset and sample a few sentences from it. We will then classify a small subset of five sentences for sentiment classification and demonstrate the results on this smaller subset. We will then perform inference on the whole test split of the dataset and evaluate the results of the classification.
The recipe does the following things:
- Loads the
RottenTomatoes
dataset and prints...