Bring your own model to SageMaker Canvas - Amazon SageMaker

Bring your own model to SageMaker Canvas

Note

The functionality described on this page only applies to Amazon SageMaker Studio Classic. Currently, you can only share models to Canvas (or view shared Canvas models) in Studio Classic. If you’re currently using the latest version of Studio, you must run Studio Classic from within the latest version of Studio to share models to Canvas or view models shared from Canvas. For more information about accessing Studio Classic, see the Studio Classic documentation.

Business analysts can benefit from ML models already built by data scientists to solve business problems instead of creating a new model in Amazon SageMaker Canvas. However, it might be difficult to use these models outside the environments in which they are built due to technical requirements, rigidity of tools, and manual processes to import models. This often forces users to rebuild ML models, resulting in the duplication of effort and additional time and resources.

SageMaker Canvas removes these limitations so you can generate predictions in Canvas with models that you’ve trained anywhere. You can register ML models in SageMaker Model Registry, which is a metadata store for ML models, and import them into SageMaker Canvas. Additionally, you can generate predictions with models that data scientists have trained in Amazon SageMaker Autopilot or SageMaker JumpStart. Canvas users can then analyze and generate predictions from any model that has been shared with them.

After you’ve satisfied the Prerequisites, see the following sections for instructions on how to bring your own models into Canvas and generate predictions. The workflow begins in Studio Classic, where a Studio Classic user shares a model with a Canvas user. Then, the Canvas user signs in to their Canvas app to receive the shared model and generate predictions with it.

Note

You can share models trained with tabular, text, and image data to Canvas. You can't share time series models. Also, Canvas bring your own model (BYOM) only supports CPU-based models (or models that use CPU instances to make predictions).

Prerequisites

To bring your model into SageMaker Canvas, complete the following prerequisites:

  • You must have a Amazon SageMaker Studio Classic user who has onboarded to Amazon SageMaker domain. The Studio Classic user must be in the same domain as the Canvas user. Model sharing occurs when a Studio Classic user shares a model with a Canvas user from within Studio Classic. If you don’t already have a Studio Classic user set up, see the Studio Classic documentation and Onboard to Amazon SageMaker domain.

  • You must have a trained model from SageMaker Autopilot, SageMaker JumpStart, or SageMaker Model Registry. For any model that you’ve built outside of SageMaker, you must register your model in Model Registry before importing it into Canvas. For more information, see the Model Registry documentation.

  • The Canvas user with whom you want to share your model must have permission to access the Amazon S3 bucket in which you store your datasets and model artifacts. For instructions on how admins can give Canvas users the permissions they need, see Grant Users Permissions to Collaborate with Studio Classic.

  • You should also have the user profile name of the Canvas user with whom you want to collaborate. The Canvas user must be in the same Amazon SageMaker domain as your Studio Classic user. You can find a user’s profile name by using the following procedure:

    1. Open the SageMaker console at https://console.aws.amazon.com/sagemaker/.

    2. In the navigation panel, choose Domains.

    3. From the list of Domains, choose your domain. This opens the domain details page, where you can find all of the User profiles for the domain.

    Keep the user profile name ready for the first step of the following tutorial.

If your SageMaker Canvas app is running in a private customer VPC, any Autopilot models shared from Studio Classic must use Autopilot HPO mode to support generating predictions in Canvas. For more information about HPO mode, see Training modes and algorithm support in the Autopilot documentation.

Note

If you want feedback from data scientists on a model built inside Canvas, see Collaborate with data scientists, where a Canvas user shares a model with a Studio Classic user, and the Studio Classic user shares feedback or model updates.

Studio Classic users: Share a model to SageMaker Canvas

You should have a model trained with tabular data that you’re ready to share with Canvas users. See the following sections for information on how to share your models from features within Studio Classic.

You can share a model to Canvas from Amazon SageMaker Autopilot in Studio Classic. Autopilot is a feature that enables you to train and and deploy your models in SageMaker.

You need to have a Studio Classic user and a trained model ready to share from Autopilot. For more information on how to set up Studio Classic, see the Studio Classic documentation. For more information about Autopilot, see the Autopilot documentation.

