Icon

10 Classification IV - exercise

There has been no title set for this workflow's metadata.

Text Mining Course: Preprocessing, Transformation, and Classification Models (bonus exercise)

Unsupervised learning with a lexicon-driven sentiment predictor:
- Create document cells.
- Tag terms based on sentiment dictionaries.
- Extract and count positive and negative terms.
- Compute sentiment score based on the number of positive and negative terms.
- Predict sentiment labels based on score.
- Score prediction.

URL: Slides KNIME Analytics Platform Text Mining Course https://www.knime.com/form/material-download-registration

Session 3 - Preprocessing, Transformation, and Classification Models

Exercise 10 - Sentiment Predictor II (Bonus)

Learning objective: In this exercise, you will further practice performing classification on an IMDB data set.


Workflow description: This workflow predicts the sentiment of movie reviews using an unsupervised approach: lexicon-driven.


You’ll find the instructions for the exercises in the yellow annotations.

Unsupervised learning: Build a lexicon-driven sentiment predictor

  1. Create document cells.

  2. Tag terms based on sentiment dictionaries with the Dictionary Tagger node.

  3. Extract and count positive and negative terms.

    • Filter terms tagged as positive and negative.

    • Generate a bag of words and and count (absolute frequency) positive and negative terms.

    • Use the Tags to String node to extract sentiment tags.

    • Use the Pivot node to sum absolute term frequency per sentiment (positive and negative) in each document.

    • Handle any missing values with 0.

  4. In a parallel branch to 3., compute absolute term frequency and use the GroupBy node to sum absolute term frequency in each document.

  5. Join the output tables of 3. and 4. with the Joiner node. Use "Document" as the join column.

  6. With the Math Formula node compute a sentiment score based on the number of positive and negative terms. Use the formula: (PositiveWords - NegativeWords)/TermFrequency

  7. Predict sentiment labels based on the score using the Rule Engine node. For example, if score is >= 0, the sentiment is positive.

  8. Score predictions.



Your Solution
Positive list
CSV Reader
Read imdbdataset
CSV Reader
Negative list
CSV Reader

Nodes

Extensions

Links