

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

# 删除 Amazon Personalize 指标归因
<a name="deleting-metric-attribution"></a>

如果您不再需要生成报告，可以删除指标归因。删除指标归因会删除其所有指标和输出配置。

 如果您删除指标归因，Amazon Personalize 将停止自动向其发送与之相关的报告 PutEvents 和增量批量数据 CloudWatch。已经发送到 Amazon S3 CloudWatch 或已发布到 Amazon S3 的数据不受影响。您可以使用 Amazon Personalize 控制台或 Amazon SDK 删除指标归因。 Amazon Command Line Interface

**Topics**
+ [删除指标归因（控制台）](#deleting-metric-attribution-console)
+ [删除指标归因 (Amazon CLI)](#deleting-metric-attribution-cli)
+ [删除指标归因 (Amazon SDKs)](#deleting-metric-attribution-sdk)

## 删除指标归因（控制台）
<a name="deleting-metric-attribution-console"></a>

在指标归因对应的概览页面上删除指标归因。

**删除指标归因**

1. 在[https://console.aws.amazon.com/personalize/家](https://console.amazonaws.cn/personalize/home)中打开 Amazon Personalize 控制台并登录您的账户。

1. 选择您的数据集组。

1. 在导航窗格中，选择**指标归因**。

1. 选择**删除**，然后确认删除。

## 删除指标归因 (Amazon CLI)
<a name="deleting-metric-attribution-cli"></a>

要使用删除指标归因 Amazon CLI，请按如下方式使用`delete-metric-attribution`命令。

```
aws personalize delete-metric-attribution --metric-attribution-arn {{metric attribution ARN}}
```

## 删除指标归因 (Amazon SDKs)
<a name="deleting-metric-attribution-sdk"></a>

 以下代码演示了如何使用 SDK for Python (Boto3) 删除指标归因：

------
#### [ SDK for Python (Boto3) ]

```
import boto3
            
personalize = boto3.client('personalize')

response = personalize.delete_metric_attribution(
  metricAttributionArn = '{{metric attribution ARN}}'
)
```

------
#### [ SDK for Java 2.x ]

```
public static void deleteMetricAttribution(PersonalizeClient client, String metricAttributionArn) {

    try {
    
        DeleteMetricAttributionRequest request = DeleteMetricAttributionRequest.builder()
                .metricAttributionArn(metricAttributionArn)
                .build();
                
        DeleteMetricAttributionResponse response = client.deleteMetricAttribution(request);
        if (response.sdkHttpResponse().statusCode() == 200) {
            System.out.println("Metric attribution deleted!");
        }
        
    } catch (PersonalizeException e) {
        System.out.println(e.awsErrorDetails().errorMessage());
    }
}
```

------
#### [ SDK for JavaScript v3 ]

```
// Get service clients and commands using ES6 syntax.
import { DeleteMetricAttributionCommand, PersonalizeClient } from
  "@aws-sdk/client-personalize";

// create personalizeClient
const personalizeClient = new PersonalizeClient({
  region: "REGION"
});

export const deleteMetricAttributionParam = {
  metricAttributionArn: "METRIC_ATTRIBUTION_ARN",
};
export const run = async () => {
  try {
    const response = await personalizeClient.send(
      new DeleteMetricAttributionCommand(deleteMetricAttributionParam)
    );
    console.log("Success", response);
    return response; // For unit tests.
  } catch (err) {
    console.log("Error", err);
  }
};
run();
```

------