Create Personalize Recommender using CDK

0

Hello,

We can create a Personalize Solution using CDK, using this code (as an example)

personalize.CfnSolution(
            self,
            "FrequentlyBoughtTogetherSolution",
            name="FrequentlyBoughtTogetherSolution",
            dataset_group_arn=dataset_group.attr_dataset_group_arn,
            recipe_arn="arn:aws:personalize:::recipe/aws-similar-items",
)

But how to create a Recommender, for an e-commerce domain? If we can't do that using CDK, why?

Thank you

asked 2 months ago57 views
1 Answer
0

Creating a Personalize Recommender for an e-commerce domain using CDK is not directly supported in the same way as creating a Solution. This is because Recommenders are specifically designed for use with Domain dataset groups, which have predefined use cases.

To create a Recommender for an e-commerce domain, you would typically use the CreateRecommender API or its equivalent in SDKs. The process involves specifying a name for the recommender, the dataset group ARN, and a recipe ARN that corresponds to a Domain dataset group use case.

While CDK doesn't have a direct construct for creating a Recommender, you can still achieve this by using a custom resource or by invoking the AWS SDK within your CDK code. Here's a conceptual approach of how you might do this:

  1. Set up your Domain dataset group for e-commerce.
  2. Choose an appropriate use case (recipe) for your e-commerce domain, such as "Top picks for you" or "Recommended for you".
  3. Use a custom resource or the AWS SDK to call the CreateRecommender API with the required parameters.

The reason CDK doesn't have a direct construct for Recommenders is likely because they are more dynamic and use-case specific compared to general Solutions. Recommenders are tied to Domain dataset groups and their predefined use cases, which may not fit well into the more static nature of infrastructure-as-code tools like CDK.

If you need to create a Recommender as part of your infrastructure, you might consider using a combination of CDK for setting up the dataset group and other Personalize resources, and then use a custom resource or a separate script to create the Recommender once the dataset group is ready.
Sources
CreateRecommender - Amazon Personalize
Creating domain recommenders in Amazon Personalize - Amazon Personalize

profile picture
answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions