1
0
Fork 0
mirror of https://github.com/imjasonh/gcloud-help synced 2026-07-08 02:25:19 +00:00
gcloud-help/gcloud/ai/model-monitoring-jobs/create

306 lines
13 KiB
Text
Raw Permalink Normal View History

2022-03-01 04:29:52 +00:00
NAME
gcloud ai model-monitoring-jobs create - create a new Vertex AI model
monitoring job
SYNOPSIS
gcloud ai model-monitoring-jobs create --display-name=DISPLAY_NAME
--emails=[EMAILS,...] --endpoint=ENDPOINT
--prediction-sampling-rate=PREDICTION_SAMPLING_RATE
[--analysis-instance-schema=ANALYSIS_INSTANCE_SCHEMA]
2022-05-11 08:44:01 +00:00
[--[no-]anomaly-cloud-logging] [--labels=[KEY=VALUE,...]]
[--log-ttl=LOG_TTL]
2022-03-01 04:29:52 +00:00
[--monitoring-frequency=MONITORING_FREQUENCY; default=24]
2024-01-10 10:17:49 +00:00
[--notification-channels=[NOTIFICATION_CHANNELS,...]]
2022-03-01 04:29:52 +00:00
[--predict-instance-schema=PREDICT_INSTANCE_SCHEMA] [--region=REGION]
[--sample-predict-request=SAMPLE_PREDICT_REQUEST]
[--kms-key=KMS_KEY : --kms-keyring=KMS_KEYRING
--kms-location=KMS_LOCATION --kms-project=KMS_PROJECT]
[--monitoring-config-from-file=MONITORING_CONFIG_FROM_FILE
| --feature-attribution-thresholds=[KEY=VALUE,...]
--feature-thresholds=[KEY=VALUE,...] --target-field=TARGET_FIELD
--training-sampling-rate=TRAINING_SAMPLING_RATE;
default=1.0 --bigquery-uri=BIGQUERY_URI | --dataset=DATASET
| --data-format=DATA_FORMAT --gcs-uris=[GCS_URIS,...]]
[GCLOUD_WIDE_FLAG ...]
DESCRIPTION
Create a new Vertex AI model monitoring job.
EXAMPLES
To create a model deployment monitoring job under project example in region
us-central1 for endpoint 123, run:
$ gcloud ai model-monitoring-jobs create --project=example \
--region=us-central1 --display-name=my_monitoring_job \
--emails=a@gmail.com,b@gmail.com --endpoint=123 \
--prediction-sampling-rate=0.2
To create a model deployment monitoring job with drift detection for all
the deployed models under the endpoint 123, run:
$ gcloud ai model-monitoring-jobs create --project=example \
--region=us-central1 --display-name=my_monitoring_job \
--emails=a@gmail.com,b@gmail.com --endpoint=123 \
--prediction-sampling-rate=0.2 \
--feature-thresholds=feat1=0.1,feat2=0.2,feat3=0.2,feat4=0.3
To create a model deployment monitoring job with skew detection for all the
deployed models under the endpoint 123, with training dataset from Google
Cloud Storage, run:
$ gcloud ai model-monitoring-jobs create --project=example \
--region=us-central1 --display-name=my_monitoring_job \
--emails=a@gmail.com,b@gmail.com --endpoint=123 \
--prediction-sampling-rate=0.2 \
--feature-thresholds=feat1=0.1,feat2=0.2,feat3=0.2,feat4=0.3 \
--target-field=price --data-format=csv \
--gcs-uris=gs://test-bucket/dataset.csv
To create a model deployment monitoring job with skew detection for all the
deployed models under the endpoint 123, with training dataset from Vertex
AI dataset 456, run:
$ gcloud ai model-monitoring-jobs create --project=example \
--region=us-central1 --display-name=my_monitoring_job \
--emails=a@gmail.com,b@gmail.com --endpoint=123 \
--prediction-sampling-rate=0.2 \
--feature-thresholds=feat1=0.1,feat2=0.2,feat3=0.2,feat4=0.3 \
--target-field=price --dataset=456
To create a model deployment monitoring job with different drift detection
or skew detection for different deployed models, run:
$ gcloud ai model-monitoring-jobs create --project=example \
--region=us-central1 --display-name=my_monitoring_job \
--emails=a@gmail.com,b@gmail.com --endpoint=123 \
--prediction-sampling-rate=0.2 \
--monitoring-config-from-file=your_objective_config.yaml
After creating the monitoring job, be sure to send some predict requests.
It will be used to generate some metadata for analysis purpose, like
predict and analysis instance schema.
REQUIRED FLAGS
--display-name=DISPLAY_NAME
Display name of the model deployment monitoring job.
--emails=[EMAILS,...]
Comma-separated email address list. e.g.
--emails=a@gmail.com,b@gmail.com
--endpoint=ENDPOINT
Id of the endpoint.
--prediction-sampling-rate=PREDICTION_SAMPLING_RATE
Prediction sampling rate.
OPTIONAL FLAGS
--analysis-instance-schema=ANALYSIS_INSTANCE_SCHEMA
YAML schema file uri(Google Cloud Storage) describing the format of a
single instance that you want Tensorflow Data Validation (TFDV) to
analyze.
2022-05-11 08:44:01 +00:00
--[no-]anomaly-cloud-logging
If true, anomaly will be sent to Cloud Logging. Use
--anomaly-cloud-logging to enable and --no-anomaly-cloud-logging to
disable.
2022-03-01 04:29:52 +00:00
--labels=[KEY=VALUE,...]
List of label KEY=VALUE pairs to add.
Keys must start with a lowercase character and contain only hyphens
(-), underscores (_), lowercase characters, and numbers. Values must
contain only hyphens (-), underscores (_), lowercase characters, and
numbers.
--log-ttl=LOG_TTL
TTL of BigQuery tables in user projects which stores logs(Day-based
unit).
--monitoring-frequency=MONITORING_FREQUENCY; default=24
Monitoring frequency, unit is 1 hour.
2024-01-10 10:17:49 +00:00
--notification-channels=[NOTIFICATION_CHANNELS,...]
Comma-separated notification channel list. e.g.
--notification-channels=projects/fake-project/notificationChannels/123,projects/fake-project/notificationChannels/456
2022-03-01 04:29:52 +00:00
--predict-instance-schema=PREDICT_INSTANCE_SCHEMA
YAML schema file uri(Google Cloud Storage) describing the format of a
single instance, which are given to format this Endpoint's prediction.
If not set, predict schema will be generated from collected predict
requests.
Region resource - Cloud region to create model deployment monitoring job.
This represents a Cloud resource. (NOTE) Some attributes are not given
2023-05-04 10:43:54 +00:00
arguments in this group but can be set in other ways.
To set the project attribute:
2022-03-01 04:29:52 +00:00
◆ provide the argument --region on the command line with a fully
specified name;
◆ set the property ai/region with a fully specified name;
◆ choose one from the prompted list of available regions with a fully
specified name;
◆ provide the argument --project on the command line;
◆ set the property core/project.
2026-02-11 11:28:25 +00:00
--region=REGION
ID of the region or fully qualified identifier for the region.
2023-05-04 10:43:54 +00:00
2026-02-11 11:28:25 +00:00
To set the region attribute:
◆ provide the argument --region on the command line;
◆ set the property ai/region;
◆ choose one from the prompted list of available regions.
2022-03-01 04:29:52 +00:00
--sample-predict-request=SAMPLE_PREDICT_REQUEST
Path to a local file containing the body of a JSON object. Same format
as [PredictRequest.instances][], this can be set as a replacement of
predict-instance-schema. If not set, predict schema will be generated
from collected predict requests.
An example of a JSON request:
{"x": [1, 2], "y": [3, 4]}
Key resource - The Cloud KMS (Key Management Service) cryptokey that will
be used to protect the model deployment monitoring job. The 'Vertex AI
Service Agent' service account must hold permission 'Cloud KMS CryptoKey
Encrypter/Decrypter'. The arguments in this group can be used to specify
the attributes of this resource.
2026-02-11 11:28:25 +00:00
--kms-key=KMS_KEY
ID of the key or fully qualified identifier for the key.
2023-05-04 10:43:54 +00:00
2026-02-11 11:28:25 +00:00
To set the kms-key attribute:
◆ provide the argument --kms-key on the command line.
2022-03-01 04:29:52 +00:00
2026-02-11 11:28:25 +00:00
This flag argument must be specified if any of the other arguments in
this group are specified.
2022-03-01 04:29:52 +00:00
2026-02-11 11:28:25 +00:00
--kms-keyring=KMS_KEYRING
The KMS keyring of the key.
2023-05-04 10:43:54 +00:00
2026-02-11 11:28:25 +00:00
To set the kms-keyring attribute:
◆ provide the argument --kms-key on the command line with a fully
specified name;
◆ provide the argument --kms-keyring on the command line.
2022-03-01 04:29:52 +00:00
2026-02-11 11:28:25 +00:00
--kms-location=KMS_LOCATION
The Google Cloud location for the key.
2023-05-04 10:43:54 +00:00
2026-02-11 11:28:25 +00:00
To set the kms-location attribute:
◆ provide the argument --kms-key on the command line with a fully
specified name;
◆ provide the argument --kms-location on the command line.
2022-03-01 04:29:52 +00:00
2026-02-11 11:28:25 +00:00
--kms-project=KMS_PROJECT
The Google Cloud project for the key.
2023-05-04 10:43:54 +00:00
2026-02-11 11:28:25 +00:00
To set the kms-project attribute:
◆ provide the argument --kms-key on the command line with a fully
specified name;
◆ provide the argument --kms-project on the command line;
◆ set the property core/project.
2022-03-01 04:29:52 +00:00
At most one of these can be specified:
--monitoring-config-from-file=MONITORING_CONFIG_FROM_FILE
Path to the model monitoring objective config file. This file should
be a YAML document containing a
ModelDeploymentMonitoringJob(https://cloud.google.com/vertex-ai/docs/reference/rest/v1beta1/projects.locations.modelDeploymentMonitoringJobs#ModelDeploymentMonitoringJob),
but only the ModelDeploymentMonitoringObjectiveConfig needs to be
configured.
Note: Only one of --monitoring-config-from-file and other objective
config set, like --feature-thresholds,
--feature-attribution-thresholds needs to be set.
Example(YAML):
modelDeploymentMonitoringObjectiveConfigs:
- deployedModelId: '5251549009234886656'
objectiveConfig:
trainingDataset:
dataFormat: csv
gcsSource:
uris:
- gs://fake-bucket/training_data.csv
targetField: price
trainingPredictionSkewDetectionConfig:
skewThresholds:
feat1:
value: 0.9
feat2:
value: 0.8
- deployedModelId: '2945706000021192704'
objectiveConfig:
predictionDriftDetectionConfig:
driftThresholds:
feat1:
value: 0.3
feat2:
value: 0.4
2026-02-11 11:28:25 +00:00
Or at least one of these can be specified:
2022-03-01 04:29:52 +00:00
2026-02-11 11:28:25 +00:00
--feature-attribution-thresholds=[KEY=VALUE,...]
List of feature-attribution score threshold value pairs(Apply for
all the deployed models under the endpoint, if you want to specify
different thresholds for different deployed model, please use flag
--monitoring-config-from-file or call API directly). If only
feature name is set, the default threshold value would be 0.3.
2022-03-01 04:29:52 +00:00
2026-02-11 11:28:25 +00:00
For example:
feature-attribution-thresholds=feat1=0.1,feat2,feat3=0.2
2022-03-01 04:29:52 +00:00
2026-02-11 11:28:25 +00:00
--feature-thresholds=[KEY=VALUE,...]
List of feature-threshold value pairs(Apply for all the deployed
models under the endpoint, if you want to specify different
thresholds for different deployed model, please use flag
--monitoring-config-from-file or call API directly). If only
feature name is set, the default threshold value would be 0.3.
2022-03-01 04:29:52 +00:00
2026-02-11 11:28:25 +00:00
For example: --feature-thresholds=feat1=0.1,feat2,feat3=0.2
2022-03-01 04:29:52 +00:00
2026-02-11 11:28:25 +00:00
--target-field=TARGET_FIELD
Target field name the model is to predict. Must be provided if
you'd like to do training-prediction skew detection.
2022-03-01 04:29:52 +00:00
2026-02-11 11:28:25 +00:00
--training-sampling-rate=TRAINING_SAMPLING_RATE; default=1.0
Training Dataset sampling rate.
2022-03-01 04:29:52 +00:00
2026-02-11 11:28:25 +00:00
At most one of these can be specified:
2022-03-01 04:29:52 +00:00
2026-02-11 11:28:25 +00:00
--bigquery-uri=BIGQUERY_URI
BigQuery table of the unmanaged Dataset used to train this Model.
For example: bq://projectId.bqDatasetId.bqTableId.
2022-03-01 04:29:52 +00:00
2026-02-11 11:28:25 +00:00
--dataset=DATASET
Id of Vertex AI Dataset used to train this Model.
2022-03-01 04:29:52 +00:00
2026-02-11 11:28:25 +00:00
Or at least one of these can be specified:
--data-format=DATA_FORMAT
Data format of the dataset, must be provided if the input is
from Google Cloud Storage. The possible formats are: tf-record,
csv
--gcs-uris=[GCS_URIS,...]
Comma-separated Google Cloud Storage uris of the unmanaged
Datasets used to train this Model.
2022-03-01 04:29:52 +00:00
GCLOUD WIDE FLAGS
These flags are available to all commands: --access-token-file, --account,
--billing-project, --configuration, --flags-file, --flatten, --format,
--help, --impersonate-service-account, --log-http, --project, --quiet,
--trace-token, --user-output-enabled, --verbosity.
Run $ gcloud help for details.
NOTES
These variants are also available:
$ gcloud alpha ai model-monitoring-jobs create
$ gcloud beta ai model-monitoring-jobs create