Skip to content

Commit

Permalink
fix: add clarity to parameters per user feedback (#886)
Browse files Browse the repository at this point in the history
* fix: add clarity per user feedback

* fix: review

* fix: review

* fix: TW review

* lint: fix wsp

* fix: param name

* fix: code review

Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
  • Loading branch information
andrewferlitsch and kweinmeister committed Dec 7, 2021
1 parent fda942f commit 37ee0a1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
15 changes: 13 additions & 2 deletions samples/model-builder/predict_tabular_classification_sample.py
Expand Up @@ -20,11 +20,22 @@

# [START aiplatform_sdk_predict_tabular_classification_sample]
def predict_tabular_classification_sample(
project: str, location: str, endpoint: str, instances: List[Dict],
project: str,
location: str,
endpoint_name: str,
instances: List[Dict],
):
'''
Args
project: Your project ID or project number.
location: Region where Endpoint is located. For example, 'us-central1'.
endpoint_name: A fully qualified endpoint name or endpoint ID. Example: "projects/123/locations/us-central1/endpoints/456" or
"456" when project and location are initialized or passed.
instances: A list of one or more instances (examples) to return a prediction for.
'''
aiplatform.init(project=project, location=location)

endpoint = aiplatform.Endpoint(endpoint)
endpoint = aiplatform.Endpoint(endpoint_name)

response = endpoint.predict(instances=instances)

Expand Down
Expand Up @@ -22,7 +22,7 @@ def test_predict_tabular_classification_sample(mock_sdk_init, mock_get_endpoint)
predict_tabular_classification_sample.predict_tabular_classification_sample(
project=constants.PROJECT,
location=constants.LOCATION,
endpoint=constants.ENDPOINT_NAME,
endpoint_name=constants.ENDPOINT_NAME,
instances=constants.PREDICTION_TABULAR_CLASSIFICATION_INSTANCE,
)

Expand Down
7 changes: 5 additions & 2 deletions samples/model-builder/predict_tabular_regression_sample.py
Expand Up @@ -19,11 +19,14 @@

# [START aiplatform_sdk_predict_tabular_regression_sample]
def predict_tabular_regression_sample(
project: str, location: str, endpoint: str, instances: List[Dict],
project: str,
location: str,
endpoint_name: str,
instances: List[Dict],
):
aiplatform.init(project=project, location=location)

endpoint = aiplatform.Endpoint(endpoint)
endpoint = aiplatform.Endpoint(endpoint_name)

response = endpoint.predict(instances=instances)

Expand Down
Expand Up @@ -22,7 +22,7 @@ def test_predict_tabular_regression_sample(mock_sdk_init, mock_get_endpoint):
predict_tabular_regression_sample.predict_tabular_regression_sample(
project=constants.PROJECT,
location=constants.LOCATION,
endpoint=constants.ENDPOINT_NAME,
endpoint_name=constants.ENDPOINT_NAME,
instances=constants.PREDICTION_TABULAR_REGRESSOIN_INSTANCE,
)

Expand Down

0 comments on commit 37ee0a1

Please sign in to comment.