

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 线性学习器响应格式
<a name="LL-in-formats"></a>

## JSON 响应格式
<a name="LL-json"></a>

所有 Amazon SageMaker AI 内置算法都遵循通用[数据格式-推理中描述的通用输入推理格式](https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html)。以下是 SageMaker AI 线性学习器算法的可用输出格式。

**二元分类**

```
let response =   {
    "predictions":    [
        {
            "score": 0.4,
            "predicted_label": 0
        } 
    ]
}
```

**多元分类**

```
let response =   {
    "predictions":    [
        {
            "score": [0.1, 0.2, 0.4, 0.3],
            "predicted_label": 2
        } 
    ]
}
```

**回归**

```
let response =   {
    "predictions":    [
        {
            "score": 0.4
        } 
    ]
}
```

## JSONLINES 响应格式
<a name="LL-jsonlines"></a>

**二元分类**

```
{"score": 0.4, "predicted_label": 0}
```

**多元分类**

```
{"score": [0.1, 0.2, 0.4, 0.3], "predicted_label": 2}
```

**回归**

```
{"score": 0.4}
```

## RECORDIO 响应格式
<a name="LL-recordio"></a>

**二元分类**

```
[
    Record = {
        features = {},
        label = {
            'score': {
                keys: [],
                values: [0.4]  # float32
            },
            'predicted_label': {
                keys: [],
                values: [0.0]  # float32
            }
        }
    }
]
```

**多元分类**

```
[
    Record = {
    "features": [],
    "label":    {
            "score":  {
                    "values":   [0.1, 0.2, 0.3, 0.4]   
            },
            "predicted_label":  {
                    "values":   [3]
            }
       },
    "uid":  "abc123",
    "metadata": "{created_at: '2017-06-03'}"
   }
]
```

**回归**

```
[
    Record = {
        features = {},
        label = {
            'score': {
                keys: [],
                values: [0.4]  # float32
            }   
        }
    }
]
```