Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Problem Scenario

Machine Learning has been showing promising results in various applications. Healthcare is one of them. Machine Learning can accurately help doctors diagnose patients. In this use case, we are trying to use machine learning algorithms to predict progression of diabetes of patients.

Description

In this paper, they collect baseline measurements: Age, Sex, BMI, BP, and 6 Serum Measurements (S1, S2,...S6). One year after baseline, a measure of diabetes progression is collected. Our goal is to teach the machine to predict the diabetes progression based on these 10 measurements.

Below screenshot is the preview of this dataset. There are 10 measurements and diabetes progression represented as Y in the rightmost column.

The live demo is available at our Machine Learning Showcase.

Objectives

  1. Cross Validation: Use Cross Validator (Regression) Snap from ML Core Snap Pack to perform 10-fold cross validation with the Linear Regression algorithm. K-Fold Cross Validation is a method of evaluating machine learning algorithms by randomly separating a dataset into training set and test set, the model will be trained on the training set and evaluated on the test set.
  2. Model Building: Use Trainer (Regression) Snap from ML Core Snap Pack to build the linear regression model based on the training set of 392 samples; then serialize and store.
  3. Model Evauation: Use Predictor (Regression) Snap from ML Core Snap Pack to apply the model on the test set of the remaining 50 samples and compute error.
  4. Model Hosting: Use Predictor (Regression) Snap from ML Core Snap Pack to host the model and build the API using Ultra Task.
  5. Test the API: Build the API as a Task then execute the Task to test the API.

...

To build an API from this pipeline. Go to the calendar icon in the toolbar. You can either use Triggered Task or Ultra TaskTasks.

Triggered Task is good for batch processing since it starts a new pipeline instance for each request. Ultra Task is good to provide REST API to external applications that require low latency. In this case, we use Ultra Task. You do not need to specify the bearer token here since we use the Router Snap to perform authentication inside the pipeline. You can go to Manager by clicking Show tasks in this project in Manager in the Create Task window to see task details as shown in the screenshot below. 

Testing

After creating the Ultra Task, you can test it. The screenshot below shows a sample request and response. Based on the following 10 measurements, the pipeline returns 103.88 as predicted diabetes progression. The expected diabetes progression of this patient is 118.