Gunakan DescribeModel dengan AWS SDK - AWS SDKContoh Kode

Ada lebih banyak AWS SDK contoh yang tersedia di GitHub repo SDKContoh AWS Dokumen.

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Gunakan DescribeModel dengan AWS SDK

Contoh kode berikut menunjukkan cara menggunakanDescribeModel.

Untuk informasi selengkapnya, lihat Melihat model Anda.

Python
SDKuntuk Python (Boto3)
catatan

Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara pengaturan dan menjalankannya di Repositori Contoh Kode AWS.

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}")