08.06.2015 Views

Building Machine Learning Systems with Python - Richert, Coelho

Building Machine Learning Systems with Python - Richert, Coelho

Building Machine Learning Systems with Python - Richert, Coelho

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Classification II – Sentiment Analysis<br />

Fortunately, there is a better way to take care of this, and it has to do <strong>with</strong> a nice<br />

relationship that we maybe still know from school:<br />

If we apply it to our case, we get the following:<br />

As the probabilities are in the interval between 0 and 1, the log of the probabilities<br />

lies in the interval -∞ and 0. Don't get irritated <strong>with</strong> that. Higher numbers are still a<br />

stronger indicator for the correct class—it is only that they are negative now.<br />

There is one caveat though: we actually don't have log in the formula's nominator<br />

(the part preceding the fraction). We only have the product of the probabilities. In<br />

our case, luckily we are not interested in the actual value of the probabilities. We<br />

simply want to know which class has the highest posterior probability. We are lucky<br />

because if we find this:<br />

Then we also have the following:<br />

[ 126 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!