ValueError: too many values to unpack using sum return function
Attempting to implement this Deep Embedded Clustering GitHub algorithm.
    def acc(y_pred, y_target):
        D = max(y_pred.max(), y_target.max()) + 1
        w = np.zeros((D, D), dtype=np.int64)
        for i in range(y_pred.size):
            w[y_pred[i], y_target[i]] += 1

        ind = linear_assignment(w.max() - w)
        return sum(w[i, j] for i, j in ind) * 1.0 / y_pred.size # &lt;- Error Line 

Just using the code within the repo I am encountering this ValueError. I attempted to use the zip function to solve this as well as assigning the output to a variable before passing return.

Solution if anyone else encounters similar issue. The Github Repo using linear_assignment  is deprecated and removed from updated scikit learn packages.
I had used the solution accepted as the answer within this thread , However, as mentioned in that thread scipy.optimize.linear_sum_assignment is not the perfect replacement for linear assignment. This was causing my issue as the output of the two functions is different.
Two options is you can downgrade your Scikit learn package to the version which supports linear assignment, or comment out the import and use the old function definition as posted by InputBlackBoxOutput in linked thread, and below.
def linear_assignment(cost_matrix):
  try:
    import lap
    _, x, y = lap.lapjv(cost_matrix, extend_cost=True)
    return np.array([[y[i], i] for i in x if i &gt;= 0])
  except ImportError:
    from scipy.optimize import linear_sum_assignment
    x, y = linear_sum_assignment(cost_matrix)
    return np.array(list(zip(x, y)))

