I have a collection of educational dataset. The dataset consists of a username and their review for the course. I want to analyze the data for sentiment analysis.

How can I label the data to train the model for my supervised machine learning model?

Do I need to label manually (Positive, negative, neutral) to train the model?


1 Answer 1


If you have a smaller dataset, then I think manual labelling could work.

For larger datasets, you need to use a sentiment analyser engine which has been retained on a very large dataset.

For example, you can use TextBlob,

from textblob import TextBlob
obj = TextBlob( some_text )

print( obj.sentiment.polarity )

You can one by one load each review and sort them into three classes or continuous values.

  • You can classify the review into a categorical variable. For example, if the polarity is above 0 then the review is positive else it is negative. Here, you will perform classification.

  • Use the values from TextBlob as they are. Hence, they will form continuous labels. Here, you will perform regression.


Also, you can search for similar packages which provide sentiment score for a text. You can use Natural Language Processing APIs.

import urllib

data = urllib.urlencode({"text": "I'm a very good boy "}) 
u = urllib.urlopen("http://text-processing.com/api/sentiment/", data )
the_page = u.read()

print (the_page)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.