【发布时间】:2019-07-17 10:22:30
【问题描述】:
我在努力
print(Y)
print(Y.shape)
class_weights = compute_class_weight('balanced',
np.unique(Y),
Y)
print(class_weights)
但这给了我一个错误:
ValueError: classes should include all valid labels that can be in y
我的Y 看起来像:
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
...
14992 0 0 1 0 0
14993 0 0 1 0 0
我的Y.shape 看起来像:
(14993, 5)
在我的keras 模型中,我想使用class_weights,因为它分布不均:
model.fit(X, Y, epochs=100, shuffle=True, batch_size=1500, class_weights=class_weights, validation_split=0.05, verbose=1, callbacks=[csvLogger])
【问题讨论】:
-
我不明白你这里所说的类 wieghts 是什么意思?
-
@MohitMotwani 我更新了问题来解释
-
@giser_yugang 对我的
pandas问题没有帮助