张量流概率负对数似然

2024-03-29 06:58:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用概率模型训练TFP的多元正态分布 如下图所示:

def NLL(y_true, y_pred):
    return -y_pred.log_prob(y_true)

output_dim = 250
model = Sequential([
    Input(shape=(5,)),
    Dense(tfpl.MultivariateNormalTriL.params_size(output_dim)),
    tfpl.MultivariateNormalTriL(output_dim)
])
model.compile(loss=NLL, optimizer=Adam(lr=1e-3, clipvalue=0.25))

培训使用Adamclipvalue=0.25进行。然而,在优化模型时,有时我仍然会得到非常高的损失值。有什么有用的技巧来获得更多的数值稳定性吗

非常感谢您的帮助。谢谢


Tags: trueoutputmodelreturndefdimtfp概率模型