Azure机器学习Web服务无法从blob

时间:2015-12-17 23:05:25

标签: csv azure blob azure-machine-learning-studio

我已使用Reader模块成功部署了ML Web服务,以从我的blob存储中获取CSV数据。通过在实验中对其进行可视化,我可以看到CSV数据是正确的。

但是,当我尝试使用此tutorial中的BES示例提供 SAME CSV数据作为Web服务的输入时,出现以下错误:

Error 1000: AFx Library exception: table: The data set being scored must
contain all features used during training, missing feature(s): 'Col 2'.

此错误没有意义,因为实验已成功接受 SAME 数据。

另请注意,使用TSV格式时会出现同样的问题。

1 个答案:

答案 0 :(得分:1)

以下是我如何让它发挥作用。

1 /我创建了一个看起来像你描述的实验。 sample experiment

读者从blob存储中读取以下文件:

col 1,col 2
1.32,somestring
3.34,anotherstring

apply SQL转换具有以下语句:

select sum([col 1]) from t1

2 /发布网络服务

3 /转到批处理执行(BES)文档并复制Python代码

4 /在文本编辑器中替换invokeBatchExecutionService方法开头记录的值(storage_account_name,storage_account_key,storage_container_name,api_key values)

5 /在Azure ML工作区中创建一个新的Python 2笔记本

在第一个单元格中,复制并粘贴以下代码:

with open('input1data.csv','a') as myfile:
    myfile.write("col 1,col 2\n")
    myfile.write("1.32,somestring\n")
    myfile.write("3.34,anotherstring\n")

在下一个单元格中,复制并粘贴您在步骤4 /

中编写的代码

在下一个单元格上,复制并粘贴以下代码:

with open('myresults.csv','r') as myfile:
    for line in myfile:
        print(line)

按顺序执行单元格。 第三个单元格执行时应该得到以下结果:

sum([col 1])

4.66