gpt4 book ai didi

machine-learning - tensorflow 估计器 : training with weighted examples

转载 作者:行者123 更新时间:2023-11-30 08:37:51 25 4
gpt4 key购买 nike

我正在使用 Tensorflow Estimator 训练模型,但我的数据不平衡。我想通过对每个训练示例进行加权来纠正这个问题。

在原始 Tensorflow 中,人们可能会做到 like this 。在 Estimator 中是否有一种简单的方法可以做到这一点?也许构建一个自定义的input_fn

最佳答案

我假设你正在做分类。如果是这样,请使用 tf.estimator.DNNClassifier :

weight_column: A string or a _NumericColumn created by tf.feature_column.numeric_column defining feature column representing weights. It is used to down weight or boost examples during training. It will be multiplied by the loss of the example. If it is a string, it is used as a key to fetch weight tensor from the features. If it is a _NumericColumn, raw tensor is fetched by key weight_column.key, then weight_column.normalizer_fn is applied on it to get weight tensor.

关于machine-learning - tensorflow 估计器 : training with weighted examples,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47080448/

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