Question

bozza on Fri, 30 Jun 2017 00:27:42


Hi,

I call ML web service using Function in stream analytic. How do I access the data in my query if ML returns a structure as below? This json is what I receive from ML when I call it web api from c#. 

Here is an example how I call ML Function HealthAnomaly from the ASA query:

WITH healthanomaly AS (  
  SELECT HealthAnomaly(EH.vin, BlobSource.Model, ......) as result from EH 
)

Select ????????????????
Into Blah  
From <g class="gr_ gr_337 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="337" id="337">healthanomaly</g>

{
  "Results": {
    "output1": {
      "type": "table",
      "value": {
        "Values": [
          [
            "7KDPDWZL9EDYBP2WW",
            "Tundra",
            "6/22/2017 6:36:33 AM",
            "77",
            "174",
            "65",
            "1",
            "39",
            "32",
            "184093",
            "Bellevue",
            "8",
            "0",
            "0",
            "0",
            "fourth",
            "0",
            "0",
            "0",
            "0",
            "0.231348931789398",
            "0",
            "0.260413527488709"
          ]
        ]
      }
    }
  }
}



Sponsored



Replies

DushyantB_Msft on Sat, 01 Jul 2017 03:27:04


You would need to use the output parameter values as you defined in your AML endpoint. Can you share your swagger doc link?

Thanks,

Dushyant

bozza on Sat, 01 Jul 2017 06:21:02


Hi Dushyant,

Thanks for responding!

Here is the swagger link:

https://asiasoutheast.services.azureml.net/workspaces/0c4c9f279e1e46a8b158c11e03388ae1/services/d2f3d5fa3b8d42c3b8999fc8c8fc25cc/swagger.json

here is the response body from API:

{
  "ExecutionResults": {
    "Results": {
      "ExecutionOutputs": {
        "output1": [
          {
            "items": {
              "output1Item": {
                "vin": "string",
                "model": "string",
                "timestamp": "string",
                "outsideTemperature": "number",
                "engineTemperature": "number",
                "speed": "number",
                "fuel": "integer",
                "engineoil": "number",
                "tirepressure": "number",
                "odometer": "integer",
                "city": "string",
                "accelerator_pedal_position": "integer",
                "parking_brake_status": "integer",
                "headlamp_status": "integer",
                "brake_pedal_status": "integer",
                "transmission_gear_position": "string",
                "ignition_status": "integer",
                "windshield_wiper_status": "integer",
                "abs": "integer",
                "MaintenanceLabel": "number",
                "MaintenanceProbability": "number",
                "RecallLabel": "number",
                "RecallProbability": "number"
              }
            }
          }
        ]
      }
    }
  }
}

DushyantB_Msft on Mon, 03 Jul 2017 22:50:42


You should be able to access the output fields like this:

WITH healthanomaly AS (  
  SELECT HealthAnomaly(EH.vin, BlobSource.Model, ......) as result from EH 
)

Select result.vin, result.model from healthanomaly
Into Blah  

bozza on Wed, 05 Jul 2017 04:05:39


It fails once I start it. How do I debug it???

DushyantB_Msft on Wed, 05 Jul 2017 17:35:31


There are diagnostic messages and an activity log on the Azure portal. Did you look at those?

DushyantB_Msft on Mon, 10 Jul 2017 22:30:16


If the error message shows you that it is an issue executing your Azure Machine Learning code, you can also enable logging on the Azure Machine Learning side to get more detailed diagnostics there. You will need to pursue the issue on their forums at that point.