Stream analytics Anomaly detection over multiple devices

30 Views Asked by At

Is it possible to do anomaly detection in stream analytics when the input contains multiple devices. I've tried using the partition key but that didn't help.

This is the query I tried.

WITH AnomalyDetectionStep AS
(
    SELECT
        DeviceName,
        EVENTENQUEUEDUTCTIME AS time,
        ConvertedSignalValue,
        AnomalyDetection_SpikeAndDip(ConvertedSignalValue, 75, 120, 'spikesanddips')
            OVER(PARTITION BY DeviceName LIMIT DURATION(hour, 24)) AS SpikeAndDipScores
    FROM [IoT-Input-EventHub-Anomaly-ACC]
)

SELECT
    DeviceName,
    time,
    ConvertedSignalValue,
    CAST(GetRecordPropertyValue(SpikeAndDipScores, 'Score') AS float) AS
    SpikeAndDipScore,
    CAST(GetRecordPropertyValue(SpikeAndDipScores, 'IsAnomaly') AS bigint) AS
    IsSpikeAndDipAnomaly
INTO output
FROM AnomalyDetectionStep
0

There are 0 best solutions below