Amazon SageMaker Model Cards

For more information about using model cards with the SageMaker Python SDK, see Amazon SageMaker Model Cards in the Amazon SageMaker Developer Guide.

class sagemaker.model_card.AdditionalInformation(ethical_considerations=None, caveats_and_recommendations=None, custom_details=None)

Bases: sagemaker.model_card.helpers._DefaultToRequestDict, sagemaker.model_card.helpers._DefaultFromDict

Additional information for a model card.

Initialize an Additional Information object.

Parameters
  • ethical_considerations (str, optional) – Any ethical considerations to document about the model (default: None).

  • caveats_and_recommendations (str, optional) – Caveats and recommendations for those who might use this model in their applications (default: None).

  • custom_details (dict, optional) – Any additional custom information to document about the model (default: None).

class sagemaker.model_card.Environment(container_image)

Bases: sagemaker.model_card.helpers._DefaultToRequestDict, sagemaker.model_card.helpers._DefaultFromDict

Training/inference environment.

Initialize an Environment object.

Parameters

container_image (list[str]) – A list of SageMaker training/inference image URIs. The maximum list length is 15.

class sagemaker.model_card.EvaluationJob(name, evaluation_observation=None, evaluation_job_arn=None, datasets=None, metadata=None, metric_groups=None)

Bases: sagemaker.model_card.helpers._DefaultToRequestDict, sagemaker.model_card.helpers._DefaultFromDict

Overview of an evaluation job.

Initialize an Evaluation Job object.

Parameters
  • name (str) – The evaluation job name.

  • evaluation_observation (str, optional) – Any observations made during model evaluation (default: None).

  • evaluation_job_arn (str, optional) – The Amazon Resource Name (ARN) of the evaluation job (default: None).

  • datasets (List[str], optional) – Evaluation dataset locations. Maximum list length is 10 (default: None).

  • metadata (Optional[dict], optional) – Additional attributes associated with the evaluation results (default: None).

  • metric_groups (List[MetricGroup], optional) – An evaluation Metric Group object (default: None).

class sagemaker.model_card.Function(function=None, facet=None, condition=None)

Bases: sagemaker.model_card.helpers._DefaultToRequestDict, sagemaker.model_card.helpers._DefaultFromDict

Function details.

Initialize a Function object.

Parameters
  • function (ObjectiveFunctionEnum or str, optional) – The optimization direction of the model’s objective function. It is highly recommended to use sagemaker.model_card.ObjectiveFunctionEnum. Possible values include: ObjectiveFunctionEnum.MAXIMIZE (“Maximize”) or ObjectiveFunctionEnum.MINIMIZE (“Minimize”) (default: None).

  • facet (FacetEnum or str, optional) – The metric of the model’s objective function. For example, loss or rmse. It is highly recommended to use sagemaker.model_card.FacetEnum. Possible values include:, FacetEnum.ACCURACY (“Accuracy”), FacetEnum.AUC (“AUC”), FacetEnum.LOSS (“Loss”), FacetEnum.MAE (“MAE”), or FacetEnum.RMSE (“RMSE”) (default: None).

  • condition (str, optional) – An optional description of any conditions of your objective function metric (default: None).

class sagemaker.model_card.IntendedUses(purpose_of_model=None, intended_uses=None, factors_affecting_model_efficiency=None, risk_rating=<RiskRatingEnum.UNKNOWN: 'Unknown'>, explanations_for_risk_rating=None)

Bases: sagemaker.model_card.helpers._DefaultToRequestDict, sagemaker.model_card.helpers._DefaultFromDict

The intended uses of a model.

Initialize an Intended Uses object.

Parameters
  • purpose_of_model (str, optional) – The general purpose of this model (default: None).

  • intended_uses (str, optional) – The intended use cases for this model (default: None).

  • factors_affecting_model_efficiency (str, optional) – Factors affecting model efficacy (default: None).

  • risk_rating (RiskRatingEnum or str, optional) – Your organization’s risk rating for this model. It is highly recommended to use sagemaker.model_card.RiskRatingEnum. Possible values include: RiskRatingEnum.HIGH (“High”), RiskRatingEnum.LOW (“Low”), RiskRatingEnum.MEDIUM (“Medium”), or RiskRatingEnum.UNKNOWN (“Unknown”). Defaults to RiskRatingEnum.UNKNOWN.

  • explanations_for_risk_rating (str, optional) – An explanation of why your organization categorizes this model with this risk rating (default: None).

class sagemaker.model_card.Metric(name, type, value, notes=None, x_axis_name=None, y_axis_name=None)

Bases: sagemaker.model_card.helpers._DefaultToRequestDict, sagemaker.model_card.helpers._DefaultFromDict

Metric data.

Initialize a Metric object.

Parameters
  • name (str) – The name of the metric.

  • type (str or MetricTypeEnum) – It is highly recommended to use sagemaker.model_card.MetricTypeEnum. Possible values include: MetricTypeEnum.BAR_CHART (“bar_char”), MetricTypeEnum.BOOLEAN (“boolean”), MetricTypeEnum.LINEAR_GRAPH (“linear_graph”), MetricTypeEnum.MATRIX (“matrix”), MetricTypeEnum.NUMBER (“number”), or MetricTypeEnum.STRING (“string”).

  • value (int or float or str or bool or List) – The datatype of the metric. The metric’s value must be compatible with the metric’s type.

  • notes (str, optional) – Any notes to add to the metric (default: None).

  • x_axis_name (str, optional) – The name of the x axis (default: None).

  • y_axis_name (str, optional) – The name of the y axis (default: None).

class sagemaker.model_card.MetricGroup(name, metric_data=None)

