

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 因式分解機回應格式
<a name="fm-in-formats"></a>

Amazon SageMaker AI 提供多種回應格式，用於從 JSON、JSONLINES 和 RECORDIO 等 Factorization Machines 模型取得推論，並具有用於二進制分類和迴歸任務的特定結構。

## JSON 回應格式
<a name="fm-json"></a>

二進位分類

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

迴歸

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

## JSONLINES 回應格式
<a name="fm-jsonlines"></a>

二進位分類

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

迴歸

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

## RECORDIO 回應格式
<a name="fm-recordio"></a>

二進位分類

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

迴歸

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