ModelBiasMonitor: Amazon SageMaker model monitor to monitor bias metrics of an...

ModelBiasMonitorR Documentation

Amazon SageMaker model monitor to monitor bias metrics of an endpoint.

Description

Please see the 'initialize' method of its base class for how to instantiate it.

Super classes

sagemaker.mlcore::ModelMonitor -> sagemaker.mlcore::ClarifyModelMonitor -> ModelBiasMonitor

Public fields

JOB_DEFINITION_BASE_NAME

Model definition base name

Methods

Public methods

Inherited methods

Method monitoring_type()

Type of the monitoring job.

Usage
ModelBiasMonitor$monitoring_type()

Method suggest_baseline()

Suggests baselines for use with Amazon SageMaker Model Monitoring Schedules.

Usage
ModelBiasMonitor$suggest_baseline(
  data_config,
  bias_config,
  model_config,
  model_predicted_label_config = NULL,
  wait = FALSE,
  logs = FALSE,
  job_name = NULL,
  kms_key = NULL
)
Arguments
data_config

(:class:'~sagemaker.clarify.DataConfig'): Config of the input/output data.

bias_config

(:class:'~sagemaker.clarify.BiasConfig'): Config of sensitive groups.

model_config

(:class:'~sagemaker.clarify.ModelConfig'): Config of the model and its endpoint to be created.

model_predicted_label_config

(:class:'~sagemaker.clarify.ModelPredictedLabelConfig'): Config of how to extract the predicted label from the model output.

wait

(bool): Whether the call should wait until the job completes (default: False).

logs

(bool): Whether to show the logs produced by the job. Only meaningful when wait is True (default: False).

job_name

(str): Processing job name. If not specified, the processor generates a default job name, based on the image name and current timestamp.

kms_key

(str): The ARN of the KMS key that is used to encrypt the user code file (default: None).

Returns

sagemaker.processing.ProcessingJob: The ProcessingJob object representing the baselining job.


Method create_monitoring_schedule()

Creates a monitoring schedule.

Usage
ModelBiasMonitor$create_monitoring_schedule(
  endpoint_input,
  ground_truth_input,
  analysis_config = NULL,
  output_s3_uri = NULL,
  constraints = NULL,
  monitor_schedule_name = NULL,
  schedule_cron_expression = NULL,
  enable_cloudwatch_metrics = TRUE
)
Arguments
endpoint_input

(str or sagemaker.model_monitor.EndpointInput): The endpoint to monitor. This can either be the endpoint name or an EndpointInput.

ground_truth_input

(str): S3 URI to ground truth dataset.

analysis_config

(str or BiasAnalysisConfig): URI to analysis_config for the bias job. If it is None then configuration of the latest baselining job will be reused, but if no baselining job then fail the call.

output_s3_uri

(str): S3 destination of the constraint_violations and analysis result. Default: "s3://<default_session_bucket>/<job_name>/output"

constraints

(sagemaker.model_monitor.Constraints or str): If provided it will be used for monitoring the endpoint. It can be a Constraints object or an S3 uri pointing to a constraints JSON file.

monitor_schedule_name

(str): Schedule name. If not specified, the processor generates a default job name, based on the image name and current timestamp.

schedule_cron_expression

(str): The cron expression that dictates the frequency that this job run. See sagemaker.model_monitor.CronExpressionGenerator for valid expressions. Default: Daily.

enable_cloudwatch_metrics

(bool): Whether to publish cloudwatch metrics as part of the baselining or monitoring jobs.


Method update_monitoring_schedule()

Updates the existing monitoring schedule. If more options than schedule_cron_expression are to be updated, a new job definition will be created to hold them. The old job definition will not be deleted.

Usage
ModelBiasMonitor$update_monitoring_schedule(
  endpoint_input = NULL,
  ground_truth_input = NULL,
  analysis_config = NULL,
  output_s3_uri = NULL,
  constraints = NULL,
  schedule_cron_expression = NULL,
  enable_cloudwatch_metrics = NULL,
  role = NULL,
  instance_count = NULL,
  instance_type = NULL,
  volume_size_in_gb = NULL,
  volume_kms_key = NULL,
  output_kms_key = NULL,
  max_runtime_in_seconds = NULL,
  env = NULL,
  network_config = NULL
)
Arguments
endpoint_input

(str or sagemaker.model_monitor.EndpointInput): The endpoint to monitor. This can either be the endpoint name or an EndpointInput.

ground_truth_input

(str): S3 URI to ground truth dataset.

analysis_config

(str or BiasAnalysisConfig): URI to analysis_config for the bias job. If it is None then configuration of the latest baselining job will be reused, but if no baselining job then fail the call.

output_s3_uri

(str): S3 destination of the constraint_violations and analysis result. Default: "s3://<default_session_bucket>/<job_name>/output"

constraints

(sagemaker.model_monitor.Constraints or str): If provided it will be used for monitoring the endpoint. It can be a Constraints object or an S3 uri pointing to a constraints JSON file.

schedule_cron_expression

(str): The cron expression that dictates the frequency that this job run. See sagemaker.model_monitor.CronExpressionGenerator for valid expressions. Default: Daily.

enable_cloudwatch_metrics

(bool): Whether to publish cloudwatch metrics as part of the baselining or monitoring jobs.

role

(str): An AWS IAM role. The Amazon SageMaker jobs use this role.

instance_count

(int): The number of instances to run the jobs with.

instance_type

(str): Type of EC2 instance to use for the job, for example, 'ml.m5.xlarge'.

volume_size_in_gb

(int): Size in GB of the EBS volume to use for storing data during processing (default: 30).

volume_kms_key

(str): A KMS key for the job's volume.

output_kms_key

(str): The KMS key id for the job's outputs.

max_runtime_in_seconds

(int): Timeout in seconds. After this amount of time, Amazon SageMaker terminates the job regardless of its current status. Default: 3600

env

(dict): Environment variables to be passed to the job.

network_config

(sagemaker.network.NetworkConfig): A NetworkConfig object that configures network isolation, encryption of inter-container traffic, security group IDs, and subnets.


Method delete_monitoring_schedule()

Deletes the monitoring schedule and its job definition.

Usage
ModelBiasMonitor$delete_monitoring_schedule()

Method attach()

Sets this object's schedule name to the name provided. This allows subsequent describe_schedule or list_executions calls to point to the given schedule.

Usage
ModelBiasMonitor$attach(monitor_schedule_name, sagemaker_session = NULL)
Arguments
monitor_schedule_name

(str): The name of the schedule to attach to.

sagemaker_session

(sagemaker.session.Session): Session object which manages interactions with Amazon SageMaker APIs and any other AWS services needed. If not specified, one is created using the default AWS configuration chain.


Method clone()

The objects of this class are cloneable with this method.

Usage
ModelBiasMonitor$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


DyfanJones/sagemaker-r-mlcore documentation built on May 3, 2022, 10:08 a.m.