consuming an deployed Azure ML model in PowerBI

Viewed 234

I have issues while interfacing Azure ML with PowerBI. I deployed a model from Auto ML, and tried to consume it in PowerBI. I successfully completed the following tutorials create a predictive model by using auto ML and consume a model in PowerBI . But when it comes to implement my proper model, I can choose the targeted model, and use the right inputs, with the right data type, but I get this error :

Unable to parse the response from the Azure ML Web Service

I have to add that my model forecasts time series. On the contrary, the model was a regression in the Microsoft tutorials. And I didn't use R or Python script, I used exactly the same method as the second tutorial about PowerBI.

Thank you very much for your help ! don't hesitate to ask me if you need more information.

Mary

1 Answers

Good practice to use error handling:

def run(data):
try:
        result = model.predict(data)
        return result.tolist()
    except Exception as e:
        result = str(e)
        return json.dumps({"error": result})
    return json.dumps({"result": result.tolist()})

If you instead used the pandas dataframe as the input schema, this should generate the swagger with the column names as separate input parameters with known data types which Power Bi can then use to map to columns in your data flow.

Related