问题描述
我训练了一个TensorFlow分类器,并使用CREATE MODEL
在BigQuery ML中将其创建为模型.现在,我想使用ML.PREDICT
来使用该模型进行批量预测.我收到错误无效的表值函数ml.predict在PREDICT函数的输入数据中找不到列输入."
I trained a TensorFlow classifier and created it as a model in BigQuery ML using CREATE MODEL
. Now I would like to use ML.PREDICT
to batch predict using this model. I get the error "Invalid table-valued function ml.predict Column inputs is not found in the input data to the PREDICT function."
这是我的查询:
select * from ml.predict (
model test.digital_native_classifier_kf,
(select * from dataset_id.features_table_id)
)
在BigQuery文档中,他们给出了一个TensorFlow模型的示例,其中单列的别名为input
,因此TensorFlow input_fn
可以接受它.但是,此分类器接受数百个功能.如何指定传递给ML.PREDICT
的查询,以便它使用功能表中的 all 列?
In the BigQuery documentation, they give an example for a TensorFlow model with a single column aliased as input
so the TensorFlow input_fn
can accept it. However, this classifier accepts hundreds of features. How do I specify the query passed to ML.PREDICT
so it uses all the columns in my features table?
推荐答案
将模型加载到BigQuery ML中后,在BigQuery UI中单击模型,然后切换到模式"选项卡.这应该告诉您模型需要什么功能(列名称).
After you load the model into BigQuery ML, click on the model in the BigQuery UI and switch over to the "Schema" tab. This should tell you what features (column names) the model wants.
创建TensorFlow/Keras模型时,可能没有为输入节点分配名称.然后,功能名称可能已经自动分配给了int1和float2之类的东西.
It is possible that when you created the TensorFlow/Keras model you did not assign names to the input nodes. Then, the feature names might have been auto-assigned to something like int1 and float2.
或者,在模型上运行程序save_model_cli(这是tensorflow附带的python程序),以查看受支持的签名是什么
Alternately, run the program saved_model_cli on the model (it's a python program that comes with tensorflow) to see what the supported signature is
saved_model_cli show --dir $export_path --all
这篇关于BigQuery ML中的TensorFlow模型的ML.PREDICT多列输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!