machine-learning - Keras 对数损失函数

标签 machine-learning neural-network keras loss-function

我必须在 keras 中应用以下损失函数:

enter image description here

这是我的代码:

input_shape = self.s_dim[1:]
input_ = Input(shape=input_shape, name='input')
hidden = Dense(self.n_hidden, activation='relu')(input_)
out = Dense(3, activation='sigmoid')(hidden)

model = Model(inputs=input_, outputs=out, name="ar-model")
model.compile(loss='mean_squared_logarithmic_error', optimizer=SGD(lr=self.lr_ar))
return model

损失函数mean_squared_logarithmic_error适合这里吗?

最佳答案

mean_squared_logarithmic_error 与对数损失不同,这正是您正在寻找的。对数损失与交叉熵相同。您可以使用 binary_crossentropy 或 categorical_crossentropy,具体取决于您的输出。

关于machine-learning - Keras 对数损失函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50097385/

相关文章:

machine-learning - 机器学习中的过度拟合减少

r - 不同编程语言中的 glmnet 算法

machine-learning - 重量衰减值增加显示最差性能

python - Keras - 'Node' 对象没有属性 'output_masks'

validation - 评估 CNN 训练效果的最佳指标是什么?验证错误或训练损失?

python - 值错误 : Found arrays with inconsistent numbers of samples

neural-network - Tensorflow:无法将 feed_dict 键解释为 Tensor

python-3.x - Tensorflow Keras 将权重从一个模型复制到另一个模型

algorithm - 使用神经网络进行数字识别的具体例子

python-3.x - Keras 二元分类将输出压缩为 0/1