I'm trying
print(Y)
print(Y.shape)
class_weights = compute_class_weight('balanced',
np.unique(Y),
Y)
print(class_weights)
But this gives me an error:
ValueError: classes should include all valid labels that can be in y
My Y
looks like:
0 1 2 3 4
0 0 0 1 0 0
1 1 0 0 0 0
2 0 0 0 1 0
3 0 0 1 0 0
4 0 0 1 0 0
5 0 0 1 0 0
And my Y.shape
looks like: (14993, 5)
In my keras
model, I want to use the class_weights
as it is an uneven distribution:
model.fit(X, Y, epochs=100, shuffle=True, batch_size=1500, class_weights=class_weights, validation_split=0.05, verbose=1, callbacks=[csvLogger])
from How to calculate class weights of a Pandas DataFrame for Keras?
No comments:
Post a Comment