Search code examples
azurerestschemapostmanazure-machine-learning-service

Azure Machine Learning REST API: why is the prediction included in the Sample Request?


I followed Microsoft's tutorial on the German credit card risk model, step by step and without mistakes. The algorithm runs, it is deployed successfully, etc.

enter image description here

I am using the Select Columns in Dataset to select the columns to input, and I do the same to select the output columns.

I noticed that when I look at the Request/Response tab of the deployed model, the Sample Request includes all columns, ignoring the selection I provided. This includes the field to be predicted, which is column 21:

{
  "Inputs": {
    "input1": {
      "ColumnNames": [
        "Col1",
        "Col2",
        "Col3",
        "Col4",
        "Col5",
        "Col6",
        "Col7",
        "Col8",
        "Col9",
        "Col10",
        "Col11",
        "Col12",
        "Col13",
        "Col14",
        "Col15",
        "Col16",
        "Col17",
        "Col18",
        "Col19",
        "Col20",
        "Col21"

The problem: column 21 is the credit risk itself, so the API is expecting to receive that value. Instead, that is the value that should be predicted!

There clearly is a problem with the input schema, but how can I change that? How can I make sure that field is not requested by the API?


Solution

  • Don't worry about the input schema for the Col21 field. The Col21 field in the input data just adapt for the Edit Metadata module which requires the Col21 data in the training stage.

    You just fill an invalid value like 0 (0 is an invalid classified value for risk) into Col21 field, and then the web service will return a prediction classified value to replace the Col21 value of your input data.

    At here, I use the first data record of the sample data with the Col21 value 0 for testing via the link of Test feature on portal, it works fine and return 1 for Credit risk

    Fig 1. To click Test link to test for Col21 with 0

    enter image description here

    Fig 2. Use the first record of sample to test

    enter image description here

    Fig 3. The Col21 value of input1 is 0, and the Credit risk value of output1 is 1

    enter image description here