You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I ran the code I encountered this error:
class_weight is causing a ValueError: The truth value of an array with more than one element is ambiguous. use a.any() or a.all().
I tried to fix it, but without success.
I saw someone's solution online:
from sklearn.utils import class_weight
weight = class_weight.compute_class_weight('balanced', np.unique(y_train), y_train)
class_weights = {l:c for l,c in zip(np.unique(labels[i]), class_weights)}
But this solution doesn't work for me, can you help me?
Thank you very much!
The text was updated successfully, but these errors were encountered:
hello,
When I ran the code I encountered this error:
class_weight is causing a ValueError: The truth value of an array with more than one element is ambiguous. use a.any() or a.all().
I tried to fix it, but without success.
I saw someone's solution online:
from sklearn.utils import class_weight
weight = class_weight.compute_class_weight('balanced', np.unique(y_train), y_train)
class_weights = {l:c for l,c in zip(np.unique(labels[i]), class_weights)}
But this solution doesn't work for me, can you help me?
Thank you very much!
The text was updated successfully, but these errors were encountered: