Sentiment analysis using sklearn

qrious mittra at juno.com
Sun Jan 28 01:53:24 EST 2018


On Saturday, January 27, 2018 at 2:45:30 PM UTC-8, Terry Reedy wrote:
> 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

The training samples already do that. I think Dan's reply below makes sense.



More information about the Python-list mailing list