我想我们可以
sample_weights代替使用。实际上,在Keras内部,
class_weights将转换为
sample_weights。
sample_weight:与x长度相同的可选数组,包含要应用于每个样本的模型损失的权重。对于时间数据,您可以传递具有形状(样本,sequence_length)的2D数组,以对每个样本的每个时间步施加不同的权重。在这种情况下,您应确保在compile()中指定sample_weight_mode
=“ temporal”。
https://github.com/fchollet/keras/blob/d89afdfd82e6e27b850d910890f4a4059ddea331/keras/engine/training.py#L1392



