AWS Personalize 使用 aws-user-personalization-v2 配方不对上下文做出反应

问题描述 投票:0回答:1

美好的一天。

我正在使用 AWS Personalize 生成建议,并尝试从“aws-user-personalization”升级到“aws-user-personalization-v2”。该模型已经过用户项目迭代的训练,其中包括一个“TIME-OF-DAY”字段,女巫采用的值包括:“早上”、“下午”、“晚上”。

架构如下所示:

{
    "type": "record",
    "name": "Interactions",
    "namespace": "com.amazonaws.personalize.schema",
    "fields": [
        {
            "name": "USER_ID",
            "type": "string",
            "categorical": false
        },
        {
            "name": "ITEM_ID",
            "type": "string",
            "categorical": false
        },
        {
            "name": "TIMESTAMP",
            "type": "long",
            "categorical": false
        },
        {
            "name": "EVENT_TYPE",
            "type": "string",
            "categorical": true
        },
        {
            "name": "EVENT_VALUE",
            "type": "float",
            "categorical": false
        },
        {
            "name": "TIME_OF_DAY",
            "type": "string",
            "categorical": true
        }
    ],
    "version": "1.0"
}

项目架构符合 AWS 文档中的默认架构。我使用 boto3 查询个性化:

ACCOUNT = ...
REGION = ...

personalize_client = boto3.client("personalize-runtime")

...

def call_personalize_with_context(campaign_name: str, profileId: str, context_field: str, timeofday):
    print(f"\n== {context_field}:{timeofday} against {campaign_name} for {profileId} ===")
    arn = f"arn:aws:personalize:{REGION}:{ACCOUNT}:campaign/{campaign_name}"

    kwargs = {"campaignArn":arn, "userId":profileId}
    if timeofday is not None:
        kwargs["context"] = { context_field: timeofday }

    response = personalize_client.get_recommendations(**kwargs)

    for item in response['itemList']:
        id = item['itemId']
        print(f"{id}")

...

call_personalize_with_context("test_campaign", "john123", "TIME_OF_DAY", "morning")
call_personalize_with_context("test_campaign", "john123", "TIME_OF_DAY", "afternoon")

使用旧配方时,根据上下文,结果会有所不同。 但是,如果我使用 aws-user-personalization-v2 配方训练具有相同数据的模型,则会导致绝对没有变化。

我在上下文中使用新食谱的方式有什么不同吗? 模式应该以不同的方式定义吗?

如有任何帮助,我们将不胜感激。

amazon-web-services amazon-personalize
1个回答
0
投票

这方面有什么更新吗?我也面临着同样的问题

© www.soinside.com 2019 - 2024. All rights reserved.