Bases: sagemaker.model_card.helpers._DefaultToRequestDict, sagemaker.model_card.helpers._DefaultFromDict

Group of metric data

Initialize a Metric Group object.

Parameters
  • name (str) – The metric group name.

  • metric_data (List[Metric]) – A list of Metric objects.

class sagemaker.model_card.ModelCard(name, status=<ModelCardStatusEnum.DRAFT: 'Draft'>, arn=None, version=None, created_time=None, created_by=None, last_modified_time=None, last_modified_by=None, model_overview=None, intended_uses=None, training_details=None, evaluation_details=None, additional_information=None, sagemaker_session=None)

Bases: object

Use an Amazon SageMaker Model Card to document qualitative and quantitative information about a model.

Initialize an Amazon SageMaker Model Card.

Parameters
  • name (str) – The unique name of the model card.

  • status (ModelCardStatusEnum or str, optional) – Your organization’s approval status of the model card. It is highly recommended to use sagemaker.model_card.ModelCardStatusEnum. Possible values include: ModelCardStatusEnum.APPROVED (“Approved”), ModelCardStatusEnum.ARCHIVED (“Archived”), ModelCardStatusEnum.DRAFT (“Draft”), or ModelCardStatusEnum.PENDING_REVIEW (“PendingReview”). Defaults to ModelCardStatusEnum.DRAFT.

  • arn (str, optional) – The Amazon Resource Name (ARN) of the model card (default: None).

  • version (int, optional) – The model card version (default: None).

  • created_time (datetime, optional) – The date/time that you created the model card (default: None).

  • created_by (dict, optional) – The group or individual that created the model card (default: None).

  • last_modified_time (datetime, optional) – The last time that the model card was modified (default: None).

  • last_modified_by (dict, optional) – The group or individual that last modified the model card (default: None).

  • model_overview (ModelOverview, optional) – An overview of the model (default: None).

  • intended_uses (IntendedUses, optional) – The intended uses of the model (default: None).

  • training_details (TrainingDetails, optional) – The training details of the model (default: None).

  • evaluation_details (List[EvaluationJob], optional) – The evaluation details of the model (default: None).

  • additional_information (AdditionalInformation, optional) – Additional information about the model (default: None).

  • sagemaker_session (Session, optional) – A SageMaker Session object, used for SageMaker interactions (default: None). If not specified, a SageMaker Session is created using the default AWS configuration chain.

class sagemaker.model_card.ModelOverview(model_id=None, model_name=None, model_description=None, model_version=None, problem_type=None, algorithm_type=None, model_creator=None, model_owner=None, model_artifact=None, inference_environment=None)

Bases: sagemaker.model_card.helpers._DefaultToRequestDict, sagemaker.model_card.helpers._DefaultFromDict

An overview of the model.

Initialize a Model Overview object.

Parameters
  • model_id (str, optional) – A SageMaker Model ARN or non-SageMaker Model ID (default: None).

  • model_name (str, optional) – A unique name for the model (default: None).

  • model_description (str, optional) – A description of the model (default: None).

  • model_version (int or float, optional) – The version of the model (default: None).

  • problem_type (str, optional) – The type of problem that the model solves. For example, “Binary Classification”, “Multiclass Classification”, “Linear Regression”, “Computer Vision”, or “Natural Language Processing” (default: None).

  • algorithm_type (str, optional) – The algorithm used to solve the problem type (default: None).

  • model_creator (str, optional) – The organization, research group, or authors that created the model (default: None).

  • model_owner (str, optional) – The individual or group that maintains the model in your organization (default: None).

  • model_artifact (List[str], optional) – A list of model artifact location URIs. The maximum list size is 15. (default: None).

  • inference_environment (Environment, optional) – An overview of the model’s inference environment (default: None).

class sagemaker.model_card.ObjectiveFunction(function, notes=None)

Bases: sagemaker.model_card.helpers._DefaultToRequestDict, sagemaker.model_card.helpers._DefaultFromDict

The objective function that is optimized during model training.

Initialize an Objective Function object.

Parameters
  • function (Function) – A Function object that details optimization direction, metric, and additional descriptions.

  • notes (str, optional) – Notes about the objective function, including other considerations for possible objective functions (default: None).

class sagemaker.model_card.TrainingDetails(objective_function=None, training_observations=None, training_job_details=None)

Bases: sagemaker.model_card.helpers._DefaultToRequestDict, sagemaker.model_card.helpers._DefaultFromDict

The overview of model training.

Initialize a TrainingDetails object.

Parameters
  • objective_function (ObjectiveFunction, optional) – The objective function that is optimized during training (default: None).

  • training_observations (str, optional) – Any observations about training (default: None).

  • training_job_details (TrainingJobDetails, optional) – Details about any associated training jobs (default: None).

class sagemaker.model_card.TrainingJobDetails(training_arn=None, training_datasets=None, training_environment=None, training_metrics=None, user_provided_training_metrics=None)

Bases: sagemaker.model_card.helpers._DefaultToRequestDict, sagemaker.model_card.helpers._DefaultFromDict

The overview of a training job.

Initialize a Training Job Details object.

Parameters
  • training_arn (str, optional) – The SageMaker training job Amazon Resource Name (ARN) (default: None).

  • training_datasets (List[str], optional) – The location of the datasets used to train the model. The maximum list size is 15. (default: None).

  • training_environment (Environment, optional) – The SageMaker training image URI. (default: None).

  • training_metrics (list[TrainingMetric], optional) – SageMaker training job results. The maximum training_metrics list length is 50 (default: None).

  • user_provided_training_metrics (list[TrainingMetric], optional) – Custom training job results. The maximum user_provided_training_metrics list length is 50 (default: None).