Setup and assumptions are already covered in above mentioned document.
Lets discuss K- means Algorithm.
K-means algorithm allows to cluster the data, discovery the categories in data which is not easy to find.
In a very simple example:
Important points:
Choose the number of clusters.
Scaling data is needed when x and y dimensions are not much related to each other, say, shoe size and weight. It has different units attached (lb, tons, m, kg ...) then these values aren't really comparable anyway; z-standardizing or scaling them is a best-practise to give equal weight to them. You don’t need scaling if data is based on longitude and latitude. If you have binary values, discrete attributes or categorical attributes, stay away from k-means. K-means needs to compute means, and the mean value is not meaningful on this kind of data. It controls the variability of the dataset, it convert data into specific range using a linear transformation which generate good quality clusters and improve the accuracy of clustering algorithms, check out the link below to view its effects on k-means analysis.
Lets design K means cluster algorithm chart in Qlik Sense which is integrated with R engine.
Data is attached on which we are going to create the visual:
Go to Qlik Sense=> Create App=> Sheet=> Drag and drop Advance analytics extension:
Select k-meanse clustering:
Select Dimension as Product Name, X axis= Sales and Y axis= Quantity
You can increase the cluster numbers by updating the setting:
You can scale the data if needed as we discussed above:
All visuals are from Qlik Sense but calculated in R.
When applicable please mark the appropriate replies as ACCEPT AS SOLUTION and LIKE it. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as LIKE if you feel additional info is useful to others.