gpt4 book ai didi

python - 使用 DNNRegressor 的损失函数是什么?

转载 作者:行者123 更新时间:2023-11-28 22:33:25 25 4
gpt4 key购买 nike

我正在使用 DNNRegressor 来训练我的模型。我在文档中搜索此包装器使用的损失函数是什么,但我没有找到。另一方面,有可能改变那个损失函数吗?。

感谢您的建议。

最佳答案

它使用 target_column.py 中定义的 L2 损失(均方误差) :

def regression_target(label_name=None,
weight_column_name=None,
target_dimension=1):
"""Creates a _TargetColumn for linear regression.
Args:
label_name: String, name of the key in label dict. Can be null if label
is a tensor (single headed models).
weight_column_name: A string defining feature column name representing
weights. It is used to down weight or boost examples during training. It
will be multiplied by the loss of the example.
target_dimension: dimension of the target for multilabels.
Returns:
An instance of _TargetColumn
"""
return _RegressionTargetColumn(loss_fn=_mean_squared_loss,
label_name=label_name,
weight_column_name=weight_column_name,
target_dimension=target_dimension)

并且目前 API 不支持此处的任何更改。但是,由于它是开源的 - 您始终可以修改构造函数以在内部调用不同的函数,并具有不同的损失。

关于python - 使用 DNNRegressor 的损失函数是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39928035/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com