BigQuery ML中的TensorFlow模型的ML.PREDICT多列输入 [英] Multi-column input to ML.PREDICT for a TensorFlow model in BigQuery ML

查看:174
本文介绍了BigQuery ML中的TensorFlow模型的ML.PREDICT多列输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我训练了一个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多列输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