danielsc / azureml-workshop-2019

AzureML Workshop for the 2019 Euro Tour
MIT License
30 stars 44 forks source link

[Paper-Cut:UI] Model Deployment from UI doesn't help on how to consume the model #25

Open CESARDELATORRE opened 4 years ago

CESARDELATORRE commented 4 years ago

Once the model is deployed into AML compute, the UI doesn't help much on how to consume it and try the service. It simply provides an URI, but a user who just deployed it won't be able to try it unless he invests time on researching docs from scratch.

This is a clear paper-cut because it is blocking the path for a fast getting started experience.

This is the only info provided so far for consumption:

image

That "Consume" page section should help on sample code on the following areas and showing client code for Python apps, .NET apps, Java apps, Node-JS apps, etc.:

import json
import pandas as pd

# the sample below contains the data for an employee that is not an attrition risk
sample = pd.DataFrame(data=[{'Age': 41, 'BusinessTravel': 'Travel_Rarely', 'DailyRate': 1102, 'Department': 'Sales', 'DistanceFromHome': 1, 'Education': 2, 'EducationField': 'Life Sciences', 'EnvironmentSatisfaction': 2, 'Gender': 'Female', 'HourlyRate': 94, 'JobInvolvement': 3, 'JobLevel': 2, 'JobRole': 'Sales Executive', 'JobSatisfaction': 4, 'MaritalStatus': 'Single', 'MonthlyIncome': 5993, 'MonthlyRate': 19479, 'NumCompaniesWorked': 8, 'OverTime': 'No', 'PercentSalaryHike': 11, 'PerformanceRating': 3, 'RelationshipSatisfaction': 1, 'StockOptionLevel': 0, 'TotalWorkingYears': 8, 'TrainingTimesLastYear': 0, 'WorkLifeBalance': 1, 'YearsAtCompany': 6, 'YearsInCurrentRole': 4, 'YearsSinceLastPromotion': 0, 'YearsWithCurrManager': 5}])

# converts the sample to JSON string
sample = pd.DataFrame.to_json(sample)

# deserializes sample to a python object 
sample = json.loads(sample)

# serializes sample to JSON formatted string as expected by the scoring script
sample = json.dumps({"data":sample})

prediction = service.run(sample)

print(prediction)
danielsc commented 4 years ago

filed a bug: https://msdata.visualstudio.com/Vienna/_workitems/edit/583745