Working in a multi-label classification problem with 13 possibles outputs in my neural network with Keras, sklearn, etc...
Each output can be an array like [0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1 ,0].
I have an imbalance dataset and i trying to apply compute_class_weight method, like:
class_weight = compute_class_weight('balanced', np.unique(Y_train), Y_train)
When i try to run my code, i got Unhashable Type: 'numpy.ndarray':
Traceback (most recent call last): File "main.py", line 115, in <module> train(dataset, labels) File "main.py", line 66, in train class_weight = compute_class_weight('balanced', np.unique(Y_train), Y_train) File "/home/python-env/env/lib/python3.6/site-packages/sklearn/utils/class_weight.py", line 41, in compute_class_weight if set(y) - set(classes): TypeError: unhashable type: 'numpy.ndarray'
I know that is because i working with arrays, already tried add some dict,
class_weight_dict = dict(enumerate(np.unique(y_train), class_weight))
Well, i don't know what to do, tried others strategies, but no success... Any ideas?
Thanks in advance!