赞
踩
是model.compile的参数,对应于模型的每个输出的损失的权重。loss_weights是一个列表,对应于每个输出的权重,默认1.
- Model.compile(
- optimizer="rmsprop",
- loss=None,
- metrics=None,
- loss_weights=None,
- weighted_metrics=None,
- run_eagerly=None,
- steps_per_execution=None,
- **kwargs
- )
loss_weights
coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a dict, it is expected to map output names (strings) to scalar coefficients.是model.fit的参数,对应于样本类别的权重,可以更加关注数量少得样本。
当数据集不平衡时,可以为每个类设置类权重。假设有 5000 个类狗样本和 45000 个类非狗样本,class_weight= [0:5,1:0.5],这给类"狗"10倍的权重作用在损失函数。
- Model.fit(
- x=None,
- y=None,
- batch_size=None,
- epochs=1,
- verbose="auto",
- callbacks=None,
- validation_split=0.0,
- validation_data=None,
- shuffle=True,
- class_weight=None,
- sample_weight=None,
- initial_epoch=0,
- steps_per_epoch=None,
- validation_steps=None,
- validation_batch_size=None,
- validation_freq=1,
- max_queue_size=10,
- workers=1,
- use_multiprocessing=False,
- )
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。