Azure 流分析:如何使用两个 Azure 机器学习函数
Posted
技术标签:
【中文标题】Azure 流分析:如何使用两个 Azure 机器学习函数【英文标题】:Azure Stream Analytics: How to use two Azure Machine Learning Function 【发布时间】:2018-01-24 09:11:33 【问题描述】:我在流分析中使用了两个 Azure 机器学习函数,但似乎每个查询只能使用一个。如何将其拆分为两个查询?
流作业失败:流分析作业存在验证错误:子查询中使用了多个 AML Web 服务函数。一个查询步骤只能包含一个 AML 函数。请将步骤拆分为多个步骤。
WITH subquery as (
SELECT
id as id,
deviceId as deviceId,
username as username,
try_cast(localtime as datetime) as localtime,
AC as AC, FM as FM, UC as UC,
DL as DL, DS as DS, DP as DP,
LB as LB, ASTV as ASTV, MSTV as MSTV,
ALTV as ALTV, MLTV as MLTV, Width as Width,
Min as Min, Max as Max, Nmax as Nmax,
Nzeros as Nzeros, Mode as Mode, Mean as Mean,
Median as Median, Variance as Variance, Tendency as Tendency,
rms,fmed,fpeak,sample_entropy,
EventProcessedUtcTime as EventProcessedUtcTime,
Distress(AC,FM,UC,DL,DS,DP,1,LB,ASTV,MSTV,ALTV,MLTV,
Width,Min,Max,Nmax,Nzeros,Mode,Mean,Median,Variance,
Tendency,1,1,1,1,1,1,1,1,1,1,1,1) as resultFHR,
Labour("",1,1,1,"",rms,fmed,fpeak,sample_entropy,"","") as resultUC
FROM
iot
)
SELECT
id as id,
deviceId as deviceId,
username as username,
localtime as localtime,
AC as AC, FM as FM, UC as UC,
DL as DL, DS as DS, DP as DP,
LB as LB, ASTV as ASTV, MSTV as MSTV,
ALTV as ALTV, MLTV as MLTV, Width as Width,
Min as Min, Max as Max, Nmax as Nmax,
Nzeros as Nzeros, Mode as Mode, Mean as Mean,
Median as Median, Variance as Variance, Tendency as Tendency,
EventProcessedUtcTime as EventProcessedUtcTime,
resultFHR.[classes] as distress,
resultFHR.[probabilities] as distressProbability,
resultUC.[classes] as labour,
resultUC.[probabilities] as labourProbability
INTO
sql
FROM
subquery
SELECT
*
INTO
c2d
FROM
subquery
【问题讨论】:
【参考方案1】:您只需将其拆分为 2 个单独的步骤。例如:
WITH subquery1 as ( SELECT id as id, deviceId as deviceId, username 作为用户名, try_cast(localtime as datetime) as localtime, AC as AC, FM as FM, UC as UC, DL as DL, DS as DS, DP as DP, LB as LB, ASTV as ASTV, MSTV as MSTV, ALTV as ALTV, MLTV as MLTV, Width 作为 Width, Min 作为 Min, Max 作为 Max, Nmax 作为 Nmax, Nzeros 作为 Nzeros, Mode 作为 Mode, Mean 作为 Mean , Median as Median, Variance as Variance, Tendency as Tendency, rms,fmed,fpeak,sample_entropy, EventProcessedUtcTime as EventProcessedUtcTime, Distress(AC,FM,UC,DL,DS,DP,1,LB,ASTV,MSTV, ALTV,MLTV, Width,Min,Max,Nmax,Nzeros,Mode,Mean,Median,Variance,Tendency,1,1,1,1,1,1,1,1,1,1,1,1) 作为结果FHR 来自物联网)
WITH 子查询为 ( SELECT id as id, deviceId as deviceId, username 作为用户名, try_cast(localtime as datetime) as localtime, AC as AC, FM as FM, UC as UC, DL as DL, DS as DS, DP as DP, LB as LB, ASTV as ASTV, MSTV as MSTV, ALTV as ALTV, MLTV as MLTV, Width 作为 Width, Min 作为 Min, Max 作为 Max, Nmax 作为 Nmax, Nzeros 作为 Nzeros, Mode 作为 Mode, Mean 作为 Mean , Median as Median, Variance as Variance, Tendency as Tendency, rms,fmed,fpeak,sample_entropy, EventProcessedUtcTime as EventProcessedUtcTime, Labour("",1,1,1,"",rms,fmed,fpeak,sample_entropy, "","") 结果UC FROM iot )
选择 id 作为 id,deviceId 作为 deviceId,username 作为用户名,localtime 作为 localtime,AC 作为 AC,FM 作为 FM,UC 作为 UC,DL 作为 DL,DS 作为 DS,DP 作为 DP,LB 作为 LB,ASTV 作为ASTV,MSTV 作为 MSTV,ALTV 作为 ALTV,MLTV 作为 MLTV,宽度作为宽度,最小值作为最小值,最大值作为最大值,Nmax 作为 Nmax,Nzeros 作为 Nzeros,众数作为众数,平均值作为平均值,中值作为中值,方差作为方差, Tendency 为 Tendency,EventProcessedUtcTime 为 EventProcessedUtcTime,resultFHR.[classes] 为窘迫,resultFHR.[probabilities] 为窘迫概率 INTO sql FROM subquery1
选择 id 作为 id,deviceId 作为 deviceId,username 作为用户名,localtime 作为 localtime,AC 作为 AC,FM 作为 FM,UC 作为 UC,DL 作为 DL,DS 作为 DS,DP 作为 DP,LB 作为 LB,ASTV 作为ASTV,MSTV 作为 MSTV,ALTV 作为 ALTV,MLTV 作为 MLTV,宽度作为宽度,最小值作为最小值,最大值作为最大值,Nmax 作为 Nmax,Nzeros 作为 Nzeros,众数作为众数,平均值作为平均值,中值作为中值,方差作为方差, Tendency 作为 Tendency,EventProcessedUtcTime 作为 EventProcessedUtcTime,resultUC.[classes] 作为 labour,resultUC.[probabilities] 作为 labourProbability INTO sql FROM subquery2
【讨论】:
它不起作用。秒附近有一个错误。以上是关于Azure 流分析:如何使用两个 Azure 机器学习函数的主要内容,如果未能解决你的问题,请参考以下文章
如何从 Azure 流分析仅将数据发送到一个 Azure SQL 数据库表?