title: Python's implementation of Mutual Information
body: <p>I am having some issues implementing the Mutual Information Function that Python's machine learning libraries provide, in particular : 
  sklearn.metrics.mutual_info_score(labels_true, labels_pred, contingency=None)</p>
  
  <p>(<a href="http://scikit-learn.org/stable/modules/generated/sklearn.metrics.mutual_info_score.html" rel="noreferrer">http://scikit-learn.org/stable/modules/generated/sklearn.metrics.mutual_info_score.html</a>)</p>
  
  <p>I am trying to implement the example I find in the Stanford NLP tutorial site: </p>
  
  <p><img src="https://i.imgur.com/VSSd5KS.jpg" alt="example"></p>
  
  <p>The site is found here : <a href="http://nlp.stanford.edu/IR-book/html/htmledition/mutual-information-1.html#mifeatsel2" rel="noreferrer">http://nlp.stanford.edu/IR-book/html/htmledition/mutual-information-1.html#mifeatsel2</a></p>
  
  <p>The problem is I keep getting different results, without figuring out the reason yet.</p>
  
  <p>I get the concept of Mutual Information and feature selection, I just don't understand how it is implemented in Python. What I do is that I provide the mutual_info_score method with two arrays based on the NLP site example, but it outputs different results. The other interesting fact is that anyhow you play around and change numbers on those arrays you are most likely to get the same result. Am I supposed to use another data structure specific to Python or what is the issue behind this? If anyone has used this function successfully in the past it would be of a great help to me, thank you for your time.</p>