multiple input parameters in item attributes input for aws personalize batch segment job

0

I followed the below link to generate the input for item affinity receipe https://github.com/aws-samples/amazon-personalize-samples/blob/master/next_steps/core_use_cases/user_segmentation/user_segmentation_example.ipynb

Input

{"itemAttributes":"ITEMS.SKILLS = \"REACT_JS\""}

But I want to provide multiple input for skills HTML, CSS, REACT_JS , and also another attribute TITLE = SDE, EXPERIENCE_RANGE_IN_YEARS_START = 5, EXPERIENCE_RANGE_IN_YEARS_END =10.

How to give multiple key and mutliple values in input itemAttributes in single query ? Is it possible to get output based on multiple parameters

已提问 1 年前258 查看次数
2 回答
2

Hi,

Yes, it is possible to provide multiple attributes and their corresponding values as input to the itemAttributes parameter in a single query. You can use the AND logical operator to combine multiple conditions.

Here is an example of how you can provide multiple conditions to the itemAttributes parameter in multiple queries:

{"itemAttributes": "ITEMS.SKILLS = "HTML" AND ITEMS.TITLE = "SDE"}

In this example, we are combining multiple conditions using the logical operators AND . The query will return items that have skills in HTML and have the title "SDE".

You may refer official docs for details if you want.

Hope it helps.

AWS
已回答 1 年前
  • We tried the recommendation I am getting the below error. Can you suggest what is missing ?

    {"input": { "itemAttributes" : "ITEMS.SKILLS="JAVA" OR ITEMS.SKILLS="ANGULAR_JS""}, "output": {"usersList": []}, "error": "UserError: Error location line 1, index 20 : extraneous input 'OR' expecting {<EOF>, Field}"} {"input": { "itemAttributes" : "(ITEMS.SKILLS="JAVA" OR ITEMS.SKILLS="ANGULAR_JS") AND ITEMS.EXPERIENCE_RANGE_IN_YEARS_START >= 0 AND ITEMS.EXPERIENCE_RANGE_IN_YEARS_END <= 1"}, "output": {"usersList": []}, "error": "UserError: Invalid input symbol: '('"}

  • OR and range is not supported. But you can refer filter function to see if it fits your scenario.

0
已接受的回答
  1. The expressions for batch segment item-attribute affinity recipe do not support range expressions or logical 'OR'. Currently, the supported querys are as the following example:

{"itemAttributes": "ITEMS.genres = "Comedy" AND ITEMS.genres = "Action""}

{"itemAttributes": "ITEMS.genres = "Comedy""}

{"itemAttributes": "ITEMS.genres = "Horror" AND ITEMS.genres = "Action""}

  1. Batch segment input expressions support only the "=" symbol for equality for string matching

  2. The "OR" operator, it can be splitted into two queries as follows:

{ "itemAttributes" : "ITEMS.genres="Comedy""}

{ "itemAttributes" : "ITEMS.genres="Horror""}

已回答 1 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则

相关内容