Step 3: Creating a solution version
After you have completed Step 1: Choosing a recipe (p. 125) and Step 2: Configuring a solution (p. 159), you are ready to create a solution version.
A solution version refers to a trained machine learning model you can deploy to get recommendations for customers. You create a solution version using the console, AWS Command Line Interface (AWS CLI), or AWS SDK. If your solution version has a status of CREATE_PENDING or CREATE_IN_PROGRESS, you can use the the section called “StopSolutionVersionCreation” (p. 406) operation to stop the solution version creation process. See Stopping the creation of a solution version (p. 174).
Topics
• Creating a solution version (console) (p. 171)
• Creating a solution version (AWS CLI) (p. 171)
• Creating a solution version (AWS SDKs) (p. 172)
• Stopping the creation of a solution version (p. 174)
Creating a solution version (console)
If you just completed Step 2: Configuring a solution (p. 159) and the Create solution version is displayed, choose FINISH to create a solution version.
On the solution details page, you can track training progress in the Solution versions section.
When training is complete, the status is Active and you are ready to deploy a campaign and get recommendations. See step 3 in the Getting started (console) (p. 30) tutorial.
If you navigated away from the Create solution version page or want to create an additional solution version for an existing solution, create a new solution version from the solution overview page as follows.
To create a new solution version
1. Open the Amazon Personalize console at https://console.aws.amazon.com/personalize/home and sign into your account.
2. Navigate to the dataset groups page and choose the dataset group with your new solution.
3. In the navigation pane, choose Solutions and recipes.
4. On the Solution and recipes page, choose the solution you want to create a solution version for.
5. On the solution overview page, choose Create solution version to start training a new model.
On the solution details page, you can track training progress in the Solution versions section. When training is complete, the status is Active you can evaluate it using metrics supplied by Amazon Personalize. For more information, see Step 4: Evaluating a solution version with metrics (p. 177).
If training does not complete because of an error, you are not charged for the training. If your solution version has a status of CREATE_PENDING or CREATE_IN_PROGRESS, you can stop the solution version creation process. To stop solution version creation, navigate to the solution version details page and choose Stop. See Stopping the creation of a solution version (p. 174).
Creating a solution version (AWS CLI)
When your solution is ACTIVE, train the model by running the following command. Replace solution arn with the solution Amazon Resource Name (ARN) from Step 2: Configuring a solution (p. 159).
aws personalize create-solution-version \
Step 3: Creating a solution version
--solution-arn solution arn
The solution version ARN is displayed, for example:
{
"solutionVersionArn": "arn:aws:personalize:us-west-2:acct-id:solution/SolutionName/
<version-id>"
}
Check the training status of the solution version by using the describe-solution-version command. Provide the solution version ARN that was returned in the previous step. For more information about the API, see DescribeSolutionVersion (p. 364).
aws personalize describe-solution-version \ --solution-version-arn solution version arn
The properties of the solution version and the training status are displayed. Initially, the status shows as CREATE PENDING, for example:
{ "solutionVersion": {
"solutionVersionArn": "arn:aws:personalize:us-west-2:acct-id:solution/solutionName/
<version-id>", ...,
"status": "CREATE PENDING"
}}
Training is complete when the status is ACTIVE and you can evaluate it using metrics supplied by Amazon Personalize. For more information, see Step 4: Evaluating a solution version with
metrics (p. 177). If training does not complete because of an error, you are not charged for the training.
If your solution version has a status of CREATE_PENDING or CREATE_IN_PROGRESS, you can use the StopSolutionVersionCreation (p. 406) operation to stop the solution version creation process. See Stopping the creation of a solution version (p. 174).
Creating a solution version (AWS SDKs)
When your solution is ACTIVE, use the following code to create a solution version with the AWS SDK for Python (Boto3) or the AWS SDK for Java 2.x.
SDK for Python (Boto3)
To create a solution version, using the following create_solution_version method. Replace the solution arn with the Amazon Resource Name (ARN) of the solution from Step 2: Configuring a solution (p. 159). The following code uses the DescribeSolutionVersion (p. 364) operation to retrieve the solution version's status.
import boto3
personalize = boto3.client('personalize')
# Store the solution ARN solution_arn = 'solution arn'
# Use the solution ARN to get the solution status.
solution_description = personalize.describe_solution(solutionArn = 'solution_arn') ['solution']
print('Solution status: ' + solution_description['status'])
Step 3: Creating a solution version
# Use the solution ARN to create a solution version.
print ('Creating solution version')
response = personalize.create_solution_version(solutionArn = solution_arn) solution_version_arn = response['solutionVersionArn']
print('Solution version ARN: ' + solution_version_arn)
# Use the solution version ARN to get the solution version status.
solution_version_description = personalize.describe_solution_version(
solutionVersionArn = solution_version_arn)['solutionVersion']
print('Solution version status: ' + solution_version_description['status'])
SDK for Java 2.x
To create a solution version, use the following createPersonalizeSolutionVersion method and pass as a parameter the Amazon Resource Name (ARN) of the solution from Step 2: Configuring a solution (p. 159). The following code uses the DescribeSolutionVersion (p. 364) operation to retrieve the solution version's status.
public static String createPersonalizeSolutionVersion(PersonalizeClient personalizeClient, String solutionArn) {
long maxTime = 0;
DescribeSolutionRequest describeSolutionRequest = DescribeSolutionRequest.builder()
if (solutionStatus.equals("ACTIVE") || solutionStatus.equals("CREATE FAILED")) {
CreateSolutionVersionResponse createSolutionVersionResponse = personalizeClient.createSolutionVersion(createSolutionVersionRequest);
Step 3: Creating a solution version
solutionVersionArn =
createSolutionVersionResponse.solutionVersionArn();
System.out.println("Solution version ARN: " + solutionVersionArn);
DescribeSolutionVersionRequest describeSolutionVersionRequest = DescribeSolutionVersionRequest.builder()
System.err.println(e.awsErrorDetails().errorMessage());
System.exit(1);
To check the current solution version status, call the DescribeSolutionVersion (p. 364) operation and pass the ARN of the solution version returned from the CreateSolutionVersion operation. Training is complete when the status is ACTIVE and you can evaluate it using metrics supplied by Amazon Personalize. For more information, see Step 4: Evaluating a solution version with metrics (p. 177). If training does not complete because of an error, you are not charged for the training.
If your solution version has a status of CREATE_PENDING or CREATE_IN_PROGRESS, you can use the StopSolutionVersionCreation (p. 406) operation to stop the solution version creation process. See Stopping the creation of a solution version (p. 174).
Stopping the creation of a solution version
If your solution version has a status of CREATE_PENDING or CREATE_IN_PROGRESS, you can use the Amazon Personalize console or the StopSolutionVersionCreation (p. 406) operation to stop creating the solution version (stop training a model). You can't resume creating a solution version after it has stopped.
You are billed for resources used up to the point when the creation of the solution version stopped.
Stopping the creation of a solution version ends model training, but doesn't delete the solution version. You can still view the solution version details in the Amazon Personalize console and with the DescribeSolutionVersion (p. 364) operation.
Step 3: Creating a solution version
You can stop the solution version creation process with the Amazon Personalize console, the AWS Command Line Interface (AWS CLI), or the AWS SDKs.
Topics
• Stopping the creation of a solution version (console) (p. 175)
• Stopping the creation of a solution version (AWS CLI) (p. 175)
• Stopping the creation of a solution version (AWS SDKs) (p. 176)
Stopping the creation of a solution version (console)
If your solution version has a status of CREATE_PENDING or CREATE_IN_PROGRESS, you can stop creating a solution version (stop training a model).
To stop creating a solution version (console)
1. Open the Amazon Personalize console at https://console.aws.amazon.com/personalize/home and sign into your account.
2. On the Dataset groups page, choose the dataset group with the solution version that you want to stop.
3. In the navigation pane, choose Solutions and recipes.
4. On the Solution and recipes page, choose the solution with the solution version that you want to stop.
5. In Solution versions, choose the solution version that you want to stop.
6. On the solution version details page, choose Stop creation. Depending on the original state of the solution version, the solution version state changes as follows:
• CREATE_PENDING changes to CREATE_STOPPED.
• CREATE_IN_PROGRESS changes to CREATE_STOPPING and then CREATE_STOPPED.
Stopping the creation of a solution version (AWS CLI)
If your solution version has a status of CREATE_PENDING or CREATE_IN_PROGRESS, you can stop creating a solution version (stop training a model). Use the following stop-solution-version-creation command to stop creating the solution version with the AWS CLI. Replace solution
version arn with the Amazon Resource Name (ARN) of the solution version that you want to stop. You are billed for resources used up to the point that creation of the solution version stopped.
aws personalize stop-solution-version-creation \ --solution-version-arn solution version arn
Check the training status of the solution version with the describe-solution-version command.
aws personalize describe-solution-version \ --solution-version-arn solution version arn
Depending on the original state of the solution version, the solution version state changes as follows:
• CREATE_PENDING changes to CREATE_STOPPED.
• CREATE_IN_PROGRESS changes to CREATE_STOPPING and then CREATE_STOPPED
Step 3: Creating a solution version
Stopping the creation of a solution version (AWS SDKs)
If your solution version has a status of CREATE_PENDING or CREATE_IN_PROGRESS, you can stop creating a solution version (stop training a model). The following code shows how to stop creating a solution version with the AWS SDK for Python (Boto3) or AWS SDK for Java 2.x. You are billed for resources used up to the point when creation of the solution version stopped.
SDK for Python (Boto3)
Use the following stop_solution_version_creationmethod to stop creation of a solution version. Replace solution_version_arn with the Amazon Resource Name (ARN) of the solution version that you want to stop. The method uses the DescribeSolutionVersion (p. 364) operation to retrieve the solution version's status.
import boto3
personalize = boto3.client('personalize')
response = personalize.stop_solution_version_creation(
solutionVersionArn = solution_version_arn )
# Use the solution version ARN to get the solution version status.
solution_version_description = personalize.describe_solution_version(
solutionVersionArn = solution_version_arn)['solutionVersion']
print('Solution version status: ' + solution_version_description['status'])
SDK for Java 2.x
Use the following stopSolutionVersionCreation method to stop creating a solution version. Pass as parameters an Amazon Personalize service client and the Amazon Resource Name (ARN) of the solution version that you want to stop creating. The following code uses the DescribeSolutionVersion (p. 364) operation to retrieve the solution version's status.
public static void stopSolutionVersionCreation(PersonalizeClient personalizeClient, String solutionVersionArn) {
String solutionVersionStatus = "";
StopSolutionVersionCreationRequest stopSolutionVersionCreationRequest = StopSolutionVersionCreationRequest.builder()
.solutionVersionArn(solutionVersionArn) .build();
personalizeClient.stopSolutionVersionCreation(stopSolutionVersionCreationRequest);
// Use the solution version ARN to get the solution version status.
DescribeSolutionVersionRequest describeSolutionVersionRequest = DescribeSolutionVersionRequest.builder()
.solutionVersionArn(solutionVersionArn) .build();
solutionVersionStatus =
personalizeClient.describeSolutionVersion(describeSolutionVersionRequest) .solutionVersion()
.status();
System.out.println("Solution version status: " + solutionVersionStatus);
}
Depending on the original state of the solution version, the solution version state changes as follows: