Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

hungarian algorithm python

>>> cost = np.array([[4, 1, 3], [2, 0, 5], [3, 2, 2]])
>>> from scipy.optimize import linear_sum_assignment
>>> row_ind, col_ind = linear_sum_assignment(cost)
>>> col_ind
array([1, 0, 2])
>>> cost[row_ind, col_ind].sum()
5
Comment

PREVIOUS NEXT
Code Example
Python :: display keys in a dictionary python 
Python :: Sum items in a list with ints and strings in python 
Python :: maximum and minimum value of array python 
Python :: hostname python 
Python :: how to use a function to find the average in python 
Python :: import all csv as append dataframes python 
Python :: select all rows in a table flask_ sqlalchemy (python) 
Python :: quick sort python 
Python :: python square a number 
Python :: how to raise the exception in __exit__ python 
Python :: python split string into floats 
Python :: datetime.time to seconds 
Python :: Creating a Pandas Data Frame Series 
Python :: get dictionary values python 
Python :: ERROR: Command errored out with exit status 1 
Python :: remove leading and lagging spaces dataframe python 
Python :: how to convert csv into list 
Python :: how to check if number has decimals python 
Python :: loading in pyqt5 
Python :: tkinter label auto text wrap 
Python :: numpy mean 
Python :: python get array length 
Python :: - inf in python 
Python :: How to read PDF from link in Python] 
Python :: online python 
Python :: save model python 
Python :: countplot for different classes in a column 
Python :: python disable logging on unittest 
Python :: pandas sort dataframe by index 
Python :: python regular expression 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =