Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add clarity to parameters per user feedback #886

Merged
merged 8 commits into from Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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