Personalize CDK Automatic Training Config

0

Hello,

When using Personalize CDK to create a solution, how to turn off the automatic training?

Here, I didn't find anything related to it.

This is my code:

personalize.CfnSolution(
        self,
        "PersonalizeRankingSolution",
        dataset_group_arn="some_dataset_group_arn",
        name="ranking-solution",
        recipe_arn="arn:aws:personalize:::recipe/aws-personalized-ranking-v2"
)

How to turn automatic training off or change the training days?

Thank you

2 Answers
1

In Amazon Personalize, the automatic training feature is managed through the solution's settings and is not directly configurable through the CfnSolution resource in CDK. To control the training behavior, you typically need to manage it through the solution version creation process or use the Personalize console or API.

To disable automatic training or change the training frequency, you should:

  1. Use the create_solution_version API or equivalent in CDK to specify the training parameters when creating a solution version, rather than modifying the CfnSolution directly.
  2. If using the console, you can configure these settings when you create or update the solution version.

Automatic training is tied to how Personalize manages solutions and versions, and adjusting the training days would be handled through these versioning processes, not directly through CfnSolution.

profile picture
EXPERT
answered a month ago
0

In AWS Personalize, when you create a solution using the AWS CDK, automatic training is typically enabled by default. However, you can control the frequency of retraining by adjusting the performAutoML and performHPO parameters or by using the solutionVersion and campaign settings instead of relying on automatic retraining.

Step 1: Modify the Training Schedule To disable automatic training or to change the training schedule, you can use the solutionVersion resource in CDK to create a specific version of the solution manually, instead of relying on automatic updates.

Step 2: Create the Solution with a Custom Schedule The AWS Personalize CDK constructs do not directly expose a parameter to disable automatic training, but you can manage the retraining schedule by creating solutionVersion resources manually whenever you need to update the model

import aws_cdk as cdk
from aws_cdk import (
    aws_personalize as personalize,
    core,
)

class PersonalizeStack(core.Stack):

    def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
        super().__init__(scope, id, **kwargs)

        # Create the solution
        solution = personalize.CfnSolution(
            self,
            "PersonalizeRankingSolution",
            dataset_group_arn="some_dataset_group_arn",
            name="ranking-solution",
            recipe_arn="arn:aws:personalize:::recipe/aws-personalized-ranking-v2",
            perform_auto_ml=False,   # Disable AutoML if needed
            perform_hpo=False        # Disable Hyperparameter Optimization if not required
        )

        # Create a solution version manually
        solution_version = personalize.CfnSolutionVersion(
            self,
            "PersonalizeRankingSolutionVersion",
            solution_arn=solution.attr_arn
        )

        # Optionally, create a campaign (which deploys the solution version)
        campaign = personalize.CfnCampaign(
            self,
            "PersonalizeRankingCampaign",
            name="ranking-campaign",
            solution_version_arn=solution_version.attr_solution_version_arn,
            min_provisioned_tps=1
        )

profile pictureAWS
EXPERT
Deeksha
answered a month ago
  • I can't use "perform_hpo" because my recipe is "aws-personalized-ranking-v2" I got this error: "HPO is not supported for recipe arn:aws:personalize:::recipe/aws-personalized-ranking-v2"

    And I didn't find any documentation about "Training Schedule" for "performAutoML" or about "CDK SolutionVersion". Can you provide some?

  • There is no "personalize.CfnSolutionVersion" or "personalize.CfnCampaign", I didn't find them in the docs? Can you send a link to docs if any?

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