Skip to content

Latest commit

 

History

History

clinical_reg

Clinical Regression Example

This example takes clinical data, RNA data, and images as inputs and uses regression to train a model that will predict how long the person is expected to take to recover. The training flow is:

  • Preprocess the clinical data and images
  • Split the training data into training, validation, and test datasets
  • Train the model
  • Deploy the model
  • Test the model with a WebApp

This example provides a fully automated way to train and deploy the model.

1. Create Code Repo

The Code Repo contains the program code and other associated files for developing and running your model training.

  • Navigate to Code menu on the left side of the screen
  • Select + Code
    • Name: regression

    Note The Code repo name must be the one above, or the example will not run

    • Code Source: Git
    • URL: https://github.com/oneconvergence/dkube-examples.git
    • Branch: tensorflow
    • Leave the other fields in their current selection and Submit

2. Automated Setup and Execution using Kubeflow Pipelines

The clinical regression can be run in an automated manner through a Kubeflow Pipeline.

Create JupyterLab IDE

A JupterLab IDE is used to create the pipeline that trains the model.

  • Navigate to IDEs menu on the left
  • Select + JupyterLab
    • Name: <your-ide-name> (Your choice of name)
    • Code: Select regression
    • Framework: Tensorflow
    • Framework Version: 2.0.0
    • Image: ocdr/dkube-datascience-tf-cpu-multiuser:v2.0.0-17

    Note The image should default to the correct selection, but you should check to ensure that it is the right one

    • Leave the other fields in their current selection and Submit

Create & Run Pipeline

A JupyterLab script is used to create the training pipeline.

  • Navigate to IDEs menu on the left
  • When the JupyterLab instance is running, select the icon on the right to open a new JL tab
  • Navigate to workspace/regression/clinical_reg
  • Open pipeline.ipynb
  • Select Run menu at the top and Select Run All Cells

  • This will create the Kubeflow Pipeline to:
    • Create the datasets
    • Proprocess the data
    • Split them in to train, validate, & test
    • Train the model
    • Deploy the model
    • Start the inference WebApp

  • The pipeline will be automatically created within DKube, and a pipeline run will be started

  • Navigate to Pipelines menu to view the pipeline graph and track the progress
  • Select Runs tab on the top
  • Your new pipeline run will be the first entry
  • Select View Pipeline on the Run row to see the entire pipeline
  • Use the backarrow to view the list of pipelines again
  • Select the pipeline name to view the pipeline progress

View Resources Created by Pipeline

After the pipeline has completed its execution, you can view the Runs, Datasets, and Models created. You can go to the Test Inference section to use example files with the deployed model.

3. Test Inference

One Convergence has created a simple test inference application for this example.

  • From the JupyterLab tab, download the csv data file cli_inp.csv from the ./sample_data folder, and any sample image from the ./sample_data/images folder
  • Navigate to the Deployments menu on the left and identify the deployment from the pipeline (it should be at the top)
    • Copy the Endpoint URL from that row to your clipboard using the icon
  • In a new tab, access the WebApp at https://<your-dkube-url>/inference (Eg. https://1.2.3.4:32222/inference)
  • In the WebApp, fill in the following fields:
    • Paste the Endpoint URL into the Model Serving URL field
    • Copy the token from the DKube Developer Settings menu at the top right
    • Select the model type as Regression
    • Select Upload Image and use the image file that you downloaded
    • Select Upload File and use the csv file that you downloaded
    • Predict

  • The WebApp will predict how long the person will take to recover

Note You may receive a message that the WebApp has timed out. This is due to the pod starting up. Select Wait.