Serverless Machine Learning with Amazon Redshift ML by Debu Panda Phil Bates Bhanu Pittampally and Sumeet Joshi

Serverless Machine Learning with Amazon Redshift ML by Debu Panda Phil Bates Bhanu Pittampally and Sumeet Joshi

Author:Debu Panda, Phil Bates, Bhanu Pittampally, and Sumeet Joshi
Language: eng
Format: epub
Publisher: Packt Publishing Pvt. Ltd.
Published: 2023-08-28T00:00:00+00:00


You should get the following output:

Figure 6.15 – Segmentation

Our training dataset has a total of 8,068 customer records. From this sample, we can see that segments C, B, and A are very similar and that more customers are in segment D.

We will use the input from the training dataset to predict the customer segment, using the linear learner algorithm.

Using Linear Learner to predict the customer segment

Linear learner is a supervised learning algorithm and one of the model types you can use to solve classification or regression problems.

For multi-class classification problems, we have more than two labels (or targets) that we will try to predict, compared to exactly two labels for binary classification problems. We will show you how to use linear learner to solve regression problems in Chapter 7.

With linear learner, you can achieve a significant increase in speed compared to traditional hyperparameter optimization techniques, making it very convenient.

We will provide a training set with data that contains our input or observations about the data, and the label that represents the value we want to predict. We can optionally provide certain combinations of preprocessors to certain sets of columns.

In this section, you will apply user guidance techniques by providing MODEL_TYPE, PROBLEM_TYPE, and OBJECTIVE to create a multi-class classification model using the linear learner algorithm. The goal of this model is to predict the segment for each customer.

We will set MODEL_TYPE as LINEAR_LEARNER and PROBLEM_TYPE as MULTICLASS_CLASSIFICATION. We will leave other options as default.

Let us execute the following code in Query Editor v2 to train the model:

CREATE MODEL chapter6_supervisedclassification.cust_segmentation_model_ll FROM ( SELECT id, gender, ever_married, age, graduated,profession, work_experience, spending_score,family_size, var_1,segmentation FROM chapter6_supervisedclassification.cust_segmentation_train ) TARGET segmentation FUNCTION predict_cust_segment_ll IAM_ROLE default MODEL_TYPE LINEAR_LEARNER PROBLEM_TYPE MULTICLASS_CLASSIFICATION OBJECTIVE 'accuracy' SETTINGS ( S3_BUCKET '<<your-s3-bucket>>', S3_GARBAGE_COLLECT OFF, MAX_RUNTIME 9600 );

To check the status of the model, run the following command in Query Editor v2:

SHOW MODEL chapter6_supervisedclassification.cust_segmentation_model_ll;

You should get the following output:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.