Sentiment analysis using sklearn

Terry Reedy tjreedy at udel.edu
Sat Jan 27 17:44:47 EST 2018


On 1/27/2018 4:05 PM, qrious wrote:
> I am attempting to understand how scikit learn works for sentiment analysis and came across this blog post:
> 
> https://marcobonzanini.wordpress.com/2015/01/19/sentiment-analysis-with-python-and-scikit-learn
> 
> The corresponding code is at this location:
> 
> https://gist.github.com/bonzanini/c9248a239bbab0e0d42e
> 
> My question is while trying to predict, why does the curr_class in Line 44 of the code need a classification (pos or neg) for the test data? After all, am I not trying to predict it? Without any initial value of curr_class, the program has a run time error.

In order for the 'bot' to classify new samples, by learning the 
difference between positive and negative samples, it needs to be trained 
on existing samples that are 'correctly' classified.


-- 
Terry Jan Reedy




More information about the Python-list mailing list