To share a model from Autopilot to Canvas, use the following procedure.

  1. Open your Amazon SageMaker Studio Classic application.

  2. In the side navigation pane, choose the Home icon ( Home icon in Studio Classic ).

  3. In the side navigation bar of Studio Classic, choose AutoML to open Autopilot.

  4. On the Autopilot page, select the Autopilot model that you want to share with the Canvas user. You can only share one model at a time.

  5. From the Autopilot job details page, in the Models tab, select the model version that you want to share.

  6. Choose Share.

  7. In the Share model dialog box, do the following:

    1. For the Add Canvas users field, enter the Canvas user’s profile name. You can enter up to 23 Canvas users. If a user profile you specify doesn’t have a Canvas app associated with it, you can't enter the profile name.

    2. For the Add a note field, add a description or note for the Canvas user when they receive the model.

    3. Choose Share to share the model.

You have now shared the model with the Canvas user.

You can share a model to Canvas from SageMaker JumpStart in Studio Classic. With JumpStart, you can access and tune pretrained models before deploying them.

You need to have a Studio Classic user and a successfully completed training job in JumpStart. For more information about how to set up Studio Classic, see the Studio Classic documentation. For more information about JumpStart, see the JumpStart documentation.

To share a model from JumpStart to Canvas, use the following procedure.

  1. Open your Amazon SageMaker Studio Classic application.

  2. In the side navigation pane, choose the Home icon ( Home icon in Studio Classic ).

  3. In the side navigation bar that opens, choose SageMaker JumpStart.

  4. Choose Launched JumpStart assets to open the page that lists your JumpStart training jobs, models, and endpoints.

  5. Choose the Training jobs tab to view the list of your model training jobs.

  6. From the Training jobs list, select the training job that you want to share with the Canvas user. You can only share one job at a time. This opens the training job details page.

  7. In the header for the training job, choose Share, and select Share to Canvas.

    Note

    You can only share tabular models to Canvas. Trying to share a model that is not tabular throws an Unsupported data type error.

  8. In the Share to Canvas dialog box, do the following:

    1. For the Add Canvas users to share field, enter the Canvas user’s profile name. You can enter up to 23 Canvas users. If a user profile you specify doesn’t have a Canvas app associated with it, you can't enter the profile name.

    2. For the Add a note field, add a description or note for the Canvas user when they receive the model.

    3. Choose Share to share the model.

You have now shared the model with the Canvas user.

You can share a model to Canvas from SageMaker Model Registry in Studio Classic. With Model Registry, you can register models that you bring from outside of SageMaker and integrate them with your ML pipelines.

You need to have a Studio Classic user and a model version saved in the Model Registry. For more information about how to set up Studio Classic, see the Studio Classic documentation. If you don’t have a model version in the Model Registry, create a model group and register a version to it. For more information about Model Registry, see the Model Registry documentation.

To share a model version from Model Registry to Canvas, use the following procedure.

  1. Open your Amazon SageMaker Studio Classic application.

  2. In the side navigation pane, choose the Home icon ( Home icon in Studio Classic ).

  3. In the side navigation bar that opens, choose Models.

  4. Select Model Registry from the dropdown list to open the Model Registry page and show all of the model groups registered in your account.

  5. Choose the model group that has the model version that you want to share.

  6. You can share a model version either from the model group page or the model version page.

    • To share a model version from the model group page, complete the following steps:

      1. Choose Versions, and check the box next to the model version you want to share with the Canvas user. You can only share one model version at a time.

      2. In the Actions dropdown menu, choose Share model artifacts.

    • To share a model version from the model version page, complete the following steps:

      1. Choose Versions, and select the name of the model version you want to share with the Canvas user. You can only share one model version at a time.

      2. In the Actions dropdown menu, choose Share model artifacts.

  7. In the Share model dialog box, do the following:

    1. For the Add Canvas users to share field, enter the Canvas user’s profile name. You can enter up to 23 Canvas users. If a user profile you specify doesn’t have a Canvas app associated with it, you can't enter the profile name.

    2. For Add model details, do the following:

      1. For the Training dataset field, enter the Amazon S3 path for your training dataset.

      2. For the Validation dataset field, enter the Amazon S3 path for your validation dataset.

      3. For Target column, either select Use the first column if the first column in your dataset is the target, or select Specify the target column name to set the target as a different column in your dataset.

      4. For Column headers, select one of the following options:

        1. Select Use the first row if the first row of your dataset contains the column headers.

        2. Select Specify a different dataset in S3 for column headers if you have a file stored in Amazon S3 containing headers that can be mapped to your dataset. The headers file must have the same number of columns as your dataset.

        3. Select Automatically generate if you don’t already have column headers and would like SageMaker to generate generic column names for your dataset.

      5. From the Problem type dropdown list, select your model type.

      6. If you selected the Binary classification or Multi-class problem types, the Configure model outputs option appears.

        If you already have a file stored in Amazon S3 that maps default target column class names to your desired class names, then turn on Model output names and enter the Amazon S3 path to the mapping file. If you don't have a mapping file, then turn off Model output names and manually enter the Numer of model outputs (the number of target column classes in your data). Then, enter your desired class names to replace the default class names.

    3. (Optional) For the Add a note field, add a description or note for the Canvas user when they receive the model.

    4. Choose Share to share the model version.

