There are more AWS SDK examples available in the AWS Doc SDK Examples
Use DescribeModel
with an AWS SDK
The following code example shows how to use DescribeModel
.
For more information, see Viewing your models.
- Python
-
- SDK for Python (Boto3)
-
Note
There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository
. class Models: @staticmethod def describe_model(lookoutvision_client, project_name, model_version): """ Shows the performance metrics for a trained model. :param lookoutvision_client: A Boto3 Amazon Lookout for Vision client. :param project_name: The name of the project that contains the desired model. :param model_version: The version of the model. """ response = lookoutvision_client.describe_model( ProjectName=project_name, ModelVersion=model_version ) model_description = response["ModelDescription"] print(f"\tModel version: {model_description['ModelVersion']}") print(f"\tARN: {model_description['ModelArn']}") if "Description" in model_description: print(f"\tDescription: {model_description['Description']}") print(f"\tStatus: {model_description['Status']}") print(f"\tMessage: {model_description['StatusMessage']}") print(f"\tCreated: {str(model_description['CreationTimestamp'])}") if model_description["Status"] in ("TRAINED", "HOSTED"): training_start = model_description["CreationTimestamp"] training_end = model_description["EvaluationEndTimestamp"] duration = training_end - training_start print(f"\tTraining duration: {duration}") print("\n\tPerformance metrics\n\t-------------------") print(f"\tRecall: {model_description['Performance']['Recall']}") print(f"\tPrecision: {model_description['Performance']['Precision']}") print(f"\tF1: {model_description['Performance']['F1Score']}") training_output_bucket = model_description["OutputConfig"]["S3Location"][ "Bucket" ] prefix = model_description["OutputConfig"]["S3Location"]["Prefix"] print(f"\tTraining output: s3://{training_output_bucket}/{prefix}")
-
For API details, see DescribeModel in AWS SDK for Python (Boto3) API Reference.
-
DescribeDataset
DetectAnomalies