Introduced
NMI is an important measure of community discovery (community detection) in the case of standard Ground-truth, which can objectively evaluate the accuracy of a Community division compared with the standard division. The range of NMI is 0 to 1, the higher the representation the more accurate. The specific principles and examples can refer to this blog: http://www.cnblogs.com/ziqiao/archive/2011/12/13/2286273.html
Because of the previous use, but found in the online off-the-shelf calculation NMI code is basically MATLAB and Java, did not find in Python write. So there is nothing to do today, the above blog in the Matlab implementation method with Python to achieve a bit. It will be used directly in the future. Code
In fact, the code is very simple, is the reference blog directly from Matlab translated into Python, but there are some small pits just.
Directly to the code, and the blog is no different, here to explain the code in the EPS is a very small positive number, in order to prevent the log function parameter is 0.
In order to facilitate the use of Python words can be used directly, and finally with the download address. Results
Using the use cases in your code, you can see that if the output is 0.36456, the result is correct. Download Address
CDNs download
No points can also be github download:
GitHub download Link
Remember to star!