From 004bf5fa4cb2d66e36de7ec52dee8e2c8dd438ee Mon Sep 17 00:00:00 2001 From: nayaknishant Date: Tue, 23 Nov 2021 12:14:31 -0800 Subject: [PATCH] docs: Added comment for evaluation_id to python examples (#860) * Added comment for evaluation_id to python examples * docs: Update name of BQ source parameter in samples (#859) * fix: issue 205934591 * fix:test * fix:test Co-authored-by: Andrew Ferlitsch --- ..._model_evaluation_image_classification_sample.py | 13 +++++++++++++ ...odel_evaluation_image_object_detection_sample.py | 13 +++++++++++++ .../get_model_evaluation_slice_sample.py | 13 +++++++++++++ ...odel_evaluation_tabular_classification_sample.py | 13 +++++++++++++ ...et_model_evaluation_tabular_regression_sample.py | 13 +++++++++++++ ...del_evaluation_tabular_regression_sample_test.py | 4 ++-- ...t_model_evaluation_text_classification_sample.py | 13 +++++++++++++ ...odel_evaluation_text_entity_extraction_sample.py | 13 +++++++++++++ ...del_evaluation_text_sentiment_analysis_sample.py | 13 +++++++++++++ ...el_evaluation_video_action_recognition_sample.py | 13 +++++++++++++ ..._model_evaluation_video_classification_sample.py | 13 +++++++++++++ ...model_evaluation_video_object_tracking_sample.py | 13 +++++++++++++ .../list_model_evaluation_slices_sample.py | 13 +++++++++++++ 13 files changed, 158 insertions(+), 2 deletions(-) diff --git a/samples/snippets/model_service/get_model_evaluation_image_classification_sample.py b/samples/snippets/model_service/get_model_evaluation_image_classification_sample.py index 9fe35aa60e..23e83e9239 100644 --- a/samples/snippets/model_service/get_model_evaluation_image_classification_sample.py +++ b/samples/snippets/model_service/get_model_evaluation_image_classification_sample.py @@ -23,6 +23,19 @@ def get_model_evaluation_image_classification_sample( location: str = "us-central1", api_endpoint: str = "us-central1-aiplatform.googleapis.com", ): + """ + To obtain evaluation_id run the following commands where LOCATION + is the region where the model is stored, PROJECT is the project ID, + and MODEL_ID is the ID of your model. + + model_client = aiplatform.gapic.ModelServiceClient( + client_options={ + 'api_endpoint':'LOCATION-aiplatform.googleapis.com' + } + ) + evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID') + print("evaluations:", evaluations) + """ # The AI Platform services require regional API endpoints. client_options = {"api_endpoint": api_endpoint} # Initialize client that will be used to create and send requests. diff --git a/samples/snippets/model_service/get_model_evaluation_image_object_detection_sample.py b/samples/snippets/model_service/get_model_evaluation_image_object_detection_sample.py index d6a4c5cc9a..d9d35b18b8 100644 --- a/samples/snippets/model_service/get_model_evaluation_image_object_detection_sample.py +++ b/samples/snippets/model_service/get_model_evaluation_image_object_detection_sample.py @@ -23,6 +23,19 @@ def get_model_evaluation_image_object_detection_sample( location: str = "us-central1", api_endpoint: str = "us-central1-aiplatform.googleapis.com", ): + """ + To obtain evaluation_id run the following commands where LOCATION + is the region where the model is stored, PROJECT is the project ID, + and MODEL_ID is the ID of your model. + + model_client = aiplatform.gapic.ModelServiceClient( + client_options={ + 'api_endpoint':'LOCATION-aiplatform.googleapis.com' + } + ) + evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID') + print("evaluations:", evaluations) + """ # The AI Platform services require regional API endpoints. client_options = {"api_endpoint": api_endpoint} # Initialize client that will be used to create and send requests. diff --git a/samples/snippets/model_service/get_model_evaluation_slice_sample.py b/samples/snippets/model_service/get_model_evaluation_slice_sample.py index e79e787c7d..f8a465ec95 100644 --- a/samples/snippets/model_service/get_model_evaluation_slice_sample.py +++ b/samples/snippets/model_service/get_model_evaluation_slice_sample.py @@ -24,6 +24,19 @@ def get_model_evaluation_slice_sample( location: str = "us-central1", api_endpoint: str = "us-central1-aiplatform.googleapis.com", ): + """ + To obtain evaluation_id run the following commands where LOCATION + is the region where the model is stored, PROJECT is the project ID, + and MODEL_ID is the ID of your model. + + model_client = aiplatform.gapic.ModelServiceClient( + client_options={ + 'api_endpoint':'LOCATION-aiplatform.googleapis.com' + } + ) + evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID') + print("evaluations:", evaluations) + """ # The AI Platform services require regional API endpoints. client_options = {"api_endpoint": api_endpoint} # Initialize client that will be used to create and send requests. diff --git a/samples/snippets/model_service/get_model_evaluation_tabular_classification_sample.py b/samples/snippets/model_service/get_model_evaluation_tabular_classification_sample.py index 2dd870f89f..e7c3901fb7 100644 --- a/samples/snippets/model_service/get_model_evaluation_tabular_classification_sample.py +++ b/samples/snippets/model_service/get_model_evaluation_tabular_classification_sample.py @@ -23,6 +23,19 @@ def get_model_evaluation_tabular_classification_sample( location: str = "us-central1", api_endpoint: str = "us-central1-aiplatform.googleapis.com", ): + """ + To obtain evaluation_id run the following commands where LOCATION + is the region where the model is stored, PROJECT is the project ID, + and MODEL_ID is the ID of your model. + + model_client = aiplatform.gapic.ModelServiceClient( + client_options={ + 'api_endpoint':'LOCATION-aiplatform.googleapis.com' + } + ) + evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID') + print("evaluations:", evaluations) + """ # The AI Platform services require regional API endpoints. client_options = {"api_endpoint": api_endpoint} # Initialize client that will be used to create and send requests. diff --git a/samples/snippets/model_service/get_model_evaluation_tabular_regression_sample.py b/samples/snippets/model_service/get_model_evaluation_tabular_regression_sample.py index b08bcd5a45..6923d16068 100644 --- a/samples/snippets/model_service/get_model_evaluation_tabular_regression_sample.py +++ b/samples/snippets/model_service/get_model_evaluation_tabular_regression_sample.py @@ -23,6 +23,19 @@ def get_model_evaluation_tabular_regression_sample( location: str = "us-central1", api_endpoint: str = "us-central1-aiplatform.googleapis.com", ): + """ + To obtain evaluation_id run the following commands where LOCATION + is the region where the model is stored, PROJECT is the project ID, + and MODEL_ID is the ID of your model. + + model_client = aiplatform.gapic.ModelServiceClient( + client_options={ + 'api_endpoint':'LOCATION-aiplatform.googleapis.com' + } + ) + evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID') + print("evaluations:", evaluations) + """ # The AI Platform services require regional API endpoints. client_options = {"api_endpoint": api_endpoint} # Initialize client that will be used to create and send requests. diff --git a/samples/snippets/model_service/get_model_evaluation_tabular_regression_sample_test.py b/samples/snippets/model_service/get_model_evaluation_tabular_regression_sample_test.py index d01fdbf515..1c4e5ba31d 100644 --- a/samples/snippets/model_service/get_model_evaluation_tabular_regression_sample_test.py +++ b/samples/snippets/model_service/get_model_evaluation_tabular_regression_sample_test.py @@ -17,8 +17,8 @@ import get_model_evaluation_sample PROJECT_ID = os.getenv("BUILD_SPECIFIC_GCLOUD_PROJECT") -MODEL_ID = "8842430840248991744" # bq all -EVALUATION_ID = "4944816689650806017" # bq all evaluation +MODEL_ID = "626638064948609024" # bq all +EVALUATION_ID = "3002272024979570688" # bq all evaluation def test_ucaip_generated_get_model_evaluation_sample(capsys): diff --git a/samples/snippets/model_service/get_model_evaluation_text_classification_sample.py b/samples/snippets/model_service/get_model_evaluation_text_classification_sample.py index cdaea5c988..300760a88d 100644 --- a/samples/snippets/model_service/get_model_evaluation_text_classification_sample.py +++ b/samples/snippets/model_service/get_model_evaluation_text_classification_sample.py @@ -23,6 +23,19 @@ def get_model_evaluation_text_classification_sample( location: str = "us-central1", api_endpoint: str = "us-central1-aiplatform.googleapis.com", ): + """ + To obtain evaluation_id run the following commands where LOCATION + is the region where the model is stored, PROJECT is the project ID, + and MODEL_ID is the ID of your model. + + model_client = aiplatform.gapic.ModelServiceClient( + client_options={ + 'api_endpoint':'LOCATION-aiplatform.googleapis.com' + } + ) + evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID') + print("evaluations:", evaluations) + """ # The AI Platform services require regional API endpoints. client_options = {"api_endpoint": api_endpoint} # Initialize client that will be used to create and send requests. diff --git a/samples/snippets/model_service/get_model_evaluation_text_entity_extraction_sample.py b/samples/snippets/model_service/get_model_evaluation_text_entity_extraction_sample.py index 1fff1fa767..9c43ba9279 100644 --- a/samples/snippets/model_service/get_model_evaluation_text_entity_extraction_sample.py +++ b/samples/snippets/model_service/get_model_evaluation_text_entity_extraction_sample.py @@ -23,6 +23,19 @@ def get_model_evaluation_text_entity_extraction_sample( location: str = "us-central1", api_endpoint: str = "us-central1-aiplatform.googleapis.com", ): + """ + To obtain evaluation_id run the following commands where LOCATION + is the region where the model is stored, PROJECT is the project ID, + and MODEL_ID is the ID of your model. + + model_client = aiplatform.gapic.ModelServiceClient( + client_options={ + 'api_endpoint':'LOCATION-aiplatform.googleapis.com' + } + ) + evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID') + print("evaluations:", evaluations) + """ # The AI Platform services require regional API endpoints. client_options = {"api_endpoint": api_endpoint} # Initialize client that will be used to create and send requests. diff --git a/samples/snippets/model_service/get_model_evaluation_text_sentiment_analysis_sample.py b/samples/snippets/model_service/get_model_evaluation_text_sentiment_analysis_sample.py index bb8521c1b1..65cbac6767 100644 --- a/samples/snippets/model_service/get_model_evaluation_text_sentiment_analysis_sample.py +++ b/samples/snippets/model_service/get_model_evaluation_text_sentiment_analysis_sample.py @@ -23,6 +23,19 @@ def get_model_evaluation_text_sentiment_analysis_sample( location: str = "us-central1", api_endpoint: str = "us-central1-aiplatform.googleapis.com", ): + """ + To obtain evaluation_id run the following commands where LOCATION + is the region where the model is stored, PROJECT is the project ID, + and MODEL_ID is the ID of your model. + + model_client = aiplatform.gapic.ModelServiceClient( + client_options={ + 'api_endpoint':'LOCATION-aiplatform.googleapis.com' + } + ) + evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID') + print("evaluations:", evaluations) + """ # The AI Platform services require regional API endpoints. client_options = {"api_endpoint": api_endpoint} # Initialize client that will be used to create and send requests. diff --git a/samples/snippets/model_service/get_model_evaluation_video_action_recognition_sample.py b/samples/snippets/model_service/get_model_evaluation_video_action_recognition_sample.py index 3233b45677..90e84b9ee9 100644 --- a/samples/snippets/model_service/get_model_evaluation_video_action_recognition_sample.py +++ b/samples/snippets/model_service/get_model_evaluation_video_action_recognition_sample.py @@ -23,6 +23,19 @@ def get_model_evaluation_video_action_recognition_sample( location: str = "us-central1", api_endpoint: str = "us-central1-aiplatform.googleapis.com", ): + """ + To obtain evaluation_id run the following commands where LOCATION + is the region where the model is stored, PROJECT is the project ID, + and MODEL_ID is the ID of your model. + + model_client = aiplatform.gapic.ModelServiceClient( + client_options={ + 'api_endpoint':'LOCATION-aiplatform.googleapis.com' + } + ) + evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID') + print("evaluations:", evaluations) + """ # The AI Platform services require regional API endpoints. client_options = {"api_endpoint": api_endpoint} # Initialize client that will be used to create and send requests. diff --git a/samples/snippets/model_service/get_model_evaluation_video_classification_sample.py b/samples/snippets/model_service/get_model_evaluation_video_classification_sample.py index 3f0eb65566..158e3ba1ff 100644 --- a/samples/snippets/model_service/get_model_evaluation_video_classification_sample.py +++ b/samples/snippets/model_service/get_model_evaluation_video_classification_sample.py @@ -23,6 +23,19 @@ def get_model_evaluation_video_classification_sample( location: str = "us-central1", api_endpoint: str = "us-central1-aiplatform.googleapis.com", ): + """ + To obtain evaluation_id run the following commands where LOCATION + is the region where the model is stored, PROJECT is the project ID, + and MODEL_ID is the ID of your model. + + model_client = aiplatform.gapic.ModelServiceClient( + client_options={ + 'api_endpoint':'LOCATION-aiplatform.googleapis.com' + } + ) + evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID') + print("evaluations:", evaluations) + """ # The AI Platform services require regional API endpoints. client_options = {"api_endpoint": api_endpoint} # Initialize client that will be used to create and send requests. diff --git a/samples/snippets/model_service/get_model_evaluation_video_object_tracking_sample.py b/samples/snippets/model_service/get_model_evaluation_video_object_tracking_sample.py index 493b3730dd..2726681178 100644 --- a/samples/snippets/model_service/get_model_evaluation_video_object_tracking_sample.py +++ b/samples/snippets/model_service/get_model_evaluation_video_object_tracking_sample.py @@ -23,6 +23,19 @@ def get_model_evaluation_video_object_tracking_sample( location: str = "us-central1", api_endpoint: str = "us-central1-aiplatform.googleapis.com", ): + """ + To obtain evaluation_id run the following commands where LOCATION + is the region where the model is stored, PROJECT is the project ID, + and MODEL_ID is the ID of your model. + + model_client = aiplatform.gapic.ModelServiceClient( + client_options={ + 'api_endpoint':'LOCATION-aiplatform.googleapis.com' + } + ) + evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID') + print("evaluations:", evaluations) + """ # The AI Platform services require regional API endpoints. client_options = {"api_endpoint": api_endpoint} # Initialize client that will be used to create and send requests. diff --git a/samples/snippets/model_service/list_model_evaluation_slices_sample.py b/samples/snippets/model_service/list_model_evaluation_slices_sample.py index 8285999aca..1d895a41ce 100644 --- a/samples/snippets/model_service/list_model_evaluation_slices_sample.py +++ b/samples/snippets/model_service/list_model_evaluation_slices_sample.py @@ -23,6 +23,19 @@ def list_model_evaluation_slices_sample( location: str = "us-central1", api_endpoint: str = "us-central1-aiplatform.googleapis.com", ): + """ + To obtain evaluation_id run the following commands where LOCATION + is the region where the model is stored, PROJECT is the project ID, + and MODEL_ID is the ID of your model. + + model_client = aiplatform.gapic.ModelServiceClient( + client_options={ + 'api_endpoint':'LOCATION-aiplatform.googleapis.com' + } + ) + evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID') + print("evaluations:", evaluations) + """ # The AI Platform services require regional API endpoints. client_options = {"api_endpoint": api_endpoint} # Initialize client that will be used to create and send requests.