Watson OpenScale tutorial: Training, deploying, and monitoring a model

Last updated: Jan 17, 2024
Watson OpenScale tutorial: Training, deploying, and monitoring a model

This tutorial uses Watson OpenScale and a Jupyter notebook to create a machine learning model, deploy the model, and then evaluate the model.

Note:

This tutorial uses Watson Machine Learning as the machine learning provider. However, you can perform all of the tasks described here with any supported model engine, such as Azure, Amazon Web Services, SPSS, or a custom engine.

Data set overview

This tutorial uses the German credit risk data set, which consists of bank information from loan applicants. This data set describes each applicant by using 20 attributes, such as gender, sex loan duration, and loan purpose.
The data set is structured in rows and columns, and saved in a .csv file format.

You can view the data set in a text editor or spreadsheet program:
a preview of the German Credit Risk data set.

Before you begin

Make sure you have the following assets available:

  1. Provision Watson Machine Learning and Watson OpenScale on your Cloud Pak for Data account.
  2. Create a project named Credit risk to store and run the Jupyter notebook.
  3. Create a deployment space named Credit risk - preproduction to view and test the results. Save the space GUID from the Manage tab as you need this credential when running the notebook.
  4. Download the sample training data file.

Run the Jupyter notebook to create the model

Add and run a notebook to create the Credit risk model

Adding the notebook

  1. From the navigation menu Navigation menu, click Projects > View all projects.

  2. Open the Credit risk project and select the Asset tab.

  3. Click New asset > Jupyter notebook editor. Enter Credit risk as the notebook name, then click URL and paste the following URL:

  4. Click Create. The Credit risk notebook opens in Edit mode.

Configuring and running the notebook

  1. Under Provision services and configure credentials section, complete the following fields:

    1. For CLOUD_API_KEY, paste your IBM Cloud API key. If you don't already have a saved API key, then follow these steps to create an API key.

      1. Access the IBM Cloud console API keys page.
      2. Click Create an IBM Cloud API key. If you have any existing API keys, the button may be labelled Create.
      3. Type a name and description.
      4. Click Create.
      5. Copy the API key.
      6. Download the API key for future use.
      7. Return to the notebook, and paste your API key in the CLOUD_API_KEY field.
    2. Follow these steps to locate your Cloud Object Storage details:

      1. From the navigation menu, click Services > Instances.
      2. Click the Overflow menu Overflow menu for your Cloud Object Storage instance, and select Launch.
      3. Click the Service credentials tab.
      4. Locate credentials with Writer access:
        • Copy the apikey, and paste that value in the COS_API_KEY_I field in the notebook.
        • Copy the resource_instance_id, and paste that value in the COS_RESOURCE_CRN field in the notebook.
      5. Click the Buckets tab.
      6. Locate the bucket where you want to store the training data.
        • Copy the bucket name.
        • Paste the bucket name in the BUCKET_NAME field in the notebook.
      7. Click the Endpoints page.
        • Locate the appropriate endpoint.
        • Copy the endpoint, and paste that value in the COS_ENDPOINT field in the notebook.
  2. In the Publish the model section, specify the space GUID value from your deployment space for the WML_SPACE_ID variable to set a default location to store your deployment.

  3. Click Cell > Run All to run all of the cells in the notebook. You can also run the notebook cell by cell to explore each cell and its output.

  4. Monitor the progress cell by cell. Notice that the asterisk "In [*]" changes to a number, for example, "In [1]" when a cell finishs. The notebook takes 1 - 3 minutes to complete.

  5. Try these tips if you encounter any errors while running the notebook:

    • Click Kernel > Restart & Clear Output to restart the kernel, and then run the notebook again.
    • Verify that you copied and pasted credentials with no leading or trailing spaces.

You are now ready to evaluate the deployed model in Watson OpenScale.

Learn about how to interpret and address results in Reviewing model insights.

Parent topic: Evaluating AI models with Watson OpenScale