Creating a K-means ML model
In this section, we will walk through the process with the help of a use case. In this use case, assume you are a data analyst for an e-commerce company specializing in home improvement goods. You have been tasked with classifying economic segments in different regions, based on income, so that you can better target customers, based on various factors, such as median home value. We will use this dataset from Kaggle: https://www.kaggle.com/datasets/camnugent/california-housing-prices.
From this dataset, you will use the median_income
, latitude
, and longitude
attributes so that you can create clusters based on location
and income
.
The syntax to create a K-means model is slightly different from what you will have used up to this point, so let’s dive into that.
Creating a model syntax overview for K-means clustering
Here is the basic syntax to create a K-means model:
CREATE model model_name FROM (Select_statement) FUNCTIONÂ Â function_name...