ModelMonitor | R Documentation |
Use this class when you want to provide your own container image containing the code you'd like to run, in order to produce your own statistics and constraint validation files. For a more guided experience, consider using the DefaultModelMonitor class instead.
new()
Initializes a “Monitor“ instance. The Monitor handles baselining datasets and creating Amazon SageMaker Monitoring Schedules to monitor SageMaker endpoints.
ModelMonitor$new( role = NULL, image_uri = NULL, instance_count = 1, instance_type = "ml.m5.xlarge", entrypoint = NULL, volume_size_in_gb = 30, volume_kms_key = NULL, output_kms_key = NULL, max_runtime_in_seconds = NULL, base_job_name = NULL, sagemaker_session = NULL, env = NULL, tags = NULL, network_config = NULL )
role
(str): An AWS IAM role. The Amazon SageMaker jobs use this role.
image_uri
(str): The uri of the image to use for the jobs started by the Monitor.
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'.
entrypoint
([str]): The entrypoint for the job.
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
base_job_name
(str): Prefix for the job name. If not specified, a default name is generated based on the training image name and current timestamp.
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.
env
(dict): Environment variables to be passed to the job.
tags
([dict]): List of tags 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.
run_baseline()
Run a processing job meant to baseline your dataset.
ModelMonitor$run_baseline( baseline_inputs, output, arguments = NULL, wait = TRUE, logs = TRUE, job_name = NULL )
baseline_inputs
([sagemaker.processing.ProcessingInput]): Input files for the processing job. These must be provided as ProcessingInput objects.
output
(sagemaker.processing.ProcessingOutput): Destination of the constraint_violations and statistics json files.
arguments
([str]): A list of string arguments to be passed to a processing job.
wait
(bool): Whether the call should wait until the job completes (default: True).
logs
(bool): Whether to show the logs produced by the job. Only meaningful when wait is True (default: True).
job_name
(str): Processing job name. If not specified, the processor generates a default job name, based on the image name and current timestamp.
create_monitoring_schedule()
Creates a monitoring schedule to monitor an Amazon SageMaker Endpoint. If constraints and statistics are provided, or if they are able to be retrieved from a previous baselining job associated with this monitor, those will be used. If constraints and statistics cannot be automatically retrieved, baseline_inputs will be required in order to kick off a baselining job.
ModelMonitor$create_monitoring_schedule( endpoint_input, output, statistics = NULL, constraints = NULL, monitor_schedule_name = NULL, schedule_cron_expression = NULL )
endpoint_input
(str or sagemaker.model_monitor.EndpointInput): The endpoint to monitor. This can either be the endpoint name or an EndpointInput.
output
(sagemaker.model_monitor.MonitoringOutput): The output of the monitoring schedule.
statistics
(sagemaker.model_monitor.Statistic or str): If provided alongside constraints, these will be used for monitoring the endpoint. This can be a sagemaker.model_monitor.Constraints object or an S3 uri pointing to a constraints JSON file.
constraints
(sagemaker.model_monitor.Constraints or str): If provided alongside statistics, these will be used for monitoring the endpoint. This can be a sagemaker.model_monitor.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 runs at. See sagemaker.model_monitor.CronExpressionGenerator for valid expressions. Default: Daily.
update_monitoring_schedule()
Updates the existing monitoring schedule.
ModelMonitor$update_monitoring_schedule( endpoint_input = NULL, output = NULL, statistics = NULL, constraints = NULL, schedule_cron_expression = NULL, instance_count = NULL, instance_type = NULL, entrypoint = NULL, volume_size_in_gb = NULL, volume_kms_key = NULL, output_kms_key = NULL, arguments = NULL, max_runtime_in_seconds = NULL, env = NULL, network_config = NULL, role = NULL, image_uri = NULL )
endpoint_input
(str or sagemaker.model_monitor.EndpointInput): The endpoint to monitor. This can either be the endpoint name or an EndpointInput.
output
(sagemaker.model_monitor.MonitoringOutput): The output of the monitoring schedule.
statistics
(sagemaker.model_monitor.Statistic or str): If provided alongside constraints, these will be used for monitoring the endpoint. This can be a sagemaker.model_monitor.Constraints object or an S3 uri pointing to a constraints JSON file.
constraints
(sagemaker.model_monitor.Constraints or str): If provided alongside statistics, these will be used for monitoring the endpoint. This can be a sagemaker.model_monitor.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 runs at. See sagemaker.model_monitor.CronExpressionGenerator for valid expressions.
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'.
entrypoint
(str): The entrypoint for the job.
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.
arguments
([str]): A list of string arguments to be passed to a processing job.
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.
role
(str): An AWS IAM role name or ARN. The Amazon SageMaker jobs use this role.
image_uri
(str): The uri of the image to use for the jobs started by the Monitor.
start_monitoring_schedule()
Starts the monitoring schedule.
ModelMonitor$start_monitoring_schedule()
stop_monitoring_schedule()
Stops the monitoring schedule.
ModelMonitor$stop_monitoring_schedule()
delete_monitoring_schedule()
Deletes the monitoring schedule.
ModelMonitor$delete_monitoring_schedule()
baseline_statistics()
Returns a Statistics object representing the statistics json file generated by the latest baselining job.
ModelMonitor$baseline_statistics(file_name = STATISTICS_JSON_DEFAULT_FILE_NAME)
file_name
(str): The name of the .json statistics file
sagemaker.model_monitor.Statistics: The Statistics object representing the file that was generated by the job.
suggested_constraints()
Returns a Statistics object representing the constraints json file generated by the latest baselining job
ModelMonitor$suggested_constraints( file_name = CONSTRAINTS_JSON_DEFAULT_FILE_NAME )
file_name
(str): The name of the .json constraints file
sagemaker.model_monitor.Constraints:
The Constraints object representing the file that was generated by the job.
latest_monitoring_statistics()
Returns the sagemaker.model_monitor.Statistics generated by the latest monitoring execution.
ModelMonitor$latest_monitoring_statistics( file_name = STATISTICS_JSON_DEFAULT_FILE_NAME )
file_name
(str): The name of the statistics file to be retrieved. Only override if generating a custom file name.
sagemaker.model_monitoring.Statistics: The Statistics object representing the file generated by the latest monitoring execution.
latest_monitoring_constraint_violations()
Returns the sagemaker.model_monitor.ConstraintViolations generated by the latest monitoring execution.
ModelMonitor$latest_monitoring_constraint_violations( file_name = CONSTRAINT_VIOLATIONS_JSON_DEFAULT_FILE_NAME )
file_name
(str): The name of the constraint violdations file to be retrieved. Only override if generating a custom file name.
sagemaker.model_monitoring.ConstraintViolations: The ConstraintViolations object representing the file generated by the latest monitoring execution.
describe_latest_baselining_job()
Describe the latest baselining job kicked off by the suggest workflow.
ModelMonitor$describe_latest_baselining_job()
describe_schedule()
Describes the schedule that this object represents.
ModelMonitor$describe_schedule()
dict: A dictionary response with the monitoring schedule description.
list_executions()
Get the list of the latest monitoring executions in descending order of "ScheduledTime". Statistics or violations can be called following this example: Example: >>> my_executions = my_monitor.list_executions() >>> second_to_last_execution_statistics = my_executions[-1].statistics() >>> second_to_last_execution_violations = my_executions[-1].constraint_violations()
ModelMonitor$list_executions()
[sagemaker.model_monitor.MonitoringExecution]: List of MonitoringExecutions in descending order of "ScheduledTime".
attach()
Sets this object's schedule name to point to the Amazon Sagemaker Monitoring Schedule name provided. This allows subsequent describe_schedule or list_executions calls to point to the given schedule.
ModelMonitor$attach(monitor_schedule_name, sagemaker_session = NULL)
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.
monitoring_type()
Type of the monitoring job.
ModelMonitor$monitoring_type()
format()
format class
ModelMonitor$format()
clone()
The objects of this class are cloneable with this method.
ModelMonitor$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.