DeepMatch icon indicating copy to clipboard operation
DeepMatch copied to clipboard

这个 deepmatch.utils.sampledsoftmaxloss 的实现是有意为之吗?还是说仅仅是个错误

Open LebranceBW opened this issue 1 year ago • 2 comments

在调用这个 Loss 进行训练时,发现完全不收敛。翻看源码才发现其实现如下: deepmatch/utils.py#

def sampledsoftmaxloss(y_true, y_pred):
    return K.mean(y_pred)

如果这是个失误,我可以提一个 PR 来修复它(用 tensorflow 中带的 loss)

LebranceBW avatar Jan 27 '25 07:01 LebranceBW

我也以为这里错了,但是好像没有错。 YoutubeDNN的最后一层SampledSoftmaxLayer已经计算好了softmax的loss,输出的shape为[batch_size, 1],直接reduce_mean即可,这里没有问题。

Tiandooo avatar Feb 26 '25 05:02 Tiandooo

我也以为这里错了,但是好像没有错。 YoutubeDNN的最后一层SampledSoftmaxLayer已经计算好了softmax的loss,输出的shape为[batch_size, 1],直接reduce_mean即可,这里没有问题。

如果真的是这样的话,这个方法应该放到 YoutubeDNN 的包里,作为一个私有成员存在,而不应该放到 utils 里公开。

LebranceBW avatar Feb 26 '25 07:02 LebranceBW