

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

# 設定及建立端點
<a name="clarify-online-explainability-create-endpoint"></a>

建立適合您模型的新端點組態，並使用此組態建立端點。您可以使用在[預先檢查步驟](https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-online-explainability-precheck.html)驗證的模型容器來建立端點，並啟用 SageMaker Clarify 線上可解釋性特徵。

使用 `sagemaker_client` 物件透過 [CreateEndpointConfig](https://docs.aws.amazon.com//sagemaker/latest/APIReference/API_CreateEndpointConfig.html) API 建立端點。在 `ExplainerConfig` 參數設定成員 `ClarifyExplainerConfig`，如下所示：

```
sagemaker_client.create_endpoint_config(
    EndpointConfigName='name-of-your-endpoint-config',
    ExplainerConfig={
        'ClarifyExplainerConfig': {
            'EnableExplanations': '`true`',
            'InferenceConfig': {
                ...
            },
            'ShapConfig': {
                ...
            }
        },
    },
    ProductionVariants=[{
        'VariantName': 'AllTraffic',
        'ModelName': 'name-of-your-model',
        'InitialInstanceCount': 1,
        'InstanceType': 'ml.m5.xlarge',
    }]
     ...
)
sagemaker_client.create_endpoint(
    EndpointName='name-of-your-endpoint',
    EndpointConfigName='name-of-your-endpoint-config'
)
```

對 `sagemaker_client` 物件的第一次呼叫會建立一個新的端點組態，並啟用可解釋性特徵。第二個呼叫會使用端點組態來啟動端點。

**注意**  
您也可以在 [SageMaker AI 即時推斷多模型端點後面的一個容器託管多個模型](https://docs.aws.amazon.com/sagemaker/latest/dg/multi-model-endpoints.html)，並使用 SageMaker Clarify 設定線上可解釋性。