sagemaker.core.model_monitor.dataset_format#

This module contains code related to the DatasetFormat class.

Codes are used for managing the constraints JSON file generated and consumed by Amazon SageMaker Model Monitoring Schedules.

Classes

DatasetFormat()

Represents a Dataset Format that is used when calling a DefaultModelMonitor.

MonitoringDatasetFormat()

Represents a Dataset Format that is used when calling a DefaultModelMonitor.

class sagemaker.core.model_monitor.dataset_format.DatasetFormat[source]#

Bases: object

Represents a Dataset Format that is used when calling a DefaultModelMonitor.

static csv(header=True, output_columns_position='START')[source]#

Returns a DatasetFormat JSON string for use with a DefaultModelMonitor.

Parameters:
  • header (bool) – Whether the csv dataset to baseline and monitor has a header. Default: True.

  • output_columns_position (str) – The position of the output columns. Must be one of (“START”, “END”). Default: “START”.

Returns:

JSON string containing DatasetFormat to be used by DefaultModelMonitor.

Return type:

dict

static json(lines=True)[source]#

Returns a DatasetFormat JSON string for use with a DefaultModelMonitor.

Parameters:

lines (bool) – Whether the file should be read as a json object per line. Default: True.

Returns:

JSON string containing DatasetFormat to be used by DefaultModelMonitor.

Return type:

dict

static sagemaker_capture_json()[source]#

Returns a DatasetFormat SageMaker Capture Json string for use with a DefaultModelMonitor.

Returns:

JSON string containing DatasetFormat to be used by DefaultModelMonitor.

Return type:

dict

class sagemaker.core.model_monitor.dataset_format.MonitoringDatasetFormat[source]#

Bases: object

Represents a Dataset Format that is used when calling a DefaultModelMonitor.

static csv(header=True)[source]#

Returns a DatasetFormat JSON string for use with a DefaultModelMonitor.

Parameters:

header (bool) – Whether the csv dataset to baseline and monitor has a header. Default: True.

Returns:

JSON string containing DatasetFormat to be used by DefaultModelMonitor.

Return type:

dict

static json(lines=True)[source]#

Returns a DatasetFormat JSON string for use with a DefaultModelMonitor.

Parameters:

lines (bool) – Whether the file should be read as a json object per line. Default: True.

Returns:

JSON string containing DatasetFormat to be used by DefaultModelMonitor.

Return type:

dict

static parquet()[source]#

Returns a DatasetFormat SageMaker Capture Json string for use with a DefaultModelMonitor.

Returns:

JSON string containing DatasetFormat to be used by DefaultModelMonitor.

Return type:

dict