{"id":344,"date":"2020-10-03T02:38:55","date_gmt":"2020-10-03T02:38:55","guid":{"rendered":"https:\/\/machine-learning.webcloning.com\/2020\/10\/03\/simplify-data-management-with-new-apis-in-amazon-personalize\/"},"modified":"2020-10-03T02:38:55","modified_gmt":"2020-10-03T02:38:55","slug":"simplify-data-management-with-new-apis-in-amazon-personalize","status":"publish","type":"post","link":"https:\/\/salarydistribution.com\/machine-learning\/2020\/10\/03\/simplify-data-management-with-new-apis-in-amazon-personalize\/","title":{"rendered":"Simplify data management with new APIs in Amazon Personalize"},"content":{"rendered":"<div id=\"\">\n<p><a href=\"https:\/\/aws.amazon.com\/personalize\">Amazon Personalize<\/a> now makes it easier to manage your growing item and user catalogs with new APIs to incrementally add items and users in your datasets to create personalized recommendations. With the new <code>putItems<\/code> and <code>putUsers<\/code> APIs, you can simplify the process of managing your datasets. You no longer need to upload an entire dataset containing historical records and new records just to include new records in your recommendations. Providing new records to Amazon Personalize when they become available reduces your latency for incorporating new information, ensuring your recommendations remain relevant to your users and item catalog.<\/p>\n<p>Based on over 20 years of personalization experience at Amazon.com, Amazon Personalize enables you to improve customer engagement by powering personalized product and content recommendations and targeted marketing promotions. Amazon Personalize uses machine learning (ML) to create higher-quality recommendations for your websites and applications. You can get started without any prior ML experience and use simple APIs to easily build sophisticated personalization capabilities in just a few clicks. Amazon Personalize processes and examines your data, identifies what is meaningful, and trains and optimizes a personalization model that is customized for your data. All your data is encrypted to be private and secure, and is only used to create recommendations for your users.<\/p>\n<p>This post walks you through the process of incrementally modifying your items and users datasets in Amazon Personalize.<\/p>\n<h2>Adding new items and users to your datasets<\/h2>\n<p>For this use case, we create a dataset group with an interaction dataset, an item dataset (item metadata) and a user dataset using the Amazon Personalize CLI. For instructions on creating a dataset group, see <a href=\"https:\/\/docs.aws.amazon.com\/personalize\/latest\/dg\/getting-started-cli.html\">Getting Started (CLI)<\/a>.<\/p>\n<ol>\n<li>Create an <code>Interactions<\/code> dataset using the following schema and import data using the <a href=\"https:\/\/concierge-public-resources.s3-us-west-2.amazonaws.com\/interactions-100k.csv\">interactions-100k.csv<\/a> data file:<\/li>\n<\/ol>\n<div class=\"hide-language\">\n<pre class=\"unlimited-height-code\"><code class=\"lang-python\">{\r\n\t\"type\": \"record\",\r\n\t\"name\": \"Interactions\",\r\n\t\"namespace\": \"com.amazonaws.personalize.schema\",\r\n\t\"fields\": [\r\n\t\t{\r\n\t\t\t\"name\": \"USER_ID\",\r\n\t\t\t\"type\": \"string\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"name\": \"ITEM_ID\",\r\n\t\t\t\"type\": \"string\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"name\": \"EVENT_TYPE\",\r\n\t\t\t\"type\": [\r\n\t\t\t\t\"string\"\r\n\t\t\t]\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"name\": \"EVENT_VALUE\",\r\n\t\t\t\"type\": [\r\n\t\t\t\t\"null\",\r\n\t\t\t\t\"float\"\r\n\t\t\t]\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"name\": \"TIMESTAMP\",\r\n\t\t\t\"type\": \"long\"\r\n\t\t}\r\n\t]\r\n}\r\n<\/code><\/pre>\n<\/div>\n<ol start=\"2\">\n<li>Create an Items dataset using the following schema and import data using the <a href=\"https:\/\/concierge-public-resources.s3-us-west-2.amazonaws.com\/item_metadata.csv\">csv<\/a> data file:<\/li>\n<\/ol>\n<div class=\"hide-language\">\n<pre class=\"unlimited-height-code\"><code class=\"lang-python\">{\r\n\t\"type\": \"record\",\r\n\t\"name\": \"Items\",\r\n\t\"namespace\": \"com.amazonaws.personalize.schema\",\r\n\t\"fields\": [\r\n\t\t{\r\n\t\t\t\"name\": \"ITEM_ID\",\r\n\t\t\t\"type\": \"string\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"name\": \"GENRE\",\r\n\t\t\t\"type\u201d: \"null\u201d\r\n\t\t\t \"categorical\": true\r\n\t\t}\r\n\t],\r\n\t\"version\": \"1.0\"\r\n}\r\n<\/code><\/pre>\n<\/div>\n<ol start=\"3\">\n<li>Create a Users dataset using the following schema and import data using the <a href=\"https:\/\/concierge-public-resources.s3-us-west-2.amazonaws.com\/users.csv\">csv<\/a> data file:<\/li>\n<\/ol>\n<div class=\"hide-language\">\n<pre class=\"unlimited-height-code\"><code class=\"lang-python\">{\r\n\t\"type\": \"record\",\r\n\t\"name\": \"Users\",\r\n\t\"namespace\": \"com.amazonaws.personalize.schema\",\r\n\t\"fields\": [\r\n\t\t{\r\n\t\t\t\"name\": \"USER_ID\",\r\n\t\t\t\"type\": \"string\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"name\": \"AGE\",\r\n\t\t\t\"type\": \"int\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"name\": \"GENDER\",\r\n\t\t\t\"type\": \"string\"\r\n\t\t}\r\n\t],\r\n\t\"version\": \"1.0\"\r\n}\r\n<\/code><\/pre>\n<\/div>\n<p>Now that you have created your datasets, you can add data to them in two different ways:<\/p>\n<ul>\n<li>Using bulk import for item and user datasets from <a href=\"http:\/\/aws.amazon.com\/s3\">Amazon Simple Storage Service<\/a> (Amazon S3). (for more information, see <a href=\"https:\/\/docs.aws.amazon.com\/personalize\/latest\/dg\/data-prep.html\">Preparing and Importing Data<\/a>)<\/li>\n<li>Using the new <code>putUsers<\/code> and <code>putItems<\/code> You can incrementally add up to 10 records per call to the user dataset using the <code>putUsers<\/code> API and the items dataset using <code>putItems<\/code> API.<\/li>\n<\/ul>\n<p>For the <code>putUsers<\/code> call, the <code>Users<\/code> dataset required schema field (<code>USER_ID<\/code>) is mapped to the camel case <code>userId<\/code>. For the <code>putItems<\/code> call, the Items dataset required schema field (<code>ITEM_ID<\/code>) is mapped to the camel case <code>itemId<\/code>.<\/p>\n<p>The following code adds two new users to the <code>Users<\/code> dataset via the <code>putUsers<\/code> API:<\/p>\n<div class=\"hide-language\">\n<pre class=\"unlimited-height-code\"><code class=\"lang-python\">personalize_events.put_users(\r\ndatasetArn=\"arn:aws:personalize:region:acctID:dataset\/crud-test\/USERS\",                          \r\n    \tusers=[\r\n {\r\n                 'userId' :\"489\",\r\n                 'properties': \"{\"AGE\":\"29\", \"GENDER\":F}\"\r\n             },\r\n             {\r\n                 'userId' : \"650\",\r\n                 'properties':\"{\"AGE\":\"65\", \"GENDER\"\":F}\"\r\n             }]\r\n)\r\n<\/code><\/pre>\n<\/div>\n<p>The following code adds a new item to the Items dataset via the <code>putItems<\/code> API:<\/p>\n<div class=\"hide-language\">\n<pre class=\"unlimited-height-code\"><code class=\"lang-python\">personalize_events.put_items(\r\ndatasetArn=\"arn:aws:personalize:region:acctID:dataset\/crud-test\/ITEMS\",\r\nitems=[\r\n{\r\n            'itemId' :\"432\",\r\n             'properties': \"{\"GENRE\":\"Action\"}\"\r\n         }]\r\n)\r\n<\/code><\/pre>\n<\/div>\n<p>An <code>HTTP\/1.1 200<\/code> response is returned for successful record creation. In cases where your new item or user doesn\u2019t match your dataset\u2019s defined schema, you receive an <code>InvalidInputException<\/code> detailing the total number of records in your request that don\u2019t match the schema.<\/p>\n<p>For new records created (incrementally or via bulk upload) with the same <code>userId<\/code> or <code>itemId<\/code> as a record that already exists in the <code>Users<\/code> or <code>Items<\/code> dataset, the most recently created record (ingested by Amazon Personalize) is used in new solutions or solution versions.<\/p>\n<p>Additionally, records added using <code>putUsers<\/code> or <code>putItems<\/code> are persisted until your dataset is deleted, so be sure to delete your dataset in the dataset group before importing a refreshed dataset. Amazon Personalize doesn\u2019t replace your catalog or user data management systems.<\/p>\n<h2>Incorporating the newly added users and items in recommendations and filters<\/h2>\n<p>Now that you\u2019ve added new items and new users to your datasets, incorporating this information into your Amazon Personalize solutions makes sure that recommendations remain timely and relevant for your users. When not using the <code>aws-user-personalization<\/code> recipe, solution re-training is needed to include these new items in your personalized recommendations.<\/p>\n<p>If you have <a href=\"https:\/\/docs.aws.amazon.com\/personalize\/latest\/dg\/native-recipe-new-item-USER_PERSONALIZATION.html\">exploration<\/a> enabled in an Amazon Personalize recipe, your new items are included in recommendations as soon as your next campaign <a href=\"https:\/\/docs.aws.amazon.com\/personalize\/latest\/dg\/API_UpdateCampaign.html\">update<\/a> is complete. New events generated by your users\u2019 interactions with these items are incorporated when your train a new solution or solution version in this dataset group.<\/p>\n<p>Any filters you created in the dataset group are updated with your new item and user data within 15 minutes from the last dataset import job completion or the last incremental record. This update allows your campaigns to use your most recent data when filtering recommendations for your users.<\/p>\n<h2>Summary<\/h2>\n<p>Amazon Personalize allows you to easily manage your growing item and user catalogs so your personalized product and content recommendations keep pace with your business and your customers. For more information about optimizing your user experience with Amazon Personalize, see <a href=\"https:\/\/docs.aws.amazon.com\/personalize\/latest\/dg\/what-is-personalize.html\">What Is Amazon Personalize?<\/a><\/p>\n<hr>\n<h3>About the Authors<\/h3>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-16650 alignleft\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2020\/10\/01\/matthew-chwastek-100.jpg\" alt=\"\" width=\"100\" height=\"135\"><strong>Matt Chwastek<\/strong> is a Senior Product Manager for Amazon Personalize. He focuses on delivering products that make it easier to build and use machine learning solutions. In his spare time, he enjoys reading and photography.<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p><strong><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-16682 alignleft\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2020\/10\/02\/E015GUGD2V6-W017G00EQQ5-f8ddda33a59c-512.jpg\" alt=\"\" width=\"99\" height=\"123\">Gaurav Singh Chauhan <\/strong>is a Software Engineer for Amazon Personalize and works on architecting software systems and big data pipelines that serve customers at scale. Gaurav has a B.Tech in Computer Science from IIT Bombay, India. Outside of work, he likes all things outdoors and is an avid runner. In his spare time, he likes reading about and exploring new technologies. He tweets on startups, technology, and India at <a href=\"https:\/\/twitter.com\/bazingaurav\">@bazingaurav.<\/a><\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/aws.amazon.com\/blogs\/machine-learning\/simplify-data-management-with-new-apis-in-amazon-personalize\/<\/p>\n","protected":false},"author":0,"featured_media":345,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/posts\/344"}],"collection":[{"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/comments?post=344"}],"version-history":[{"count":0,"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/posts\/344\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/media\/345"}],"wp:attachment":[{"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/media?parent=344"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/categories?post=344"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/tags?post=344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}