[英]TFX Evaluator problem with a keras multioutput model
I am using a very simple keras model in TFX, to solve a regression problem.我在 TFX 中使用了一个非常简单的 keras 模型来解决回归问题。 It seems that TFX wants that you use a keras model with named outputs, so I made:
TFX 似乎希望您使用具有命名输出的 keras 模型,所以我做了:
output = {key: tf.keras.layers.Dense(1, name = key)(x)
for key in _transformed_names(_LABEL_KEYS)}
model(inputs, outputs)
I don't understand how the evaluator maps the label names of my dataset with the output names of my model.我不明白评估器如何将我的数据集的标签名称与我的模型的输出名称进行映射。
In my code I set up the label_keys and prediction_keys
argument in tfma.ModelSpec
with a list of form :在我的代码中,我在
label_keys and prediction_keys
设置了label_keys and prediction_keys
参数, tfma.ModelSpec
包含一个表单列表:
[["model output name", "Label key in my Dataset"]]
It seems that the proto message is created correctly, but when I run the Evaluator I get the following error:似乎 proto 消息已正确创建,但是当我运行 Evaluator 时,出现以下错误:
ValueError: unable to prepare labels and predictions because the labels and/or predictions are dicts with unrecognized keys. If a multi-output keras model (or estimator) was used check that an output_name was provided. If an estimator was used check that common prediction keys were provided (e.g. logistic, probabilities, etc)
If I try to provide a single label key and a single prediction key using the label_key
and prediction_key
arguments I get the following error:如果我尝试使用
label_key
和prediction_key
参数提供单个标签键和单个预测键,我会收到以下错误:
TypeError: update_state() takes from 2 to 3 positional arguments but 4 were given [while running 'ExtractEvaluateAndWriteResults/ExtractAndEvaluate/EvaluateMetricsAndPlots/ComputeMetricsAndPlots()/ComputePerSlice/ComputeUnsampledMetrics/CombinePerSliceKey/WindowIntoDiscarding']
I have tried in all possible ways but nothing.我已经尝试了所有可能的方法,但什么也没有。 Is there a way to use a model with no named outputs (an Dense output layer with more than one node) ?
有没有一种方法可以使用没有命名输出的模型(具有多个节点的密集输出层)? Or a way to solve this problem ?
或者有什么办法可以解决这个问题?
PS Is there a Tutorials of a TFX pipeline with a multiple outputs keras model ? PS 是否有具有多输出 keras 模型的 TFX 管道的教程?
Thanks.谢谢。
in eval_config,setting在 eval_config 中,设置
options=Options(include_default_metrics=BoolValue(value=False))
选项=选项(include_default_metrics=BoolValue(value=False))
eg:例如:
eval_config = tfma.EvalConfig(
model_specs = [...],
slicing_specs=[tfma.SlicingSpec(),...],
metrics_specs=[...],
options=Options(include_default_metrics=BoolValue(value=False))
)
evaluator = Evaluator(
...
eval_config=eval_config
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.