Sub topic 2
Where Labels Come From: Star Ratings, Annotation, and Weak Labels
Assume you know basic Python and the difference between training data and test data. This chapter focuses on how sentiment labels are created. A model can only learn the meaning that your labels encode, so label quality often matters more than model choice.
Define the label before collecting data
A sentiment label is the target value that describes an author's attitude. Common labels are:
- Positive: the writer expresses approval or satisfaction.
- Negative: the writer expresses dislike, dissatisfaction, or harm.
- Neutral: the writer gives information without a clear positive or negative attitude.
Decide the level of detail first. A document-level label describes the whole review or post. A sentence-level label gives each sentence its own label. Aspect-based labels connect sentiment to a specific topic, such as battery life or customer service.
Also decide whether sentiment is categorical or ordinal. Categorical labels treat positive, neutral, and negative as separate classes. Ordinal labels preserve an order, such as one to five stars. The difference matters because confusing a one-star review with a five-star review is worse than confusing a three-star review with a four-star review.
Star ratings are useful but imperfect
A star rating is often an existing source of labels. You might map one or two stars to negative, three stars to neutral, and four or five stars to positive.
| Star rating | Possible sentiment label | Risk |
|---|---|---|
| 1–2 stars | Negative | Some reviews praise one feature while criticizing another |
| 3 stars | Neutral | A three-star review may contain strong mixed opinions |
| 4–5 stars | Positive | The written text may not match the selected rating |
This approach is inexpensive, but a rating measures the reviewer's overall experience. It does not necessarily label every sentence. In “The camera is excellent, but the battery is terrible,” the overall rating may hide two opposing sentiments.
Ratings can also contain selection bias. People with unusually good or bad experiences may be more likely to post reviews. A platform's rating scale may differ from another platform's scale.
Human annotation captures the text directly
Annotation is the process of asking people to assign labels according to written instructions. Give annotators examples and define difficult cases, such as:
- Mixed sentiment: label as mixed, neutral, or split into aspects.
- Sarcasm: label the intended meaning if annotators can identify it consistently.
- Quoted speech: decide whether quoted words represent the author's view.
- Spam or irrelevant text: add a separate exclusion label when needed.
Use multiple annotators for at least part of the dataset. Agreement shows whether the task instructions are clear. If annotators disagree often, the problem may be an ambiguous label scheme rather than a weak model.
A simple majority vote creates one training label. Keep the individual judgments too. They help you find uncertain examples and measure disagreement later.
Weak labels trade accuracy for scale
A weak label is an automatically generated or indirect label. Star ratings, emoji rules, keyword matches, and product-return records can all provide weak labels. They let you create a large dataset quickly, but they may include systematic errors.
For example, selecting posts containing “love” as positive will mislabel “I love waiting three hours for support” as positive. These errors can teach a classifier the wrong patterns. Inspect a sample of weakly labeled data before training, and use a smaller, carefully annotated set for evaluation.
Build a trustworthy labeling process
Separate labeling from evaluation. If the same noisy rule creates both training and test labels, a high score may only show that the model copied the rule. Prefer a manually reviewed test set that represents the data your system will meet in production.
Record the label definition, source, annotator instructions, mapping rules, and excluded examples. These details make later error analysis possible and help you change the scheme without losing the dataset's history.
Exercise
You have reviews with one to five stars and want positive, neutral, and negative labels. What should you check before using the ratings as ground truth?
Show answer
Check whether the star-to-label mapping matches your task, inspect written reviews for rating-text disagreements and mixed sentiment, and manually review a representative evaluation set.