You have now shared the model with the Canvas user.

On the Shared models and notebooks page in Amazon SageMaker Studio Classic, you can view the models that you've shared and that have been shared with you. This page gives you a central place to view and manage all of your models in Studio Classic.

You need to have a Studio Classic user and a model ready to share from Autopilot, JumpStart, or Model Registry. For more information on how to set up Studio Classic, see the Studio Classic documentation. For more information about the Shared models and notebooks page, see the Shared models and notebooks documentation.

The following example walks you through sharing an Amazon SageMaker Autopilot model, but you can use the sharing feature on the Shared models and notebooks page to share models from any of the other features in the previous sections, such as Jumpstart and Model Registry.

To share an Autopilot model from the Shared models and notebooks page, use the following procedure.

  1. Open your Amazon SageMaker Studio Classic application.

  2. In the side navigation pane, choose the Home icon ( Home icon in Studio Classic ).

  3. In the side navigation bar of Studio Classic, choose Models.

  4. In the dropdown list, choose Shared models to open the Shared models and notebooks page.

  5. Choose the filter icon, and in the Shared from dropdown list, choose Autopilot.

  6. Select the Autopilot model from the list that you want to share with the Canvas user. You can only share one model at a time. Alternatively, you can select the model to open the model details page.

  7. From either the Autopilot jobs page or the model details page, choose Share.

  8. In the Share model dialog box, do the following:

    1. For the Add Canvas users to share field, enter the Canvas user’s profile name. You can enter up to 23 Canvas users. If a user profile you specify doesn’t have a Canvas app associated with it, you can't enter the profile name.

    2. For the Add a note field, add a description or note for the Canvas user when they receive the model.

    3. Choose Share to share the model.

You have now shared the model with the Canvas user.

After you share the model, you receive a notification popup in Studio Classic similar to the following screenshot.


    Screenshot of the Studio Classic notification that you shared a model successfully.

You can choose View model to open the Shared models and notebooks page in Studio Classic. You can also view your shared models at any time from the Shared models and notebooks page.

From this page, you can see the models that you’ve shared with the Canvas user under the Shared by me label, as shown in the following screenshot.


    Screenshot of the Studio Classic Shared models and notebooks page where you can view all of your shared models.

Models that you’ve shared to Canvas have text on the card similar to the following example: Shared to: 12 Canvas users.

Canvas users: Receive a shared model in SageMaker Canvas

When a Studio Classic user shares a model with a Canvas user, you receive a notification within the Canvas application that a Studio Classic user has shared a model with you.

In the Canvas application, the notification is similar to the following screenshot.


    Screenshot of the notification message in the SageMaker Canvas application for a newly shared
     model.

You can choose View update to see the shared model, or you can go to the Models page in the Canvas application to discover all of the models that have been shared with you.

Note

Canvas users can’t edit a model that has been shared with them by a Studio Classic user. Models imported from Studio Classic are view and predict only.

A model that has been shared by a Studio Classic user looks like the following card on the Models page. This is different from Collaborate with data scientists, where a Canvas user shares a model and a Studio Classic user shares updates or feedback with the Canvas user.


    Screenshot of the model card in the SageMaker Canvas application for a model that has been shared
     from Studio Classic.

The model import from Studio Classic can take up to 20 minutes, during which the model shows as Importing.

After importing the model, you can view its metrics and generate predictions with it. SageMaker Canvas uses Amazon SageMaker Serverless Inference resources to generate model analysis and predictions for shared models. You might see costs associated with Serverless Inference in your AWS account.

The following screenshot shows the Analyze tab in the Canvas application for a shared model, where you can evaluate the model accuracy and metrics. For more information, see Evaluate Your Model's Performance in Amazon SageMaker Canvas.


    Screenshot of the Analyze tab in the SageMaker Canvas application for a shared model.

The following screenshot shows the Predict tab, where you can generate predictions with the model. For more information on generating predictions in Canvas, see Make predictions for your data.


    Screenshot of the Predict tab in the SageMaker Canvas application for a shared model.

On both the Analyze and Predict tabs, you can see the Shared History panel, which shows you the model versions and comments shared with you by Studio Classic users.