Giter VIP home page Giter VIP logo

nmi's Introduction

NMI

Calculate NMI (normalized Mutual Information) as defined by Danon et al (2005).

DANON, Leon et al. Comparing community structure identification. 
Journal of Statistical Mechanics: Theory and Experiment, v. 2005, n. 09, p. P09008, 2005.

Algorithm characteristics:

  • Time complexity: O (3n + |C1|*|C2|) , where |C1| and |C2| are the number of communities in partitions 1 and 2 respectively
  • Space complexity: O (2n + |C1|*|C2| + |C1| + |C2|)

Compiling

Just call make in Linux or Mac. This will compile the nmi file and the converters convert and convertLFR.

Usage

Usage: ./nmi -g groundTrue_file -h heuristic_file -n num_nodes
-g ground true file
-h heuristic file
-n Number of nodes in the graph

Return: NMI time
NMI = -2 * I(X;Y)/(H(X)+H(Y))
time = wall time in seconds

Example of use

./nmi -g groundtruePartition.txt -h heuristicPartition.txt -n 334863

Community file format

One community per line with the ID of each node separated by space. All node IDs needs to be in range [0,n-1].

The following example presents a partition with 3 commuties and 10 nodes.

0 4 3 2 7
1 5 6
8 9

If your partition follows the pattern of one community per line but is out of range [0,n-1] you can convert it with the program convert.

./convert originalFile.txt resultingFile.txt

If you are working with LFR benchmark community files you can convert it by using the program convertLFR.

./convertLFR LFRfile.txt resultingFile.txt

nmi's People

Contributors

luizhnlorena avatar

Stargazers

DrownFish19 avatar YLiu avatar  avatar João Felipe Gonçalves avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.