Victor
Victor

Reputation: 1205

Azure ML's web service asking for label?

I built a linear regression algorithm in Azure ML. On the "Score Model" module I can actually see the predictions and the rest of the features. However, when I deploy this project as a web service, the service is expecting the actual label of the data (e.g. I'm trying to predict a house's price and it asks me for the price of the house to make the prediction), which doesn't make any sense to me... What am I doing wrong? On the "Train Model" module I set that the label column is the HousePrice, which is what I'm trying to predict...

This is my model: enter image description here

I tried leaving that field blank but the prediction returns null...

Upvotes: 4

Views: 1116

Answers (1)

mewahl
mewahl

Reputation: 815

The input schema (names/types of required input) based on the location in the graph where you attach the "Web Service Input" module. To get the schema you want, you will need to find -- or if necessary, create -- a place in the experiment where the data has the column names/types you desire.

Consider this simple example experiment that predicts whether a field called "income" will be above or below $50k/year:

enter image description here

When we click "Set up web service", the following graph is automatically generated:

enter image description here

Since the input dataset and "Web service input" modules are connected to the same port, the web service schema will perfectly match the schema of the input dataset. This is unfortunate because the input dataset contains a column called "income", which is what our web service is supposed to predict -- this is equivalent to the problem that you are having.

To get around it, we need to create a place in our experiment graph where we've dropped the unneeded "income" field from the input dataset, and attach the "Web service input" module there:

enter image description here

With this arrangement, the web service only requests the features actually needed to score the model. I'm sure you can use a similar method to create a predictive experiment with whatever input schema you need for your own work.

Upvotes: 3

Related Questions