# No module named 'sklearn.utils.linear_assignment_'

pip install scikit-learn==0.22.2

As **yiakwy** points out in a github comment the `scipy.optimize.linear_sum_assignment`

**is not** the perfect replacement:

I am concerned that linear_sum_assignment is not equivalent to linear_assignment which later implements "maximum values" matching strategy not "complete matching" strategy, i.e. in tracking problem maybe an old landmark lost and a new detection coming in. We don't have to make a complete assignment, just match as more as possible.

I have found this out while trying to use it inside SORT-based yolo tracking code which that replacement broke (I was lucky that it did otherwise, I would get wrong results from the experiments without realising it...)

Instead, I suggest copying the module itself to the last version of sklearn and include as module in your code.

https://github.com/scikit-learn/scikit-learn/blob/0.22.X/sklearn/utils/linear_assignment_.py

For instance if you copy this file into an `utils`

directory import with `from utils.linear_assignment_ import linear_assignment`

The `linear_assignment`

function is deprecated in 0.21 and will be removed from 0.23, but `sklearn.utils.linear_assignment_`

can be replaced by `scipy.optimize.linear_sum_assignment`

.

You can use:

```
from scipy.optimize import linear_sum_assignment as linear_assignment
```

then you can run the file and don't need to change the code.