Giter Club home page Giter Club logo

Comments (1)

jacquesfize avatar jacquesfize commented on July 28, 2024

Hi @emmanuelasso

For my part, the installation of the munkres module worked smoothly. Here, my installation script:

virtualenv -p python3 test_munkres
cd test_munkres
source bin/activate
pip install numpy cython scipy
pip install git+https://github.com/jfrelinger/cython-munkres-wrapper.git

If the munkres algorithm is not installed, the scipy.optimize.linear_sum_assignment is used. However, in terms of performance, the munkres package is much faster. As an example:

import numpy as np
from munkres import munkres
from scipy.optimize import linear_sum_assignment

a = np.random.randint(0,10,81).reshape(9,9).astype(float)

%time linear_sum_assignment(a)
CPU times: user 759 µs, sys: 208 µs, total: 967 µs
Wall time: 800 µs
Out[18]: (array([0, 1, 2, 3, 4, 5, 6, 7, 8]), array([5, 2, 0, 3, 8, 7, 1, 4, 6]))

%time munkres(a)
CPU times: user 46 µs, sys: 4 µs, total: 50 µs
Wall time: 54.1 µs
Out[19]:
array([[False, False, False, False, False,  True, False, False, False],
       [False, False,  True, False, False, False, False, False, False],
       [ True, False, False, False, False, False, False, False, False],
       [False, False, False,  True, False, False, False, False, False],
       [False, False, False, False, False, False, False, False,  True],
       [False, False, False, False, False, False, False,  True, False],
       [False,  True, False, False, False, False, False, False, False],
       [False, False, False, False,  True, False, False, False, False],
       [False, False, False, False, False, False,  True, False, False]])

Bests,
Jacques

from gmatch4py.

Related Issues (20)

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.