Search code examples
azureazure-machine-learning-servicestream-analytics

How can I use ML function in Azure Stream Analytics?


I try to use a trained model from Microsoft Azure Machine Learning Studio in Azure Stream Analytics. Before I start work with my IoT-Stream sensor data, I try this sample: https://learn.microsoft.com/en-us/azure/stream-analytics/stream-analytics-machine-learning-integration-tutorial

I can deploy the web service and it works fine with a console application. The result from web service:

{
    "Results": {
        "output1": {
            "type": "table",
            "value": {
                "ColumnNames": ["Sentiment", "Score"],
                "ColumnTypes": ["String", "Double"],
                "Values": [
                    ["neutral", "0.564501523971558"]
                ]
            }
        }
    }
}

The T-SQL in Stream Analytics from tutorial looks like:

WITH subquery AS (  
    SELECT text, sentiment(text) as result from input  
)  

Select text, result.[Scored Labels]  
Into output  
From subquery

Unfortunately it does not work. Can someone explain result.[Scored Labels]

Is it possible to debug my Stream Analytic job? I get no output. No result-file, no warning, no exception...


Solution

  • It is not currently possible to test your query when you use a function to call out to Azure ML. The test query functionality runs in the web browser window so I guess they haven't implemented that feature yet.

    I expect if you start the job it will actually work. However you may need to change result.[Scored Labels] to match the columns in the Azure ML API output by saying result.Sentiment and result.Score